Allow user to define which package need to be installed before tagging.

This is for supporting tagging software collections (SC), if you have
installed meta package of SC then then name of package is different.
I.e. if you are tagging rubygem-foo package and you have ruby193-build
installed then the name of package is ruby193-rubygem-foo.
This commit is contained in:
Miroslav Suchý 2013-02-20 11:40:41 +01:00
parent 562ef769df
commit 1c08f3595e
3 changed files with 23 additions and 0 deletions

View file

@ -16,6 +16,7 @@ Code for tagging Spacewalk/Satellite packages.
import os
import re
import rpm
import commands
import StringIO
import shutil
@ -92,12 +93,28 @@ class VersionTagger(object):
if options.use_version:
self._use_version = options.use_version
self.check_tag_precondition()
# Only two paths through the tagger module right now:
if options.undo:
self._undo()
else:
self._tag_release()
def check_tag_precondition(self):
if self.config.has_option("tagconfig", "require_package"):
packages = self.config.get_option("taggerconfig", "require_package").split(',')
ts = rpm.TransactionSet()
missing_packages = []
for p in packages:
p = p.strip()
mi = ts.dbMatch('name', p)
if not mi:
missing_packages.append(p)
if missing_packages:
raise TitoException("To tag this package, you must first install: %s"
', '.join(missing_packages))
def _tag_release(self):
"""
Tag a new version of the package. (i.e. x.y.z+1)

View file

@ -108,6 +108,11 @@ REQUIREMENTS
tito::
If tito is older then specified version, it will refuse to continue.
TAGCONFIG
---------
require_package::
Comma separated list of packages, which needs to be installed prior tagging. If those
packages are not installed, tito will refuse to continue.
BUILDERS
--------

View file

@ -25,6 +25,7 @@ Requires: fedpkg
Requires: fedora-cert
Requires: fedora-packager
Requires: rpmdevtools
Requires: rpm-python
%description
Tito is a tool for managing tarballs, rpms, and builds for projects using