From 16a524c980984505914635c9c232366bf5aa27d2 Mon Sep 17 00:00:00 2001 From: Jochen Schmitt Date: Thu, 16 Sep 2010 20:05:45 +0200 Subject: Implenentation of a tag command Hello Jesse, this patch contains a tag command for fedpkg. I have divede the tag function in __init__.py into three functions for add, delete and list tags. All this functions lives outside of the PackageModule class. Best Regards: Jochen Schmitt --- src/fedpkg.py | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) (limited to 'src/fedpkg.py') diff --git a/src/fedpkg.py b/src/fedpkg.py index 4f707b8..0319c70 100755 --- a/src/fedpkg.py +++ b/src/fedpkg.py @@ -652,6 +652,35 @@ def switch_branch(args): print('Locals:\n%s\nRemotes:\n %s' % ('\n'.join(locals), '\n '.join(remotes))) +def tag(args): + if args.list: + try: + pyfedpkg.list_tag(args.tag) + except pyfedpkg.FedpkgError, e: + log.error('Could not create a list of the tag: %s' % e) + sys.exit(1) + elif args.delete: + try: + pyfedpkg.delete_tag(args.tag) + except pyfedpkg.FedpkgError, e: + log.error('Coult not delete tag: %s' % e) + sys.exit(1) + else: + filename = args.file + tagname = args.tag + try: + if not tagname or args.clog: + mymodule = pyfedpkg.PackageModule(args.path) + if not tagname: + tagname = mymodule.getnvr() + if clog: + mymodule.clog() + filename = 'clog' + pyfedpkg.add_tag(tagname, args.force, args.message, filename) + except pyfedpkg.FedpkgError, e: + log.error('Coult not create a tag: %s' % e) + sys.exit(1) + def tagrequest(args): # not implimented log.warning('Not implimented yet, got %s' % args) @@ -871,7 +900,6 @@ packages will be built sequentially. conflict_handler = 'resolve', help = 'Alias for clone') parser_co.set_defaults(command = clone) - # commit stuff parser_commit = subparsers.add_parser('commit', help = 'Commit changes') @@ -1036,6 +1064,37 @@ packages will be built sequentially. action = 'store_true') parser_switchbranch.set_defaults(command = switch_branch) + # tag stuff + parser_tag = subparsers.add_parser('tag', + help = 'Managementz 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 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', + default = False, + action = 'store_true', + help = 'List all tags with a given pattern, or all if not pattern is given') + parser_tag.add_argument('-d', '--delete', + default = False, + action = 'store_true', + help = 'Delete a tag') + parser_tag.add_argument('tag', + nargs = '?', + default = None, + help = 'Name of the tag') + parser_tag.set_defaults(command = tag) + # Create a releng tag request parser_tagrequest = subparsers.add_parser('tag-request', help = 'Submit last build as a releng tag request') -- cgit From f9443e37b7ca3863ba79f9603d074bcd7c749abe Mon Sep 17 00:00:00 2001 From: Jochen Schmitt Date: Thu, 16 Sep 2010 20:05:46 +0200 Subject: Implementation of a pull command Hello Jesse, this patch implemts a pull command for fedpkg. Best Regards: Jochen Schmitt --- src/fedpkg.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/fedpkg.py') diff --git a/src/fedpkg.py b/src/fedpkg.py index 0319c70..257d7a7 100755 --- a/src/fedpkg.py +++ b/src/fedpkg.py @@ -598,6 +598,14 @@ def prep(args): log.error('Could not prep: %s' % e) sys.exit(1) +def pull(args): + try: + mymodule = pyfedpkg.PackageModule(args.path) + mymodule.pull() + except pyfedpkg.FedpkgError, e: + log.error('Could not push: %s' % e) + sys.exit(1) + def push(args): try: mymodule = pyfedpkg.PackageModule(args.path) @@ -1024,6 +1032,12 @@ packages will be built sequentially. parser_prep.add_argument('--arch', help = 'Prep for a specific arch') parser_prep.set_defaults(command = prep) + # Pull stuff + parser_pull = subparsers.add_parser('pull', + help = 'Pull changes from remote repository') + parser_pull.set_defaults(command = pull) + + # Push stuff parser_push = subparsers.add_parser('push', help = 'Push changes to remote repository') -- cgit From abd8e620a19b31a995a57f546988f794fa233b05 Mon Sep 17 00:00:00 2001 From: Jochen Schmitt Date: Thu, 16 Sep 2010 20:05:47 +0200 Subject: Move pull and push function out of PackageModule Hello Jesse, I have move the pull() and push() function in the __init__.py module out of the PackageModule class. Best Regards: Jochen Schmitt --- src/fedpkg.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/fedpkg.py') diff --git a/src/fedpkg.py b/src/fedpkg.py index 257d7a7..8fc21ad 100755 --- a/src/fedpkg.py +++ b/src/fedpkg.py @@ -600,16 +600,14 @@ def prep(args): def pull(args): try: - mymodule = pyfedpkg.PackageModule(args.path) - mymodule.pull() + pyfedpkg.pull() except pyfedpkg.FedpkgError, e: log.error('Could not push: %s' % e) sys.exit(1) def push(args): try: - mymodule = pyfedpkg.PackageModule(args.path) - mymodule.push() + pyfedpkg.push() except pyfedpkg.FedpkgError, e: log.error('Could not push: %s' % e) sys.exit(1) -- cgit From 28e4985e215a8313841491c7d5794eb3c597ac8b Mon Sep 17 00:00:00 2001 From: Jochen Schmitt Date: Thu, 16 Sep 2010 20:05:48 +0200 Subject: Add a -c (clog) switch to the commit command Hello Jesse, this patch add a -c (clong) switch for the commit commant. Best Regards: Jochen Schmitt --- src/fedpkg.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/fedpkg.py') diff --git a/src/fedpkg.py b/src/fedpkg.py index 8fc21ad..405eb3f 100755 --- a/src/fedpkg.py +++ b/src/fedpkg.py @@ -440,6 +440,14 @@ def clone(args): sys.exit(1) def commit(args): + if args.clog: + try: + mymodule = pyfedpkg.PackageModule(args.path) + mymodule.clog() + except pyfedpkg.FedpkgError, e: + log.error('coult not create clog: %s' % e) + sys.exit(1) + args.file = os.path.abspath('clog') try: pyfedpkg.commit(args.path, args.message, args.file, args.files) except pyfedpkg.FedpkgError, e: @@ -909,6 +917,10 @@ packages will be built sequentially. # commit stuff parser_commit = subparsers.add_parser('commit', help = 'Commit changes') + parser_commit.add_argument('-c', '--clog', + default = False, + action = 'store_true', + help = 'Generate the commit message from the %Changelog section') parser_commit.add_argument('-m', '--message', default = None, help = 'Use the given as the commit message') -- cgit From c142a78896e27cf6b43135a12379c2f8ae1eb572 Mon Sep 17 00:00:00 2001 From: Jochen Schmitt Date: Thu, 16 Sep 2010 20:05:49 +0200 Subject: Add a -t (tag) switch for the commit command Hello Jesse, this patch implenents a -t (tag) switch for the commit command. Because you have wrote, that you don't like to see additional function in the PackageModule class, I have refactor this patch to fullfill your requirements. Best Regards: Jochen Schmitt --- src/fedpkg.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/fedpkg.py') diff --git a/src/fedpkg.py b/src/fedpkg.py index 405eb3f..3a9b65a 100755 --- a/src/fedpkg.py +++ b/src/fedpkg.py @@ -440,6 +440,7 @@ def clone(args): sys.exit(1) def commit(args): + mymodule = None if args.clog: try: mymodule = pyfedpkg.PackageModule(args.path) @@ -453,6 +454,18 @@ def commit(args): except pyfedpkg.FedpkgError, e: log.error('Could not commit: %s' % e) sys.exit(1) + if args.tag: + try: + if not mymodule: + mymodule = pyfedpkg.PackageModule(args.path) + tagname = mymodule.getnvr() + filename = args.file + if args.clog: + filename = 'clog' + pyfedpkg.add_tag(tagname, True, args.message, filename) + except pyfedpkg.FedpkgError, e: + log.error('Coult not create a tag: %s' % e) + sys.exit(1) if args.push: push(args) @@ -921,6 +934,10 @@ packages will be built sequentially. default = False, action = 'store_true', help = 'Generate the commit message from the %Changelog section') + parser_commit.add_argument('-t', '--tag', + default = False, + action = 'store_true', + help = 'Create a tag for this commit') parser_commit.add_argument('-m', '--message', default = None, help = 'Use the given as the commit message') -- cgit From 5ea2a82354f503ffcaf24c7288c640256a65306b Mon Sep 17 00:00:00 2001 From: Jochen Schmitt Date: Thu, 16 Sep 2010 20:05:50 +0200 Subject: Add -i (info) switch to the lint command Hello Jesse, this patch add a -i (info) tag for the fedpkg lint command. Best Regards: Jochen Schmitt --- src/fedpkg.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/fedpkg.py') diff --git a/src/fedpkg.py b/src/fedpkg.py index 3a9b65a..8f90364 100755 --- a/src/fedpkg.py +++ b/src/fedpkg.py @@ -549,7 +549,7 @@ def install(args): def lint(args): try: mymodule = pyfedpkg.PackageModule(args.path) - return mymodule.lint() + return mymodule.lint(info) except pyfedpkg.FedpkgError, e: log.error('Could not run rpmlint: %s' % e) sys.exit(1) @@ -1018,6 +1018,10 @@ packages will be built sequentially. # rpmlint target parser_lint = subparsers.add_parser('lint', help = 'Run rpmlint against local build output') + parser_lint.add_argument('--info', '-i', + default = False, + action = 'store_true', + help = 'Display explainations for reported messages') parser_lint.set_defaults(command = lint) # Build locally -- cgit From dd57b28231771b06b91af41a4cadfd0d133861ca Mon Sep 17 00:00:00 2001 From: Jochen Schmitt Date: Thu, 16 Sep 2010 20:05:53 +0200 Subject: Move diff function out of the PackageModule class hello Jesse, because you have wrote, that you want a minimum set of functions in the PackageModule clase, I have move the diff function out of their. Best Regards: Jochen Schmitt --- src/fedpkg.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/fedpkg.py') diff --git a/src/fedpkg.py b/src/fedpkg.py index 8f90364..70ce711 100755 --- a/src/fedpkg.py +++ b/src/fedpkg.py @@ -485,8 +485,7 @@ def compile(args): def diff(args): try: - mymodule = pyfedpkg.PackageModule(args.path) - return mymodule.diff(args.cached, args.files) + return mymodule.diff(args.path, args.cached, args.files) except pyfedpkg.FedpkgError, e: log.error('Could not diff: %s' % e) sys.exit(1) -- cgit From d95a4d0146cd236d3fe51291ee1c68a7b027994c Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Mon, 20 Sep 2010 13:31:47 -0700 Subject: Don't use the unnecessary getnvr() --- src/fedpkg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/fedpkg.py') diff --git a/src/fedpkg.py b/src/fedpkg.py index 70ce711..5441e08 100755 --- a/src/fedpkg.py +++ b/src/fedpkg.py @@ -698,7 +698,7 @@ def tag(args): if not tagname or args.clog: mymodule = pyfedpkg.PackageModule(args.path) if not tagname: - tagname = mymodule.getnvr() + tagname = mymodule.nvr if clog: mymodule.clog() filename = 'clog' -- cgit From a84e02917af598b0cc050694809dd351913ddd73 Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Mon, 20 Sep 2010 13:53:50 -0700 Subject: Fix up tag commands Minor clean ups from jochen's submission --- src/fedpkg.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/fedpkg.py') diff --git a/src/fedpkg.py b/src/fedpkg.py index 5441e08..6c53b50 100755 --- a/src/fedpkg.py +++ b/src/fedpkg.py @@ -687,7 +687,7 @@ def tag(args): sys.exit(1) elif args.delete: try: - pyfedpkg.delete_tag(args.tag) + pyfedpkg.delete_tag(args.tag, args.path) except pyfedpkg.FedpkgError, e: log.error('Coult not delete tag: %s' % e) sys.exit(1) @@ -1110,7 +1110,7 @@ packages will be built sequentially. # tag stuff parser_tag = subparsers.add_parser('tag', - help = 'Managementz of git tags') + help = 'Management of git tags') parser_tag.add_argument('-f', '--force', default = False, action = 'store_true', @@ -1121,7 +1121,7 @@ packages will be built sequentially. parser_tag.add_argument('-c', '--clog', default = False, action = 'store_true', - help = 'Generate the tag message from the %Changelog section') + help = 'Generate the tag message from the spec changelog section') parser_tag.add_argument('-F', '--file', default = None, help = 'Take the tag message from the given file') -- cgit From 53146ca4838576cb7383f2218d8ad3c51d9c564d Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Mon, 20 Sep 2010 13:54:52 -0700 Subject: expand on pull help output --- src/fedpkg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/fedpkg.py') diff --git a/src/fedpkg.py b/src/fedpkg.py index 6c53b50..ecfbbf8 100755 --- a/src/fedpkg.py +++ b/src/fedpkg.py @@ -1064,7 +1064,7 @@ packages will be built sequentially. # Pull stuff parser_pull = subparsers.add_parser('pull', - help = 'Pull changes from remote repository') + help = 'Pull changes from remote repository and update working copy') parser_pull.set_defaults(command = pull) -- cgit From 3810d8d56a046206628c9d906d561e2931367bf2 Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Mon, 20 Sep 2010 14:05:26 -0700 Subject: Handle paths with push/pull --- src/fedpkg.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/fedpkg.py') diff --git a/src/fedpkg.py b/src/fedpkg.py index ecfbbf8..04b8073 100755 --- a/src/fedpkg.py +++ b/src/fedpkg.py @@ -620,14 +620,14 @@ def prep(args): def pull(args): try: - pyfedpkg.pull() + pyfedpkg.pull(path=args.path) except pyfedpkg.FedpkgError, e: log.error('Could not push: %s' % e) sys.exit(1) def push(args): try: - pyfedpkg.push() + pyfedpkg.push(path=args.path) except pyfedpkg.FedpkgError, e: log.error('Could not push: %s' % e) sys.exit(1) -- cgit From e60a98b0969a729178202bc63668758aea0773d1 Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Mon, 20 Sep 2010 14:08:14 -0700 Subject: Include path to clog --- src/fedpkg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/fedpkg.py') diff --git a/src/fedpkg.py b/src/fedpkg.py index 04b8073..a6bab26 100755 --- a/src/fedpkg.py +++ b/src/fedpkg.py @@ -448,7 +448,7 @@ def commit(args): except pyfedpkg.FedpkgError, e: log.error('coult not create clog: %s' % e) sys.exit(1) - args.file = os.path.abspath('clog') + args.file = os.path.abspath(self.path.join(args.path, 'clog')) try: pyfedpkg.commit(args.path, args.message, args.file, args.files) except pyfedpkg.FedpkgError, e: -- cgit From b9c57959f458a3e3265bb4eace245a46526d031a Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Mon, 20 Sep 2010 14:12:55 -0700 Subject: Fix up commit with tag changes Don't use getnvr, and use existing reference to clog file --- src/fedpkg.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/fedpkg.py') diff --git a/src/fedpkg.py b/src/fedpkg.py index a6bab26..faaa23e 100755 --- a/src/fedpkg.py +++ b/src/fedpkg.py @@ -458,11 +458,9 @@ def commit(args): try: if not mymodule: mymodule = pyfedpkg.PackageModule(args.path) - tagname = mymodule.getnvr() + tagname = mymodule.nvr() filename = args.file - if args.clog: - filename = 'clog' - pyfedpkg.add_tag(tagname, True, args.message, filename) + pyfedpkg.add_tag(tagname, True, args.message, args.file) except pyfedpkg.FedpkgError, e: log.error('Coult not create a tag: %s' % e) sys.exit(1) -- cgit From 3aba12fd7b1805e6e88eedaad9cd82f25f6da84e Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Mon, 20 Sep 2010 14:14:00 -0700 Subject: Remove unused variable --- src/fedpkg.py | 1 - 1 file changed, 1 deletion(-) (limited to 'src/fedpkg.py') diff --git a/src/fedpkg.py b/src/fedpkg.py index faaa23e..b99d2d4 100755 --- a/src/fedpkg.py +++ b/src/fedpkg.py @@ -459,7 +459,6 @@ def commit(args): if not mymodule: mymodule = pyfedpkg.PackageModule(args.path) tagname = mymodule.nvr() - filename = args.file pyfedpkg.add_tag(tagname, True, args.message, args.file) except pyfedpkg.FedpkgError, e: log.error('Coult not create a tag: %s' % e) -- cgit From 789d7dcf0527db2339110e6047c525a9486fba2c Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Mon, 20 Sep 2010 14:15:46 -0700 Subject: Minor fixes for lint -i changes --- src/fedpkg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/fedpkg.py') diff --git a/src/fedpkg.py b/src/fedpkg.py index b99d2d4..6b6477d 100755 --- a/src/fedpkg.py +++ b/src/fedpkg.py @@ -1017,7 +1017,7 @@ packages will be built sequentially. parser_lint.add_argument('--info', '-i', default = False, action = 'store_true', - help = 'Display explainations for reported messages') + help = 'Display explanations for reported messages') parser_lint.set_defaults(command = lint) # Build locally -- cgit From bfbb12faf3124c8f4a4729dd55ac13c2dcb98f8f Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Mon, 20 Sep 2010 14:19:52 -0700 Subject: Fix up the diff changes from jochen --- src/fedpkg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/fedpkg.py') diff --git a/src/fedpkg.py b/src/fedpkg.py index 6b6477d..48fb1d4 100755 --- a/src/fedpkg.py +++ b/src/fedpkg.py @@ -482,7 +482,7 @@ def compile(args): def diff(args): try: - return mymodule.diff(args.path, args.cached, args.files) + return pyfedpkg.diff(args.path, args.cached, args.files) except pyfedpkg.FedpkgError, e: log.error('Could not diff: %s' % e) sys.exit(1) -- cgit