Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 99876 Details for
Bug 68618
[PATCH] new/more dispatch-conf fixes
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch against portage 2.1.2_pre3-r3
dispatch-conf.patch (text/plain), 4.51 KB, created by
Neil Bothwick
on 2006-10-17 06:08:27 UTC
(
hide
)
Description:
Patch against portage 2.1.2_pre3-r3
Filename:
MIME Type:
Creator:
Neil Bothwick
Created:
2006-10-17 06:08:27 UTC
Size:
4.51 KB
patch
obsolete
>--- dispatch-conf.orig 2006-10-15 11:15:31.000000000 +0100 >+++ dispatch-conf 2006-10-17 13:51:18.000000000 +0100 >@@ -101,6 +101,52 @@ > return False > > >+ # config file freezing support and command like opts for "emerge like" previewing >+ frozenfiles = [] >+ if self.options.has_key('frozen'): >+ frozenfiles = self.options['frozen'].split() >+ >+ # -s "show" option to show frozen config files >+ if '-s' in sys.argv[1:]: >+ if frozenfiles == []: >+ print bold('\nNo config files are frozen\n') >+ sys.exit(0) >+ else: >+ print darkgreen('\nThese config files have been frozen:\n') >+ for file in frozenfiles: >+ print file >+ print >+ sys.exit(0) >+ >+ # -f "force" option to allow ignoring of frozen config files >+ if '-f' in sys.argv[1:]: >+ frozenfiles = [] >+ >+ # -p and -a for "pretend" and "ask", nice color emerge-like output >+ # new files are in green, frozen files are in blue and followed by a * (for colorless pipe into non-ttys) >+ # ask is like emerge --ask, it shows a pretend, then asks yes or no to continue or stop >+ if '-p' in sys.argv[1:] or '-a' in sys.argv[1:]: >+ if confs == []: >+ print bold('\nNo files to update\n') >+ sys.exit(0) >+ print darkgreen('\nNew files are green, frozen files are blue and followed by a *\nThese are the files that will be updated:\n') >+ for file in confs: >+ if file['current'] in frozenfiles: >+ print blue(file['current'])+'*' >+ else: >+ print green(file['current']) >+ if (not sys.stdout.isatty()) or '-p' in sys.argv[1:]: >+ print >+ sys.exit(0) >+ else: >+ if '-c' in sys.argv[1:]: >+ prompt = '\nOverwrite all new files only keeping protected files?' >+ else: >+ prompt = '\nInteractivly update these config files?' >+ if ask(prompt) == 'No': >+ sys.exit('\nQuitting.\n') >+ >+ > # > # Remove new configs identical to current > # and >@@ -138,13 +184,15 @@ > same_wsc = same_wsc and self.options['replace-wscomments'] == 'yes' > unmodified = unmodified and self.options['replace-unmodified'] == 'yes' > >- if same_file: >+ # check to keep frozen files >+ if same_file or conf['current'] in frozenfiles: > os.unlink (conf ['new']) > self.post_process(conf['current']) > if os.path.exists(mrgconf): > os.unlink(mrgconf) > return False >- elif unmodified or same_cvs or same_wsc or conf ['dir'] in portage.settings ['CONFIG_PROTECT_MASK'].split (): >+ # -c to overwrite all files >+ elif unmodified or same_cvs or same_wsc or conf ['dir'] in portage.settings ['CONFIG_PROTECT_MASK'].split () or '-c' in sys.argv[1:]: > self.replace(newconf, conf['current']) > self.post_process(conf['current']) > if newconf == mrgconf: >@@ -318,12 +366,36 @@ > termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) > return ch > >+# simplified prompt function from emerge >+def ask(prompt): >+ """promt = string, this string is the question that will be asked of the user >+ >+ ask function, mostly taken from the emerge function userquery >+ >+ this function returns (string) Yes or No depending on the users Yes / No response""" >+ responses = [ 'Yes', 'No' ] >+ print bold(prompt), >+ try: >+ while True: >+ response = raw_input('[' + green(responses[0]) + '/' + red(responses[1]) + ']') >+ for key in responses: >+ if response.upper() == key[:len(response)].upper(): >+ return key >+ print "Sorry, response '%s' not understood." % response, >+ except (EOFError, KeyboardInterrupt): >+ print "Interrupted." >+ sys.exit(1) >+ > > # run > d = dispatch () > >-if len(sys.argv) > 1: >- # for testing >- d.grind (string.join (sys.argv [1:])) >+# color stuff for ttys but not non-ttys >+if (not sys.stdout.isatty()) or (portage.settings["NOCOLOR"] in ["yes","true"]): >+ nocolor() >+ >+if '-t' in sys.argv[1:]: >+ # -t for testing >+ d.grind (sys.argv [sys.argv.index('-t') + 1]) > else: > d.grind (portage.settings ['CONFIG_PROTECT'])
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 68618
:
42451
|
42626
|
42659
|
42719
|
43186
|
43571
| 99876