aboutsummaryrefslogtreecommitdiffstats
path: root/RepSys/commands
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
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')
-rw-r--r--RepSys/commands/changed.py4
-rw-r--r--RepSys/commands/co.py14
-rw-r--r--RepSys/commands/create.py3
-rw-r--r--RepSys/commands/editlog.py3
-rw-r--r--RepSys/commands/getspec.py4
-rw-r--r--RepSys/commands/getsrpm.py4
-rw-r--r--RepSys/commands/markrelease.py3
-rw-r--r--RepSys/commands/patchspec.py3
-rw-r--r--RepSys/commands/putsrpm.py3
-rw-r--r--RepSys/commands/rpmlog.py10
-rw-r--r--RepSys/commands/submit.py14
11 files changed, 45 insertions, 20 deletions
diff --git a/RepSys/commands/changed.py b/RepSys/commands/changed.py
index 62b20b6..7d05604 100644
--- a/RepSys/commands/changed.py
+++ b/RepSys/commands/changed.py
@@ -1,6 +1,7 @@
#!/usr/bin/python
from RepSys import Error
from RepSys.command import *
+from RepSys.layout import package_url
from RepSys.rpmutil import check_changed
import getopt
import sys
@@ -13,6 +14,7 @@ Shows if there are pending changes since the last package release.
Options:
-a Check all packages in given URL
-s Show differences
+ -M Do not use the mirror (use the main repository)
-h Show this message
Examples:
@@ -27,7 +29,7 @@ def parse_options():
opts, args = parser.parse_args()
if len(args) != 1:
raise Error, "invalid arguments"
- opts.pkgdirurl = default_parent(args[0])
+ opts.pkgdirurl = package_url(args[0])
opts.verbose = 1 # Unconfigurable
return opts
diff --git a/RepSys/commands/co.py b/RepSys/commands/co.py
index 830b7e7..5349049 100644
--- a/RepSys/commands/co.py
+++ b/RepSys/commands/co.py
@@ -13,13 +13,19 @@ Checkout the package source from the Mandriva repository.
If the 'mirror' option is enabled, the package is obtained from the mirror
repository.
+You can specify the distro branch to checkout from by using distro/pkgname.
+
Options:
+ -d The distribution branch to checkout from
+ -b The package branch
-r REV Revision to checkout
- -o Do not use the mirror (use official server)
+ -M Do not use the mirror (use the main repository)
-h Show this message
Examples:
repsys co pkgname
+ repsys co -d 2009.0 pkgname
+ repsys co 2009.0/pkgame
repsys co http://repos/svn/cnc/snapshot/foo
repsys co http://repos/svn/cnc/snapshot/foo foo-pkg
"""
@@ -27,11 +33,13 @@ Examples:
def parse_options():
parser = OptionParser(help=HELP)
parser.add_option("-r", dest="revision")
- parser.add_option("-o", dest="use_mirror", default=True,
- action="store_false")
+ parser.add_option("--distribution", "-d", dest="distro", default=None)
+ parser.add_option("--branch", "-b", dest="branch", default=None)
opts, args = parser.parse_args()
if len(args) not in (1, 2):
raise Error, "invalid arguments"
+ # here we don't use package_url in order to notify the user we are
+ # using the mirror
opts.pkgdirurl = args[0]
if len(args) == 2:
opts.path = args[1]
diff --git a/RepSys/commands/create.py b/RepSys/commands/create.py
index a8709f0..ded8abe 100644
--- a/RepSys/commands/create.py
+++ b/RepSys/commands/create.py
@@ -1,6 +1,7 @@
#!/usr/bin/python
from RepSys import Error
from RepSys.command import *
+from RepSys.layout import package_url
from RepSys.rpmutil import create_package
import getopt
import sys
@@ -23,7 +24,7 @@ def parse_options():
opts, args = parser.parse_args()
if len(args) != 1:
raise Error, "invalid arguments"
- opts.pkgdirurl = default_parent(args[0])
+ opts.pkgdirurl = package_url(args[0], mirrored=False)
opts.verbose = 1 # Unconfigurable
return opts
diff --git a/RepSys/commands/editlog.py b/RepSys/commands/editlog.py
index 1962ed8..9d1afc5 100644
--- a/RepSys/commands/editlog.py
+++ b/RepSys/commands/editlog.py
@@ -1,6 +1,7 @@
#!/usr/bin/python
from RepSys import Error
from RepSys.command import *
+from RepSys.layout import package_url
from RepSys.svn import SVN
import re
@@ -24,7 +25,7 @@ def parse_options():
pkgdirurl, revision = "", args[0]
else:
raise Error, "invalid arguments"
- opts.pkgdirurl = default_parent(pkgdirurl)
+ opts.pkgdirurl = package_url(pkgdirurl, mirrored=False)
opts.revision = re.compile(r".*?(\d+).*").sub(r"\1", revision)
return opts
diff --git a/RepSys/commands/getspec.py b/RepSys/commands/getspec.py
index 5e44074..6a8f7ea 100644
--- a/RepSys/commands/getspec.py
+++ b/RepSys/commands/getspec.py
@@ -1,6 +1,7 @@
#!/usr/bin/python
from RepSys import Error
from RepSys.command import *
+from RepSys.layout import package_url
from RepSys.rpmutil import get_spec
import getopt
import sys
@@ -12,6 +13,7 @@ Prints the .spec file of a given package.
Options:
-t DIR Use DIR as target for spec file (default is ".")
+ -M Do not use the mirror (use the main repository)
-h Show this message
Examples:
@@ -25,7 +27,7 @@ def parse_options():
opts, args = parser.parse_args()
if len(args) != 1:
raise Error, "invalid arguments"
- opts.pkgdirurl = default_parent(args[0])
+ opts.pkgdirurl = package_url(args[0])
return opts
def main():
diff --git a/RepSys/commands/getsrpm.py b/RepSys/commands/getsrpm.py
index f9a63d2..8cbe1f1 100644
--- a/RepSys/commands/getsrpm.py
+++ b/RepSys/commands/getsrpm.py
@@ -5,6 +5,7 @@
#
from RepSys import Error, config
from RepSys.command import *
+from RepSys.layout import package_url
from RepSys.rpmutil import get_srpm
import tempfile
import shutil
@@ -29,6 +30,7 @@ Options:
-n Rename the package to include the revision number
-l Use subversion log to build rpm %changelog
-T FILE Template to be used to generate the %changelog
+ -M Do not use the mirror (use the main repository)
-h Show this message
--strict Check if the given revision contains changes in REPPKGURL
@@ -80,7 +82,7 @@ def parse_options():
del opts.__ignore
if len(args) != 1:
raise Error, "invalid arguments"
- opts.pkgdirurl = default_parent(args[0])
+ opts.pkgdirurl = package_url(args[0])
opts.verbose = 1
return opts
diff --git a/RepSys/commands/markrelease.py b/RepSys/commands/markrelease.py
index 1707f39..057cf1d 100644
--- a/RepSys/commands/markrelease.py
+++ b/RepSys/commands/markrelease.py
@@ -9,6 +9,7 @@
#
from RepSys import Error
from RepSys.command import *
+from RepSys.layout import package_url
from RepSys.simplerpm import SRPM
from RepSys.rpmutil import mark_release
from RepSys.util import get_auth
@@ -60,7 +61,7 @@ def parse_options():
if len(args) != 1:
raise Error, "invalid arguments"
- opts.pkgdirurl = default_parent(args[0])
+ opts.pkgdirurl = package_url(args[0], mirrored=False)
filename = opts.filename
appendname = opts.appendname
diff --git a/RepSys/commands/patchspec.py b/RepSys/commands/patchspec.py
index 8330cc3..9a4881b 100644
--- a/RepSys/commands/patchspec.py
+++ b/RepSys/commands/patchspec.py
@@ -5,6 +5,7 @@
from RepSys import Error
from RepSys.rpmutil import patch_spec
from RepSys.command import *
+from RepSys.layout import package_url
import getopt
import sys
@@ -27,7 +28,7 @@ def parse_options():
opts, args = parser.parse_args()
if len(args) != 2:
raise Error, "invalid arguments"
- opts.pkgdirurl = default_parent(args[0])
+ opts.pkgdirurl = package_url(args[0], mirrored=False)
opts.patchfile = args[1]
return opts
diff --git a/RepSys/commands/putsrpm.py b/RepSys/commands/putsrpm.py
index 21ad234..0717cd6 100644
--- a/RepSys/commands/putsrpm.py
+++ b/RepSys/commands/putsrpm.py
@@ -9,6 +9,7 @@
#
from RepSys import Error
from RepSys.command import *
+from RepSys.layout import package_url
from RepSys.rpmutil import put_srpm
import getopt
import sys, os
@@ -34,7 +35,7 @@ def parse_options():
opts, args = parser.parse_args()
if len(args) != 2:
raise Error, "invalid arguments"
- opts.pkgdirurl = default_parent(args[0])
+ opts.pkgdirurl = package_url(args[0], mirrored=False)
opts.srpmfile = args[1]
return opts
diff --git a/RepSys/commands/rpmlog.py b/RepSys/commands/rpmlog.py
index 3cdcc02..11fe36d 100644
--- a/RepSys/commands/rpmlog.py
+++ b/RepSys/commands/rpmlog.py
@@ -3,7 +3,7 @@
# This program will convert the output of "svn log" to be suitable
# for usage in an rpm %changelog session.
#
-from RepSys import Error, RepSysTree
+from RepSys import Error, layout
from RepSys.command import *
from RepSys.svn import SVN
from RepSys.log import get_changelog, split_spec_changelog
@@ -24,6 +24,7 @@ Options:
-o Append old package changelog
-p Append changelog found in .spec file
-s Sort changelog entries, even from the old log
+ -M Do not use the mirror (use the main repository)
-h Show this message
Examples:
@@ -45,17 +46,14 @@ def parse_options():
opts, args = parser.parse_args()
if len(args) != 1:
raise Error, "invalid arguments"
- opts.pkgdirurl = default_parent(args[0])
+ opts.pkgdirurl = layout.package_url(args[0])
return opts
def rpmlog(pkgdirurl, revision, size, template, oldlog, usespec, sort):
another = None
if usespec:
svn = SVN()
- pkgname = RepSysTree.pkgname(pkgdirurl)
- #FIXME don't hardcode current/, it may already be in the URL
- specurl = os.path.join(pkgdirurl, "current/SPECS", pkgname +
- ".spec")
+ specurl = layout.package_spec_url(pkgdirurl)
rawspec = svn.cat(specurl, rev=revision)
spec, another = split_spec_changelog(StringIO(rawspec))
newlog = get_changelog(pkgdirurl, another=another, rev=revision,
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):