Welcome to the Pacman bug collection. Please search the current bugs and feature requests before filing a new one! Use advanced search and select "Search in Comments".
* Please select the correct category and version.
* Write a descriptive summary, background info, and provide a reproduceable test case whenever possible.
* Please select the correct category and version.
* Write a descriptive summary, background info, and provide a reproduceable test case whenever possible.
FS#8043 - rankmirrors should optionally read from stdin
Attached to Project:
Pacman
Opened by Peter Johnson (tam1138) - Monday, 17 September 2007, 13:13 GMT-5
Last edited by Dan McGee (toofishes) - Thursday, 04 October 2007, 21:15 GMT-5
Opened by Peter Johnson (tam1138) - Monday, 17 September 2007, 13:13 GMT-5
Last edited by Dan McGee (toofishes) - Thursday, 04 October 2007, 21:15 GMT-5
|
DetailsSummary and Info:
It is standard for programs which take file arguments to interpret the argument "-" to mean "read from stdin". This would be particularly useful with rankmirrors, as one could use it as a filter to rewrite one's /etc/pacman.d files with little to no interaction. Eg, in vi command mode: "6,13!rankmirrors -" would replace lines 6 through 13 with the output of rankmirrors fed lines 6-13 on stdin. Here is a patch to add this feature: --- rankmirrors.orig 2007-09-17 13:08:11.000000000 -0400 +++ rankmirrors 2007-09-17 13:08:56.000000000 -0400 @@ -112,11 +112,15 @@ print args[0], ':', "%.2f" % serverToTime sys.exit(0) - if not os.path.isfile(args[0]): + if not os.path.isfile(args[0]) and args[0] != "-": print >>sys.stderr, 'rankmirrors: file', args[0], 'does not exist.' sys.exit(1) - fl = open(args[0], 'r') + if args[0] == "-": + fl = sys.stdin + else: + fl = open(args[0], 'r') + serverToTime = {} if options.times: print 'Querying servers, this may take some time...' |
Closed by Dan McGee (toofishes)
Thursday, 04 October 2007, 21:15 GMT-5
Reason for closing: Implemented
Additional comments about closing: Patch in GIT, to be released in 3.1
Thursday, 04 October 2007, 21:15 GMT-5
Reason for closing: Implemented
Additional comments about closing: Patch in GIT, to be released in 3.1
Comment by Dan McGee (toofishes) -
Monday, 17 September 2007, 20:49 GMT-5
Committed to my local GIT branch, thanks.