diff options
-rwxr-xr-x | bin/emaint | 11 | ||||
-rwxr-xr-x | bin/emerge | 10 | ||||
-rwxr-xr-x | bin/regenworld | 6 | ||||
-rw-r--r-- | pym/portage.py | 18 | ||||
-rw-r--r-- | pym/portage_const.py | 2 |
5 files changed, 24 insertions, 23 deletions
diff --git a/bin/emaint b/bin/emaint index e6d11fc15..472656bc7 100755 --- a/bin/emaint +++ b/bin/emaint @@ -18,9 +18,10 @@ class WorldHandler(object): self.invalid = [] self.not_installed = [] self.okay = [] - self.found = os.access(portage_const.WORLD_FILE, os.R_OK) + self.world_file = os.path.join("/", portage_const.WORLD_FILE) + self.found = os.access(self.world_file, os.R_OK) - for atom in open(portage_const.WORLD_FILE).read().split(): + for atom in open(self.world_file).read().split(): if not portage.isvalidatom(atom): self.invalid.append(atom) elif not portage.db["/"]["vartree"].dbapi.match(atom): @@ -34,15 +35,15 @@ class WorldHandler(object): errors += map(lambda x: "'%s' is not a valid atom" % x, self.invalid) errors += map(lambda x: "'%s' is not installed" % x, self.not_installed) else: - errors.append(portage_const.WORLD_FILE + " could not be opened for reading") + errors.append(self.world_file + " could not be opened for reading") return errors def fix(self): errors = [] try: - portage.write_atomic(portage_const.WORLD_FILE,"\n".join(self.okay)) + portage.write_atomic(self.world_file, "\n".join(self.okay)) except OSError: - errors.append(portage_const.WORLD_FILE + " could not be opened for writing") + errors.append(self.world_file + " could not be opened for writing") return errors class VdbKeyHandler(object): diff --git a/bin/emerge b/bin/emerge index 4afe24432..d0682aabd 100755 --- a/bin/emerge +++ b/bin/emerge @@ -835,7 +835,7 @@ def getlist(mode): mylines=portage.settings.packages elif mode=="world": try: - myfile=open(portage.root+portage.WORLD_FILE,"r") + myfile = open(os.path.join(portage.root, portage.WORLD_FILE), "r") mylines=myfile.readlines() myfile.close() except OSError: @@ -1843,7 +1843,7 @@ class depgraph: print red("!!! the merge operation manually.") sys.exit(1) else: - myfavs=portage.grabfile(portage.root+portage.WORLD_FILE) + myfavs = portage.grabfile(os.path.join(portage.root, portage.WORLD_FILE)) myfavdict=genericdict(myfavs) for x in range(len(mylist)): if mylist[x][3]!="nomerge": @@ -1862,7 +1862,7 @@ class depgraph: print ">>> Recording",myfavkey,"in \"world\" favorites file..." if not "--fetchonly" in myopts: portage.write_atomic( - os.path.join(portage.root, portage.WORLD_FILE.lstrip(os.sep)), + os.path.join(portage.root, portage.WORLD_FILE), "\n".join(myfavdict.values())) portage.mtimedb["resume"]["mergelist"]=mymergelist[:] @@ -2025,7 +2025,7 @@ class depgraph: portage.db[x[1]]["vartree"].inject(x[2]) myfavkey=portage.cpv_getkey(x[2]) if "--fetchonly" not in myopts and "--fetch-all-uri" not in myopts and myfavkey in favorites: - myfavs=portage.grabfile(myroot+portage.WORLD_FILE) + myfavs = portage.grabfile(os.path.join(myroot, portage.WORLD_FILE)) myfavdict=genericdict(myfavs) mysysdict=genericdict(syslist) #don't record if already in system profile or already recorded @@ -2035,7 +2035,7 @@ class depgraph: print ">>> Recording",myfavkey,"in \"world\" favorites file..." emergelog(" === ("+str(mergecount)+" of "+str(len(mymergelist))+") Updating world file ("+x[pkgindex]+")") portage.write_atomic( - os.path.join(myroot, portage.WORLD_FILE.lstrip(os.sep)), + os.path.join(myroot, portage.WORLD_FILE), "\n".join(myfavdict.values())) if ("noclean" not in portage.features) and (x[0] != "binary"): diff --git a/bin/regenworld b/bin/regenworld index 8723d7f20..221412dd5 100755 --- a/bin/regenworld +++ b/bin/regenworld @@ -5,7 +5,7 @@ import sys sys.path.insert(0, "/usr/lib/portage/pym") - +import os import portage, string, re __candidatematcher__ = re.compile("^[0-9]+: \\*\\*\\* emerge ") @@ -44,7 +44,7 @@ if len(sys.argv) >= 2 and sys.argv[1] in ["-h", "--help"]: print "your existing world file (%s) before using this tool." % portage.WORLD_FILE sys.exit(0) -worldlist = portage.grabfile(portage.WORLD_FILE) +worldlist = portage.grabfile(os.path.join("/", portage.WORLD_FILE)) syslist = portage.settings.packages syslist = filter(issyspkg, syslist) @@ -88,4 +88,4 @@ for mykey in biglist: print "add to world:",myfavkey worldlist.append(myfavkey) -portage.write_atomic(portage.WORLD_FILE,"\n".join(worldlist)) +portage.write_atomic(os.path.join("/", portage.WORLD_FILE), "\n".join(worldlist)) diff --git a/pym/portage.py b/pym/portage.py index 850800f89..f2bf9d6d6 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -5797,7 +5797,7 @@ class dblink: # New code to remove stuff from the world and virtuals files when unmerged. if trimworld: - worldlist=grabfile(self.myroot+WORLD_FILE) + worldlist = grabfile(os.path.join(self.myroot, WORLD_FILE)) mykey=cpv_getkey(self.mycpv) newworldlist=[] for x in worldlist: @@ -5820,13 +5820,13 @@ class dblink: # (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) + my_private_path = os.path.join(self.myroot, PRIVATE_PATH) + if not os.path.exists(my_private_path): + os.makedirs(my_private_path, mode=0755) + os.chown(my_private_path, 0, portage_gid) + os.chmod(my_private_path, 02770) - write_atomic(os.path.join(self.myroot, WORLD_FILE.lstrip(os.sep)), + write_atomic(os.path.join(self.myroot, WORLD_FILE), "\n".join(newworldlist)) #do original postrm @@ -6811,7 +6811,7 @@ def update_config_files(update_iter): if file_contents.has_key(x): del file_contents[x] continue - worldlist = grabfile(WORLD_FILE) + worldlist = grabfile(os.path.join("/", WORLD_FILE)) for update_cmd in update_iter: if update_cmd[0] == "move": @@ -6834,7 +6834,7 @@ def update_config_files(update_iter): sys.stdout.write("p") sys.stdout.flush() - write_atomic(WORLD_FILE,"\n".join(worldlist)) + write_atomic(os.path.join("/", WORLD_FILE), "\n".join(worldlist)) for x in update_files: mydblink = dblink('','','/',settings) diff --git a/pym/portage_const.py b/pym/portage_const.py index c3c768620..99082a77c 100644 --- a/pym/portage_const.py +++ b/pym/portage_const.py @@ -29,7 +29,7 @@ BASH_BINARY = "/bin/bash" MOVE_BINARY = "/bin/mv" PRELINK_BINARY = "/usr/sbin/prelink" -WORLD_FILE = "/" + PRIVATE_PATH + "/world" +WORLD_FILE = PRIVATE_PATH + "/world" MAKE_CONF_FILE = "/etc/make.conf" MAKE_DEFAULTS_FILE = PROFILE_PATH + "/make.defaults" DEPRECATED_PROFILE_FILE = PROFILE_PATH+"/deprecated" |