Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 348960 Details for
Bug 212403
dev-util/catalyst: automatically clear autoresume points if spec has been modified
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Clears autoresume if the spec file has been modified
0001-Clears-autoresume-if-spec-has-been-changed.patch (text/plain), 4.48 KB, created by
Devan Franchini (RETIRED)
on 2013-05-23 04:08:57 UTC
(
hide
)
Description:
Clears autoresume if the spec file has been modified
Filename:
MIME Type:
Creator:
Devan Franchini (RETIRED)
Created:
2013-05-23 04:08:57 UTC
Size:
4.48 KB
patch
obsolete
>From 2c5e109f633fd110eab69e60a8674557855d62ad Mon Sep 17 00:00:00 2001 >From: Devan Franchini <twitch153@hotmail.com> >Date: Thu, 23 May 2013 00:05:22 -0400 >Subject: [PATCH] Clears autoresume if spec has been changed > >--- > catalyst/defaults.py | 1 + > catalyst/hash_utils.py | 53 +++++++++++++++++++++++++++++++++++++++++++++++++- > catalyst/main.py | 13 +++++++++++-- > 3 files changed, 64 insertions(+), 3 deletions(-) > >diff --git a/catalyst/defaults.py b/catalyst/defaults.py >index e07940b..c562f4b 100644 >--- a/catalyst/defaults.py >+++ b/catalyst/defaults.py >@@ -77,6 +77,7 @@ confdefaults={ > "snapshot_name": "portage-", > "snapshot_cache": "/var/tmp/catalyst/snapshot_cache", > "hash_function": "crc32", >+ "exit_on_error": True > } > > >diff --git a/catalyst/hash_utils.py b/catalyst/hash_utils.py >index cd31ad3..07ed940 100644 >--- a/catalyst/hash_utils.py >+++ b/catalyst/hash_utils.py >@@ -102,5 +102,56 @@ class HashMap(object): > print header+" (%s) = %s" % (short_file, result) > return result > >- >+ def gen_chksumfile(self, file_, filename, storedir, hash_type, exit_on_error=True): >+ filename = filename >+ modtime = os.path.getmtime(file_) >+ chksum = self.calc_hash2(file_, hash_type) >+ chksum = chksum[:-1] + " " +str(modtime) >+ try: >+ with open(os.path.join(storedir,filename), 'w') as chksumfile: >+ chksumfile.write(chksum) >+ except IOError: >+ if exit_on_error: >+ raise CatalystError("Could not generate checksum for " + file_, print_traceback=True) >+ return False >+ return True >+ >+ def evaluate_spec(self, spec, filename, storedir, hash_type, exit_on_error): >+ chksumfile = os.path.join(storedir,filename) >+ with open(chksumfile, 'r') as specfile: >+ lines = specfile.readlines() >+ hash_value = lines[0].split() >+ hash_value = hash_value[1] >+ chksum, filename, modtime = lines[1].split() >+ modtime_n = os.path.getmtime(spec) >+ chksum_equals = True >+ # First check the modification time to save >+ # resources, if it hasn't been modified, >+ # don't bother generating a second checksum. >+ if not modtime == modtime_n: >+ hash_value_n = self.calc_hash2(spec, hash_type.lower()).split() >+ hash_value_n = hash_value_n[1] >+ chksum_n = self.calc_hash2(spec, hash_type).split() >+ chksum_n = chksum_n[3] >+ # Check the hash value in the file against >+ # the current hash value from the config. >+ if not hash_value == hash_value_n: >+ chksum_n = self.calc_hash2(spec, hash_value.lower()).split() >+ chksum_n = chksum_n[3] >+ >+ if not chksum == chksum_n: >+ chksum_equals = False >+ # Rewrite the checksum file to be assured >+ # that everything is up to date. >+ self.gen_chksumfile(spec, filename, storedir, hash_value_n.lower(), exit_on_error) >+ return chksum_equals >+ >+ def check_chksum(self, spec, filename, storedir, hash_type, exit_on_error): >+ file_location=os.path.join(storedir,filename) >+ if os.path.exists(file_location): >+ return self.evaluate_spec(spec, filename, storedir, hash_type, exit_on_error) >+ else: >+ # If the checksum doesn't exist, this is the first time >+ # using this spec file, so no need to check against it. >+ return self.gen_chksumfile(spec, filename, storedir, hash_type, exit_on_error) > >diff --git a/catalyst/main.py b/catalyst/main.py >index 05904ec..b2c4f45 100644 >--- a/catalyst/main.py >+++ b/catalyst/main.py >@@ -106,13 +106,13 @@ def parse_config(myconfig): > # now, load up the values into conf_values so that we can use them > for x in list(confdefaults): > if x in myconf: >- print "Setting",x,"to config file value \""+myconf[x]+"\"" >+ print "Setting",str(x),"to config file value \""+str(myconf[x])+"\"" > if x == 'options': > conf_values[x] = set(myconf[x].split()) > else: > conf_values[x]=myconf[x] > else: >- print "Setting",x,"to default value \""+confdefaults[x]+"\"" >+ print "Setting",str(x),"to default value \""+str(confdefaults[x])+"\"" > conf_values[x]=confdefaults[x] > > # add our python base directory to use for loading target arch's >@@ -330,6 +330,15 @@ def main(): > if myspecfile: > spec = catalyst.config.SpecParser(myspecfile) > addlargs.update(spec.get_values()) >+ >+ name_components = [] >+ for key in ["target", "subarch", "version_stamp"]: >+ if key in addlargs: >+ name_components.append(addlargs[key]) >+ >+ filename = "-".join(name_components) + ".DIGESTS" >+ if not hash_map.check_chksum(myspecfile, filename, conf_values["storedir"], conf_values["hash_function"], conf_values["exit_on_error"]): >+ conf_values["options"].add("clear-autoresume") > > if mycmdline: > try: >-- >1.8.1.5 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 212403
:
348634
|
348954
| 348960