Bugzilla – Attachment 696 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]
Updated patch which avoids trailing spaces
machine_walk.patch (text/plain), 2.90 KB, created by
Peter Åstrand
on 2016-05-25 13:53:33 CEST
(
hide
)
Description:
Updated patch which avoids trailing spaces
Filename:
MIME Type:
Creator:
Peter Åstrand
Created:
2016-05-25 13:53:33 CEST
Size:
2.90 KB
patch
obsolete
>Index: tlmisc/hiveconf/hivetool >=================================================================== >--- tlmisc/hiveconf/hivetool (revision 31450) >+++ tlmisc/hiveconf/hivetool (arbetskopia) >@@ -82,6 +82,27 @@ > 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, "=", >+ if value != "": >+ print value >+ else: >+ print >+ #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 +146,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 +174,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 +183,7 @@ > > roothive = DEFAULT_ROOT_HIVE > walk_folders = [] >+ machine_folders = [] > imp_files = [] > purge_files = [] > recursive = 0 >@@ -170,6 +193,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 +260,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 +269,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