From: "Brian D. Harring" <ferringb@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Subject: [gentoo-portage-dev] PATCH: properly handle metadata transfer on first sync of an empty tree (#96410)
Date: Thu, 4 Aug 2005 22:31:18 -0500 [thread overview]
Message-ID: <20050805033118.GM21865@exodus> (raw)
In-Reply-To: <200507220849.43700.jstubbs@gentoo.org>
[-- Attachment #1.1: Type: text/plain, Size: 462 bytes --]
Hola all, patch (incvs now) to fix up a traceback on first sync with
an empty tree; bug #96410
http://bugs.gentoo.org/show_bug.cgi?id=96410
The fix isn't exactly what I'd call pretty (creating an intermediate
portdbapi and config instance to do the updates), but it's a corner
case; config's categories is a bit of a hack, and tearing it out in
stable is more work then worth... so this.
Either way, it's attached, poke at it kindly :)
~harring
[-- Attachment #1.2: empty-tree-sync-fix.patch --]
[-- Type: text/plain, Size: 3637 bytes --]
Index: emerge
===================================================================
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 $
import os,sys
os.environ["PORTAGE_CALLER"]="emerge"
@@ -2677,28 +2677,33 @@
raise # Needed else can't exit
except:
pass
- # we don't make overlay trees cache here.
- backup_porttrees=portage.portdb.porttrees
+ # we don't make overlay trees cache here, plus we don't trust portage.settings.categories
porttree_root = portage.portdb.porttree_root
- portage.portdb.porttrees=[porttree_root]
- cp_list=portage.portdb.cp_all()
+ pdb = portage.portdbapi(porttree_root, portage.config(config_profile_path=portage.settings.profile_path[:], \
+ config_incrementals=portage.settings.incrementals[:]))
+ cp_list = pdb.cp_all()
+ if len(cp_list) == 0:
+ print "no metadata to transfer, exiting"
+ sys.exit(0)
cp_list.sort()
pcnt=0
pcntstr=""
pcntcount=len(cp_list)/100.0
nextupdate=pcntcount
current=1
- def cleanse_cache(cat, saves, porttree_root=porttree_root):
+
+ def cleanse_cache(pdb, cat, saves, porttree_root=porttree_root):
if len(saves):
d={}
for v in saves:
d[portage.catsplit(v)[1]] = 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 = []
catlist = []
oldcat = portage.catsplit(cp_list[0])[0]
@@ -2714,18 +2719,18 @@
cat = portage.catsplit(cp)[0]
if cat != oldcat:
catlist.append(oldcat)
- cleanse_cache(oldcat, savelist)
+ cleanse_cache(pdb, oldcat, savelist)
savelist = []
oldcat = cat
- mymatches = portage.db["/"]["porttree"].dbapi.xmatch("match-all", cp)
+ mymatches = pdb.xmatch("match-all", cp)
savelist.extend(mymatches)
for cpv in mymatches:
- try: portage.db["/"]["porttree"].dbapi.aux_get(cpv, ["IUSE"],metacachedir=myportdir+"/metadata/cache",debug=("cachedebug" in portage.features))
+ try: pdb.aux_get(cpv, ["IUSE"],metacachedir=myportdir+"/metadata/cache",debug=("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 = portage.listdir(cachedir+"/"+myportdir)
for x in filelist:
found = False
@@ -2737,7 +2742,6 @@
portage.spawn("cd /; rm -Rf "+cachedir+"/"+myportdir+"/"+x,portage.settings,free=1,droppriv=1)
- portage.portdb.porttrees=backup_porttrees
sys.stdout.write("\n\n")
sys.stdout.flush()
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2005-08-05 3:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-21 14:13 [gentoo-portage-dev] PATCH: Use lchown and lchgrp no-op functions when operating on symlinks (#99616) Jason Stubbs
2005-07-21 17:17 ` Brian D. Harring
2005-07-21 23:49 ` Jason Stubbs
2005-08-05 3:31 ` Brian D. Harring [this message]
2005-08-05 11:20 ` [gentoo-portage-dev] PATCH: properly handle metadata transfer on first sync of an empty tree (#96410) Jason Stubbs
2005-08-09 7:19 ` Brian Harring
2005-08-06 23:30 ` Zac Medico
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050805033118.GM21865@exodus \
--to=ferringb@gentoo.org \
--cc=gentoo-portage-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox