diff options
author | Daniel Robbins <drobbins@gentoo.org> | 2000-09-10 23:00:01 +0000 |
---|---|---|
committer | Daniel Robbins <drobbins@gentoo.org> | 2000-09-10 23:00:01 +0000 |
commit | 26f8fb3a875f9408a7896bc48ab9b3cb6a4e39aa (patch) | |
tree | 032274c625f4ad65925ae9668f4e5d4a386d0026 /sys-apps | |
parent | unmerge now removes dead symlinks (tested) (diff) | |
download | gentoo-2-26f8fb3a875f9408a7896bc48ab9b3cb6a4e39aa.tar.gz gentoo-2-26f8fb3a875f9408a7896bc48ab9b3cb6a4e39aa.tar.bz2 gentoo-2-26f8fb3a875f9408a7896bc48ab9b3cb6a4e39aa.zip |
fixes :)
Diffstat (limited to 'sys-apps')
-rwxr-xr-x | sys-apps/portage/files/portage-merge | 50 | ||||
-rwxr-xr-x | sys-apps/portage/files/portage-unmerge | 30 |
2 files changed, 65 insertions, 15 deletions
diff --git a/sys-apps/portage/files/portage-merge b/sys-apps/portage/files/portage-merge index 2d2114bbb0c3..774497d1d565 100755 --- a/sys-apps/portage/files/portage-merge +++ b/sys-apps/portage/files/portage-merge @@ -24,21 +24,25 @@ def prepare_db(): if not os.path.isdir(myroot+"var/db/pkg/"+mycategory+"/"+mypackage): os.mkdir(myroot+"var/db/pkg/"+mycategory+"/"+mypackage,0755) +def isfifo(x): + mymode=os.stat(x)[ST_MODE] + return S_ISFIFO(mymode) + def movefile(src,dest): mystat=os.stat(src) mymode=mystat[ST_MODE] myperms=S_IMODE(mymode) if S_ISCHR(mymode): - mydev=commands.getstatusoutput("/bin/ls -l "+src)[1][34:42] + mydev=getstatusoutput("/bin/ls -l "+src)[1][34:42] mymajor=mydev[:3] myminor=mydev[4:] - myout=commands.getstatusoutput("/bin/mknod "+dest+" c "+mymajor+" "+myminor) + myout=getstatusoutput("/bin/mknod "+dest+" c "+mymajor+" "+myminor) #character device elif S_ISBLK(mymode): - mydev=commands.getstatusoutput("/bin/ls -l "+src)[1][34:42] + mydev=getstatusoutput("/bin/ls -l "+src)[1][34:42] mymajor=mydev[:3] myminor=mydev[4:] - myout=commands.getstatusoutput("/bin/mknod "+dest+" b "+mymajor+" "+myminor) + myout=getstatusoutput("/bin/mknod "+dest+" b "+mymajor+" "+myminor) #block device elif S_ISLNK(mymode): pointsto=os.readlink(src) @@ -108,16 +112,6 @@ def mergefiles(): outfile.write("sym "+floc[1]+" -> "+myto+" "+getmtime(floc[0])+"\n") except: print "!!!",floc[0],"->",myto - elif os.path.isfile(x): - mymd5=md5digest(mycurpath+"/"+x) - if movefile(x,pathstrip(mycurpath)[0]+"/"+x): - zing="<<<" - else: - zing="!!!" - - print zing+" "+floc[0] - print "md5",mymd5 - outfile.write("obj "+floc[1]+" "+mymd5+" "+getmtime(floc[0])+"\n") elif os.path.isdir(x): mystat=os.stat(x) if not os.path.exists(floc[0]): @@ -133,7 +127,35 @@ def mergefiles(): os.chdir(x) mergefiles() os.chdir(mywd) + elif os.path.isfile(x): + mymd5=md5digest(mycurpath+"/"+x) + if movefile(x,pathstrip(mycurpath)[0]+"/"+x): + zing="<<<" + else: + zing="!!!" + print zing+" "+floc[0] + print "md5",mymd5 + outfile.write("obj "+floc[1]+" "+mymd5+" "+getmtime(floc[0])+"\n") + elif isfifo(x): + zing="!!!" + if not os.path.exists(pathstrip(mycurpath)[0]+"/"+x): + if movefile(x,pathstrip(mycurpath)[0]+"/"+x): + zing="<<<" + elif isfifo(pathstrip(mycurpath)[0]+"/"+x): + os.unlink(pathstrip(mycurpath)[0]+"/"+x) + if movefile(x,pathstrip(mycurpath)[0]+"/"+x): + zing="<<<" + print zing+" "+floc[0] + outfile.write("fif "+floc[1]+"\n") + else: + if movefile(x,pathstrip(mycurpath)[0]+"/"+x): + zing="<<<" + else: + zing="!!!" + print zing+" "+floc[0] + outfile.write("dev "+floc[1]+"\n") + prepare_db() outfile=open(myroot+"var/db/pkg/"+mycategory+"/"+mypackage+"/CONTENTS","w") diff --git a/sys-apps/portage/files/portage-unmerge b/sys-apps/portage/files/portage-unmerge index 10e84caa55b3..0d9d1c9bf22e 100755 --- a/sys-apps/portage/files/portage-unmerge +++ b/sys-apps/portage/files/portage-unmerge @@ -3,11 +3,20 @@ import sys import os +from stat import * norm=os.path.normpath import string from commands import * category=os.environ["CATEGORY"] +def isfifo(x): + mymode=os.stat(x)[ST_MODE] + return S_ISFIFO(mymode) + +def isdev(x): + mymode=os.stat(x)[ST_MODE] + return ( S_ISCHR(mymode) or S_ISBLK(mymode)) + def pkgscript(x): myresult=getstatusoutput("/usr/bin/ebuild "+myebuildfile+" "+x) if myresult[0] or myresult[1]: @@ -60,6 +69,12 @@ for pkgname in sys.argv[1:]: elif mydat[0]=="sym": #format: type, mtime, dest pkgfiles[mydat[1]]=[mydat[0], mydat[4], mydat[3]] + elif mydat[0]=="dev": + #format: type + pkgfiles[mydat[1]]=[mydat[0] ] + elif mydat[0]=="fif": + #format: type + pkgfiles[mydat[1]]=[mydat[0]] else: print "Error -- CONTENTS file for", pkgname, "is corrupt." print ">>> "+line @@ -84,7 +99,7 @@ for pkgname in sys.argv[1:]: if not os.path.exists(obj): print "--- !found", pkgfiles[obj][0], obj continue - if (pkgfiles[obj][0]!="dir") and (getmtime(obj) != pkgfiles[obj][1]): + if (pkgfiles[obj][0] not in ("dir","fif","dev")) and (getmtime(obj) != pkgfiles[obj][1]): print "--- !mtime", pkgfiles[obj][0], obj continue if pkgfiles[obj][0]=="dir": @@ -117,6 +132,19 @@ for pkgname in sys.argv[1:]: continue os.unlink(obj) print "<<< ","obj",obj + elif pkgfiles[obj][0]=="fif": + if not isfifo(obj): + print "--- !fif ","fif", obj + continue + os.unlink(obj) + print "<<< ","fif",obj + elif pkgfiles[obj][0]=="dev": + if not isdev(obj): + print "--- !dev ","dev", obj + continue + os.unlink(obj) + print "<<< ","dev",obj + #postrm script pkgscript("postrm") #recursive cleanup |