summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fedpkg.bash5
-rwxr-xr-xsrc/fedpkg.py36
-rw-r--r--src/pyfedpkg/__init__.py31
3 files changed, 70 insertions, 2 deletions
diff --git a/src/fedpkg.bash b/src/fedpkg.bash
index 33cd78f..04cdcfe 100644
--- a/src/fedpkg.bash
+++ b/src/fedpkg.bash
@@ -11,7 +11,7 @@ _fedpkg()
# define all available commands to complete
commands='help build chain-build clean clog clone co commit ci compile \
diff gimmespec giturl import install lint local mockbuild new new-sources \
- patch prep push scratch-build sources srpm switch-branch tag-request \
+ patch prep push scratch-build sources srpm switch-branch tag tag-request \
unused-patches update upload verrel'
if [[ $COMP_CWORD -eq 1 ]] ; then
@@ -95,6 +95,9 @@ _fedpkg()
srpm)
options='--md5'
;;
+ tag)
+ options="-c --clog -m --message -f --force -F --file -l --list -d --delete"
+ ;;
switch-branch)
options='-l'
;;
diff --git a/src/fedpkg.py b/src/fedpkg.py
index 1da01cd..09bcd36 100755
--- a/src/fedpkg.py
+++ b/src/fedpkg.py
@@ -596,6 +596,15 @@ def push(args):
log.error('Could not push: %s' % e)
sys.exit(1)
+def tag(args):
+ try:
+ mymodule = pyfedpkg.PackageModule(args.path)
+ mymodule.tag(args.force, args.clog, args.message, args.file,
+ args.list, args.delete)
+ except pyfedpkg.FedpkgError, e:
+ log.error('Coult not create a tag: %s' % e)
+ sys.exit(1)
+
def scratchbuild(args):
# A scratch build is just a build with --scratch
args.scratch = True
@@ -866,7 +875,32 @@ packages will be built sequentially.
conflict_handler = 'resolve',
help = 'Alias for clone')
parser_co.set_defaults(command = clone)
-
+ # tag stuff
+ parser_tag = subparsers.add_parser('tag',
+ help = 'Managmentz of git tags')
+ parser_tag.add_argument('-f', '--force',
+ default = False,
+ action = 'store_true',
+ help = 'Force the creation of the tag')
+ parser_tag.add_argument('-m', '--message',
+ default = None,
+ help = 'Use the given <msg> as the tag message')
+ parser_tag.add_argument('-c', '--clog',
+ default = False,
+ action = 'store_true',
+ help = 'Generate the tag message from the %Changelog section')
+ parser_tag.add_argument('-F', '--file',
+ default = None,
+ help = 'Take the tag message from the given file')
+ parser_tag.add_argument('-l', '--list',
+ nargs = '?',
+ const = '*',
+ default = None,
+ help = 'List all tags with a given pattern')
+ parser_tag.add_argument('-d', '--delete',
+ nargs = 1,
+ help = 'Delete a tag')
+ parser_tag.set_defaults(command = tag)
# commit stuff
parser_commit = subparsers.add_parser('commit',
help = 'Commit changes')
diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py
index 65e64bc..b84b74f 100644
--- a/src/pyfedpkg/__init__.py
+++ b/src/pyfedpkg/__init__.py
@@ -961,6 +961,37 @@ class PackageModule:
if self.branch.startswith('el5') or self.branch.startswith('el4'):
self.hashtype = 'md5'
+ def tag(self, force=False, clog=False, message=None, file=None,
+ list=None, delete=None):
+ """Managment of git tags
+ """
+ t = None
+ cmd = ['git', 'tag']
+ if list:
+ cmd.extend(['-l'])
+ if not list == '*':
+ cmd.extend([list])
+ elif delete:
+ cmd.extend(['-d'])
+ cmd.extend(delete)
+ else:
+ cmd.extend(['-a'])
+ if force:
+ cmd.extend(['-f'])
+ if message:
+ cmd.extend(['-m', message])
+ elif clog:
+ self.clog()
+ cmd.extend(['-F', os.path.abspath('clog')])
+ elif file:
+ cmd.extend(['-F', os.path.abspath(file)])
+ t = self.nvr.replace('.', '_')
+ cmd.append(t)
+ # make it so
+ _run_command(cmd)
+ if t:
+ log.info ('Tag %s was created' % t)
+
def build(self, skip_tag=False, scratch=False, background=False,
url=None, chain=None):
"""Initiate a build of the module. Available options are: