From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.43) id 1E0svq-0000zM-5Y for garchives@archives.gentoo.org; Fri, 05 Aug 2005 03:31:38 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.4/8.13.4) with SMTP id j753UGru006458; Fri, 5 Aug 2005 03:30:16 GMT Received: from smtp.gentoo.org (smtp.gentoo.org [134.68.220.30]) by robin.gentoo.org (8.13.4/8.13.4) with ESMTP id j753UFWI016148 for ; Fri, 5 Aug 2005 03:30:16 GMT Received: from adsl-67-39-48-193.dsl.milwwi.ameritech.net ([67.39.48.193] helo=exodus) by smtp.gentoo.org with esmtpa (Exim 4.43) id 1E0svG-0005GN-RZ for gentoo-portage-dev@lists.gentoo.org; Fri, 05 Aug 2005 03:31:03 +0000 Date: Thu, 4 Aug 2005 22:31:18 -0500 From: "Brian D. Harring" To: gentoo-portage-dev@lists.gentoo.org Subject: [gentoo-portage-dev] PATCH: properly handle metadata transfer on first sync of an empty tree (#96410) Message-ID: <20050805033118.GM21865@exodus> References: <200507212313.36804.jstubbs@gentoo.org> <20050721171701.GA27660@exodus> <200507220849.43700.jstubbs@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="XlS4q8O07AKt4+K1" Content-Disposition: inline In-Reply-To: <200507220849.43700.jstubbs@gentoo.org> User-Agent: Mutt/1.5.8i X-Archives-Salt: 3f9ab019-a2e5-4b1b-9a48-55eb3871eed7 X-Archives-Hash: 5ca717b7468607b771c977a08cbf573f --XlS4q8O07AKt4+K1 Content-Type: multipart/mixed; boundary="oY1uq2ONqt5kuovO" Content-Disposition: inline --oY1uq2ONqt5kuovO Content-Type: text/plain; charset=utf8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hola all, patch (incvs now) to fix up a traceback on first sync with=20 an empty tree; bug #96410 http://bugs.gentoo.org/show_bug.cgi?id=3D96410 The fix isn't exactly what I'd call pretty (creating an intermediate=20 portdbapi and config instance to do the updates), but it's a corner=20 case; config's categories is a bit of a hack, and tearing it out in=20 stable is more work then worth... so this. Either way, it's attached, poke at it kindly :) ~harring --oY1uq2ONqt5kuovO Content-Type: text/plain; charset=utf8 Content-Disposition: attachment; filename="empty-tree-sync-fix.patch" Content-Transfer-Encoding: quoted-printable Index: emerge =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /var/cvsroot/gentoo-src/portage/bin/emerge,v retrieving revision 1.345.2.33 retrieving revision 1.345.2.36 diff -u -r1.345.2.33 -r1.345.2.36 --- emerge 2 Jun 2005 00:57:52 -0000 1.345.2.33 +++ emerge 5 Aug 2005 03:26:17 -0000 1.345.2.36 @@ -1,7 +1,7 @@ #!/usr/bin/python -O # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-src/portage/bin/emerge,v 1.345.2.33 2005/06= /02 00:57:52 vapier Exp $ +# $Header: /var/cvsroot/gentoo-src/portage/bin/emerge,v 1.345.2.36 2005/08= /05 03:26:17 ferringb Exp $ =20 import os,sys os.environ["PORTAGE_CALLER"]=3D"emerge" @@ -2677,28 +2677,33 @@ raise # Needed else can't exit except: pass - # we don't make overlay trees cache here. - backup_porttrees=3Dportage.portdb.porttrees + # we don't make overlay trees cache here, plus we don't trust portage.se= ttings.categories porttree_root =3D portage.portdb.porttree_root - portage.portdb.porttrees=3D[porttree_root] - cp_list=3Dportage.portdb.cp_all() + pdb =3D portage.portdbapi(porttree_root, portage.config(config_profile_p= ath=3Dportage.settings.profile_path[:], \ + config_incrementals=3Dportage.settings.incrementals[:])) + cp_list =3D pdb.cp_all() + if len(cp_list) =3D=3D 0: + print "no metadata to transfer, exiting" + sys.exit(0) cp_list.sort() pcnt=3D0 pcntstr=3D"" pcntcount=3Dlen(cp_list)/100.0 nextupdate=3Dpcntcount current=3D1 - def cleanse_cache(cat, saves, porttree_root=3Dporttree_root): + + def cleanse_cache(pdb, cat, saves, porttree_root=3Dporttree_root): if len(saves): d=3D{} for v in saves: d[portage.catsplit(v)[1]] =3D True - for pv in portage.db["/"]["porttree"].dbapi.auxdb[porttree_root][cat].= keys(): + for pv in pdb.auxdb[porttree_root][cat].keys(): if pv not in d: - portage.db["/"]["porttree"].dbapi.auxdb[porttree_root][cat].del_key(= pv) + pdb.auxdb[porttree_root][cat].del_key(pv) else: - portage.db["/"]["porttree"].dbapi.auxdb[porttree_root][cat].clear() - del portage.db["/"]["porttree"].dbapi.auxdb[porttree_root][cat] + pdb.auxdb[porttree_root][cat].clear() + del pdb.auxdb[porttree_root][cat] + savelist =3D [] catlist =3D [] oldcat =3D portage.catsplit(cp_list[0])[0] @@ -2714,18 +2719,18 @@ cat =3D portage.catsplit(cp)[0] if cat !=3D oldcat: catlist.append(oldcat) - cleanse_cache(oldcat, savelist) + cleanse_cache(pdb, oldcat, savelist) savelist =3D [] oldcat =3D cat - mymatches =3D portage.db["/"]["porttree"].dbapi.xmatch("match-all", cp) + mymatches =3D pdb.xmatch("match-all", cp) savelist.extend(mymatches) for cpv in mymatches: - try: portage.db["/"]["porttree"].dbapi.aux_get(cpv, ["IUSE"],metacache= dir=3Dmyportdir+"/metadata/cache",debug=3D("cachedebug" in portage.features= )) + try: pdb.aux_get(cpv, ["IUSE"],metacachedir=3Dmyportdir+"/metadata/cac= he",debug=3D("cachedebug" in portage.features)) except SystemExit: raise except Exception, e: print "\nFailed cache update:",cpv,e catlist.append(oldcat) catlist.append("local") - cleanse_cache(oldcat, savelist) + cleanse_cache(pdb, oldcat, savelist) filelist =3D portage.listdir(cachedir+"/"+myportdir) for x in filelist: found =3D False @@ -2737,7 +2742,6 @@ portage.spawn("cd /; rm -Rf "+cachedir+"/"+myportdir+"/"+x,portage.set= tings,free=3D1,droppriv=3D1) =20 =20 - portage.portdb.porttrees=3Dbackup_porttrees sys.stdout.write("\n\n") sys.stdout.flush() =20 --oY1uq2ONqt5kuovO-- --XlS4q8O07AKt4+K1 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFC8t2GvdBxRoA3VU0RAvqeAJ9Xp8H7I51NKqNozqDeQK/o3alCSQCgzcRZ HTI+7+4I7E30VpSpzYgfkRo= =5DtO -----END PGP SIGNATURE----- --XlS4q8O07AKt4+K1-- -- gentoo-portage-dev@gentoo.org mailing list