diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-11-04 18:01:46 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-11-04 18:01:46 +0000 |
commit | e8d0134d592fca0096c9f60c44a92ec6f71c2938 (patch) | |
tree | 206debe93e8cdc293e2ccfdb25c61fa1c74b1498 | |
parent | fc0b5e7903f27685152934eef4a5889a13fb8a75 (diff) | |
download | portage-e8d0134d592fca0096c9f60c44a92ec6f71c2938.tar.gz portage-e8d0134d592fca0096c9f60c44a92ec6f71c2938.tar.bz2 portage-e8d0134d592fca0096c9f60c44a92ec6f71c2938.zip |
Make Manifest.create() do some basic validation of ebuild
file names like portdbapi.cp_list() would do. (trunk r8423)
svn path=/main/branches/2.1.2/; revision=8424
-rw-r--r-- | pym/portage_manifest.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/pym/portage_manifest.py b/pym/portage_manifest.py index cdccbd9fa..ccd32ec67 100644 --- a/pym/portage_manifest.py +++ b/pym/portage_manifest.py @@ -443,11 +443,22 @@ class Manifest(object): self.__init__(self.pkgdir, self.distdir, fetchlist_dict=self.fetchlist_dict, from_scratch=True, manifest1_compat=self.compat) + cpvlist = [] + pn = os.path.basename(self.pkgdir.rstrip(os.path.sep)) + cat = self._pkgdir_category() for pkgdir, pkgdir_dirs, pkgdir_files in os.walk(self.pkgdir): break for f in pkgdir_files: if f.endswith(".ebuild"): mytype = "EBUILD" + pf = f[:-7] + ps = portage_versions.pkgsplit(pf) + cpv = "%s/%s" % (cat, pf) + if not ps: + raise portage_exception.PortagePackageException(cpv) + if ps[0] != pn: + raise portage_exception.PortagePackageException(cpv) + cpvlist.append(cpv) elif manifest2MiscfileFilter(f): mytype = "MISC" else: @@ -464,7 +475,6 @@ class Manifest(object): continue self.fhashdict["AUX"][f] = perform_multiple_checksums( os.path.join(self.pkgdir, "files", f.lstrip(os.sep)), self.hashes) - cpvlist = [os.path.join(self._pkgdir_category(), x[:-7]) for x in os.listdir(self.pkgdir) if x.endswith(".ebuild")] distlist = set() for cpv in cpvlist: distlist.update(self._getCpvDistfiles(cpv)) |