Bugzilla – Attachment 690 Details for
Bug 5811
tl-config/hivetool should have an option for machine-readable output
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Suggested patch
machine_walk.patch (text/plain), 2.78 KB, created by
Peter Åstrand
on 2016-05-10 12:34:37 CEST
(
hide
)
Description:
Suggested patch
Filename:
MIME Type:
Creator:
Peter Åstrand
Created:
2016-05-10 12:34:37 CEST
Size:
2.78 KB
patch
obsolete
>Index: hivetool >=================================================================== >--- hivetool (revision 31429) >+++ hivetool (arbetskopia) >@@ -82,6 +82,23 @@ > return 0 > > >+def machine_walk(hive, ih, folderpath): >+ # Handle parameters and values >+ for paramname in ih.get_parameters(folderpath): >+ parampath = folderpath + "/" + paramname >+ value = ih.get_string(parampath) >+ print parampath, "=", value >+ #hive.set_string(parampath, value) >+ >+ for subname in ih.get_folders(folderpath): >+ if subname == "/": >+ continue >+ if folderpath != "/": >+ subname = "/" + subname >+ subfolder = folderpath + subname >+ machine_walk(hive, ih, subfolder) >+ >+ > def imp_walk(hive, ih, folderpath): > # Handle parameters and values > for paramname in ih.get_parameters(folderpath): >@@ -125,6 +142,7 @@ > hivetool [options] [type:]parameter[=value] ... > > -a,--all-entries Print all parameters and values in a folder >+ -A Like -a, but with machine parseable output > -i,--import <file> Import all parameters in specified file > -p,--purge <file> Remove parameters in specified file which exists elsewhere > -R,--recursive When using -a, ascend folders recursively >@@ -152,7 +170,7 @@ > > def main(): > try: >- opts, args = getopt.getopt(sys.argv[1:], "a:i:p:Rr:ve:E:x?", >+ opts, args = getopt.getopt(sys.argv[1:], "a:A:i:p:Rr:ve:E:x?", > ["all-entries=", "import=", "purge=", "recursive", "root=", "version", "help", > "eval=", "export"]) > except getopt.GetoptError: >@@ -161,6 +179,7 @@ > > roothive = DEFAULT_ROOT_HIVE > walk_folders = [] >+ machine_folders = [] > imp_files = [] > purge_files = [] > recursive = 0 >@@ -170,6 +189,8 @@ > for o, a in opts: > if o in ("-a", "--all-entries"): > walk_folders.append(a) >+ if o in ("-A",): >+ machine_folders.append(a) > if o in ("-i", "--import"): > imp_files.append(a) > if o in ("-p", "--purge"): >@@ -235,7 +256,7 @@ > errors += handle_param(hive, param) > > # Walk >- for foldername in walk_folders: >+ for foldername in walk_folders + machine_folders: > folder = hive.lookup(foldername) > if not folder: > print >>sys.stderr, "%s: Folder not found" % foldername >@@ -244,9 +265,12 @@ > if not isinstance(folder, hiveconf.Folder): > print >>sys.stderr, "%s: not a folder" % foldername > continue >- >- folder.walk(recursive) > >+ if foldername in walk_folders: >+ folder.walk(recursive) >+ else: >+ machine_walk(hive, folder, "/") >+ > sys.exit(errors) > > if __name__ == "__main__":
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 Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 5811
:
690
|
696