From fab604dffbc59b7a57d794fbdb9c35fc0ac39c51 Mon Sep 17 00:00:00 2001 From: Jakub Kadlčík Date: May 18 2019 12:00:59 +0000 Subject: Deprecate --cleancopr parameter --- diff --git a/prunerepo b/prunerepo index f4489f5..0047808 100755 --- a/prunerepo +++ b/prunerepo @@ -17,7 +17,7 @@ parser.add_argument('--days', type=int, action='store', default=0, that are DAYS old or older (for packages by their build date, for directories\ the last modification time is considered') parser.add_argument('--cleancopr', action='store_true', - help='additionaly remove whole copr build dirs and logs if the associated package gets deleted') + help='DEPRECATED: additionaly remove whole copr build dirs and logs if the associated package gets deleted') parser.add_argument('--alwayscreaterepo', action='store_true', help='Recreate repository even when there was no change in data.') parser.add_argument('--nocreaterepo', action='store_true', @@ -139,37 +139,19 @@ def recreate_repo(): def clean_copr(): """ - Remove whole copr build dirs if they no longer contain a srpm/rpm file + Deprecated: Remove whole copr build dirs if they no longer contain a srpm/rpm file """ - log_info("Cleaning COPR repository...") - for dir_name in os.listdir(args.path): - dir_path = os.path.abspath(os.path.join(args.path, dir_name)) - - if not os.path.isdir(dir_path): - continue - if not os.path.isfile(os.path.join(dir_path, 'build.info')): - continue - if [item for item in os.listdir(dir_path) if re.match(r'.*\.rpm$', item)]: - continue - if time.time() - os.stat(dir_path).st_mtime <= args.days * 24 * 3600: - continue - - if args.verbose: - log_info('Removing: '+dir_path) - shutil.rmtree(dir_path) - - # also remove the associated log in the main dir - build_id = os.path.basename(dir_path).split('-')[0] - buildlog_name = 'build-' + build_id + '.log' - buildlog_path = os.path.abspath(os.path.join(args.path, buildlog_name)) - rm_file(os.path.join(args.path, buildlog_path)) + print("The --cleancopr parameter is deprecated!") + print("The feature was build system specific and therefore moved to the Copr upstream.") + print("It is available in copr-backend > 1.122 package within `copr_prune_results.py' script.") + sys.exit(1) if __name__ == '__main__': + if args.cleancopr: + clean_copr() + was_deletion = prune_packages() if (was_deletion or args.alwayscreaterepo) \ and not args.nocreaterepo: recreate_repo() - - if args.cleancopr: - clean_copr()