summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Ulrich Niedermann <hun@n-dimensional.de>2011-01-31 16:44:43 +0100
committerJesse Keating <jkeating@redhat.com>2011-02-09 15:53:33 -0700
commitf73acaf60b745656f8269a560d846bb8d134355b (patch)
treeb83e088296f293c067c0661b8ab189d612262fbb
parentde2bc133afb7f44e11a1b07169a291baa82f1992 (diff)
downloadfedora-packager-f73acaf60b745656f8269a560d846bb8d134355b.zip
fedora-packager-f73acaf60b745656f8269a560d846bb8d134355b.tar.gz
fedora-packager-f73acaf60b745656f8269a560d846bb8d134355b.tar.xz
Add "fedpkg verify-files" command
usage: fedpkg verify-files [-h] Locally run 'rpmbuild -bl' to verify the spec file's %files sections. This is useful after a successful run of 'fedpkg install' or after a 'fedpkg local' run which failed due to %files list inaccuracies.
-rw-r--r--src/fedpkg.bash2
-rwxr-xr-xsrc/fedpkg.py14
-rw-r--r--src/pyfedpkg/__init__.py13
3 files changed, 28 insertions, 1 deletions
diff --git a/src/fedpkg.bash b/src/fedpkg.bash
index 1191bb5..2d0f4d8 100644
--- a/src/fedpkg.bash
+++ b/src/fedpkg.bash
@@ -37,7 +37,7 @@ _fedpkg()
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"
+ srpm switch-branch tag tag-request unused-patches update upload verify-files verrel"
# parse main options and get command
diff --git a/src/fedpkg.py b/src/fedpkg.py
index 0498009..b7ac38e 100755
--- a/src/fedpkg.py
+++ b/src/fedpkg.py
@@ -501,6 +501,14 @@ def diff(args):
log.error('Could not diff: %s' % e)
sys.exit(1)
+def verify_files(args):
+ try:
+ mymodule = pyfedpkg.PackageModule(args.path, args.dist)
+ return mymodule.verify_files()
+ except pyfedpkg.FedpkgError, e:
+ log.error('Could not verify %%files list: %s' % e)
+ sys.exit(1)
+
def export(args):
# not implimented; not planned
log.warning('Not implimented yet, got %s' % args)
@@ -1074,6 +1082,12 @@ defined, packages will be built sequentially.""")
help = 'short-circuit compile')
parser_compile.set_defaults(command = compile)
+ # Verify %files list locally
+ parser_verify_files = subparsers.add_parser('verify-files',
+ help='Locally verify %%files section',
+ description="Locally run 'rpmbuild -bl' to verify the spec file's %files sections. This is useful after a successful run of 'fedpkg install' or after a 'fedpkg local' run which failed due to %files list inaccuracies.")
+ parser_verify_files.set_defaults(command = verify_files)
+
# export the module; not planned
#parser_export = subparsers.add_parser('export',
# help = 'Create a clean export')
diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py
index dcea285..cf5c506 100644
--- a/src/pyfedpkg/__init__.py
+++ b/src/pyfedpkg/__init__.py
@@ -1341,6 +1341,19 @@ class PackageModule:
_run_command(cmd, shell=True)
return
+ def verify_files(self):
+ """Run rpmbuild -bl on a module to verify the %files section"""
+
+ # Get the sources
+ sources(self.path)
+ # setup the rpm command
+ cmd = ['rpmbuild']
+ cmd.extend(self.rpmdefines)
+ cmd.extend(['-bl', os.path.join(self.path, self.spec)])
+ # Run the command
+ _run_command(cmd, shell=True)
+ return
+
def getver(self):
"""Return the version-release of a package module."""