########################################
-def clean(now_date, max_delete, session):
+def clean(now_date, archives, max_delete, session):
cnf = Config()
count = 0
old_files = old_files.limit(max_delete)
print "Limiting removals to %d" % max_delete
+ if archives is not None:
+ archive_ids = [ a.archive_id for a in archives ]
+ old_files = old_files.filter(ArchiveFile.archive_id.in_(archive_ids))
+
for af in old_files:
filename = af.path
if not os.path.exists(filename):
cnf["Clean-Suites::Options::%s" % (i)] = ""
Arguments = [('h',"help","Clean-Suites::Options::Help"),
+ ('a','archive','Clean-Suites::Options::Archive','HasArg'),
('n',"no-action","Clean-Suites::Options::No-Action"),
('m',"maximum","Clean-Suites::Options::Maximum", "HasArg")]
session = DBConn().session()
+ archives = None
+ if 'Archive' in Options:
+ archive_names = Options['Archive'].split(',')
+ archives = session.query(Archive).filter(Archive.archive_name.in_(archive_names)).all()
+ if len(archives) == 0:
+ utils.fubar('Unknown archive.')
+
now_date = datetime.now()
set_archive_delete_dates(now_date, session)
clean_binaries(now_date, session)
check_sources(now_date, session)
check_files(now_date, session)
- clean(now_date, max_delete, session)
+ clean(now_date, archives, max_delete, session)
clean_maintainers(now_date, session)
clean_fingerprints(now_date, session)
clean_empty_directories(session)