summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Robbins <drobbins@gentoo.org>2000-10-31 05:23:49 +0000
committerDaniel Robbins <drobbins@gentoo.org>2000-10-31 05:23:49 +0000
commitda60829fa201872b166fa25102f3980ef949c0b4 (patch)
tree3dfe113fc8c67dfa72bcb9ac560ea6e3a774a086 /sys-apps
parentmore fixes (diff)
downloadgentoo-2-da60829fa201872b166fa25102f3980ef949c0b4.tar.gz
gentoo-2-da60829fa201872b166fa25102f3980ef949c0b4.tar.bz2
gentoo-2-da60829fa201872b166fa25102f3980ef949c0b4.zip
more portage updates
Diffstat (limited to 'sys-apps')
-rwxr-xr-xsys-apps/portage/files/portage-maintain65
-rw-r--r--sys-apps/portage/files/portage.py91
2 files changed, 96 insertions, 60 deletions
diff --git a/sys-apps/portage/files/portage-maintain b/sys-apps/portage/files/portage-maintain
index 0efa082a3f9b..8b6438182a74 100755
--- a/sys-apps/portage/files/portage-maintain
+++ b/sys-apps/portage/files/portage-maintain
@@ -5,70 +5,16 @@ import portage
import string
import sys
-portagedict={}
-portdir=portage.getsetting("PORTDIR")
-dbdir=portage.getsetting("DBDIR")
-currentfile=portage.getsetting("CURRENTFILE")
-
-if not os.path.isdir(portdir):
- print "Couldn't find",portdir
- print "Exiting."
- sys.exit(1)
-if not os.path.isdir(dbdir):
- print "Couldn't find",dbdir
- print "Exiting."
- sys.exit(1)
-os.chdir(portdir)
-
-for x in portage.categories:
- for y in os.listdir(os.getcwd()+"/"+x):
- if not os.path.isdir(os.getcwd()+"/"+x+"/"+y):
- continue
- if y=="CVS":
- continue
- for mypkg in os.listdir(os.getcwd()+"/"+x+"/"+y):
- if mypkg[-7:] != ".ebuild":
- continue
- mypkg=mypkg[:-7]
- mykey=x+"/"+y
- if not portagedict.has_key(mykey):
- portagedict[mykey]=[]
- portagedict[mykey].append([x+"/"+mypkg,portage.pkgsplit(mypkg)])
-
-#format: cat/basepkgname: [ cat/fullpkgname, mysplit ]
-installeddict={}
-os.chdir(dbdir)
-for x in os.listdir(os.getcwd()):
- for y in os.listdir(os.getcwd()+"/"+x):
- mysplit=portage.pkgsplit(y)
- if not installeddict.has_key(x+"/"+mysplit[0]):
- installeddict[x+"/"+mysplit[0]]=[]
- installeddict[x+"/"+mysplit[0]].append([x+"/"+y,mysplit])
-
-#format: cat/basepkgname: [ cat/fullpkgname, mysplit ]
-currentdict={}
-mycurrent=open(currentfile,"r")
-mylines=mycurrent.readlines()
-for x in mylines:
- if x[:2]!="./":
- continue
- myline=string.split(string.strip(x)[2:-7],"/")
- if len(myline)!=3:
- continue
- mysplit=portage.pkgsplit(myline[2])
- mykey=myline[0]+"/"+myline[1]
- if not currentdict.has_key(mykey):
- currentdict[mykey]=[]
- currentdict[mykey].append([myline[0]+"/"+myline[2],mysplit])
-mycurrent.close()
-del mylines
+installeddict=portage.port_insttree()
+currentdict=portage.port_currtree()
+portagedict=portage.port_porttree()
for mypkg in installeddict.keys():
#if there is one installed version, and one recommended version, and they both
#are the same version, don't list the package. This package is up-to-date.
if (len(installeddict[mypkg])==1) and currentdict.has_key(mypkg):
if len(currentdict[mypkg])==1:
- if portage.pkgcmp(currentdict[mypkg][0][1],installeddict[mypkg][0][1])==0:
+ if portage.pkgcmp(currentdict[mypkg][0][1][1:],installeddict[mypkg][0][1][1:])==0:
continue
print "Package",mypkg
print "Installed version(s):"
@@ -92,8 +38,7 @@ for mypkg in installeddict.keys():
print "System (important) packages not installed:"
print
for x in currentdict.keys():
- mysplit=string.split(currentdict[x][0][0],"/")[0]
- if mysplit[0:4]=="sys-":
+ if currentdict[x][0][1][0][0:4]=="sys-":
#required package
if not installeddict.has_key(x):
print x
diff --git a/sys-apps/portage/files/portage.py b/sys-apps/portage/files/portage.py
index 9e5a7f88bb2e..9bfc2d53888f 100644
--- a/sys-apps/portage/files/portage.py
+++ b/sys-apps/portage/files/portage.py
@@ -1056,6 +1056,97 @@ def dep_frontend():
dep_print(myparse[1])
return 1
+def port_currtree():
+ """
+ This function builds a dictionary of current (recommended) packages on the system,
+ based on the contents of CURRENTFILE. Dictionary format is:
+ mydict["cat/pkg"]=[
+ ["cat/fullpkgname",["cat","pkg","ver","rev"]
+ ["cat/fullpkgname",["cat","pkg","ver2","rev2"]
+ ]
+ """
+ currentdict={}
+ currentfile=getsetting("CURRENTFILE")
+ if not os.path.isfile(currentfile):
+ return
+ mycurrent=open(currentfile,"r")
+ mylines=mycurrent.readlines()
+ for x in mylines:
+ if x[:2]!="./":
+ continue
+ myline=string.split(string.strip(x)[2:-7],"/")
+ if len(myline)!=3:
+ continue
+ fullpkg=string.join([myline[0],myline[2]],"/")
+ mysplit=catpkgsplit(fullpkg)
+ mykey=mysplit[0]+"/"+mysplit[1]
+ if not currentdict.has_key(mykey):
+ currentdict[mykey]=[]
+ currentdict[mykey].append([fullpkg,mysplit])
+ mycurrent.close()
+ return currentdict
+
+
+def port_insttree():
+ """
+ This function builds a dictionary of installed packages on the system, based on
+ the contents of DBDIR. Dictionary format is:
+ mydict["cat/pkg"]=[
+ ["cat/fullpkgname",["cat","pkg","ver","rev"]
+ ["cat/fullpkgname",["cat","pkg","ver2","rev2"]
+ ]
+ """
+ installeddict={}
+ dbdir=getsetting("DBDIR")
+ if not os.path.isdir(dbdir):
+ return
+ origdir=os.getcwd()
+ os.chdir(dbdir)
+ for x in os.listdir(os.getcwd()):
+ for y in os.listdir(os.getcwd()+"/"+x):
+ fullpkg=x+"/"+y
+ mysplit=catpkgsplit(fullpkg)
+ mykey=x+"/"+mysplit[1]
+ if not installeddict.has_key(mykey):
+ installeddict[mykey]=[]
+ installeddict[mykey].append([fullpkg,mysplit])
+ os.chdir(origdir)
+ return installeddict
+
+def port_porttree():
+ """
+ This function builds a dictionary of available ebuilds in the portage tree.
+ Dictionary format is:
+ mydict["cat/pkg"]=[
+ ["cat/fullpkgname",["cat","pkg","ver","rev"]
+ ["cat/fullpkgname",["cat","pkg","ver2","rev2"]
+ ]
+ """
+ portagedict={}
+ mydir=getsetting("PORTDIR")
+ if not os.path.isdir(mydir):
+ return
+ origdir=os.getcwd()
+ os.chdir(mydir)
+ for x in categories:
+ for y in os.listdir(os.getcwd()+"/"+x):
+ if not os.path.isdir(os.getcwd()+"/"+x+"/"+y):
+ continue
+ if y=="CVS":
+ continue
+ for mypkg in os.listdir(os.getcwd()+"/"+x+"/"+y):
+ if mypkg[-7:] != ".ebuild":
+ continue
+ mypkg=mypkg[:-7]
+ mykey=x+"/"+y
+ fullpkg=x+"/"+mypkg
+ if not portagedict.has_key(mykey):
+ portagedict[mykey]=[]
+ portagedict[mykey].append([fullpkg,catpkgsplit(fullpkg)])
+ os.chdir(origdir)
+ return portagedict
+
+
configdefaults=getconfig("/etc/make.defaults")
configsettings=getconfig("/etc/make.conf")
root=getsetting("ROOT")