Gentoo Archives: gentoo-commits

From: "Marius Mauch (genone)" <genone@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r9398 - in main/trunk: bin man pym/portage pym/portage/dbapi
Date: Thu, 28 Feb 2008 15:08:55
Message-Id: E1JUkNF-0003ZI-OR@stork.gentoo.org
1 Author: genone
2 Date: 2008-02-28 15:08:40 +0000 (Thu, 28 Feb 2008)
3 New Revision: 9398
4
5 Modified:
6 main/trunk/bin/repoman
7 main/trunk/man/repoman.1
8 main/trunk/pym/portage/__init__.py
9 main/trunk/pym/portage/dbapi/porttree.py
10 main/trunk/pym/portage/manifest.py
11 Log:
12 remove code for manifest1 support
13
14 Modified: main/trunk/bin/repoman
15 ===================================================================
16 --- main/trunk/bin/repoman 2008-02-28 14:55:51 UTC (rev 9397)
17 +++ main/trunk/bin/repoman 2008-02-28 15:08:40 UTC (rev 9398)
18 @@ -236,13 +236,6 @@
19 qahelp={
20 "CVS/Entries.IO_error":"Attempting to commit, and an IO error was encountered access the Entries file",
21 "desktop.invalid":"desktop-file-validate reports errors in a *.desktop file",
22 - "digest.partial":"Digest files do not contain all corresponding URI elements",
23 - "digest.assumed":"Existing digest must be assumed correct (Package level only)",
24 - "digestentry.unused":"Digest/Manifest entry has no matching SRC_URI entry",
25 - "digest.fail":"Digest does not match the specified local file",
26 - "digest.stray":"Digest files that do not have a corresponding ebuild",
27 - "digest.missing":"Digest files that are missing (ebuild exists, digest doesn't)",
28 - "digest.unmatch":"Digests which are incomplete (please check if your USE/ARCH includes all files)",
29 "ebuild.invalidname":"Ebuild files with a non-parseable or syntactically incorrect name (or using 2.1 versioning extensions)",
30 "ebuild.namenomatch":"Ebuild files that do not have the same name as their parent directory",
31 "changelog.missing":"Missing ChangeLog files",
32 @@ -315,9 +308,6 @@
33 "ebuild.allmasked",
34 "ebuild.nesteddie",
35 "desktop.invalid",
36 -"digest.assumed",
37 -"digest.missing",
38 -"digestentry.unused",
39 "DEPEND.badmasked","RDEPEND.badmasked","PDEPEND.badmasked",
40 "DEPEND.badindev","RDEPEND.badindev","PDEPEND.badindev",
41 "DEPEND.badmaskedindev","RDEPEND.badmaskedindev","PDEPEND.badmaskedindev",
42 @@ -542,7 +532,6 @@
43 logging.fatal("Couldn't read KEYWORDS from arch.list")
44 sys.exit(1)
45
46 -manifest1_compat = False
47 if portdir_overlay != portdir:
48 kwlist.update(portage.grabfile(
49 os.path.join(portdir_overlay, "profiles", "arch.list")))
50 @@ -780,9 +769,6 @@
51 has_filesdir = True
52 if not os.path.isdir(os.path.join(checkdir, "files")):
53 has_filesdir = False
54 - if manifest1_compat:
55 - stats["filedir.missing"] += 1
56 - fails["filedir.missing"].append(checkdir)
57
58 if isCvs:
59 try:
60 @@ -856,68 +842,7 @@
61
62 if os.path.exists(checkdir+"/files"):
63 filesdirlist=os.listdir(checkdir+"/files")
64 - if manifest1_compat:
65 - for y in filesdirlist:
66 - if not y.startswith("digest-"):
67 - continue
68 - relative_path = os.path.join(x, "files", y)
69 - full_path = os.path.join(repodir, relative_path)
70 - if stat.S_IMODE(os.stat(full_path).st_mode) & 0111:
71 - stats["file.executable"] += 1
72 - fails["file.executable"].append(x+"/files/"+y)
73 -
74 - mykey = catdir + "/" + y[7:]
75 - if y[7:] not in ebuildlist:
76 - #stray digest
77 - if options.mode == "fix":
78 - if options.pretend:
79 - print "(cd "+repodir+"/"+x+"/files; cvs rm -f "+y+")"
80 - else:
81 - os.system("(cd "+repodir+"/"+x+"/files; cvs rm -f "+y+")")
82 - else:
83 - stats["digest.stray"]=stats["digest.stray"]+1
84 - fails["digest.stray"].append(x+"/files/"+y)
85 - else:
86 - # We have an ebuild
87 - try:
88 - myuris, myfiles = portdb.getfetchlist(mykey, all=True)
89 - except portage.exception.InvalidDependString, e:
90 - # Already handled above.
91 - continue
92
93 - uri_dict = {}
94 - for myu in myuris:
95 - myubn = os.path.basename(myu)
96 - if myubn not in uri_dict:
97 - uri_dict[myubn] = [myu]
98 - else:
99 - uri_dict[myubn] += [myu]
100 -
101 - for myf in uri_dict:
102 - myff = repoman_settings["DISTDIR"] + "/" + myf
103 - if not mydigests.has_key(myf):
104 - uri_settings = portage.config(clone=repoman_settings)
105 - if options.mode == "fix":
106 - if not portage.fetch(uri_dict[myf], uri_settings):
107 - stats["digest.unmatch"] += 1
108 - fails["digest.unmatch"].append(y+"::"+myf)
109 - else:
110 - eb_name = portdb.findname2(mykey)[0]
111 - portage.doebuild(eb_name, "digest", "/",
112 - uri_settings, tree="porttree",
113 - mydbapi=portdb)
114 - else:
115 - stats["digest.partial"] += 1
116 - fails["digest.partial"].append(y+"::"+myf)
117 - elif "assume-digests" not in repoman_settings.features:
118 - if os.path.exists(myff):
119 - if not portage.checksum.verify_all(myff, mydigests[myf])[0]:
120 - stats["digest.fail"] += 1
121 - fails["digest.fail"].append(y+"::"+myf)
122 - elif repolevel == 3:
123 - stats["digest.assumed"] += 1
124 - fails["digest.assumed"].append(y+"::"+myf)
125 -
126 # recurse through files directory
127 # use filesdirlist as a stack, appending directories as needed so people can't hide > 20k files in a subdirectory.
128 while filesdirlist:
129 @@ -1008,20 +933,6 @@
130 if y in dadded:
131 stats["ebuild.disjointed"]=stats["ebuild.disjointed"]+1
132 fails["ebuild.disjointed"].append(x+"/"+y+".ebuild")
133 - if manifest1_compat and \
134 - not os.path.exists(os.path.join(checkdir, "files", "digest-"+y)):
135 - if options.mode == "fix":
136 - if options.pretend:
137 - print "You will need to run:"
138 - print " /usr/bin/ebuild "+repodir+"/"+x+"/"+y+".ebuild digest"
139 - else:
140 - retval=os.system("/usr/bin/ebuild "+repodir+"/"+x+"/"+y+".ebuild digest")
141 - if retval:
142 - print "!!! Exiting on ebuild digest (shell) error code:",retval
143 - sys.exit(retval)
144 - else:
145 - stats["digest.missing"]=stats["digest.missing"]+1
146 - fails["digest.missing"].append(x+"/files/digest-"+y)
147 myesplit=portage.pkgsplit(y)
148 if myesplit is None or myesplit[0] != x.split("/")[-1]:
149 stats["ebuild.invalidname"]=stats["ebuild.invalidname"]+1
150 @@ -1508,20 +1419,6 @@
151 if options.pretend:
152 print green("RepoMan sez:"), "\"So, you want to play it safe. Good call.\"\n"
153
154 - if fails["digest.missing"]:
155 - print green("Creating missing digests...")
156 - for x in fails["digest.missing"]:
157 - xs=x.split("/")
158 - del xs[-2]
159 - myeb="/".join(xs[:-1])+"/"+xs[-1][7:]
160 - if options.pretend:
161 - print "(ebuild "+portdir+"/"+myeb+".ebuild digest)"
162 - else:
163 - retval=os.system("ebuild "+portdir+"/"+myeb+".ebuild digest")
164 - if retval:
165 - print "!!! Exiting on ebuild digest (shell) error code:",retval
166 - sys.exit(retval)
167 -
168 mycvstree=portage.cvstree.getentries("./",recursive=1)
169 if isCvs and not mycvstree:
170 print "!!! It seems we don't have a cvs tree?"
171
172 Modified: main/trunk/man/repoman.1
173 ===================================================================
174 --- main/trunk/man/repoman.1 2008-02-28 14:55:51 UTC (rev 9397)
175 +++ main/trunk/man/repoman.1 2008-02-28 15:08:40 UTC (rev 9398)
176 @@ -174,24 +174,6 @@
177 .B digest.assumed
178 Existing digest must be assumed correct (Package level only)
179 .TP
180 -.B digest.fail
181 -Digest does not match the specified local file
182 -.TP
183 -.B digest.missing
184 -Digest files that are missing (ebuild exists, digest doesn't)
185 -.TP
186 -.B digest.partial
187 -Digest files do not contain all corresponding URI elements
188 -.TP
189 -.B digest.stray
190 -Digest files that do not have a corresponding ebuild
191 -.TP
192 -.B digest.unmatch
193 -Digests which are incomplete (please check if your USE/ARCH includes all files)
194 -.TP
195 -.B digest.unused
196 -Digest/Manifest entry has no matching SRC_URI entry
197 -.TP
198 .B ebuild.allmasked
199 All ebuilds are masked for this package (Package level only)
200 .TP
201
202 Modified: main/trunk/pym/portage/__init__.py
203 ===================================================================
204 --- main/trunk/pym/portage/__init__.py 2008-02-28 14:55:51 UTC (rev 9397)
205 +++ main/trunk/pym/portage/__init__.py 2008-02-28 15:08:40 UTC (rev 9398)
206 @@ -3627,7 +3627,7 @@
207 for filename in auto_assumed:
208 if filename in fetchlist:
209 writemsg_stdout(
210 - " digest-%s::%s\n" % (pv, filename))
211 + " %s::%s\n" % (pv, filename))
212 return 1
213 finally:
214 _doebuild_manifest_exempt_depend -= 1
215
216 Modified: main/trunk/pym/portage/dbapi/porttree.py
217 ===================================================================
218 --- main/trunk/pym/portage/dbapi/porttree.py 2008-02-28 14:55:51 UTC (rev 9397)
219 +++ main/trunk/pym/portage/dbapi/porttree.py 2008-02-28 15:08:40 UTC (rev 9398)
220 @@ -146,18 +146,6 @@
221 for x in self.auxdb.values():
222 x.sync()
223
224 - def finddigest(self,mycpv):
225 - try:
226 - mydig = self.findname2(mycpv)[0]
227 - if not mydig:
228 - return ""
229 - mydigs = mydig.split("/")[:-1]
230 - mydig = "/".join(mydigs)
231 - mysplit = mycpv.split("/")
232 - except OSError:
233 - return ""
234 - return mydig+"/files/digest-"+mysplit[-1]
235 -
236 def findLicensePath(self, license_name):
237 mytrees = self.porttrees[:]
238 mytrees.reverse()
239
240 Modified: main/trunk/pym/portage/manifest.py
241 ===================================================================
242 --- main/trunk/pym/portage/manifest.py 2008-02-28 14:55:51 UTC (rev 9397)
243 +++ main/trunk/pym/portage/manifest.py 2008-02-28 15:08:40 UTC (rev 9398)
244 @@ -50,21 +50,6 @@
245 myentry = Manifest2Entry(type=mytype, name=myname, hashes=myhashes)
246 return myentry
247
248 -def parseManifest1(mysplit):
249 - myentry = None
250 - if len(mysplit) == 4 and mysplit[0] in ["size"] + portage.const.MANIFEST1_HASH_FUNCTIONS:
251 - myname = mysplit[2]
252 - mytype = None
253 - mytype = guessManifestFileType(myname)
254 - if mytype == "AUX":
255 - if myname.startswith("files" + os.path.sep):
256 - myname = myname[6:]
257 - mysize = int(mysplit[3])
258 - myhashes = {mysplit[0]: mysplit[1]}
259 - myhashes["size"] = mysize
260 - myentry = Manifest1Entry(type=mytype, name=myname, hashes=myhashes)
261 - return myentry
262 -
263 class ManifestEntry(object):
264 __slots__ = ("type", "name", "hashes")
265 def __init__(self, **kwargs):
266 @@ -75,17 +60,6 @@
267 return 0
268 return 1
269
270 -class Manifest1Entry(ManifestEntry):
271 - def __str__(self):
272 - for hashkey in self.hashes:
273 - if hashkey != "size":
274 - break
275 - hashvalue = self.hashes[hashkey]
276 - myname = self.name
277 - if self.type == "AUX" and not myname.startswith("files" + os.sep):
278 - myname = os.path.join("files", myname)
279 - return " ".join([hashkey, str(hashvalue), myname, str(self.hashes["size"])])
280 -
281 class Manifest2Entry(ManifestEntry):
282 def __str__(self):
283 myline = " ".join([self.type, self.name, str(self.hashes["size"])])
284 @@ -97,7 +71,7 @@
285 return myline
286
287 class Manifest(object):
288 - parsers = (parseManifest2, parseManifest1)
289 + parsers = (parseManifest2,)
290 def __init__(self, pkgdir, distdir, fetchlist_dict=None,
291 manifest1_compat=False, from_scratch=False):
292 """ create new Manifest instance for package in pkgdir
293 @@ -110,16 +84,15 @@
294 self.hashes = set()
295 self.hashes.update(portage.const.MANIFEST2_HASH_FUNCTIONS)
296 if manifest1_compat:
297 - self.hashes.update(portage.const.MANIFEST1_HASH_FUNCTIONS)
298 + raise NotImplementedError("manifest1 support has been removed")
299 self.hashes.difference_update(hashname for hashname in \
300 list(self.hashes) if hashname not in hashfunc_map)
301 self.hashes.add("size")
302 if manifest1_compat:
303 - self.hashes.add(portage.const.MANIFEST1_REQUIRED_HASH)
304 + raise NotImplementedError("manifest1 support has been removed")
305 self.hashes.add(portage.const.MANIFEST2_REQUIRED_HASH)
306 for t in portage.const.MANIFEST2_IDENTIFIERS:
307 self.fhashdict[t] = {}
308 - self.compat = manifest1_compat
309 if not from_scratch:
310 self._read()
311 if fetchlist_dict != None:
312 @@ -144,26 +117,9 @@
313 """ Similar to getDigests(), but restricted to files of the given type. """
314 return self.fhashdict[ftype]
315
316 - def _readDigests(self, myhashdict=None):
317 - """ Parse old style digest files for this Manifest instance """
318 - if myhashdict is None:
319 - myhashdict = {}
320 - try:
321 - for d in os.listdir(os.path.join(self.pkgdir, "files")):
322 - if d.startswith("digest-"):
323 - self._readManifest(os.path.join(self.pkgdir, "files", d), mytype="DIST",
324 - myhashdict=myhashdict)
325 - except (IOError, OSError), e:
326 - if e.errno == errno.ENOENT:
327 - pass
328 - else:
329 - raise
330 - return myhashdict
331 -
332 def _readManifest(self, file_path, myhashdict=None, **kwargs):
333 - """Parse a manifest or an old style digest. If myhashdict is given
334 - then data will be added too it. Otherwise, a new dict will be created
335 - and returned."""
336 + """Parse a manifest. If myhashdict is given then data will be added too it.
337 + Otherwise, a new dict will be created and returned."""
338 try:
339 fd = open(file_path, "r")
340 if myhashdict is None:
341 @@ -183,8 +139,6 @@
342 self._readManifest(self.getFullname(), myhashdict=self.fhashdict)
343 except FileNotFound:
344 pass
345 - if self.compat:
346 - self._readDigests(myhashdict=self.fhashdict)
347
348 def _parseManifestLines(self, mylines):
349 """Parse manifest lines and return a list of manifest entries."""
350 @@ -212,63 +166,6 @@
351 myhashdict[myentry_type][myentry.name].update(myentry.hashes)
352 return myhashdict
353
354 - def _writeDigests(self, force=False):
355 - """ Create old style digest files for this Manifest instance """
356 - cpvlist = [os.path.join(self._pkgdir_category(), x[:-7]) for x in os.listdir(self.pkgdir) if x.endswith(".ebuild")]
357 - rval = []
358 - try:
359 - os.makedirs(os.path.join(self.pkgdir, "files"))
360 - except OSError, oe:
361 - if oe.errno == errno.EEXIST:
362 - pass
363 - else:
364 - raise
365 - for cpv in cpvlist:
366 - dname = os.path.join(self.pkgdir, "files", "digest-%s" % self._catsplit(cpv)[1])
367 - distlist = self._getCpvDistfiles(cpv)
368 - missing_digests = set()
369 - for f in distlist:
370 - if f not in self.fhashdict["DIST"] or len(self.fhashdict["DIST"][f]) == 0:
371 - missing_digests.add(f)
372 - if missing_digests:
373 - # This allows us to force remove of stale digests for the
374 - # ebuild --force digest option.
375 - distlist = [f for f in distlist if f not in missing_digests]
376 - update_digest = True
377 - if not force:
378 - try:
379 - f = open(dname, "r")
380 - old_data = self._parseDigests(f)
381 - f.close()
382 - new_data = self._getDigestData(distlist)
383 - if not old_data and not new_data:
384 - # SRC_URI is empty
385 - update_digest = False
386 - elif len(old_data) == 1 and "DIST" in old_data:
387 - if "DIST" in new_data:
388 - for myfile in new_data["DIST"]:
389 - for hashname in \
390 - new_data["DIST"][myfile].keys():
391 - if hashname != "size" and hashname not in \
392 - portage.const.MANIFEST1_HASH_FUNCTIONS:
393 - del new_data["DIST"][myfile][hashname]
394 - if new_data["DIST"] == old_data["DIST"]:
395 - update_digest = False
396 - except (IOError, OSError), e:
397 - if errno.ENOENT == e.errno:
398 - pass
399 - else:
400 - raise
401 - if update_digest:
402 - mylines = self._createDigestLines1(distlist, self.fhashdict)
403 - if mylines:
404 - mylines = "\n".join(mylines) + "\n"
405 - else:
406 - mylines = ""
407 - write_atomic(dname, mylines)
408 - rval.append(dname)
409 - return rval
410 -
411 def _getDigestData(self, distlist):
412 """create a hash dict for a specific list of files"""
413 myhashdict = {}
414 @@ -280,32 +177,6 @@
415 myhashdict[mytype][myname].update(self.fhashdict[mytype][myname])
416 return myhashdict
417
418 - def _createDigestLines1(self, distlist, myhashdict):
419 - """ Create an old style digest file."""
420 - mylines = []
421 - myfiles = myhashdict["DIST"].keys()
422 - myfiles.sort()
423 - for f in myfiles:
424 - if f in distlist:
425 - myhashkeys = myhashdict["DIST"][f].keys()
426 - myhashkeys.sort()
427 - for h in myhashkeys:
428 - if h not in portage.const.MANIFEST1_HASH_FUNCTIONS:
429 - continue
430 - myline = " ".join([h, str(myhashdict["DIST"][f][h]), f, str(myhashdict["DIST"][f]["size"])])
431 - mylines.append(myline)
432 - return mylines
433 -
434 - def _addDigestsToManifest(self, digests, fd):
435 - """ Add entries for old style digest files to Manifest file """
436 - mylines = []
437 - for dname in digests:
438 - myhashes = perform_multiple_checksums(dname, portage.const.MANIFEST1_HASH_FUNCTIONS+["size"])
439 - for h in myhashes:
440 - mylines.append((" ".join([h, str(myhashes[h]), os.path.join("files", os.path.basename(dname)), str(myhashes["size"])])))
441 - fd.write("\n".join(mylines))
442 - fd.write("\n")
443 -
444 def _createManifestEntries(self):
445 mytypes = self.fhashdict.keys()
446 mytypes.sort()
447 @@ -321,37 +192,7 @@
448 if h not in ["size"] + portage.const.MANIFEST2_HASH_FUNCTIONS:
449 del myentry.hashes[h]
450 yield myentry
451 - if self.compat and t != "DIST":
452 - mysize = self.fhashdict[t][f]["size"]
453 - myhashes = self.fhashdict[t][f]
454 - for h in myhashkeys:
455 - if h not in portage.const.MANIFEST1_HASH_FUNCTIONS:
456 - continue
457 - yield Manifest1Entry(
458 - type=t, name=f, hashes={"size":mysize, h:myhashes[h]})
459
460 - if self.compat:
461 - cvp_list = self.fetchlist_dict.keys()
462 - cvp_list.sort()
463 - manifest1_hashes = set(hashname for hashname in \
464 - portage.const.MANIFEST1_HASH_FUNCTIONS \
465 - if hashname in hashfunc_map)
466 - manifest1_hashes.add(portage.const.MANIFEST1_REQUIRED_HASH)
467 - manifest1_hashes.add("size")
468 - for cpv in cvp_list:
469 - digest_path = os.path.join("files", "digest-%s" % self._catsplit(cpv)[1])
470 - dname = os.path.join(self.pkgdir, digest_path)
471 - try:
472 - myhashes = perform_multiple_checksums(dname, manifest1_hashes)
473 - myhashkeys = myhashes.keys()
474 - myhashkeys.sort()
475 - for h in myhashkeys:
476 - if h in portage.const.MANIFEST1_HASH_FUNCTIONS:
477 - yield Manifest1Entry(type="AUX", name=digest_path,
478 - hashes={"size":myhashes["size"], h:myhashes[h]})
479 - except FileNotFound:
480 - pass
481 -
482 def checkIntegrity(self):
483 for t in self.fhashdict:
484 for f in self.fhashdict[t]:
485 @@ -362,8 +203,6 @@
486 """ Write Manifest instance to disk, optionally signing it """
487 self.checkIntegrity()
488 try:
489 - if self.compat:
490 - self._writeDigests()
491 myentries = list(self._createManifestEntries())
492 update_manifest = True
493 if not force:
494 @@ -451,7 +290,7 @@
495 distfilehashes = {}
496 self.__init__(self.pkgdir, self.distdir,
497 fetchlist_dict=self.fetchlist_dict, from_scratch=True,
498 - manifest1_compat=self.compat)
499 + manifest1_compat=False)
500 cpvlist = []
501 pn = os.path.basename(self.pkgdir.rstrip(os.path.sep))
502 cat = self._pkgdir_category()
503
504 --
505 gentoo-commits@l.g.o mailing list