+def version_checks(package, architecture, target_suite, new_version, session, force = False):
+ if architecture == "source":
+ suite_version_list = get_suite_version_by_source(package, session)
+ else:
+ suite_version_list = get_suite_version_by_package(package, architecture, session)
+
+ must_be_newer_than = [ vc.reference.suite_name for vc in get_version_checks(target_suite, "MustBeNewerThan") ]
+ must_be_older_than = [ vc.reference.suite_name for vc in get_version_checks(target_suite, "MustBeOlderThan") ]
+
+ # Must be newer than an existing version in target_suite
+ if target_suite not in must_be_newer_than:
+ must_be_newer_than.append(target_suite)
+
+ violations = False
+
+ for suite, version in suite_version_list:
+ cmp = apt_pkg.VersionCompare(new_version, version)
+ if suite in must_be_newer_than and cmp < 1:
+ utils.warn("%s (%s): version check violated: %s targeted at %s is *not* newer than %s in %s" % (package, architecture, new_version, target_suite, version, suite))
+ violations = True
+ if suite in must_be_older_than and cmp > 1:
+ utils.warn("%s (%s): version check violated: %s targeted at %s is *not* older than %s in %s" % (package, architecture, new_version, target_suite, version, suite))
+ violations = True
+
+ if violations:
+ if force:
+ utils.warn("Continuing anyway (forced)...")
+ else:
+ utils.fubar("Aborting. Version checks violated and not forced.")
+
+#######################################################################################
+
+def set_suite(file, suite, session, britney=False, force=False):