From: Michael Tremer Date: Fri, 30 Apr 2010 23:30:40 +0000 (+0200) Subject: naoki: Cron needs to rebuild packages that have been altered since last build. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a7447d2cebd9b52af0aa34cb1af1c6995fba9a5;p=ipfire-3.x.git naoki: Cron needs to rebuild packages that have been altered since last build. --- diff --git a/naoki/__init__.py b/naoki/__init__.py index c95a52867..ddda5cf06 100644 --- a/naoki/__init__.py +++ b/naoki/__init__.py @@ -350,18 +350,22 @@ Release : %(release)s packages_must.append(package) continue + # If package was altered since last build + if package.last_change >= package.last_build: + packages_must.append(package) + continue + if package.buildable: packages_may.append(package) packages += packages_must + packages_may = sorted(packages_may, key=lambda p: p.last_build) + while len(packages) < 10 and packages_may: - package = random.choice(packages_may) - packages_may.remove(package) + package = packages_may.pop(0) packages.append(package) - random.shuffle(packages) - # Bad hack because we lack a _build method args.packages = [p.name for p in packages] args.onlydeps = False diff --git a/naoki/backend.py b/naoki/backend.py index 1c7f69074..ca12b3ac1 100644 --- a/naoki/backend.py +++ b/naoki/backend.py @@ -353,7 +353,7 @@ class PackageInfo(object): @property def fingerprint(self): - return "%d" % os.stat(self.filename).st_mtime + return "%d" % self.last_change @property def group(self): @@ -363,6 +363,18 @@ class PackageInfo(object): def id(self): return "%s-%s-%s" % (self.name, self.version, self.release) + @property + def last_build(self): + file = os.path.join(PACKAGESDIR, self.package_files[0]) + if not os.path.exists(file): + return 0 + + return os.stat(file).st_mtime + + @property + def last_change(self): + return os.stat(self.filename).st_mtime + @property def license(self): return self._data.get("PKG_LICENSE")