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.bash | 8 ++++++- src/fedpkg.py | 61 +++++++++++++++++++++++++++++++++++++++++++++++- src/pyfedpkg/__init__.py | 49 +++++++++++++++++++++++++++++++++++--- 3 files changed, 113 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/fedpkg.bash b/src/fedpkg.bash index aab9ce2..8c81ccc 100644 --- a/src/fedpkg.bash +++ b/src/fedpkg.bash @@ -37,7 +37,7 @@ _fedpkg() local options_value="-u --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 push scratch-build sources srpm \ - switch-branch tag-request unused-patches update upload verrel" + switch-branch tag tag-request unused-patches update upload verrel" # parse main options and get command @@ -148,6 +148,12 @@ _fedpkg() sources) options_dir="--outdir" ;; + tag) + options="--clog -c --force -f --list -l --delete -d" + options_string="--message -m" + options_file="--file -F" + after_more=true + ;; srpm) options="--md5" ;; 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') diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py index 5991fce..c975afc 100644 --- a/src/pyfedpkg/__init__.py +++ b/src/pyfedpkg/__init__.py @@ -311,6 +311,23 @@ def _srpmdetails(srpm): return((name, files, uploadfiles)) +def add_tag(tagname, force=False, message=None, file=None): + """Add a git tag to the repository""" + cmd = ['git', 'tag'] + cmd.extend(['-a']) + # force tag creation, if tag already exists + if force: + cmd.extend(['-f']) + # Description for the tag + if message: + cmd.extend(['-m', message]) + elif file: + cmd.extend(['-F', os.path.abspath(file)]) + cmd.append(tagname) + # make it so + _run_command(cmd) + log.info ('Tag \'%s\' was created' % tagname) + def clean(dry=False, useignore=True): """Clean a module checkout of untracked files. @@ -331,7 +348,7 @@ def clean(dry=False, useignore=True): # Run it! _run_command(cmd) return - + def clone(module, user, path=None, branch=None, bare_dir=None): """Clone a repo, optionally check out a specific branch. @@ -479,6 +496,18 @@ def commit(path=None, message=None, file=None, files=[]): _run_command(cmd, cwd=path) return +def delete_tag(tagname=None): + """Delete a git tag from the repository + """ + + if not tagname: + raise fedpkgError('Please specified a tagname') + cmd = ['git', 'tag'] + cmd.extend(['-d']) + cmd.extend(tagname) + _run_command(cmd) + log.info ('Tag %s was deleted' % ', '.join(delete)) + def get_latest_commit(module): """Discover the latest commit has for a given module and return it""" @@ -582,6 +611,17 @@ def import_srpm(srpm, path=None): os.chdir(oldpath) return(uploadfiles) +def list_tag(tagname=None): + """Create a list of all tags in the repository which mathe a given pattern. + if list == '*' all tags will been shown. + """ + cmd = ['git', 'tag'] + cmd.extend(['-l']) + if not tagname == '*': + cmd.extend([tagname]) + # make it so + _run_command(cmd) + def new(path=None): """Return changes in a repo since the last tag""" @@ -799,7 +839,6 @@ class Lookaside(object): raise FedpkgError('Lookaside failure. Check your cert.') curl.close() - class GitIgnore(object): """ Smaller wrapper for managing a .gitignore file and it's entries. """ @@ -966,7 +1005,7 @@ class PackageModule: self.hashtype = 'sha256' if self.branch.startswith('el5') or self.branch.startswith('el4'): self.hashtype = 'md5' - + def build(self, skip_tag=False, scratch=False, background=False, url=None, chain=None): """Initiate a build of the module. Available options are: @@ -1186,6 +1225,10 @@ class PackageModule: # Get just the output, then split it by space, grab the first return output[0].split()[0] + def getnvr(self): + """Return Name-Version-Release of a package""" + return self.nvr + def getrel(self): """Return the version-release of a package module.""" -- 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.bash | 2 +- src/fedpkg.py | 14 ++++++++++++++ src/pyfedpkg/__init__.py | 7 +++++++ 3 files changed, 22 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/fedpkg.bash b/src/fedpkg.bash index 8c81ccc..bb57b94 100644 --- a/src/fedpkg.bash +++ b/src/fedpkg.bash @@ -36,7 +36,7 @@ _fedpkg() local options="-h --help -v -q" local options_value="-u --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 push scratch-build sources srpm \ + import install lint local mockbuild new new-sources patch prep pull push scratch-build sources srpm \ switch-branch tag tag-request unused-patches update upload verrel" # parse main options and get command 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') diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py index c975afc..790cb93 100644 --- a/src/pyfedpkg/__init__.py +++ b/src/pyfedpkg/__init__.py @@ -1543,7 +1543,14 @@ class PackageModule: # Run the command _run_command(cmd, shell=True) return + + def pull(self): + """Pull changes from the main repository""" + cmd = ['git', 'pull'] + _run_command(cmd) + return + def push(self): """Push changes to the main 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 ++---- src/pyfedpkg/__init__.py | 28 ++++++++++++++-------------- 2 files changed, 16 insertions(+), 18 deletions(-) (limited to 'src') 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) diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py index 790cb93..a49f4ed 100644 --- a/src/pyfedpkg/__init__.py +++ b/src/pyfedpkg/__init__.py @@ -638,6 +638,20 @@ def new(path=None): log.debug('Diffing from tag %s' % tag) return repo.git.diff('-M', tag) +def pull(): + """Pull changes from the main repository""" + + cmd = ['git', 'pull'] + _run_command(cmd) + return + +def push(): + """Push changes to the main repository""" + + cmd = ['git', 'push'] + _run_command(cmd) + return + def sources(path, outdir=None): """Download source files""" @@ -1544,20 +1558,6 @@ class PackageModule: _run_command(cmd, shell=True) return - def pull(self): - """Pull changes from the main repository""" - - cmd = ['git', 'pull'] - _run_command(cmd) - return - - def push(self): - """Push changes to the main repository""" - - cmd = ['git', 'push'] - _run_command(cmd) - return - def srpm(self, hashtype=None): """Create an srpm using hashtype from content in the module -- 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.bash | 2 +- src/fedpkg.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/fedpkg.bash b/src/fedpkg.bash index bb57b94..9ec0f02 100644 --- a/src/fedpkg.bash +++ b/src/fedpkg.bash @@ -108,7 +108,7 @@ _fedpkg() after="package" ;; commit|ci) - options="--push -p" + options="--push -p --clog -c" options_string="--message -m" options_file="--file -F" after="file" 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.bash | 2 +- src/fedpkg.py | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/fedpkg.bash b/src/fedpkg.bash index 9ec0f02..300d0d6 100644 --- a/src/fedpkg.bash +++ b/src/fedpkg.bash @@ -108,7 +108,7 @@ _fedpkg() after="package" ;; commit|ci) - options="--push -p --clog -c" + options="--push -p --clog -c --tag -t" options_string="--message -m" options_file="--file -F" after="file" 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.bash | 3 +++ src/fedpkg.py | 6 +++++- src/pyfedpkg/__init__.py | 7 +++++-- 3 files changed, 13 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/fedpkg.bash b/src/fedpkg.bash index 300d0d6..7170637 100644 --- a/src/fedpkg.bash +++ b/src/fedpkg.bash @@ -128,6 +128,9 @@ _fedpkg() options_branch="--branch -b" after="srpm" ;; + lint) + options="--info -i" + ;; local) options="--md5" options_arch="--arch" 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 diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py index a49f4ed..2694cb7 100644 --- a/src/pyfedpkg/__init__.py +++ b/src/pyfedpkg/__init__.py @@ -1385,7 +1385,7 @@ class PackageModule: _run_command(cmd, shell=True) return - def lint(self): + def lint(self, info=False): """Run rpmlint over a built srpm Log the output and returns nothing @@ -1404,7 +1404,10 @@ class PackageModule: rpms.extend([os.path.join(self.path, arch, file) for file in os.listdir(os.path.join(self.path, arch)) if file.endswith('.rpm')]) - cmd = ['rpmlint', os.path.join(self.path, srpm)] + cmd = ['rpmlint'] + if info: + cmd.extend(['-i']) + cmd.extend([os.path.join(self.path, srpm)]) cmd.extend(rpms) # Run the command _run_command(cmd, shell=True) -- cgit From a86aa28ef548579a3d7e2f25df752cba65a1544e Mon Sep 17 00:00:00 2001 From: Jochen Schmitt Date: Thu, 16 Sep 2010 20:05:51 +0200 Subject: Distlinguish between new empty repositories and retiered packages Hello Jesse, I have add an test to distlinguish a new package in which a package should been imported form a package which is retired. Best Regards: Jochen Schmitt --- src/pyfedpkg/__init__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py index 2694cb7..9d0865b 100644 --- a/src/pyfedpkg/__init__.py +++ b/src/pyfedpkg/__init__.py @@ -1264,13 +1264,20 @@ class PackageModule: def gimmespec(self): """Return the name of a specfile within a package module""" + deadpackage = False + # Get a list of files in the path we're looking at files = os.listdir(self.path) # Search the files for the first one that ends with ".spec" for f in files: if f.endswith('.spec'): return f - raise FedpkgError('No spec file found.') + if f == 'dead.package': + deadpackage = True + if deadpackage: + raise FedpkgError('No spec file found. This package is retired') + else: + raise FedpkgError('No spec file found. Please import a new package') def giturl(self): """Return the git url that would be used for building""" -- 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 +-- src/pyfedpkg/__init__.py | 57 ++++++++++++++++++++++++------------------------ 2 files changed, 29 insertions(+), 31 deletions(-) (limited to 'src') 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) diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py index 9d0865b..cdcde24 100644 --- a/src/pyfedpkg/__init__.py +++ b/src/pyfedpkg/__init__.py @@ -508,6 +508,34 @@ def delete_tag(tagname=None): _run_command(cmd) log.info ('Tag %s was deleted' % ', '.join(delete)) +def diff(path, cached=False, files=[]): + """Excute a git diff + + optionally diff the cached or staged changes + + Takes an optional list of files to diff reletive to the module base + directory + + Logs the output and returns nothing + + """ + + # Things work better if we're in our module directory + oldpath = os.getcwd() + os.chdir(path) + # build up the command + cmd = ['git', 'diff'] + if cached: + cmd.append('--cached') + if files: + cmd.extend(files) + + # Run it! + _run_command(cmd) + # popd + os.chdir(oldpath) + return + def get_latest_commit(module): """Discover the latest commit has for a given module and return it""" @@ -1192,35 +1220,6 @@ class PackageModule: _run_command(cmd, shell=True) return - def diff(self, cached=False, files=[]): - """Excute a git diff - - optionally diff the cached or staged changes - - Takes an optional list of files to diff reletive to the module base - directory - - Logs the output and returns nothing - - """ - - # Things work better if we're in our module directory - oldpath = os.getcwd() - os.chdir(self.path) - - # build up the command - cmd = ['git', 'diff'] - if cached: - cmd.append('--cached') - if files: - cmd.extend(files) - - # Run it! - _run_command(cmd) - # popd - os.chdir(oldpath) - return - def getver(self): """Return the version-release of a package module.""" -- cgit From d8f7b38625aa55972a76ffef0beddf64cd4c788c Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Mon, 20 Sep 2010 13:24:27 -0700 Subject: Whitespace fix --- src/pyfedpkg/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py index cdcde24..e10bb97 100644 --- a/src/pyfedpkg/__init__.py +++ b/src/pyfedpkg/__init__.py @@ -326,7 +326,7 @@ def add_tag(tagname, force=False, message=None, file=None): cmd.append(tagname) # make it so _run_command(cmd) - log.info ('Tag \'%s\' was created' % tagname) + log.info('Tag \'%s\' was created' % tagname) def clean(dry=False, useignore=True): """Clean a module checkout of untracked files. -- cgit From 72531d43ecceaee02ac1f46a056ea6403ecc3ee4 Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Mon, 20 Sep 2010 13:27:39 -0700 Subject: Only list long options in bash completion for tag --- src/fedpkg.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/fedpkg.bash b/src/fedpkg.bash index 7170637..c04c424 100644 --- a/src/fedpkg.bash +++ b/src/fedpkg.bash @@ -152,7 +152,7 @@ _fedpkg() options_dir="--outdir" ;; tag) - options="--clog -c --force -f --list -l --delete -d" + options="--clog --force --list --delete" options_string="--message -m" options_file="--file -F" after_more=true -- 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') 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 7783646df117dab495ca6b5831a762cbebda73eb Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Mon, 20 Sep 2010 13:36:34 -0700 Subject: Fix up some contributed docstrings --- src/pyfedpkg/__init__.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py index e10bb97..6b9b6a1 100644 --- a/src/pyfedpkg/__init__.py +++ b/src/pyfedpkg/__init__.py @@ -312,7 +312,17 @@ def _srpmdetails(srpm): return((name, files, uploadfiles)) def add_tag(tagname, force=False, message=None, file=None): - """Add a git tag to the repository""" + """Add a git tag to the repository + + Takes a tagname + + Optionally can force the tag, include a message, + or reference a message file. + + Runs the tag command and returns nothing + + """ + cmd = ['git', 'tag'] cmd.extend(['-a']) # force tag creation, if tag already exists @@ -497,8 +507,7 @@ def commit(path=None, message=None, file=None, files=[]): return def delete_tag(tagname=None): - """Delete a git tag from the repository - """ + """Delete a git tag from the repository""" if not tagname: raise fedpkgError('Please specified a tagname') @@ -640,9 +649,12 @@ def import_srpm(srpm, path=None): return(uploadfiles) def list_tag(tagname=None): - """Create a list of all tags in the repository which mathe a given pattern. - if list == '*' all tags will been shown. + """Create a list of all tags in the repository which match a given tagname. + + if tagname == '*' all tags will been shown. + """ + cmd = ['git', 'tag'] cmd.extend(['-l']) if not tagname == '*': -- 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 +++--- src/pyfedpkg/__init__.py | 18 ++++++++---------- 2 files changed, 11 insertions(+), 13 deletions(-) (limited to 'src') 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') diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py index 6b9b6a1..9e15057 100644 --- a/src/pyfedpkg/__init__.py +++ b/src/pyfedpkg/__init__.py @@ -506,16 +506,14 @@ def commit(path=None, message=None, file=None, files=[]): _run_command(cmd, cwd=path) return -def delete_tag(tagname=None): - """Delete a git tag from the repository""" +def delete_tag(tagname, path=None): + """Delete a git tag from the repository found at optional path""" - if not tagname: - raise fedpkgError('Please specified a tagname') - cmd = ['git', 'tag'] - cmd.extend(['-d']) - cmd.extend(tagname) - _run_command(cmd) - log.info ('Tag %s was deleted' % ', '.join(delete)) + if not path: + path = os.getcwd() + cmd = ['git', 'tag', '-d', tagname] + _run_command(cmd, cwd=path) + log.info ('Tag %s was deleted' % tagname) def diff(path, cached=False, files=[]): """Excute a git diff @@ -657,7 +655,7 @@ def list_tag(tagname=None): cmd = ['git', 'tag'] cmd.extend(['-l']) - if not tagname == '*': + if tagname != '*': cmd.extend([tagname]) # make it so _run_command(cmd) -- 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') 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 ++-- src/pyfedpkg/__init__.py | 16 ++++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) (limited to 'src') 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) diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py index 9e15057..bb7449f 100644 --- a/src/pyfedpkg/__init__.py +++ b/src/pyfedpkg/__init__.py @@ -676,18 +676,22 @@ def new(path=None): log.debug('Diffing from tag %s' % tag) return repo.git.diff('-M', tag) -def pull(): - """Pull changes from the main repository""" +def pull(path=None): + """Pull changes from the main repository using optional path""" + if not path: + path = os.getcwd() cmd = ['git', 'pull'] - _run_command(cmd) + _run_command(cmd, cwd=path) return -def push(): - """Push changes to the main repository""" +def push(path=None): + """Push changes to the main repository using optional path""" + if not path: + path = os.getcwd() cmd = ['git', 'push'] - _run_command(cmd) + _run_command(cmd, cwd=path) return def sources(path, outdir=None): -- cgit From c726c445a0e2adcc0dccaba4ac49a7b617627ca5 Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Mon, 20 Sep 2010 14:08:01 -0700 Subject: No short options in commit completion --- src/fedpkg.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/fedpkg.bash b/src/fedpkg.bash index c04c424..76423f2 100644 --- a/src/fedpkg.bash +++ b/src/fedpkg.bash @@ -108,7 +108,7 @@ _fedpkg() after="package" ;; commit|ci) - options="--push -p --clog -c --tag -t" + options="--push --clog --tag" options_string="--message -m" options_file="--file -F" after="file" -- 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') 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') 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') 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.bash | 2 +- src/fedpkg.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/fedpkg.bash b/src/fedpkg.bash index 76423f2..45f6d35 100644 --- a/src/fedpkg.bash +++ b/src/fedpkg.bash @@ -129,7 +129,7 @@ _fedpkg() after="srpm" ;; lint) - options="--info -i" + options="--info" ;; local) options="--md5" 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 +- src/pyfedpkg/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') 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) diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py index bb7449f..df788cb 100644 --- a/src/pyfedpkg/__init__.py +++ b/src/pyfedpkg/__init__.py @@ -520,7 +520,7 @@ def diff(path, cached=False, files=[]): optionally diff the cached or staged changes - Takes an optional list of files to diff reletive to the module base + Takes an optional list of files to diff relative to the module base directory Logs the output and returns nothing -- cgit