Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 126059
Collapse All | Expand All

(-)portage/pym/portage_const.py (+1 lines)
Lines 57-62 Link Here
57
HASHING_BLOCKSIZE        = 32768
53
HASHING_BLOCKSIZE        = 32768
58
MANIFEST1_HASH_FUNCTIONS = ["MD5","SHA256","RMD160"]
54
MANIFEST1_HASH_FUNCTIONS = ["MD5","SHA256","RMD160"]
59
MANIFEST2_HASH_FUNCTIONS = ["SHA1","SHA256","RMD160"]
55
MANIFEST2_HASH_FUNCTIONS = ["SHA1","SHA256","RMD160"]
56
MANIFEST2_REQUIRED_HASH = "SHA1"
60
57
61
MANIFEST2_IDENTIFIERS = ["AUX","MISC","DIST","EBUILD"]
58
MANIFEST2_IDENTIFIERS = ["AUX","MISC","DIST","EBUILD"]
62
# ===========================================================================
59
# ===========================================================================
(-)portage/pym/portage_manifest.py (-8 / +14 lines)
Lines 120-126 Link Here
120
		if not from_scratch:
120
		if not from_scratch:
121
			self._read()
121
			self._read()
122
		self.compat = manifest1_compat
122
		self.compat = manifest1_compat
123
		self.fetchlist_dict = fetchlist_dict
123
		if fetchlist_dict != None:
124
			self.fetchlist_dict = fetchlist_dict
125
		else:
126
			self.fetchlist_dict = {}
124
		self.distdir = distdir
127
		self.distdir = distdir
125
		self.guessType = guessManifestFileType
128
		self.guessType = guessManifestFileType
126
129
Lines 381-397 Link Here
381
		""" Validate signature on Manifest """
384
		""" Validate signature on Manifest """
382
		raise NotImplementedError()
385
		raise NotImplementedError()
383
	
386
	
384
	def addFile(self, ftype, fname, hashdict=None):
387
	def addFile(self, ftype, fname, hashdict=None, ignoreMissing=False):
385
		""" Add entry to Manifest optionally using hashdict to avoid recalculation of hashes """
388
		""" Add entry to Manifest optionally using hashdict to avoid recalculation of hashes """
386
		if not os.path.exists(self.pkgdir+fname):
389
		if ftype == "AUX" and not fname.startswith("files/"):
390
			fname = os.path.join("files", fname)
391
		if not os.path.exists(self.pkgdir+fname) and not ignoreMissing:
387
			raise FileNotFound(fname)
392
			raise FileNotFound(fname)
388
		if not ftype in portage_const.MANIFEST2_IDENTIFIERS:
393
		if not ftype in portage_const.MANIFEST2_IDENTIFIERS:
389
			raise InvalidDataType(ftype)
394
			raise InvalidDataType(ftype)
395
		if ftype == "AUX" and fname.startswith("files"):
396
			fname = fname[6:]
390
		self.fhashdict[ftype][fname] = {}
397
		self.fhashdict[ftype][fname] = {}
391
		if hashdict != None:
398
		if hashdict != None:
392
			self.fhashdict[ftype][fname].update(hashdict)
399
			self.fhashdict[ftype][fname].update(hashdict)
393
		if not portage_const.MANIFEST2_REQUIRED_HASH in self.fhashdict[ftype][fname]:
400
		if not portage_const.MANIFEST2_REQUIRED_HASH in self.fhashdict[ftype][fname]:
394
			self.updateFileHashes(ftype, fname)
401
			self.updateFileHashes(ftype, fname, checkExisting=False, ignoreMissing=ignoreMissing)
395
	
402
	
396
	def removeFile(self, ftype, fname):
403
	def removeFile(self, ftype, fname):
397
		""" Remove given entry from Manifest """
404
		""" Remove given entry from Manifest """
Lines 521-530 Link Here
521
				self.checkTypeHashes("MISC", ignoreMissingFiles=False)
528
				self.checkTypeHashes("MISC", ignoreMissingFiles=False)
522
			ebuildname = "%s.ebuild" % self._catsplit(cpv)[1]
529
			ebuildname = "%s.ebuild" % self._catsplit(cpv)[1]
523
			self.checkFileHashes("EBUILD", ebuildname, ignoreMissing=False)
530
			self.checkFileHashes("EBUILD", ebuildname, ignoreMissing=False)
524
		if checkDistfiles:
531
		if checkDistfiles or onlyDistfiles:
525
			if onlyDistfiles:
532
			for f in self._getCpvDistfiles(cpv):
526
				for f in self._getCpvDistfiles(cpv):
533
				self.checkFileHashes("DIST", f, ignoreMissing=False)
527
					self.checkFileHashes("DIST", f, ignoreMissing=False)
528
	
534
	
529
	def _getCpvDistfiles(self, cpv):
535
	def _getCpvDistfiles(self, cpv):
530
		""" Get a list of all DIST files associated to the given cpv """
536
		""" Get a list of all DIST files associated to the given cpv """

Return to bug 126059