aboutsummaryrefslogtreecommitdiffstats
path: root/RepSys/commands/submit.py
diff options
context:
space:
mode:
authorBogdano Arendartchuk <bogdano@mandriva.org>2008-07-17 12:24:21 +0000
committerBogdano Arendartchuk <bogdano@mandriva.org>2008-07-17 12:24:21 +0000
commit5c7f585c08c8ffb944095ae031fbf82a54ba13bc (patch)
treec3b1eaad57b0518416b5adb59ac51576716ebf1e /RepSys/commands/submit.py
parent0af96a9eb0e69191d5fb5d5dcfa35a287bcc31b4 (diff)
downloadmgarepo-5c7f585c08c8ffb944095ae031fbf82a54ba13bc.tar
mgarepo-5c7f585c08c8ffb944095ae031fbf82a54ba13bc.tar.gz
mgarepo-5c7f585c08c8ffb944095ae031fbf82a54ba13bc.tar.bz2
mgarepo-5c7f585c08c8ffb944095ae031fbf82a54ba13bc.tar.xz
mgarepo-5c7f585c08c8ffb944095ae031fbf82a54ba13bc.zip
Allow specifying distro branches without using complete URLs
Added the configuration option "repository", which will have the URL to the root of the repository. The change also allowed using mirrors in all the read-only commands.
Diffstat (limited to 'RepSys/commands/submit.py')
-rw-r--r--RepSys/commands/submit.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/RepSys/commands/submit.py b/RepSys/commands/submit.py
index 2869ff4..334a424 100644
--- a/RepSys/commands/submit.py
+++ b/RepSys/commands/submit.py
@@ -1,7 +1,8 @@
#!/usr/bin/python
from RepSys import Error, config
from RepSys.command import *
-from RepSys.rpmutil import get_spec, get_submit_info, svn_url_rev
+from RepSys.layout import package_url, distro_branch
+from RepSys.rpmutil import get_spec, get_submit_info
from RepSys.util import get_auth, execcmd, get_helper
import urllib
import getopt
@@ -41,16 +42,19 @@ Options:
Examples:
repsys submit
repsys submit foo
+ repsys submit 2009.1/foo
repsys submit foo@14800 bar baz@11001
repsys submit https://repos/svn/mdv/cooker/foo
repsys submit -l https://repos
repsys submit --define section=main/testing -t 2008.1
"""
+DEFAULT_TARGET = "Cooker"
+
def parse_options():
parser = OptionParser(help=HELP)
parser.defaults["revision"] = None
- parser.add_option("-t", dest="target", default="Cooker")
+ parser.add_option("-t", dest="target", default=None)
parser.add_option("-l", action="callback", callback=list_targets)
parser.add_option("-r", dest="revision", type="string", nargs=1)
parser.add_option("-s", dest="submithost", type="string", nargs=1,
@@ -79,7 +83,11 @@ def parse_options():
else:
raise Error, "the format <name> <revision> is deprecated, "\
"use <name>@<revision> instead"
- opts.urls = [default_parent(nameurl) for nameurl in args]
+ opts.urls = [package_url(nameurl, mirrored=False) for nameurl in args]
+ if opts.target is None:
+ target = distro_branch(opts.urls[0]) or DEFAULT_TARGET
+ print "Implicit target: %s" % target
+ opts.target = target
return opts
def list_targets(option, opt, val, parser):