From 59341cd17766e9aae61256160009184dc469eec3 Mon Sep 17 00:00:00 2001 From: Nicolas Vigier Date: Fri, 28 Jan 2011 18:27:48 +0000 Subject: add binrepo revision options --- MgaRepo/binrepo.py | 10 +++++----- MgaRepo/commands/co.py | 2 ++ MgaRepo/commands/getsrpm.py | 4 +++- MgaRepo/commands/markrelease.py | 3 +++ MgaRepo/rpmutil.py | 11 ++++++----- 5 files changed, 19 insertions(+), 11 deletions(-) (limited to 'MgaRepo') diff --git a/MgaRepo/binrepo.py b/MgaRepo/binrepo.py index 9eb5c03..2a6f437 100644 --- a/MgaRepo/binrepo.py +++ b/MgaRepo/binrepo.py @@ -151,7 +151,7 @@ def make_symlinks(source, dest): os.symlink(linkpath, destpath) def download(targetdir, pkgdirurl=None, export=False, show=True, - revision=None, symlinks=True, check=False): + revision=None, binrev=None, symlinks=True, check=False): assert not export or (export and pkgdirurl) svn = SVN() sourcespath = os.path.join(targetdir, "SOURCES") @@ -160,8 +160,7 @@ def download(targetdir, pkgdirurl=None, export=False, show=True, topurl = translate_url(pkgdirurl) else: topurl = translate_topdir(targetdir) - binrev = None - if revision: + if revision and not binrev: if pkgdirurl: binrev = mapped_revision(pkgdirurl, revision) else: @@ -409,9 +408,10 @@ def mapped_revision(target, revision, wc=False): binrev = "{%s}" % date return binrev -def markrelease(sourceurl, releasesurl, version, release, revision): +def markrelease(sourceurl, releasesurl, version, release, revision, binrev): svn = SVN() - binrev = mapped_revision(sourceurl, revision) + if not binrev: + binrev = mapped_revision(sourceurl, revision) binsource = translate_url(sourceurl) binreleases = translate_url(releasesurl) versiondir = mirror._joinurl(binreleases, version) diff --git a/MgaRepo/commands/co.py b/MgaRepo/commands/co.py index e7c9aec..8044c86 100644 --- a/MgaRepo/commands/co.py +++ b/MgaRepo/commands/co.py @@ -19,6 +19,7 @@ Options: -d The distribution branch to checkout from -b The package branch -r REV Revision to checkout + -R REV binrepo revision to checkout -S Do not download sources from the binaries repository -L Do not make symlinks of the binaries downloaded in SOURCES/ -s Only checkout the SPECS/ directory @@ -37,6 +38,7 @@ Examples: def parse_options(): parser = OptionParser(help=HELP) parser.add_option("-r", dest="revision") + parser.add_option("-R", dest="binrev") parser.add_option("-S", dest="use_binrepo", default=True, action="store_false") parser.add_option("--check", dest="binrepo_check", default=False, diff --git a/MgaRepo/commands/getsrpm.py b/MgaRepo/commands/getsrpm.py index 6c238ba..0642c85 100644 --- a/MgaRepo/commands/getsrpm.py +++ b/MgaRepo/commands/getsrpm.py @@ -24,6 +24,7 @@ Options: -p Use files in pristine/ directory -v VER Use files from the version specified by VER (e.g. 2.2.1-2cl) -r REV Use files from current directory, in revision REV (e.g. 1001) + -R REV Use binrepo files from current directory, in revision REV (e.g. 1001) -t DIR Put SRPM file in directory DIR when done (default is ".") -P USER Define the RPM packager inforamtion to USER -s FILE Run script with "FILE TOPDIR SPECFILE" command @@ -41,7 +42,7 @@ Examples: mgarepo getsrpm -l python mgarepo getsrpm http://foo.bar/svn/cnc/snapshot/python mgarepo getsrpm -p http://foo.bar/svn/cnc/releases/8cl/python - mgarepo getsrpm -r 1001 file:///svn/cnc/snapshot/python + mgarepo getsrpm -r 1001 -R 101 file:///svn/cnc/snapshot/python """ def mode_callback(option, opt, val, parser, mode): @@ -78,6 +79,7 @@ def parse_options(): parser.add_option("-n", dest="revname", action="store_true") parser.add_option("-l", dest="svnlog", action="store_true") parser.add_option("-T", dest="template", type="string", default=None) + parser.add_option("-R", dest="binrev", type="string", default=None) parser.add_option("-S", dest="use_binrepo", default=True, action="store_false") parser.add_option("--check", dest="binrepo_check", default=False, diff --git a/MgaRepo/commands/markrelease.py b/MgaRepo/commands/markrelease.py index 857d38d..65a091c 100644 --- a/MgaRepo/commands/markrelease.py +++ b/MgaRepo/commands/markrelease.py @@ -30,6 +30,7 @@ structure. Options: -f FILE Try to extract information from given file -r REV Revision which will be used to make the release copy tag + -R REV binrepo revision which will be used to make the release copy tag -v VER Version which will be used to make the release copy tag -n Append package name to provided URL -h Show this message @@ -51,9 +52,11 @@ def parse_options(): parser = OptionParser(help=HELP) parser.defaults["version"] = None parser.defaults["release"] = None + parser.defaults["binrev"] = None parser.add_option("-v", action="callback", callback=version_callback, nargs=1, type="string", dest="__ignore") parser.add_option("-r", dest="revision") + parser.add_option("-R", dest="binrev") parser.add_option("-f", dest="filename") parser.add_option("-n", dest="appendname", action="store_true") opts, args = parser.parse_args() diff --git a/MgaRepo/rpmutil.py b/MgaRepo/rpmutil.py index 2f07845..ef3780a 100644 --- a/MgaRepo/rpmutil.py +++ b/MgaRepo/rpmutil.py @@ -61,6 +61,7 @@ def get_srpm(pkgdirurl, version = None, release = None, revision = None, + binrev = None, packager = "", revname = 0, svnlog = 0, @@ -105,7 +106,7 @@ def get_srpm(pkgdirurl, binrepo_check = (binrepo_check or config.getbool("binrepo", "getsrpm-check", False)) download_binaries(tmpdir, geturl, revision=revision, - export=True, check=binrepo_check) + binrev=binrev, export=True, check=binrepo_check) srpmsdir = os.path.join(tmpdir, "SRPMS") os.mkdir(srpmsdir) specsdir = os.path.join(tmpdir, "SPECS") @@ -462,7 +463,7 @@ def check_changed(pkgdirurl, all=0, show=0, verbose=0): "nocurrent": nocurrent, "nopristine": nopristine} -def checkout(pkgdirurl, path=None, revision=None, branch=None, distro=None, +def checkout(pkgdirurl, path=None, revision=None, binrev=None, branch=None, distro=None, spec=False, use_binrepo=False, binrepo_check=True, binrepo_link=True): o_pkgdirurl = pkgdirurl pkgdirurl = layout.package_url(o_pkgdirurl, distro=distro) @@ -477,7 +478,7 @@ def checkout(pkgdirurl, path=None, revision=None, branch=None, distro=None, svn = SVN() svn.checkout(current, path, rev=revision, show=1) if use_binrepo: - download_binaries(path, revision=revision, symlinks=binrepo_link, + download_binaries(path, revision=revision, binrev=binrev, symlinks=binrepo_link, check=binrepo_check) def getpkgtopdir(basedir=None): @@ -609,13 +610,13 @@ def spec_sources(topdir): return sources def download_binaries(target, pkgdirurl=None, export=False, revision=None, - symlinks=True, check=False): + binrev=None, symlinks=True, check=False): refurl = pkgdirurl if refurl is None: refurl = binrepo.svn_root(target) if binrepo.enabled(refurl): binrepo.download(target, pkgdirurl, export=export, - revision=revision, symlinks=symlinks, check=check) + revision=revision, binrev=binrev symlinks=symlinks, check=check) def update(target=None): svn = SVN() -- cgit v1.2.1