diff options
author | Marius Mauch <genone@gentoo.org> | 2007-01-20 16:06:50 +0000 |
---|---|---|
committer | Marius Mauch <genone@gentoo.org> | 2007-01-20 16:06:50 +0000 |
commit | e768571187d1655fbb558c23d61fa2983e48e411 (patch) | |
tree | 21cc200fc2f7f41110fd97a7131708644dfe17e8 | |
parent | 1ebe6671a4962c5738957eb2fc33b5836cfa0179 (diff) | |
download | portage-e768571187d1655fbb558c23d61fa2983e48e411.tar.gz portage-e768571187d1655fbb558c23d61fa2983e48e411.tar.bz2 portage-e768571187d1655fbb558c23d61fa2983e48e411.zip |
Some minor fixes for manifest code
svn path=/main/trunk/; revision=5735
-rw-r--r-- | pym/portage_const.py | 1 | ||||
-rw-r--r-- | pym/portage_manifest.py | 22 |
2 files changed, 15 insertions, 8 deletions
diff --git a/pym/portage_const.py b/pym/portage_const.py index 7b44a6c1a..e1af7cb44 100644 --- a/pym/portage_const.py +++ b/pym/portage_const.py @@ -57,6 +57,7 @@ EAPI = 0 HASHING_BLOCKSIZE = 32768 MANIFEST1_HASH_FUNCTIONS = ["MD5","SHA256","RMD160"] MANIFEST2_HASH_FUNCTIONS = ["SHA1","SHA256","RMD160"] +MANIFEST2_REQUIRED_HASH = "SHA1" MANIFEST2_IDENTIFIERS = ["AUX","MISC","DIST","EBUILD"] # =========================================================================== diff --git a/pym/portage_manifest.py b/pym/portage_manifest.py index 1266e33df..e621606c1 100644 --- a/pym/portage_manifest.py +++ b/pym/portage_manifest.py @@ -120,7 +120,10 @@ class Manifest(object): if not from_scratch: self._read() self.compat = manifest1_compat - self.fetchlist_dict = fetchlist_dict + if fetchlist_dict != None: + self.fetchlist_dict = fetchlist_dict + else: + self.fetchlist_dict = {} self.distdir = distdir self.guessType = guessManifestFileType @@ -381,17 +384,21 @@ class Manifest(object): """ Validate signature on Manifest """ raise NotImplementedError() - def addFile(self, ftype, fname, hashdict=None): + def addFile(self, ftype, fname, hashdict=None, ignoreMissing=False): """ Add entry to Manifest optionally using hashdict to avoid recalculation of hashes """ - if not os.path.exists(self.pkgdir+fname): + if ftype == "AUX" and not fname.startswith("files/"): + fname = os.path.join("files", fname) + if not os.path.exists(self.pkgdir+fname) and not ignoreMissing: raise FileNotFound(fname) if not ftype in portage_const.MANIFEST2_IDENTIFIERS: raise InvalidDataType(ftype) + if ftype == "AUX" and fname.startswith("files"): + fname = fname[6:] self.fhashdict[ftype][fname] = {} if hashdict != None: self.fhashdict[ftype][fname].update(hashdict) if not portage_const.MANIFEST2_REQUIRED_HASH in self.fhashdict[ftype][fname]: - self.updateFileHashes(ftype, fname) + self.updateFileHashes(ftype, fname, checkExisting=False, ignoreMissing=ignoreMissing) def removeFile(self, ftype, fname): """ Remove given entry from Manifest """ @@ -521,10 +528,9 @@ class Manifest(object): self.checkTypeHashes("MISC", ignoreMissingFiles=False) ebuildname = "%s.ebuild" % self._catsplit(cpv)[1] self.checkFileHashes("EBUILD", ebuildname, ignoreMissing=False) - if checkDistfiles: - if onlyDistfiles: - for f in self._getCpvDistfiles(cpv): - self.checkFileHashes("DIST", f, ignoreMissing=False) + if checkDistfiles or onlyDistfiles: + for f in self._getCpvDistfiles(cpv): + self.checkFileHashes("DIST", f, ignoreMissing=False) def _getCpvDistfiles(self, cpv): """ Get a list of all DIST files associated to the given cpv """ |