aboutsummaryrefslogtreecommitdiff
path: root/pym
diff options
context:
space:
mode:
authorJason Stubbs <jstubbs@gentoo.org>2005-02-26 06:35:20 +0000
committerJason Stubbs <jstubbs@gentoo.org>2005-02-26 06:35:20 +0000
commit1978a109a82b369758f317b1246823c46be9df03 (patch)
treeaafe53e88dd1e1aac511f425aed380f90510fa19 /pym
parentBrought forward changes from portage_2_0. Repoman is broken until pym/* is (diff)
downloadportage-cvs-1978a109a82b369758f317b1246823c46be9df03.tar.gz
portage-cvs-1978a109a82b369758f317b1246823c46be9df03.tar.bz2
portage-cvs-1978a109a82b369758f317b1246823c46be9df03.zip
Brought forward changes from portage_2_0
Diffstat (limited to 'pym')
-rw-r--r--pym/cvstree.py3
-rw-r--r--pym/dcdialog.py1
-rw-r--r--pym/dispatch_conf.py3
-rw-r--r--pym/ebuild.py31
-rw-r--r--pym/emergehelp.py7
-rw-r--r--pym/getbinpkg.py3
-rw-r--r--pym/output.py106
-rw-r--r--pym/portage.py304
-rw-r--r--pym/portage_checksum.py3
-rw-r--r--pym/portage_const.py6
-rw-r--r--pym/portage_contents.py3
-rw-r--r--pym/portage_data.py3
-rw-r--r--pym/portage_db_anydbm.py3
-rw-r--r--pym/portage_db_cpickle.py3
-rw-r--r--pym/portage_db_flat.py7
-rw-r--r--pym/portage_db_template.py3
-rw-r--r--pym/portage_db_test.py3
-rw-r--r--pym/portage_dep.py3
-rw-r--r--pym/portage_exception.py3
-rw-r--r--pym/portage_exec.py3
-rw-r--r--pym/portage_file.py3
-rw-r--r--pym/portage_gpg.py3
-rw-r--r--pym/portage_localization.py3
-rw-r--r--pym/portage_locks.py5
-rw-r--r--pym/portage_util.py59
-rw-r--r--pym/xpak.py3
26 files changed, 421 insertions, 156 deletions
diff --git a/pym/cvstree.py b/pym/cvstree.py
index 187d205..7679259 100644
--- a/pym/cvstree.py
+++ b/pym/cvstree.py
@@ -1,7 +1,8 @@
# cvstree.py -- cvs tree utilities
# Copyright 1998-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/cvstree.py,v 1.12 2004/10/11 04:12:02 carpaski Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/cvstree.py,v 1.13 2005/02/26 06:35:20 jstubbs Exp $
+cvs_id_string="$Id: cvstree.py,v 1.13 2005/02/26 06:35:20 jstubbs Exp $"[5:-2]
import string,os,time,sys,re
from stat import *
diff --git a/pym/dcdialog.py b/pym/dcdialog.py
index 2cda507..1687392 100644
--- a/pym/dcdialog.py
+++ b/pym/dcdialog.py
@@ -1,6 +1,7 @@
#
# Changes and extensions by Carlos Castillo...
#
+cvs_id_string="$Id: dcdialog.py,v 1.2 2005/02/26 06:35:20 jstubbs Exp $"[5:-2]
#
# Module: dialog.py
diff --git a/pym/dispatch_conf.py b/pym/dispatch_conf.py
index 17146de..3c529cb 100644
--- a/pym/dispatch_conf.py
+++ b/pym/dispatch_conf.py
@@ -1,7 +1,8 @@
# archive_conf.py -- functionality common to archive-conf and dispatch-conf
# Copyright 2003-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/dispatch_conf.py,v 1.3 2004/10/04 14:07:40 vapier Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/dispatch_conf.py,v 1.4 2005/02/26 06:35:20 jstubbs Exp $
+cvs_id_string="$Id: dispatch_conf.py,v 1.4 2005/02/26 06:35:20 jstubbs Exp $"[5:-2]
# Library by Wayne Davison <gentoo@blorf.net>, derived from code
# written by Jeremy Wohl (http://igmus.org)
diff --git a/pym/ebuild.py b/pym/ebuild.py
index 5a60eba..a314a80 100644
--- a/pym/ebuild.py
+++ b/pym/ebuild.py
@@ -2,7 +2,7 @@
# ebuild.py; Ebuild classes/abstraction of phase processing, and communicating with a ebuild-daemon.sh instance
# Copyright 2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-#$Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/ebuild.py,v 1.10 2005/02/21 12:45:49 genone Exp $
+#$Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/ebuild.py,v 1.11 2005/02/26 06:35:20 jstubbs Exp $
import os,sys,traceback
@@ -712,11 +712,23 @@ class ebuild_handler:
mysettings["A"]=string.join(alist," ")
mysettings["AA"]=string.join(aalist," ")
if ("mirror" in features) or fetchall:
- fetchme=alluris
- checkme=aalist
+ fetchme=alluris[:]
+ checkme=aalist[:]
+ elif mydo=="digest":
+ fetchme=alluris[:]
+ checkme=aalist[:]
+ digestfn=mysettings["FILESDIR"]+"/digest-"+mysettings["PF"]
+ if os.path.exists(digestfn):
+ mydigests=digestParseFile(digestfn)
+ if mydigests:
+ for x in mydigests:
+ while x in checkme:
+ i = checkme.index(x)
+ del fetchme[i]
+ del checkme[i]
else:
- fetchme=newuris
- checkme=alist
+ fetchme=newuris[:]
+ checkme=alist[:]
try:
if not os.path.exists(mysettings["DISTDIR"]):
@@ -782,10 +794,13 @@ class ebuild_handler:
os.chmod(logdir, 0770)
try:
- if ("nouserpriv" not in string.split(mysettings["RESTRICT"])):
- if ("userpriv" in features) and (portage_uid and portage_gid):
+ #XXX: negative restrict
+ myrestrict = mysettings["RESTRICT"].split()
+ if ("nouserpriv" not in myrestrict and "userpriv" not in myrestrict):
+ if ("userpriv" in mysettings.features) and (portage_uid and portage_gid):
if (secpass==2):
if os.path.exists(mysettings["HOME"]):
++ # XXX: Potentially bad, but held down by HOME replacement above.
portage_exec.spawn("rm -Rf "+mysettings["HOME"])
if not os.path.exists(mysettings["HOME"]):
os.makedirs(mysettings["HOME"])
@@ -909,7 +924,7 @@ class ebuild_handler:
try:
mysettings["SLOT"], mysettings["RESTRICT"] = db["/"]["porttree"].dbapi.aux_get(mycpv,["SLOT","RESTRICT"])
except (IOError,KeyError):
- print red("doebuild():")+" aux_get() error; aborting."
+ print red("doebuild():")+" aux_get() error reading "+mycpv+"; aborting."
sys.exit(1)
#initial dep checks complete; time to process main commands
diff --git a/pym/emergehelp.py b/pym/emergehelp.py
index 0d8adbf..c07dfb5 100644
--- a/pym/emergehelp.py
+++ b/pym/emergehelp.py
@@ -1,9 +1,10 @@
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/emergehelp.py,v 1.9 2004/10/28 14:48:26 jstubbs Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/emergehelp.py,v 1.10 2005/02/26 06:35:20 jstubbs Exp $
+cvs_id_string="$Id: emergehelp.py,v 1.10 2005/02/26 06:35:20 jstubbs Exp $"[5:-2]
import os,sys
-from output import *
+from output import bold, turquoise, green
def shorthelp():
print
@@ -168,7 +169,7 @@ def help(myaction,myopts,havecolor=1):
print " used in combination with --pretend all the SRC_URIs will be"
print " displayed multiple mirrors per line, one line per file."
print
- print " "+green("--fetch-all-uri")
+ print " "+green("--fetch-all-uri")+" ("+green("-F")+" short option)"
print " Same as --fetchonly except that all package files, including those"
print " not required to build the package, will be processed."
print
diff --git a/pym/getbinpkg.py b/pym/getbinpkg.py
index 63c22e7..3b4a53d 100644
--- a/pym/getbinpkg.py
+++ b/pym/getbinpkg.py
@@ -1,7 +1,8 @@
# getbinpkg.py -- Portage binary-package helper functions
# Copyright 2003-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/getbinpkg.py,v 1.14 2004/10/29 14:45:35 jstubbs Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/getbinpkg.py,v 1.15 2005/02/26 06:35:20 jstubbs Exp $
+cvs_id_string="$Id: getbinpkg.py,v 1.15 2005/02/26 06:35:20 jstubbs Exp $"[5:-2]
from output import *
import htmllib,HTMLParser,string,formatter,sys,os,xpak,time,tempfile,cPickle,base64
diff --git a/pym/output.py b/pym/output.py
index 0cad4bb..3038176 100644
--- a/pym/output.py
+++ b/pym/output.py
@@ -1,45 +1,107 @@
# Copyright 1998-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/output.py,v 1.24 2004/10/04 14:07:40 vapier Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/output.py,v 1.25 2005/02/26 06:35:20 jstubbs Exp $
+cvs_id_string="$Id: output.py,v 1.25 2005/02/26 06:35:20 jstubbs Exp $"[5:-2]
import os,sys,re
havecolor=1
dotitles=1
-codes={}
-codes["reset"]="\x1b[0m"
-codes["bold"]="\x1b[01m"
-
-codes["teal"]="\x1b[36;06m"
-codes["turquoise"]="\x1b[36;01m"
-
-codes["fuchsia"]="\x1b[35;01m"
-codes["purple"]="\x1b[35;06m"
-
-codes["blue"]="\x1b[34;01m"
-codes["darkblue"]="\x1b[34;06m"
+esc_seq = "\x1b["
+
+g_attr = {}
+g_attr["normal"] = 0
+
+g_attr["bold"] = 1
+g_attr["faint"] = 2
+g_attr["standout"] = 3
+g_attr["underline"] = 4
+g_attr["blink"] = 5
+g_attr["overline"] = 6 # Why is overline actually useful?
+g_attr["reverse"] = 7
+g_attr["invisible"] = 8
+
+g_attr["no-attr"] = 22
+g_attr["no-standout"] = 23
+g_attr["no-underline"] = 24
+g_attr["no-blink"] = 25
+g_attr["no-overline"] = 26
+g_attr["no-reverse"] = 27
+# 28 isn't defined?
+# 29 isn't defined?
+g_attr["black"] = 30
+g_attr["red"] = 31
+g_attr["green"] = 32
+g_attr["yellow"] = 33
+g_attr["blue"] = 34
+g_attr["magenta"] = 35
+g_attr["cyan"] = 36
+g_attr["white"] = 37
+# 38 isn't defined?
+g_attr["default"] = 39
+g_attr["bg_black"] = 40
+g_attr["bg_red"] = 41
+g_attr["bg_green"] = 42
+g_attr["bg_yellow"] = 43
+g_attr["bg_blue"] = 44
+g_attr["bg_magenta"] = 45
+g_attr["bg_cyan"] = 46
+g_attr["bg_white"] = 47
+g_attr["bg_default"] = 49
+
+
+# make_seq("blue", "black", "normal")
+def color(fg, bg="default", attr=["normal"]):
+ mystr = esc_seq[:] + "%02d" % g_attr[fg]
+ for x in [bg]+attr:
+ mystr += ";%02d" % g_attr[x]
+ return mystr+"m"
-codes["green"]="\x1b[32;01m"
-codes["darkgreen"]="\x1b[32;06m"
-codes["yellow"]="\x1b[33;01m"
-codes["brown"]="\x1b[33;06m"
-codes["red"]="\x1b[31;01m"
-codes["darkred"]="\x1b[31;06m"
+codes={}
+codes["reset"] = esc_seq + "39;49;00m"
+
+codes["bold"] = esc_seq + "01m"
+codes["faint"] = esc_seq + "02m"
+codes["standout"] = esc_seq + "03m"
+codes["underline"] = esc_seq + "04m"
+codes["blink"] = esc_seq + "05m"
+codes["overline"] = esc_seq + "06m" # Who made this up? Seriously.
+
+codes["teal"] = esc_seq + "36m"
+codes["turquoise"] = esc_seq + "36;01m"
+
+codes["fuchsia"] = esc_seq + "35;01m"
+codes["purple"] = esc_seq + "35m"
+
+codes["blue"] = esc_seq + "34;01m"
+codes["darkblue"] = esc_seq + "34m"
+
+codes["green"] = esc_seq + "32;01m"
+codes["darkgreen"] = esc_seq + "32m"
+
+codes["yellow"] = esc_seq + "33;01m"
+codes["brown"] = esc_seq + "33m"
+
+codes["red"] = esc_seq + "31;01m"
+codes["darkred"] = esc_seq + "31m"
def nc_len(mystr):
- tmp = re.sub("\x1b[^m]+m", "", mystr);
+ tmp = re.sub(esc_seq + "^m]+m", "", mystr);
return len(tmp)
def xtermTitle(mystr):
- if havecolor and dotitles and os.environ.has_key("TERM"):
+ if havecolor and dotitles and os.environ.has_key("TERM") and sys.stderr.isatty():
myt=os.environ["TERM"]
legal_terms = ["xterm","Eterm","aterm","rxvt","screen","kterm","rxvt-unicode"]
- if (myt in legal_terms) or myt.startswith("xterm"):
+ if (myt in legal_terms) or myt.startswith("xterm") or myt.startswith("screen"):
sys.stderr.write("\x1b]2;"+str(mystr)+"\x07")
sys.stderr.flush()
+ if (myt.startswith("screen")):
+ sys.stderr.write("\x1bk"+str(mystr)+"\x1b\\")
+ sys.stderr.flush()
def xtermTitleReset():
if havecolor and dotitles and os.environ.has_key("TERM"):
diff --git a/pym/portage.py b/pym/portage.py
index 4e3608d..dcc17b4 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -2,19 +2,10 @@
# portage.py -- core Portage functionality
# Copyright 1998-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage.py,v 1.573 2005/02/25 04:56:53 ferringb Exp $
-
-# ===========================================================================
-# START OF CONSTANTS -- START OF CONSTANTS -- START OF CONSTANTS -- START OF
-# ===========================================================================
-
-VERSION="20041207"
-
-INCREMENTALS=["USE","FEATURES","ACCEPT_KEYWORDS","ACCEPT_LICENSE","CONFIG_PROTECT_MASK","CONFIG_PROTECT","PRELINK_PATH","PRELINK_PATH_MASK"]
-incrementals=INCREMENTALS
-STICKIES=["KEYWORDS_ACCEPT","USE","CFLAGS","CXXFLAGS","MAKEOPTS","EXTRA_ECONF","EXTRA_EINSTALL","EXTRA_EMAKE"]
-stickies=STICKIES
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage.py,v 1.574 2005/02/26 06:35:20 jstubbs Exp $
+cvs_id_string="$Id: portage.py,v 1.574 2005/02/26 06:35:20 jstubbs Exp $"[5:-2]
+VERSION="$Revision: 1.574 $"[11:-2] + "-cvs"
# ===========================================================================
# START OF IMPORTS -- START OF IMPORTS -- START OF IMPORTS -- START OF IMPORT
@@ -63,7 +54,16 @@ except:
try:
- from portage_const import *
+ #XXX: This should get renamed to bsd_chflags, I think.
+ import chflags
+ bsd_chflags = chflags
+except SystemExit, e:
+ raise
+except:
+ # XXX: This should get renamed to bsd_chflags, I think.
+ bsd_chflags = None
+
+try:
import ebuild
import cvstree
import xpak
@@ -78,8 +78,20 @@ try:
pkgcmp = portage_versions.pkgcmp
# XXX: This needs to get cleaned up.
- # XXX: Output's color handling is mildly broken is a few cases.
- from output import *
+ import output
+ from output import blue, bold, brown, darkblue, darkgreen, darkred, darkteal, \
+ darkyellow, fuchsia, fuscia, green, purple, red, teal, turquoise, white, \
+ xtermTitle, xtermTitleReset, yellow
+
+ import portage_const
+ from portage_const import VDB_PATH, PRIVATE_PATH, CACHE_PATH, DEPCACHE_PATH, \
+ USER_CONFIG_PATH, MODULES_FILE_PATH, CUSTOM_PROFILE_PATH, PORTAGE_BASE_PATH, \
+ PORTAGE_BIN_PATH, PORTAGE_PYM_PATH, PROFILE_PATH, LOCALE_DATA_PATH, \
+ EBUILD_SH_BINARY, SANDBOX_BINARY, DEPSCAN_SH_BINARY, BASH_BINARY, \
+ MOVE_BINARY, PRELINK_BINARY, WORLD_FILE, MAKE_CONF_FILE, MAKE_DEFAULTS_FILE, \
+ DEPRECATED_PROFILE_FILE, USER_VIRTUALS_FILE, EBUILD_SH_ENV_FILE, \
+ INVALID_ENV_FILE, CUSTOM_MIRRORS_FILE, SANDBOX_PIDS_FILE, CONFIG_MEMORY_FILE,\
+ INCREMENTALS, STICKIES
from portage_data import ostype, lchown, userland, secpass, uid, wheelgid, \
portage_uid, portage_gid
@@ -107,7 +119,7 @@ except Exception, e:
sys.stderr.write("!!! portage and failure here indicates that you have a problem with your\n")
sys.stderr.write("!!! installation of portage. Please try a rescue portage located in the\n")
sys.stderr.write("!!! portage tree under '/usr/portage/sys-apps/portage/files/' (default).\n")
- sys.stderr.write("!!! There is a README.rescue file that details the steps required to perform\n")
+ sys.stderr.write("!!! There is a README.RESCUE file that details the steps required to perform\n")
sys.stderr.write("!!! a recovery of portage.\n")
sys.stderr.write(" "+str(e)+"\n\n")
@@ -552,6 +564,8 @@ def env_update(root,makelinks=1):
for x in specials["LDPATH"]+specials["PATH"]+specials["PRELINK_PATH"]:
if not x:
continue
+ if x[-1] != "/":
+ x += "/"
plmasked=0
for y in specials["PRELINK_PATH_MASK"]:
if y[-1]!='/':
@@ -718,6 +732,8 @@ def grabfile_package(myfilename,compatlevel=0):
pkgs=grabfile(myfilename,compatlevel)
for x in range(len(pkgs)-1,-1,-1):
pkg = pkgs[x]
+ if pkg[0] == "-":
+ pkg = pkg[1:]
if pkg[0] == "*":
pkg = pkg[1:]
if not portage_dep.isvalidatom(pkg):
@@ -784,7 +800,6 @@ def ExtractKernelVersion(base_dir):
return (version,None)
-aumtime=0
def check_config_instance(test):
if not test or (str(test.__class__) != 'portage.config'):
@@ -794,6 +809,7 @@ class config:
def clone(self, clone):
self.incrementals = copy.deepcopy(clone.incrementals)
self.profile_path = copy.deepcopy(clone.profile_path)
+ self.user_profile_dir = copy.deepcopy(clone.user_profile_dir)
self.module_priority = copy.deepcopy(clone.module_priority)
self.modules = copy.deepcopy(clone.modules)
@@ -803,6 +819,10 @@ class config:
self.packages = copy.deepcopy(clone.packages)
self.virtuals = copy.deepcopy(clone.virtuals)
+ self.treeVirtuals = copy.deepcopy(clone.treeVirtuals)
+ self.userVirtuals = copy.deepcopy(clone.userVirtuals)
+ self.negVirtuals = copy.deepcopy(clone.negVirtuals)
+
self.use_defs = copy.deepcopy(clone.use_defs)
self.usemask = copy.deepcopy(clone.usemask)
@@ -827,7 +847,6 @@ class config:
self.uvlist = copy.deepcopy(clone.uvlist)
self.dirVirtuals = copy.deepcopy(clone.dirVirtuals)
self.treeVirtuals = copy.deepcopy(clone.treeVirtuals)
- self.userVirtuals = copy.deepcopy(clone.userVirtuals)
def __init__(self, clone=None, mycpv=None, config_profile_path=PROFILE_PATH, config_incrementals=None):
@@ -841,6 +860,15 @@ class config:
self.virtuals = {}
self.v_count = 0
+ # Virtuals obtained from the vartree
+ self.treeVirtuals = {}
+ # Virtuals by user specification. Includes negatives.
+ self.userVirtuals = {}
+ # Virtual negatives from user specifications.
+ self.negVirtuals = {}
+
+ self.user_profile_dir = None
+
if clone:
self.clone( clone )
else:
@@ -896,7 +924,8 @@ class config:
else:
# XXX: This should depend on ROOT?
if os.path.exists("/"+CUSTOM_PROFILE_PATH):
- self.profiles.append("/"+CUSTOM_PROFILE_PATH)
+ self.user_profile_dir = os.path.normpath("/"+"///"+CUSTOM_PROFILE_PATH)
+ self.profiles.append(self.user_profile_dir[:])
self.packages_list = grab_multiple("packages", self.profiles, grabfile_package)
self.packages = stack_lists(self.packages_list, incremental=1)
@@ -922,7 +951,7 @@ class config:
try:
mygcfg_dlists = grab_multiple("make.globals", self.profiles+["/etc"], getconfig)
- self.mygcfg = stack_dicts(mygcfg_dlists, incrementals=INCREMENTALS, ignore_none=1)
+ self.mygcfg = stack_dicts(mygcfg_dlists, incrementals=self.incrementals, ignore_none=1)
if self.mygcfg == None:
self.mygcfg = {}
@@ -940,8 +969,7 @@ class config:
if self.profiles:
try:
mygcfg_dlists = grab_multiple("make.defaults", self.profiles, getconfig)
- self.mygcfg = stack_dicts(mygcfg_dlists, incrementals=self.incrementals[:], ignore_none=1)
- #self.mygcfg = grab_stacked("make.defaults", self.profiles, getconfig)
+ self.mygcfg = stack_dicts(mygcfg_dlists, incrementals=self.incrementals, ignore_none=1)
if self.mygcfg == None:
self.mygcfg = {}
except SystemExit, e:
@@ -957,7 +985,7 @@ class config:
try:
# XXX: Should depend on root?
- self.mygcfg=getconfig("/"+MAKE_CONF_FILE)
+ self.mygcfg=getconfig("/"+MAKE_CONF_FILE,allow_sourcing=True)
if self.mygcfg == None:
self.mygcfg = {}
except SystemExit, e:
@@ -1043,15 +1071,7 @@ class config:
self.loadVirtuals('/')
#package.mask
- # Don't enable per profile package.mask unless the profile
- # specifically depends on the >=portage-2.0.51 using
- # <portage-2.0.51 syntax.
- # don't hardcode portage versions into portage. It's not nice.
- if self.profiles and (">=sys-apps/portage-2.0.51" in self.packages \
- or "*>=sys-apps/portage-2.0.51" in self.packages):
- pkgmasklines = grab_multiple("package.mask", self.profiles + locations, grabfile_package)
- else:
- pkgmasklines = grab_multiple("package.mask", locations, grabfile_package)
+ pkgmasklines = grab_multiple("package.mask", self.profiles + locations, grabfile_package)
pkgmasklines = stack_lists(pkgmasklines, incremental=1)
self.pmaskdict = {}
@@ -1128,18 +1148,21 @@ class config:
self.regenerate()
-
self.features = portage_util.unique_array(self["FEATURES"].split())
- self.features.sort()
#XXX: Should this be temporary? Is it possible at all to have a default?
if "gpg" in self.features:
if not os.path.exists(self["PORTAGE_GPG_DIR"]) or not os.path.isdir(self["PORTAGE_GPG_DIR"]):
writemsg("PORTAGE_GPG_DIR is invalid. Removing gpg from FEATURES.\n")
self.features.remove("gpg")
- self["FEATURES"] = " ".join(self.features)
- self.backup_changes("FEATURES")
+ if "maketest" in self.features and "test" not in self.features:
+ self.features.append("test")
+
+ self.features.sort()
+ self["FEATURES"] = " ".join(self.features)
+ self.backup_changes("FEATURES")
+
if mycpv:
self.setcpv(mycpv)
@@ -1261,12 +1284,11 @@ class config:
virt = dep_getkey(virt)
if not self.treeVirtuals.has_key(virt):
self.treeVirtuals[virt] = []
+ # XXX: Is this bad? -- It's a permanent modification
self.treeVirtuals[virt] = portage_util.unique_array(self.treeVirtuals[virt]+[cp])
- # Reconstruct the combined virtuals.
- val = stack_dictlist( [self.userVirtuals, self.treeVirtuals]+self.dirVirtuals, incremental=1)
- for v in val.values():
- v.reverse()
- self.virtuals = val
+
+ self.virtuals = self.__getvirtuals_compile()
+
def regenerate(self,useonly=0,use_cache=1):
global usesplit
@@ -1345,11 +1367,10 @@ class config:
usesplit.append(mystr)
# Pre-Pend ARCH variable to USE settings so '-*' in env doesn't kill arch.
- if profiledir:
- if self.configdict["defaults"].has_key("ARCH"):
- if self.configdict["defaults"]["ARCH"]:
- if self.configdict["defaults"]["ARCH"] not in usesplit:
- usesplit.insert(0,self.configdict["defaults"]["ARCH"])
+ if self.configdict["defaults"].has_key("ARCH"):
+ if self.configdict["defaults"]["ARCH"]:
+ if self.configdict["defaults"]["ARCH"] not in usesplit:
+ usesplit.insert(0,self.configdict["defaults"]["ARCH"])
self.configlist[-1]["USE"]=" ".join(usesplit)
@@ -1363,47 +1384,97 @@ class config:
# from. So the only ROOT prefixed dir should be local configs.
#myvirtdirs = prefix_array(self.profiles,myroot+"/")
myvirtdirs = copy.deepcopy(self.profiles)
+
+ while self.user_profile_dir in myvirtdirs:
+ myvirtdirs.remove(self.user_profile_dir)
self.treeVirtuals = {}
- # Repoman should ignore these.
- user_profile_dir = None
- if os.environ.get("PORTAGE_CALLER","") != "repoman":
- user_profile_dir = myroot+USER_CONFIG_PATH
-
- # XXX: Removing this as virtuals and profile/virtuals behave
- # differently. portage/profile/virtuals overrides the default
- # virtuals but are overridden by installed virtuals whereas
- # portage/virtuals overrides everything.
-
- #if os.path.exists("/etc/portage/virtuals"):
- # writemsg("\n\n*** /etc/portage/virtuals should be moved to /etc/portage/profile/virtuals\n")
- # writemsg("*** Please correct this by merging or moving the file. (Deprecation notice)\n\n")
- # time.sleep(1)
-
+ # Rules
+ # R1: Collapse profile virtuals
+ # R2: Extract user-negatives.
+ # R3: Collapse user-virtuals.
+ # R4: Apply user negatives to all except user settings.
+
+ # Order of preference:
+ # 1. user-declared that are installed
+ # 3. installed and in profile
+ # 4. installed
+ # 2. user-declared set
+ # 5. profile
self.dirVirtuals = grab_multiple("virtuals", myvirtdirs, grabdict)
self.dirVirtuals.reverse()
- self.userVirtuals = {}
- if user_profile_dir and os.path.exists(user_profile_dir+"/virtuals"):
- self.userVirtuals = grabdict(user_profile_dir+"/virtuals")
- # User settings and profile settings take precedence over tree.
- profile_virtuals = stack_dictlist([self.userVirtuals]+self.dirVirtuals,incremental=1)
+ if self.user_profile_dir and os.path.exists(self.user_profile_dir+"/virtuals"):
+ self.userVirtuals = grabdict(self.user_profile_dir+"/virtuals")
- # repoman doesn't need local virtuals
+ # Store all the negatives for later.
+ for x in self.userVirtuals.keys():
+ self.negVirtuals[x] = []
+ for y in self.userVirtuals[x]:
+ if y[0] == '-':
+ self.negVirtuals[x].append(y[:])
+
+ # Collapse the user virtuals so that we don't deal with negatives.
+ self.userVirtuals = stack_dictlist([self.userVirtuals],incremental=1)
+
+ # Collapse all the profile virtuals including user negations.
+ self.dirVirtuals = stack_dictlist([self.negVirtuals]+self.dirVirtuals,incremental=1)
+
+ # Repoman does not use user or tree virtuals.
if os.environ.get("PORTAGE_CALLER","") != "repoman":
- temp_vartree = vartree(myroot,profile_virtuals,categories=self.categories)
+ # XXX: vartree does not use virtuals, does user set matter?
+ temp_vartree = vartree(myroot,self.dirVirtuals,categories=self.categories)
+ # Reduce the provides into a list by CP.
myTreeVirtuals = map_dictlist_vals(getCPFromCPV,temp_vartree.get_all_provides())
- for x,v in myTreeVirtuals.items():
- self.treeVirtuals[x] = portage_util.unique_array(v)
-
- # User settings and profile settings take precedence over tree
- val = stack_dictlist([self.userVirtuals,self.treeVirtuals]+self.dirVirtuals,incremental=1)
- for x in val.values():
- x.reverse()
- return val
+ return self.__getvirtuals_compile()
+
+
+ def __getvirtuals_compile(self):
+ """Actually generate the virtuals we have collected.
+ The results are reversed so the list order is left to right.
+ Given data is [Best,Better,Good] sets of [Good, Better, Best]"""
+ # Virtuals by profile+tree preferences.
+ ptVirtuals = {}
+ # Virtuals by user+tree preferences.
+ utVirtuals = {}
+
+ # If a user virtual is already installed, we preference it.
+ for x in self.userVirtuals.keys():
+ utVirtuals[x] = []
+ if self.treeVirtuals.has_key(x):
+ for y in self.userVirtuals[x]:
+ if y in self.treeVirtuals[x]:
+ utVirtuals[x].append(y)
+ #print "F:",utVirtuals
+ #utVirtuals[x].reverse()
+ #print "R:",utVirtuals
+
+ # If a profile virtual is already installed, we preference it.
+ for x in self.dirVirtuals.keys():
+ ptVirtuals[x] = []
+ if self.treeVirtuals.has_key(x):
+ for y in self.dirVirtuals[x]:
+ if y in self.treeVirtuals[x]:
+ ptVirtuals[x].append(y)
+
+ # UserInstalled, ProfileInstalled, Installed, User, Profile
+ biglist = [utVirtuals, ptVirtuals, self.treeVirtuals,
+ self.userVirtuals, self.dirVirtuals]
+
+ # We reverse each dictlist so that the order matches everything
+ # else in portage. [-*, a, b] [b, c, d] ==> [b, a]
+ for dictlist in biglist:
+ for key in dictlist:
+ dictlist[key].reverse()
+
+ # User settings and profile settings take precedence over tree.
+ val = stack_dictlist(biglist,incremental=1)
+
+ return val
+
def __delitem__(self,mykey):
for x in self.lookuplist:
@@ -1505,8 +1576,10 @@ def spawn(mystring,mysettings,debug=0,free=0,droppriv=0,fd_pipes=None,**keywords
keywords["opt_name"]="[%s]" % mysettings["PF"]
- droppriv=(droppriv and ("userpriv" in features) and \
- ("nouserpriv" not in mysettings["RESTRICT"].split()))
+ # XXX: Negative RESTRICT word
+ myrestrict = mysettings["RESTRICT"].split()
+ droppriv=(droppriv and "userpriv" in mysettings.features and
+ "nouserpriv" not in myrestrict and "userpriv" not in myrestrict)
if ("sandbox" in features) and (not free):
keywords["opt_name"] += " sandbox"
@@ -1519,10 +1592,17 @@ def spawn(mystring,mysettings,debug=0,free=0,droppriv=0,fd_pipes=None,**keywords
def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",use_locks=1, try_mirrors=1,verbosity=0):
"fetch files. Will use digest file if available."
- if ("mirror" in features) and ("nomirror" in mysettings["RESTRICT"].split()):
- if verbosity:
- print ">>> \"mirror\" mode and \"nomirror\" restriction enabled; skipping fetch."
- return 1
+
+ # 'nomirror' is bad/negative logic. You Restrict mirroring, not no-mirroring.
+ myrestrict = mysettings["RESTRICT"].split()
+ if "mirror" in myrestrict or "nomirror" in myrestrict:
+ if ("mirror" in mysettings.features) and ("lmirror" not in mysettings.features):
+ # lmirror should allow you to bypass mirror restrictions.
+ # XXX: This is not a good thing, and is temporary at best.
+ if verbosity:
+ print ">>> \"mirror\" mode desired and \"mirror\" restriction found; skipping fetch."
+ return 1
+
global thirdpartymirrors
check_config_instance(mysettings)
@@ -1599,6 +1679,7 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
return 1
locations=mymirrors[:]
filedict={}
+ primaryuri_indexes={}
for myuri in myuris:
myfile=os.path.basename(myuri)
if not filedict.has_key(myfile):
@@ -1641,6 +1722,14 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
writemsg("Invalid mirror definition in SRC_URI:\n",verbosity)
writemsg(" %s\n" % (myuri),verbosity)
else:
+ if "primaryuri" in mysettings["RESTRICT"].split():
+ # Use the source site first.
+ if primaryuri_indexes.has_key(myfile):
+ primaryuri_indexes[myfile] += 1
+ else:
+ primaryuri_indexes[myfile] = 0
+ filedict[myfile].insert(primaryuri_indexes[myfile], myuri)
+ else:
filedict[myfile].append(myuri)
missingSourceHost = False
@@ -1885,8 +1974,8 @@ def digestCreate(myfiles,basedir,oldDigest={}):
print "!!! Given file does not appear to be readable. Does it exist?"
print "!!! File:",myfile
return None
- mysize = os.stat(myfile)[stat.ST_SIZE]
- mysums = portage_checksum.perform_all(myfile)
+ mydigests[x] = portage_checksum.perform_all(myfile)
+ mysize = os.stat(myfile)[stat.ST_SIZE]
else:
if x in oldDigest:
# DeepCopy because we might not have a unique reference.
@@ -1897,7 +1986,6 @@ def digestCreate(myfiles,basedir,oldDigest={}):
print "!!! File:",myfile
return None
- mydigests[x] = mysums
if "size" in mydigests[x] and (mydigests[x]["size"] != mysize):
raise portage_exception.DigestException, "Size mismatch during checksums"
mydigests[x]["size"] = mysize
@@ -4312,7 +4400,7 @@ class portdbapi(dbapi):
try:
myuris = self.aux_get(mypkg,["SRC_URI"])[0]
except (IOError,KeyError):
- print red("getfetchlist():")+" aux_get() error; aborting."
+ print red("getfetchlist():")+" aux_get() error reading "+mypkg+"; aborting."
sys.exit(1)
useflags = mysettings["USE"].split()
@@ -4563,8 +4651,8 @@ class portdbapi(dbapi):
cp = dep_getkey(mycpv)
if cp in pkgdict:
matches = match_to_list(mycpv, pkgdict[cp].keys())
- for match in matches:
- pgroups.extend(pkgdict[cp][match])
+ for atom in matches:
+ pgroups.extend(pkgdict[cp][atom])
match=0
for gp in mygroups:
if gp=="*":
@@ -5247,6 +5335,17 @@ class dblink:
else:
#this doesn't match the package we're unmerging; keep it.
newworldlist.append(x)
+
+ # if the base dir doesn't exist, create it.
+ # (spanky noticed bug)
+ # XXX: dumb question, but abstracting the root uid might be wise/useful for
+ # 2nd pkg manager installation setups.
+ if not os.path.exists(os.path.dirname(self.myroot+WORLD_FILE)):
+ pdir = os.path.dirname(self.myroot + WORLD_FILE)
+ os.makedirs(pdir, mode=0755)
+ os.chown(pdir, 0, portage_gid)
+ os.chmod(pdir, 02770)
+
myworld=open(self.myroot+WORLD_FILE,"w")
for x in newworldlist:
myworld.write(x+"\n")
@@ -5822,6 +5921,13 @@ class dblink:
# we are merging a directory
if mydmode!=None:
# destination exists
+
+ if bsd_chflags:
+ # Save then clear flags on dest.
+ dflags=bsd_chflags.lgetflags(mydest)
+ if(bsd_chflags.lchflags(mydest, 0)<0):
+ writemsg("!!! Couldn't clear flags on '"+mydest+"'.\n")
+
if not os.access(mydest, os.W_OK):
pkgstuff = portage_versions.pkgsplit(self.pkg)
writemsg("\n!!! Cannot write to '"+mydest+"'.\n")
@@ -5834,6 +5940,8 @@ class dblink:
if stat.S_ISLNK(mydmode) or stat.S_ISDIR(mydmode):
# a symlink to an existing directory will work for us; keep it:
print "---",mydest+"/"
+ if bsd_chflags:
+ bsd_chflags.lchflags(mydest, dflags)
else:
# a non-directory and non-symlink-to-directory. Won't work for us. Move out of the way.
if movefile(mydest,mydest+".backup", mysettings=self.settings) == None:
@@ -5846,6 +5954,8 @@ class dblink:
selinux.secure_mkdir(mydest,sid)
else:
os.mkdir(mydest)
+ if bsd_chflags:
+ bsd_chflags.lchflags(mydest, dflags)
os.chmod(mydest,mystat[0])
lchown(mydest,mystat[4],mystat[5])
print ">>>",mydest+"/"
@@ -5857,6 +5967,8 @@ class dblink:
else:
os.mkdir(mydest)
os.chmod(mydest,mystat[0])
+ if bsd_chflags:
+ bsd_chflags.lchflags(mydest, bsd_chflags.lgetflags(mysrc))
lchown(mydest,mystat[4],mystat[5])
print ">>>",mydest+"/"
outfile.write("dir "+myrealdest+"\n")
@@ -6149,9 +6261,13 @@ if not os.path.exists(root+"var/tmp"):
writemsg("portage: couldn't create /var/tmp; exiting.\n")
sys.exit(1)
+
+#####################################
+# Deprecation Checks
+
os.umask(022)
profiledir=None
-if os.path.exists(MAKE_DEFAULTS_FILE):
+if os.path.isdir(PROFILE_PATH):
profiledir = PROFILE_PATH
if os.access(DEPRECATED_PROFILE_FILE, os.R_OK):
deprecatedfile = open(DEPRECATED_PROFILE_FILE, "r")
@@ -6167,6 +6283,14 @@ if os.path.exists(MAKE_DEFAULTS_FILE):
writemsg(myline)
writemsg("\n\n")
+if os.path.exists(USER_VIRTUALS_FILE):
+ writemsg(red("\n!!! /etc/portage/virtuals is deprecated in favor of\n"))
+ writemsg(red("!!! /etc/portage/profile/virtuals. Please move it to\n"))
+ writemsg(red("!!! this new location.\n\n"))
+
+#
+#####################################
+
db={}
# =============================================================================
@@ -6174,7 +6298,7 @@ db={}
# -----------------------------------------------------------------------------
# We're going to lock the global config to prevent changes, but we need
# to ensure the global settings are right.
-settings=config(config_profile_path=PROFILE_PATH,config_incrementals=incrementals)
+settings=config(config_profile_path=PROFILE_PATH,config_incrementals=portage_const.INCREMENTALS)
# useful info
settings["PORTAGE_MASTER_PID"]=str(os.getpid())
diff --git a/pym/portage_checksum.py b/pym/portage_checksum.py
index b72ecfc..106c805 100644
--- a/pym/portage_checksum.py
+++ b/pym/portage_checksum.py
@@ -1,7 +1,8 @@
# portage_checksum.py -- core Portage functionality
# Copyright 1998-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage_checksum.py,v 1.11 2004/11/07 11:58:29 ferringb Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage_checksum.py,v 1.12 2005/02/26 06:35:20 jstubbs Exp $
+cvs_id_string="$Id: portage_checksum.py,v 1.12 2005/02/26 06:35:20 jstubbs Exp $"[5:-2]
from portage_const import PRIVATE_PATH,PRELINK_BINARY
import os
diff --git a/pym/portage_const.py b/pym/portage_const.py
index 3e652b2..668e868 100644
--- a/pym/portage_const.py
+++ b/pym/portage_const.py
@@ -1,7 +1,8 @@
# portage: Constants
# Copyright 1998-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage_const.py,v 1.7 2005/02/21 12:45:49 genone Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage_const.py,v 1.8 2005/02/26 06:35:20 jstubbs Exp $
+cvs_id_string="$Id: portage_const.py,v 1.8 2005/02/26 06:35:20 jstubbs Exp $"[5:-2]
# ===========================================================================
# START OF CONSTANTS -- START OF CONSTANTS -- START OF CONSTANTS -- START OF
@@ -48,6 +49,9 @@ CUSTOM_MIRRORS_FILE = USER_CONFIG_PATH+"/mirrors"
SANDBOX_PIDS_FILE = "/tmp/sandboxpids.tmp"
CONFIG_MEMORY_FILE = PRIVATE_PATH + "/config"
+INCREMENTALS=["USE","FEATURES","ACCEPT_KEYWORDS","ACCEPT_LICENSE","CONFIG_PROTECT_MASK","CONFIG_PROTECT","PRELINK_PATH","PRELINK_PATH_MASK"]
+STICKIES=["KEYWORDS_ACCEPT","USE","CFLAGS","CXXFLAGS","MAKEOPTS","EXTRA_ECONF","EXTRA_EINSTALL","EXTRA_EMAKE"]
+
CONFCACHE_FILE = CACHE_PATH+"/confcache"
CONFCACHE_LIST = CACHE_PATH+"/confcache_files.anydbm"
diff --git a/pym/portage_contents.py b/pym/portage_contents.py
index 1ec72cb..e6ad4a0 100644
--- a/pym/portage_contents.py
+++ b/pym/portage_contents.py
@@ -1,7 +1,8 @@
# portage_contents.py -- (Persistent) Contents File Management
# Copyright 1998-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage_contents.py,v 1.3 2004/10/04 14:07:40 vapier Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage_contents.py,v 1.4 2005/02/26 06:35:20 jstubbs Exp $
+cvs_id_string="$Id: portage_contents.py,v 1.4 2005/02/26 06:35:20 jstubbs Exp $"[5:-2]
import os,string,types,sys,copy
import portage_exception
diff --git a/pym/portage_data.py b/pym/portage_data.py
index 5627544..9eab5a5 100644
--- a/pym/portage_data.py
+++ b/pym/portage_data.py
@@ -1,7 +1,8 @@
# portage_data.py -- Calculated/Discovered Data Values
# Copyright 1998-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage_data.py,v 1.6 2004/11/07 11:58:29 ferringb Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage_data.py,v 1.7 2005/02/26 06:35:20 jstubbs Exp $
+cvs_id_string="$Id: portage_data.py,v 1.7 2005/02/26 06:35:20 jstubbs Exp $"[5:-2]
import os,pwd,grp
from portage_util import writemsg
diff --git a/pym/portage_db_anydbm.py b/pym/portage_db_anydbm.py
index 6053ef0..245baec 100644
--- a/pym/portage_db_anydbm.py
+++ b/pym/portage_db_anydbm.py
@@ -1,6 +1,7 @@
# Copyright 2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/Attic/portage_db_anydbm.py,v 1.11 2004/10/19 04:58:42 carpaski Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/Attic/portage_db_anydbm.py,v 1.12 2005/02/26 06:35:20 jstubbs Exp $
+cvs_id_string="$Id: portage_db_anydbm.py,v 1.12 2005/02/26 06:35:20 jstubbs Exp $"[5:-2]
import anydbm,cPickle,types,os
diff --git a/pym/portage_db_cpickle.py b/pym/portage_db_cpickle.py
index 5194fb6..91bdf55 100644
--- a/pym/portage_db_cpickle.py
+++ b/pym/portage_db_cpickle.py
@@ -1,6 +1,7 @@
# Copyright 2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/Attic/portage_db_cpickle.py,v 1.9 2004/10/19 04:58:42 carpaski Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/Attic/portage_db_cpickle.py,v 1.10 2005/02/26 06:35:20 jstubbs Exp $
+cvs_id_string="$Id: portage_db_cpickle.py,v 1.10 2005/02/26 06:35:20 jstubbs Exp $"[5:-2]
import anydbm,cPickle,types
from os import chown,access,R_OK,unlink
diff --git a/pym/portage_db_flat.py b/pym/portage_db_flat.py
index 2932b4f..d74cfd6 100644
--- a/pym/portage_db_flat.py
+++ b/pym/portage_db_flat.py
@@ -1,12 +1,11 @@
# Copyright 2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/Attic/portage_db_flat.py,v 1.17 2005/02/18 04:37:59 ferringb Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/Attic/portage_db_flat.py,v 1.18 2005/02/26 06:35:20 jstubbs Exp $
+cvs_id_string="$Id: portage_db_flat.py,v 1.18 2005/02/26 06:35:20 jstubbs Exp $"[5:-2]
import types
import os
import stat
-from copy import deepcopy
-from string import join
import portage_db_template
@@ -57,7 +56,7 @@ class database(portage_db_template.database):
# return portage.listdir(self.fullpath,filesonly=1)
mykeys = []
for x in os.listdir(self.fullpath):
- if os.path.isfile(self.fullpath+x):
+ if os.path.isfile(self.fullpath+x) and not x.beginswith(".update."):
mykeys += [x]
return mykeys
diff --git a/pym/portage_db_template.py b/pym/portage_db_template.py
index 60fbf30..ebb4d82 100644
--- a/pym/portage_db_template.py
+++ b/pym/portage_db_template.py
@@ -1,6 +1,7 @@
# Copyright 2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/Attic/portage_db_template.py,v 1.12 2004/11/07 12:28:29 ferringb Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/Attic/portage_db_template.py,v 1.13 2005/02/26 06:35:20 jstubbs Exp $
+cvs_id_string="$Id: portage_db_template.py,v 1.13 2005/02/26 06:35:20 jstubbs Exp $"[5:-2]
import os.path,string
from portage_util import getconfig, ReadOnlyConfig
diff --git a/pym/portage_db_test.py b/pym/portage_db_test.py
index 678a298..e2a08a8 100644
--- a/pym/portage_db_test.py
+++ b/pym/portage_db_test.py
@@ -1,7 +1,8 @@
#!/usr/bin/python -O
# Copyright 2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/Attic/portage_db_test.py,v 1.3 2004/10/04 14:07:40 vapier Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/Attic/portage_db_test.py,v 1.4 2005/02/26 06:35:20 jstubbs Exp $
+cvs_id_string="$Id: portage_db_test.py,v 1.4 2005/02/26 06:35:20 jstubbs Exp $"[5:-2]
import portage
import portage_db_template
diff --git a/pym/portage_dep.py b/pym/portage_dep.py
index d1d8d37..68b071f 100644
--- a/pym/portage_dep.py
+++ b/pym/portage_dep.py
@@ -1,7 +1,8 @@
# deps.py -- Portage dependency resolution functions
# Copyright 2003-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage_dep.py,v 1.22 2004/12/07 15:06:41 jstubbs Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage_dep.py,v 1.23 2005/02/26 06:35:20 jstubbs Exp $
+cvs_id_string="$Id: portage_dep.py,v 1.23 2005/02/26 06:35:20 jstubbs Exp $"[5:-2]
# DEPEND SYNTAX:
#
diff --git a/pym/portage_exception.py b/pym/portage_exception.py
index 6598142..82a0895 100644
--- a/pym/portage_exception.py
+++ b/pym/portage_exception.py
@@ -1,6 +1,7 @@
# Copyright 1998-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage_exception.py,v 1.9 2004/11/15 21:42:50 carpaski Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage_exception.py,v 1.10 2005/02/26 06:35:20 jstubbs Exp $
+cvs_id_string="$Id: portage_exception.py,v 1.10 2005/02/26 06:35:20 jstubbs Exp $"[5:-2]
class PortageException(Exception):
"""General superclass for portage exceptions"""
diff --git a/pym/portage_exec.py b/pym/portage_exec.py
index 3b241ed..4837fb1 100644
--- a/pym/portage_exec.py
+++ b/pym/portage_exec.py
@@ -1,7 +1,8 @@
# portage.py -- core Portage functionality
# Copyright 1998-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage_exec.py,v 1.19 2004/12/07 15:06:41 jstubbs Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage_exec.py,v 1.20 2005/02/26 06:35:20 jstubbs Exp $
+cvs_id_string="$Id: portage_exec.py,v 1.20 2005/02/26 06:35:20 jstubbs Exp $"[5:-2]
import os,types,string,sys
import signal
diff --git a/pym/portage_file.py b/pym/portage_file.py
index 79586f2..6b43dfb 100644
--- a/pym/portage_file.py
+++ b/pym/portage_file.py
@@ -1,7 +1,8 @@
# portage_data.py -- Calculated/Discovered Data Values
# Copyright 1998-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage_file.py,v 1.3 2004/10/11 04:12:02 carpaski Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage_file.py,v 1.4 2005/02/26 06:35:20 jstubbs Exp $
+cvs_id_string="$Id: portage_file.py,v 1.4 2005/02/26 06:35:20 jstubbs Exp $"[5:-2]
import os
import portage_data
diff --git a/pym/portage_gpg.py b/pym/portage_gpg.py
index 2863931..1deb1a1 100644
--- a/pym/portage_gpg.py
+++ b/pym/portage_gpg.py
@@ -1,7 +1,8 @@
# portage_gpg.py -- core Portage functionality
# Copyright 2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage_gpg.py,v 1.10 2004/11/15 21:42:50 carpaski Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage_gpg.py,v 1.11 2005/02/26 06:35:20 jstubbs Exp $
+cvs_id_string="$Id: portage_gpg.py,v 1.11 2005/02/26 06:35:20 jstubbs Exp $"[5:-2]
import os
import copy
diff --git a/pym/portage_localization.py b/pym/portage_localization.py
index f851f96..edcd94b 100644
--- a/pym/portage_localization.py
+++ b/pym/portage_localization.py
@@ -1,7 +1,8 @@
# portage_localization.py -- Code to manage/help portage localization.
# Copyright 2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage_localization.py,v 1.2 2004/10/04 14:07:40 vapier Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage_localization.py,v 1.3 2005/02/26 06:35:20 jstubbs Exp $
+cvs_id_string="$Id: portage_localization.py,v 1.3 2005/02/26 06:35:20 jstubbs Exp $"[5:-2]
# We define this to make the transition easier for us.
diff --git a/pym/portage_locks.py b/pym/portage_locks.py
index 9bdb018..f96c3ad 100644
--- a/pym/portage_locks.py
+++ b/pym/portage_locks.py
@@ -1,7 +1,8 @@
# portage: Lock management code
# Copyright 2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage_locks.py,v 1.22 2004/11/12 17:04:19 ferringb Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage_locks.py,v 1.23 2005/02/26 06:35:20 jstubbs Exp $
+cvs_id_string="$Id: portage_locks.py,v 1.23 2005/02/26 06:35:20 jstubbs Exp $"[5:-2]
import atexit
import errno
@@ -71,7 +72,7 @@ def lockfile(mypath,wantnewlockfile=0,unlinkfile=0,verbosity=0):
except SystemExit, e:
raise
except OSError, e:
- if e[0] == 2: # No such file or directory
+ if e[0] == 2: #XXX: No such file or directory
return lockfile(mypath,wantnewlockfile,unlinkfile)
else:
portage_util.writemsg("Cannot chown a lockfile. This could cause inconvenience later.\n",verbosity)
diff --git a/pym/portage_util.py b/pym/portage_util.py
index 39a36ec..ef09096 100644
--- a/pym/portage_util.py
+++ b/pym/portage_util.py
@@ -1,6 +1,7 @@
# Copyright 2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage_util.py,v 1.17 2004/12/07 15:06:41 jstubbs Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/portage_util.py,v 1.18 2005/02/26 06:35:20 jstubbs Exp $
+cvs_id_string="$Id: portage_util.py,v 1.18 2005/02/26 06:35:20 jstubbs Exp $"[5:-2]
import sys,string,shlex,os.path,stat,types
import shutil
@@ -73,16 +74,16 @@ def stack_dictlist(original_dicts, incremental=0, incrementals=[], ignore_none=0
if not kill_list.has_key(y):
kill_list[y] = []
+ mydict[y].reverse()
for thing in mydict[y]:
- if thing and (thing not in kill_list[y]):
+ if thing and (thing not in kill_list[y]) and ("*" not in kill_list[y]):
if (incremental or (y in incrementals)) and thing[0] == '-':
if thing[1:] not in kill_list[y]:
kill_list[y] += [thing[1:]]
-# while(thing[1:] in final_dict[y]):
-# del final_dict[y][final_dict[y].index(thing[1:])]
else:
if thing not in final_dict[y]:
- final_dict[y].insert(0,thing[:])
+ final_dict[y].append(thing[:])
+ mydict[y].reverse()
if final_dict.has_key(y) and not final_dict[y]:
del final_dict[y]
return final_dict
@@ -167,9 +168,11 @@ def grabfile_package(myfilename,compatlevel=0):
pkgs=grabfile(myfilename,compatlevel)
for x in range(len(pkgs)-1,-1,-1):
pkg = pkgs[x]
+ if pkg[0] == "-":
+ pkg = pkg[1:]
if pkg[0] == "*": # Kill this so we can deal the "packages" file too
pkg = pkg[1:]
- if not isvalidatom(pkg):
+ if not isvalidatom(pkg): #XXX: isvalidatom is not available from this context
writemsg("--- Invalid atom in %s: %s\n" % (myfilename, pkgs[x]))
del(pkgs[x])
return pkgs
@@ -221,7 +224,7 @@ def writedict(mydict,myfilename,writekey=1):
myfile.close()
return 1
-def getconfig(mycfg,tolerant=0):
+def getconfig(mycfg,tolerant=0,allow_sourcing=False):
mykeys={}
try:
f=open(mycfg,'r')
@@ -231,6 +234,8 @@ def getconfig(mycfg,tolerant=0):
lex=shlex.shlex(f)
lex.wordchars=string.digits+string.letters+"~!@#$%*_\:;?,./-+{}"
lex.quotes="\"'"
+ if allow_sourcing:
+ lex.source="source"
while 1:
key=lex.get_token()
if (key==''):
@@ -460,6 +465,13 @@ def movefile(src,dest,newmtime=None,sstat=None,mysettings=None):
try:
if not sstat:
sstat=os.lstat(src)
+ if bsd_chflags:
+ sflags=bsd_chflags.lgetflags(src)
+ if sflags < 0:
+ # Problem getting flags...
+ print "!!! Couldn't get flags for "+dest+"\n"
+ return None
+
except SystemExit, e:
raise
except Exception, e:
@@ -476,6 +488,24 @@ def movefile(src,dest,newmtime=None,sstat=None,mysettings=None):
dstat=os.lstat(os.path.dirname(dest))
destexists=0
+ if bsd_chflags:
+ # Check that we can actually unset schg etc flags...
+ # Clear the flags on source and destination; we'll reinstate them after merging
+ if(destexists):
+ if bsd_chflags.lchflags(dest, 0) < 0:
+ print "!!! Couldn't clear flags on file being merged: \n"
+ # We might have an immutable flag on the parent dir; save and clear.
+ pflags=bsd_chflags.lgetflags(os.path.dirname(dest))
+ bsd_chflags.lchflags(os.path.dirname(dest), 0)
+
+ # Don't bother checking the return value here; if it fails then the next line will catch it.
+ bsd_chflags.lchflags(src, 0)
+
+ if bsd_chflags.lhasproblems(src)>0 or (destexists and bsd_chflags.lhasproblems(dest)>0) or bsd_chflags.lhasproblems(os.path.dirname(dest))>0:
+ # This is bad: we can't merge the file with these flags set.
+ print "!!! Can't merge file "+dest+" because of flags set\n"
+ return None
+
if destexists:
if stat.S_ISLNK(dstat[stat.ST_MODE]):
try:
@@ -500,8 +530,12 @@ def movefile(src,dest,newmtime=None,sstat=None,mysettings=None):
else:
os.symlink(target,dest)
lchown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID])
- return os.lstat(dest)[stat.ST_MTIME]
- lchown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID])
+ if bsd_chflags:
+ # Restore the flags we saved before moving
+ if bsd_chflags.lchflags(dest, sflags) < 0 or bsd_chflags.lchflags(os.path.dirname(dest), pflags) < 0:
+ writemsg("!!! Couldn't restore flags ("+str(flags)+") on " + dest+":\n")
+ writemsg("!!! %s\n" % str(e))
+ return None
return os.lstat(dest)[stat.ST_MTIME]
except SystemExit, e:
raise
@@ -577,6 +611,13 @@ def movefile(src,dest,newmtime=None,sstat=None,mysettings=None):
else:
os.utime(dest, (sstat[stat.ST_ATIME], sstat[stat.ST_MTIME]))
newmtime=sstat[stat.ST_MTIME]
+
+ if bsd_chflags:
+ # Restore the flags we saved before moving
+ if bsd_chflags.lchflags(dest, sflags) < 0 or bsd_chflags.lchflags(os.path.dirname(dest), pflags) < 0:
+ writemsg("!!! Couldn't restore flags ("+str(sflags)+") on " + dest+":\n")
+ return None
+
return newmtime
def flatten(mytokens):
diff --git a/pym/xpak.py b/pym/xpak.py
index d6bb381..2beda5f 100644
--- a/pym/xpak.py
+++ b/pym/xpak.py
@@ -1,6 +1,7 @@
# Copyright 2001-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/xpak.py,v 1.14 2004/11/15 21:42:50 carpaski Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/pym/xpak.py,v 1.15 2005/02/26 06:35:20 jstubbs Exp $
+cvs_id_string="$Id: xpak.py,v 1.15 2005/02/26 06:35:20 jstubbs Exp $"[5:-2]
# The format for a tbz2/xpak:
#