summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Keating <jkeating@redhat.com>2011-01-30 15:40:39 -0700
committerJesse Keating <jkeating@redhat.com>2011-01-30 15:48:50 -0700
commitcda6081ad56a792fd116ec2350653b3e0ede3ea9 (patch)
treeeb6c10dc2a3a1cc0066e31e4d8bdd2fbf97f56a7
parenta13b9ac7617e43a0e9f685cec994bc8ec750b75d (diff)
downloadfedora-packager-cda6081ad56a792fd116ec2350653b3e0ede3ea9.zip
fedora-packager-cda6081ad56a792fd116ec2350653b3e0ede3ea9.tar.gz
fedora-packager-cda6081ad56a792fd116ec2350653b3e0ede3ea9.tar.xz
Add an argument to override the "distribution"
This allows developers to force fedpkg into not discovering the distribution based on branch name, and instead just take what the developer says it is.
-rw-r--r--src/fedpkg.bash4
-rwxr-xr-xsrc/fedpkg.py45
-rw-r--r--src/pyfedpkg/__init__.py7
3 files changed, 32 insertions, 24 deletions
diff --git a/src/fedpkg.bash b/src/fedpkg.bash
index 117bd23..90cb2ac 100644
--- a/src/fedpkg.bash
+++ b/src/fedpkg.bash
@@ -34,7 +34,7 @@ _fedpkg()
# global options
local options="--help -v -q"
- local options_value="--user --path"
+ local options_value="--dist --user --path"
local commands="build chain-build ci clean clog clone co commit compile diff gimmespec giturl help \
import install lint local mockbuild new new-sources patch prep pull push retire scratch-build sources \
srpm switch-branch tag tag-request unused-patches update upload verrel"
@@ -71,6 +71,8 @@ _fedpkg()
fi
case "$prev" in
+ --dist)
+ ;;
--user|-u)
;;
--path)
diff --git a/src/fedpkg.py b/src/fedpkg.py
index fdda1b6..b9d46c4 100755
--- a/src/fedpkg.py
+++ b/src/fedpkg.py
@@ -295,7 +295,7 @@ def build(args):
user = getuser(args.user)
# Need to do something with BUILD_FLAGS or KOJI_FLAGS here for compat
try:
- mymodule = pyfedpkg.PackageModule(args.path)
+ mymodule = pyfedpkg.PackageModule(args.path, args.dist)
except pyfedpkg.FedpkgError, e:
# This error needs a better print out
log.error('Could not use module: %s' % e)
@@ -347,7 +347,7 @@ def build(args):
def chainbuild(args):
try:
- mymodule = pyfedpkg.PackageModule(args.path)
+ mymodule = pyfedpkg.PackageModule(args.path, args.dist)
except pyfedpkg.FedpkgError, e:
log.error('Could not use module %s' % e)
sys.exit(1)
@@ -429,7 +429,7 @@ def clean(args):
def clog(args):
try:
- mymodule = pyfedpkg.PackageModule(args.path)
+ mymodule = pyfedpkg.PackageModule(args.path, args.dist)
return mymodule.clog()
except pyfedpkg.FedpkgError, e:
log.error('Could not generate clog: %s' % e)
@@ -454,7 +454,7 @@ def commit(args):
mymodule = None
if args.clog:
try:
- mymodule = pyfedpkg.PackageModule(args.path)
+ mymodule = pyfedpkg.PackageModule(args.path, args.dist)
mymodule.clog()
except pyfedpkg.FedpkgError, e:
log.error('coult not create clog: %s' % e)
@@ -468,7 +468,7 @@ def commit(args):
if args.tag:
try:
if not mymodule:
- mymodule = pyfedpkg.PackageModule(args.path)
+ mymodule = pyfedpkg.PackageModule(args.path, args.dist)
tagname = mymodule.nvr
pyfedpkg.add_tag(tagname, True, args.message, args.file)
except pyfedpkg.FedpkgError, e:
@@ -485,7 +485,7 @@ def compile(args):
if args.short_circuit:
short = True
try:
- mymodule = pyfedpkg.PackageModule(args.path)
+ mymodule = pyfedpkg.PackageModule(args.path, args.dist)
return mymodule.compile(arch=arch, short=short)
except pyfedpkg.FedpkgError, e:
log.error('Could not compile: %s' % e)
@@ -504,7 +504,7 @@ def export(args):
def gimmespec(args):
try:
- mymodule = pyfedpkg.PackageModule(args.path)
+ mymodule = pyfedpkg.PackageModule(args.path, args.dist)
print(mymodule.spec)
except pyfedpkg.FedpkgError, e:
log.error('Could not get spec file: %s' % e)
@@ -512,7 +512,7 @@ def gimmespec(args):
def giturl(args):
try:
- mymodule = pyfedpkg.PackageModule(args.path)
+ mymodule = pyfedpkg.PackageModule(args.path, args.dist)
print(mymodule.giturl())
except pyfedpkg.FedpkgError, e:
log.error('Could not get the giturl: %s' % e)
@@ -526,7 +526,7 @@ def import_srpm(args):
if not args.create:
try:
uploadfiles = pyfedpkg.import_srpm(args.srpm, path=args.path)
- mymodule = pyfedpkg.PackageModule(args.path)
+ mymodule = pyfedpkg.PackageModule(args.path, args.dist)
mymodule.upload(uploadfiles, replace=True)
except pyfedpkg.FedpkgError, e:
log.error('Could not import srpm: %s' % e)
@@ -547,7 +547,7 @@ def install(args):
if args.short_circuit:
short = True
try:
- mymodule = pyfedpkg.PackageModule(args.path)
+ mymodule = pyfedpkg.PackageModule(args.path, args.dist)
return mymodule.install(arch=arch, short=short)
except pyfedpkg.FedpkgError, e:
log.error('Could not install: %s' % e)
@@ -555,7 +555,7 @@ def install(args):
def lint(args):
try:
- mymodule = pyfedpkg.PackageModule(args.path)
+ mymodule = pyfedpkg.PackageModule(args.path, args.dist)
return mymodule.lint(args.info)
except pyfedpkg.FedpkgError, e:
log.error('Could not run rpmlint: %s' % e)
@@ -566,7 +566,7 @@ def local(args):
if args.arch:
arch = args.arch
try:
- mymodule = pyfedpkg.PackageModule(args.path)
+ mymodule = pyfedpkg.PackageModule(args.path, args.dist)
if args.md5:
return mymodule.local(arch=arch, hashtype='md5')
else:
@@ -590,7 +590,7 @@ def mockbuild(args):
# there were no args
pass
try:
- mymodule = pyfedpkg.PackageModule(args.path)
+ mymodule = pyfedpkg.PackageModule(args.path, args.dist)
return mymodule.mockbuild(mockargs)
except pyfedpkg.FedpkgError, e:
log.error('Could not run mockbuild: %s' % e)
@@ -610,7 +610,7 @@ def new_sources(args):
log.error('File does not exist: %s' % file)
sys.exit(1)
try:
- mymodule = pyfedpkg.PackageModule(args.path)
+ mymodule = pyfedpkg.PackageModule(args.path, args.dist)
mymodule.upload(args.files, replace=args.replace)
except pyfedpkg.FedpkgError, e:
log.error('Could not upload new sources: %s' % e)
@@ -626,7 +626,7 @@ def prep(args):
if args.arch:
arch = args.arch
try:
- mymodule = pyfedpkg.PackageModule(args.path)
+ mymodule = pyfedpkg.PackageModule(args.path, args.dist)
return mymodule.prep(arch=arch)
except pyfedpkg.FedpkgError, e:
log.error('Could not prep: %s' % e)
@@ -670,7 +670,7 @@ def sources(args):
def srpm(args):
try:
- mymodule = pyfedpkg.PackageModule(args.path)
+ mymodule = pyfedpkg.PackageModule(args.path, args.dist)
pyfedpkg.sources(args.path)
if args.md5:
mymodule.srpm('md5')
@@ -719,7 +719,7 @@ def tag(args):
tagname = args.tag
try:
if not tagname or args.clog:
- mymodule = pyfedpkg.PackageModule(args.path)
+ mymodule = pyfedpkg.PackageModule(args.path, args.dist)
if not tagname:
tagname = mymodule.nvr
if clog:
@@ -738,7 +738,7 @@ def tagrequest(args):
args.desc = raw_input('\nAdd a description to your request: ')
try:
- mymodule = pyfedpkg.PackageModule(args.path)
+ mymodule = pyfedpkg.PackageModule(args.path, args.dist)
mymodule.new_ticket(user, passwd, args.desc, args.build)
except pyfedpkg.FedpkgError, e:
print('Could not request a tag release: %s' % e)
@@ -750,7 +750,7 @@ def unusedfedpatches(args):
def unusedpatches(args):
try:
- mymodule = pyfedpkg.PackageModule(args.path)
+ mymodule = pyfedpkg.PackageModule(args.path, args.dist)
unused = mymodule.unused_patches()
except pyfedpkg.FedpkgError, e:
log.error('Could not get unused patches: %s' % e)
@@ -761,7 +761,7 @@ def update(args):
"""Submit a new update to bodhi"""
user = getuser(args.user)
try:
- mymodule = pyfedpkg.PackageModule(args.path)
+ mymodule = pyfedpkg.PackageModule(args.path, args.dist)
except pyfedpkg.FedpkgError, e:
log.error('Could not use module: %s' % e)
sys.exit(1)
@@ -840,7 +840,7 @@ def update(args):
def verrel(args):
try:
- mymodule = pyfedpkg.PackageModule(args.path)
+ mymodule = pyfedpkg.PackageModule(args.path, args.dist)
except pyfedpkg.FedpkgError, e:
log.error('Could not get ver-rel: %s' % e)
sys.exit(1)
@@ -855,6 +855,9 @@ if __name__ == '__main__':
"--help to a target")
# Add top level arguments
+ # Let people override the "distribution"
+ parser.add_argument('--dist', default=None,
+ help='Override the distribution, eg f15 or el6')
# Let somebody override the username found in fedora cert
parser.add_argument('-u', '--user')
# Let the user define which path to look at instead of pwd
diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py
index 073169f..5ac11a0 100644
--- a/src/pyfedpkg/__init__.py
+++ b/src/pyfedpkg/__init__.py
@@ -1067,7 +1067,7 @@ class PackageModule:
return subprocess.Popen(['rpm --eval %{_arch}'], shell=True,
stdout=subprocess.PIPE).communicate()[0].strip('\n')
- def __init__(self, path=None):
+ def __init__(self, path=None, dist=None):
# Initiate a PackageModule object in a given path
# Set some global variables used throughout
if not path:
@@ -1091,7 +1091,10 @@ class PackageModule:
raise FedpkgError('%s is not a valid repo' % path)
# Find the branch and set things based from that
# Still requires a 'branch' file in each branch
- self.branch = self._findbranch()
+ if dist:
+ self.branch = dist
+ else:
+ self.branch = self._findbranch()
if self.branch.startswith('f'):
self.distval = self.branch.split('f')[1]
self.distvar = 'fedora'