From 774779ec434bd38667e68331b288e7c748abf2b0 Mon Sep 17 00:00:00 2001 From: Andre Anjos <andre.dos.anjos@gmail.com> Date: Wed, 21 Aug 2019 09:32:46 +0200 Subject: [PATCH] [dav] Make clean-betas work properly --- bob/devtools/dav.py | 23 +++++++++++------------ bob/devtools/scripts/dav.py | 2 +- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/bob/devtools/dav.py b/bob/devtools/dav.py index e7f07cc2..40bec89e 100644 --- a/bob/devtools/dav.py +++ b/bob/devtools/dav.py @@ -4,10 +4,11 @@ import os import re import configparser +import dateutil.parser from distutils.version import StrictVersion -from .log import get_logger, echo_warning, echo_info +from .log import get_logger, echo_warning, echo_info, echo_normal from .deploy import _setup_webdav_client logger = get_logger(__name__) @@ -31,10 +32,10 @@ def _get_config(): ): assert KeyError, ( "The file %s should contain a single " - '"dav" section with 3 variables defined inside: ' + '"webdav" section with 3 variables defined inside: ' '"server", "username", "password".' % (k,) ) - return data["dav"] + return data["webdav"] # ask the user for the information, cache credentials for future use retval = dict() @@ -134,27 +135,25 @@ def remove_old_beta_packages(client, path, dry_run, pyver=True): ( StrictVersion(version), int(build), # build number - info['modified'], + dateutil.parser.parse(info['modified']).timestamp(), target, ) ) - import ipdb; ipdb.set_trace() - count = sum([len(k) for k in betas.values()]) - len(betas) - echo_info(" - %d variants" % len(betas)) - echo_info(" - %d packages found" % count) - echo_info(" --------------------") + echo_normal(" - %d variants" % len(betas)) + echo_normal(" - %d packages found" % count) + echo_normal(" ---------------------") for name in sorted(betas.keys()): - echo_info(" - packages for %s (%d) ====" % (name, len(betas[name]))) + echo_normal(" - packages for %s (%d)" % (name, len(betas[name]))) sorted_packages = sorted(betas[name]) keep_version, keep_build, _, _ = sorted_packages[-1] for version, build, mtime, target in sorted_packages: if version == keep_version and build == keep_build: - echo_info("[keep] %s (time=%u)" % (target, mtime)) + echo_normal("[keep] %s (time=%u)" % (target, mtime)) else: - echo_info("rm %s (time=%u)" % (target, mtime)) + echo_warning("rm %s (time=%u)" % (target, mtime)) if not dry_run: #client.clean(target) echo_info("boooom") diff --git a/bob/devtools/scripts/dav.py b/bob/devtools/scripts/dav.py index a9687bb0..cecf4017 100644 --- a/bob/devtools/scripts/dav.py +++ b/bob/devtools/scripts/dav.py @@ -348,7 +348,7 @@ def clean_betas(private, execute, path): arch_path = '/'.join((path, arch)) - if not cl.is_dir(arch_path): + if not (cl.check(arch_path) and cl.is_dir(arch_path)): # it is normal if the directory does not exist continue -- GitLab