summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJochen Schmitt <Jochen@herr-schmitt.de>2010-09-21 21:20:13 +0200
committerJesse Keating <jkeating@redhat.com>2010-09-23 13:03:49 +0200
commit34a1d857659b5aa0456a33a603f12060f45704ab (patch)
treec014bd4d3ac5b7fc4064948d3247ceb3cb9dd121 /src
parentbec2d5bd707a43bd6fb47e3b9a28cbb2db162c91 (diff)
downloadfedora-packager-34a1d857659b5aa0456a33a603f12060f45704ab.zip
fedora-packager-34a1d857659b5aa0456a33a603f12060f45704ab.tar.gz
fedora-packager-34a1d857659b5aa0456a33a603f12060f45704ab.tar.xz
Implementing a retire command
Diffstat (limited to 'src')
-rw-r--r--src/fedpkg.bash8
-rwxr-xr-xsrc/fedpkg.py21
-rw-r--r--src/pyfedpkg/__init__.py22
3 files changed, 49 insertions, 2 deletions
diff --git a/src/fedpkg.bash b/src/fedpkg.bash
index 8bf97ec..c0f3fca 100644
--- a/src/fedpkg.bash
+++ b/src/fedpkg.bash
@@ -36,8 +36,8 @@ _fedpkg()
local options="--help -v -q"
local options_value="--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 scratch-build sources srpm \
- switch-branch tag tag-request unused-patches update upload verrel"
+ 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"
# parse main options and get command
@@ -165,6 +165,10 @@ _fedpkg()
tag-request)
options_string="--desc --build"
;;
+ retire)
+ options="--push"
+ after_more=true
+ ;;
srpm)
options="--md5"
;;
diff --git a/src/fedpkg.py b/src/fedpkg.py
index 20dc774..5f3219e 100755
--- a/src/fedpkg.py
+++ b/src/fedpkg.py
@@ -630,6 +630,15 @@ def push(args):
log.error('Could not push: %s' % e)
sys.exit(1)
+def retire(args):
+ try:
+ pyfedpkg.retire(args.path, args.msg)
+ except pyfedpkg.FedpkgError, e:
+ log.error('Could not retire package: %s' % e)
+ sys.exit(1)
+ if args.push:
+ push()
+
def scratchbuild(args):
# A scratch build is just a build with --scratch
args.scratch = True
@@ -1081,6 +1090,18 @@ packages will be built sequentially.
help = 'Push changes to remote repository')
parser_push.set_defaults(command = push)
+ # retire stuff
+ parser_retire = subparsers.add_parser('retire',
+ help = 'Retire a package')
+ parser_retire.add_argument('-p', '--push',
+ default = False,
+ action = 'store_true',
+ help = 'Push changes to remote repository')
+ parser_retire.add_argument('msg',
+ nargs = '?',
+ help = 'Message for retiring the package')
+ parser_retire.set_defaults(command = retire)
+
# scratch build
parser_scratchbuild = subparsers.add_parser('scratch-build',
help = 'Request scratch build',
diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py
index 474053c..cfd9f3b 100644
--- a/src/pyfedpkg/__init__.py
+++ b/src/pyfedpkg/__init__.py
@@ -696,6 +696,28 @@ def push(path=None):
_run_command(cmd, cwd=path)
return
+def retire(path, message=None):
+ """Retire a Fedora package"""
+
+ cmd = ['git', 'rm', '-rf', path]
+ _run_command(cmd, cwd=path)
+
+ if message:
+ msg = message
+ else:
+ msg = 'Package is retired'
+
+ fd = open(os.path.join(path, 'dead.package'), 'w')
+ fd.write(msg)
+ fd.close()
+
+ cmd = ['git', 'add', os.path.join(path, 'dead.package')]
+ _run_command(cmd, cwd=path)
+
+ commit (path, msg)
+
+ return
+
def sources(path, outdir=None):
"""Download source files"""