summaryrefslogtreecommitdiffstats
path: root/src/fedpkg.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/fedpkg.py')
-rwxr-xr-xsrc/fedpkg.py66
1 files changed, 48 insertions, 18 deletions
diff --git a/src/fedpkg.py b/src/fedpkg.py
index e12124f..4086562 100755
--- a/src/fedpkg.py
+++ b/src/fedpkg.py
@@ -446,6 +446,8 @@ def clone(args):
pyfedpkg.clone_with_dirs(args.module[0], user)
else:
pyfedpkg.clone(args.module[0], user, args.path, args.branch)
+ if args.initial_merge:
+ pyfedpkg.initial_merge.handle_repo(args.module[0])
except pyfedpkg.FedpkgError, e:
log.error('Could not clone: %s' % e)
sys.exit(1)
@@ -575,10 +577,7 @@ def local(args):
arch = args.arch
try:
mymodule = pyfedpkg.PackageModule(args.path, args.dist)
- if args.md5:
- return mymodule.local(arch=arch, hashtype='md5')
- else:
- return mymodule.local(arch=arch)
+ return mymodule.local(arch=arch, hashtype=args.hashtype)
except pyfedpkg.FedpkgError, e:
log.error('Could not build locally: %s' % e)
sys.exit(1)
@@ -680,10 +679,8 @@ def srpm(args):
try:
mymodule = pyfedpkg.PackageModule(args.path, args.dist)
pyfedpkg.sources(args.path)
- if args.md5:
- mymodule.srpm('md5')
- else:
- mymodule.srpm()
+ mymodule.srpm(hashtype=args.hashtype,
+ fix_permissions=args.fix_permissions)
except pyfedpkg.FedpkgError, e:
log.error('Could not make an srpm: %s' % e)
sys.exit(1)
@@ -854,8 +851,10 @@ def verrel(args):
sys.exit(1)
print('%s-%s-%s' % (mymodule.module, mymodule.ver, mymodule.rel))
-# THe main code goes here
-if __name__ == '__main__':
+
+def parse_cmdline(generate_manpage = False):
+ """Parse the command line"""
+
# Create the parser object
parser = argparse.ArgumentParser(description = 'Fedora Packaging utility',
prog = 'fedpkg',
@@ -867,7 +866,8 @@ if __name__ == '__main__':
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')
+ parser.add_argument('-u', '--user',
+ help = "Override the username found in the fedora cert")
# Let the user define which path to look at instead of pwd
parser.add_argument('--path', default = os.getcwd(),
help='Directory to interact with instead of current dir')
@@ -955,9 +955,15 @@ packages will be built sequentially.
parser_clone = subparsers.add_parser('clone',
help = 'Clone and checkout a module')
# Allow an old style clone with subdirs for branches
- parser_clone.add_argument('--branches', '-B',
- action = 'store_true',
- help = 'Do an old style checkout with subdirs for branches')
+ parser_clone_branches_group = parser_clone.add_mutually_exclusive_group()
+ parser_clone_branches_group.add_argument(
+ '--branches', '-B',
+ action = 'store_true',
+ help = 'Do an old style checkout with subdirs for branches')
+ parser_clone_branches_group.add_argument(
+ '--initial-merge', '-i',
+ action = 'store_true',
+ help = 'Run initial-merge on the cloned repo immediately')
# provide a convenient way to get to a specific branch
parser_clone.add_argument('--branch', '-b',
help = 'Check out a specific branch')
@@ -1060,6 +1066,9 @@ packages will be built sequentially.
help = 'Source rpm to import')
parser_import_srpm.set_defaults(command = import_srpm)
+ # Initial branch merges
+ pyfedpkg.initial_merge.add_parser_to(subparsers)
+
# install locally
parser_install = subparsers.add_parser('install',
help = 'Local test rpmbuild install')
@@ -1082,7 +1091,8 @@ packages will be built sequentially.
help = 'Local test rpmbuild binary')
parser_local.add_argument('--arch', help = 'Build for arch')
# optionally define old style hashsums
- parser_local.add_argument('--md5', action = 'store_true',
+ parser_local.add_argument('--md5', action = 'store_const',
+ dest='hashtype', const='md5', default=None,
help = 'Use md5 checksums (for older rpm hosts)')
parser_local.set_defaults(command = local)
@@ -1160,8 +1170,12 @@ packages will be built sequentially.
parser_srpm = subparsers.add_parser('srpm',
help = 'Create a source rpm')
# optionally define old style hashsums
- parser_srpm.add_argument('--md5', action = 'store_true',
+ parser_srpm.add_argument('--md5', action = 'store_const',
+ dest='hashtype', const='md5', default=None,
help = 'Use md5 checksums (for older rpm hosts)')
+ parser_srpm.add_argument('--fix-permissions', action='store_true',
+ default=False,
+ help = 'Fix permissions of files to be put into .src.rpm file')
parser_srpm.set_defaults(command = srpm)
# switch branches
@@ -1241,8 +1255,24 @@ packages will be built sequentially.
' name-version-release')
parser_verrel.set_defaults(command = verrel)
- # Parse the args
- args = parser.parse_args()
+ if not generate_manpage:
+ # Parse the args
+ return parser.parse_args()
+ else:
+ # Generate the man page
+
+ # Use the "as man_page" part to avoid overwriting the pyfedpkg
+ # namespace, which would break all usage of pyfedpkg.* outside
+ # of this else branch.
+ import pyfedpkg.man_page as man_page
+ man_page.generate(parser, subparsers)
+ sys.exit(0)
+ # no return possible
+
+
+# The main code goes here
+if __name__ == '__main__':
+ args = parse_cmdline()
# setup the logger -- This logger will take things of INFO or DEBUG and
# log it to stdout. Anything above that (WARN, ERROR, CRITICAL) will go