diff options
-rwxr-xr-x | bin/pkgmerge | 59 | ||||
-rwxr-xr-x | bin/pkgmerge.new | 84 |
2 files changed, 0 insertions, 143 deletions
diff --git a/bin/pkgmerge b/bin/pkgmerge deleted file mode 100755 index 9983ec37e..000000000 --- a/bin/pkgmerge +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/python -# Copyright 1999-2006 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -import sys,os,string -sys.path = ["/usr/lib/portage/pym"]+sys.path - -import portage,xpak - -#build our package digraph - -def digraph_create(digraph,mykey,myprovides=None): - mytbz2=xpak.tbz2(bintree.getname(mykey)) - mydep=mytbz2.getelements("RDEPEND") - digraph.addnode(mykey,myprovides) - mycheck=roottree.depcheck(string.join(mydep," ")) - if mycheck[0]==0: - print "!!! Error: RDEPEND string formatted incorrectly:",mydep - return None - for x in mycheck[1]: - mymatch=bintree.dep_bestmatch(x) - if mymatch=="": - print "!!! Error: can't resolve dependency --",x - return None - if not digraph_create(digraph,mymatch,mykey): - return None - return 1 - -#main program loop -myvirtuals=portage.getvirtuals(portage.root) -roottree=portage.vartree(portage.root,myvirtuals) -bintree=portage.binarytree("/",myvirtuals) -pretend=0 -if len(sys.argv)>=2: - if sys.argv[1]=="--pretend": - print "These are the packages that I would merge, in order:" - pretend=1 - del sys.argv[1] - elif sys.argv[1]=="--help": - print "Usage: pkgmerge [--pretend] pkg1.tbz2 [pkg2.tbz2]..." - sys.exit(1) -for mypkg in sys.argv[1:]: - digraph=portage.digraph() - mytbz2=xpak.tbz2(mypkg) - mykey=mytbz2.getelements("CATEGORY")[0]+"/"+os.path.basename(mypkg)[:-5] - digraph_create(digraph,mykey) - while not digraph.empty(): - mykey=digraph.firstzero() - if not mykey: - print "!!! Error: circular dependencies" - sys.exit(1) - mytbz2=bintree.getname(mykey) - if pretend: - print mytbz2 - else: - portage.pkgmerge(mytbz2,portage.settings["ROOT"]) - digraph.delnode(mykey) - diff --git a/bin/pkgmerge.new b/bin/pkgmerge.new deleted file mode 100755 index 80c70ab10..000000000 --- a/bin/pkgmerge.new +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/python -# Copyright 1999-2006 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -import os,string,sys -sys.path = ["/usr/lib/portage/pym"]+sys.path - -import portage,xpak - -#beautiful directed graph functions - -def dig_addnode(digraph,mykey,myprovides): - if not digraph.has_key(mykey): - if myprovides==None: - digraph[mykey]=[0,[]] - else: - digraph[mykey]=[0,[myprovides]] - digraph[myprovides][0]=digraph[myprovides][0]+1 - return - digraph[mykey]=[digraph[mykey][0],digraph[mykey][1].append(myprovides)] - -def dig_delnode(digraph,mykey): - if not digraph.has_key(mykey): - return - for x in digraph[mykey][1]: - digraph[x][0]=digraph[x][0]-1 - del digraph[mykey] - -def dig_firstzero(digraph): - for x in digraph.keys(): - if digraph[x][0]==0: - return x - return None - -#build our package digraph - -def digraph_create(digraph,mykey,myprovides=None): - mytbz2=xpak.tbz2(bintree.getname(mykey)) - mydep=mytbz2.getelements("RDEPEND") - dig_addnode(digraph,mykey,myprovides) - mycheck=roottree.depcheck(string.join(mydep," ")) - if mycheck[0]==0: - print "!!! Error: RDEPEND string formatted incorrectly:",mydep - return None - for x in mycheck[1]: - mymatch=bintree.dep_bestmatch(x) - if mymatch=="": - print "!!! Error: can't resolve dependency --",x - return None - if not digraph_create(digraph,mymatch,mykey): - return None - return 1 - -#main program loop -myvirtuals=portage.getvirtual(portage.root) -roottree=portage.vartree(portage.root,myvirtuals) -bintree=portage.binarytree("/",myvirtuals) -pretend=0 -if len(sys.argv)>=2: - if sys.argv[1]=="--pretend": - print "These are the packages that I would merge, in order:" - pretend=1 - del sys.argv[1] - elif sys.argv[1]=="--help": - print "Usage: pkgmerge [--pretend] pkg1.tbz2 [pkg2.tbz2]..." - sys.exit(1) -for mypkg in sys.argv[1:]: - digraph={} - mytbz2=xpak.tbz2(mypkg) - mykey=mytbz2.getelements("CATEGORY")[0]+"/"+mypkg[:-5] - digraph_create(digraph,mykey) - while (len(digraph)): - mykey=dig_firstzero(digraph) - if not mykey: - print "!!! Error: circular dependencies" - sys.exit(1) - mytbz2=bintree.getname(mykey) - if pretend: - print mytbz2 - else: - portage.pkgmerge(mytbz2) - dig_delnode(digraph,mykey) - |