Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 2344 Details for
Bug 5075
settings-change awareness
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Python script to perform the suggested enhancement
useupdate (text/plain), 2.67 KB, created by
cwillisf
on 2002-07-17 16:09:35 UTC
(
hide
)
Description:
Python script to perform the suggested enhancement
Filename:
MIME Type:
Creator:
cwillisf
Created:
2002-07-17 16:09:35 UTC
Size:
2.67 KB
patch
obsolete
>#!/usr/bin/python2.2 ># ># useupdate - list packages that would be affected by USE changes that have ># happened since they were built ># ># Copyright (c) Chris Willis-Ford <porridj@hotmail.com> ># This program is distributed under the terms of the GPL version 2. ># ># Note: This is my first Python program, so don't trust it to be 100% perfect ># or optimal. It *was* written in one night, after all... :P > >from os.path import walk, normpath, split >from portage import pkgsplit, settings >from string import join > >installRoot = "/var/db/pkg" >maxRead = 1024*1024 # Read no more than 1MB for safety > >def undupe(list): > unique = [] > for word in list: > if not ( word in unique ): > unique.append(word) > return unique > ># Normalize the global USE settings first >use = join(undupe(settings["USE"].strip().split())) > ># Compare two USE strings, ignoring order and duplicates. ># Return None if there are no differences that would affect a recompile ># Return differences if there are any >def whatchanged(old,new): > if (old == new): > return None > newsplit=undupe(new.split()) > oldsplit=undupe(old.split()) > for word in oldsplit[:]: > if ( word in newsplit ): # Setting has not changed > oldsplit.remove(word) > newsplit.remove(word) > else: > if ( word[0] == '-' ): # Don't care if it was off before > oldsplit.remove(word) > else: > newsplit.append('-'+word) # It was on, now it's not. Notice this. > diffs=join(newsplit) > if ( diffs ): > return diffs > return None > >def affects(usechanges, rdepfile): > changes=usechanges.split() > rdep=rdepfile.split() > important=[] > for word in rdep: > if ( word[-1] == '?' ): > if ( word[:-1] in changes ): > important.append(word[:-1]) > if ( '-'+word[:-1] in changes ): > important.append('-'+word[:-1]) > return join(important) > >def visit(dummy, dirname, files): > for file in files: > if (file == 'USE'): > f=open(dirname+'/USE') > thisuse=f.readline(maxRead).strip() > f.close() > f=open(dirname+'/RDEPEND') > thisrdep=f.read(maxRead) > f.close() > (cat, fullname)=split(normpath(dirname)) > cat=split(cat)[1] > (name,ver,rev)=pkgsplit(fullname) > changes=whatchanged(thisuse,use) > if ( changes ): > important=affects(changes, thisrdep) > if ( important ): > print cat + '/' + name + ' : ' + important > >if __name__ == '__main__': > import sys > if (len(sys.argv) != 1): > print 'Usage: useupdate' > sys.exit(1) > walk(installRoot, visit, "")
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 5075
: 2344