source: soft/build_system/build_system/repsys/tags/V1_6_12/RepSys/commands/putsrpm.py @ 1

Last change on this file since 1 was 1, checked in by fasma, 12 years ago

Initial Import from Mandriva's soft revision 224062 and package revision 45733

File size: 1.9 KB
Line 
1#!/usr/bin/python
2#
3# This program will append a release to the Conectiva Linux package
4# repository system.  It's meant to be a startup system to include
5# pre-packaged SRPMS in the repository, thus, you should not commit
6# packages over an ongoing package structure (with changes in current/
7# directory and etc). Also, notice that packages must be included in
8# cronological order.
9#
10from RepSys import Error
11from RepSys.command import *
12from RepSys.rpmutil import put_srpm
13import getopt
14import sys, os
15
16HELP = """\
17*** WARNING --- You probably SHOULD NOT use this program! --- WARNING ***
18
19Usage: repsys putsrpm [OPTIONS] REPPKGURL
20
21Options:
22    -n      Append package name to provided URL
23    -l LOG  Use log when commiting changes
24    -h      Show this message
25
26Examples:
27    repsys putsrpm file://svn/cnc/snapshot/foo /cnc/d/SRPMS/foo-1.0.src.rpm
28"""
29
30def parse_options():
31    parser = OptionParser(help=HELP)
32    parser.add_option("-l", dest="log", default="")
33    parser.add_option("-n", dest="appendname", action="store_true")
34    opts, args = parser.parse_args()
35    if len(args) != 2:
36        raise Error, "invalid arguments"
37    opts.pkgdirurl = default_parent(args[0])
38    opts.srpmfile = args[1]
39    return opts
40
41def put_srpm_cmd(pkgdirurl, srpmfile, appendname=0, log=""):
42    if os.path.isdir(srpmfile):
43        dir = srpmfile
44        for entry in os.listdir(dir):
45            if entry[-8:] == ".src.rpm":
46                sys.stderr.write("Putting %s... " % entry)
47                sys.stderr.flush()
48                entrypath = os.path.join(dir, entry)
49                try:
50                    put_srpm(pkgdirurl, entrypath, appendname, log)
51                    sys.stderr.write("done\n")
52                except Error, e:
53                    sys.stderr.write("error: %s\n" % str(e))
54    else:
55        put_srpm(pkgdirurl, srpmfile, appendname, log)
56       
57                 
58def main():
59    do_command(parse_options, put_srpm_cmd)
60
61# vim:et:ts=4:sw=4
Note: See TracBrowser for help on using the repository browser.