aboutsummaryrefslogtreecommitdiffstats
path: root/RepSys/commands/putsrpm.py
diff options
context:
space:
mode:
authorFrederic Lepied <flepied@mandriva.com>2005-12-07 10:06:33 +0000
committerFrederic Lepied <flepied@mandriva.com>2005-12-07 10:06:33 +0000
commit2c78c40c9bfae22d1501022b2e52cf938b5a957e (patch)
tree33a030236dd735f665e7b1ff1a9fba203742ecc0 /RepSys/commands/putsrpm.py
parentaa9174bf0cce8d6a3c6e4d9e795be717da184406 (diff)
downloadmgarepo-2c78c40c9bfae22d1501022b2e52cf938b5a957e.tar
mgarepo-2c78c40c9bfae22d1501022b2e52cf938b5a957e.tar.gz
mgarepo-2c78c40c9bfae22d1501022b2e52cf938b5a957e.tar.bz2
mgarepo-2c78c40c9bfae22d1501022b2e52cf938b5a957e.tar.xz
mgarepo-2c78c40c9bfae22d1501022b2e52cf938b5a957e.zip
Diffstat (limited to 'RepSys/commands/putsrpm.py')
-rw-r--r--RepSys/commands/putsrpm.py61
1 files changed, 61 insertions, 0 deletions
diff --git a/RepSys/commands/putsrpm.py b/RepSys/commands/putsrpm.py
new file mode 100644
index 0000000..21ad234
--- /dev/null
+++ b/RepSys/commands/putsrpm.py
@@ -0,0 +1,61 @@
+#!/usr/bin/python
+#
+# This program will append a release to the Conectiva Linux package
+# repository system. It's meant to be a startup system to include
+# pre-packaged SRPMS in the repository, thus, you should not commit
+# packages over an ongoing package structure (with changes in current/
+# directory and etc). Also, notice that packages must be included in
+# cronological order.
+#
+from RepSys import Error
+from RepSys.command import *
+from RepSys.rpmutil import put_srpm
+import getopt
+import sys, os
+
+HELP = """\
+*** WARNING --- You probably SHOULD NOT use this program! --- WARNING ***
+
+Usage: repsys putsrpm [OPTIONS] REPPKGURL
+
+Options:
+ -n Append package name to provided URL
+ -l LOG Use log when commiting changes
+ -h Show this message
+
+Examples:
+ repsys putsrpm file://svn/cnc/snapshot/foo /cnc/d/SRPMS/foo-1.0.src.rpm
+"""
+
+def parse_options():
+ parser = OptionParser(help=HELP)
+ parser.add_option("-l", dest="log", default="")
+ parser.add_option("-n", dest="appendname", action="store_true")
+ opts, args = parser.parse_args()
+ if len(args) != 2:
+ raise Error, "invalid arguments"
+ opts.pkgdirurl = default_parent(args[0])
+ opts.srpmfile = args[1]
+ return opts
+
+def put_srpm_cmd(pkgdirurl, srpmfile, appendname=0, log=""):
+ if os.path.isdir(srpmfile):
+ dir = srpmfile
+ for entry in os.listdir(dir):
+ if entry[-8:] == ".src.rpm":
+ sys.stderr.write("Putting %s... " % entry)
+ sys.stderr.flush()
+ entrypath = os.path.join(dir, entry)
+ try:
+ put_srpm(pkgdirurl, entrypath, appendname, log)
+ sys.stderr.write("done\n")
+ except Error, e:
+ sys.stderr.write("error: %s\n" % str(e))
+ else:
+ put_srpm(pkgdirurl, srpmfile, appendname, log)
+
+
+def main():
+ do_command(parse_options, put_srpm_cmd)
+
+# vim:et:ts=4:sw=4