extras-repoclosure substrepo,NONE,1.1
Michael Schwendt
mschwendt at fedoraproject.org
Fri Sep 19 08:53:36 UTC 2008
- Previous message (by thread): rpms/libpng10/devel .cvsignore, 1.14, 1.15 libpng10.spec, 1.18, 1.19 sources, 1.14, 1.15
- Next message (by thread): rpms/mono/devel mono-2.0-mimeicon.patch, NONE, 1.1 import.log, 1.5, 1.6 mono.spec, 1.79, 1.80
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: mschwendt
Update of /cvs/fedora/extras-repoclosure
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv20791
Added Files:
substrepo
Log Message:
add this small helper tool to avoid sed e.g.
--- NEW FILE substrepo ---
#!/usr/bin/python
# -*- mode: Python; indent-tabs-mode: nil; -*-
#
# Small convenience helper to substitute arbitrary variables in
# a Yum .repo definition file and print the result to stdout.
# Author: Michael Schwendt / Licence: GPLv2+
import sys, errno
from optparse import OptionParser
import yum.parser
usage = "Usage: %s [options] [file]" % sys.argv[0]
parser = OptionParser(usage=usage)
parser.add_option("-s", "--subst", default=[], action='append',
help="a 'key:value' pair to substitute")
(opts, args) = parser.parse_args()
if not len(args):
infile = sys.stdin
elif len(args)>1:
print "ERROR: invalid arguments"
sys.exit(errno.EINVAL)
else:
infile = file( args[0] )
vars = {}
for kv in opts.subst:
key, val = kv.split(':')
vars[key] = val
for line in infile.readlines():
sys.stdout.write( yum.parser.varReplace(line,vars) )
infile.close()
sys.exit(0)
- Previous message (by thread): rpms/libpng10/devel .cvsignore, 1.14, 1.15 libpng10.spec, 1.18, 1.19 sources, 1.14, 1.15
- Next message (by thread): rpms/mono/devel mono-2.0-mimeicon.patch, NONE, 1.1 import.log, 1.5, 1.6 mono.spec, 1.79, 1.80
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list