Trivial createrepo fixes
Ville Skyttä <[email protected]>
| Newsgroups | gmane.linux.rpm.metadata |
|---|---|
| Message-ID | <[email protected]> |
Here's a couple of trivial createrepo fixes, inspired by: $ createrepo --version Error: Only one directory allowed per run. [Usage message here] The patch fixes --help and --version to work the way I assume they were intended to be (not the prettiest way to fix 'em though), improves a couple of error messages and fixes the exit code of --help. BTW, I didn't find a createrepo/metadata component in https://devel.linux.duke.edu/bugzilla/ ... _______________________________________________ Rpm-metadata mailing list [email protected] https://lists.dulug.duke.edu/mailman/listinfo/rpm-metadata
genpkgmd-nits.patch
(text/x-patch, 2 KB)
Index: genpkgmetadata.py
===================================================================
RCS file: /cvsroot/metadata/cvs-root/generate/genpkgmetadata.py,v
retrieving revision 1.30
diff -a -u -r1.30 genpkgmetadata.py
--- genpkgmetadata.py 30 Sep 2004 05:54:42 -0000 1.30
+++ genpkgmetadata.py 3 Oct 2004 20:02:36 -0000
@@ -42,7 +42,7 @@
"""Stub function for translation"""
return args
-def usage():
+def usage(retval=1):
print _("""
createrepo [options] directory-of-packages
@@ -58,7 +58,7 @@
-p, --pretty = output xml files in pretty format.
""")
- sys.exit(1)
+ sys.exit(retval)
def getFileList(path, ext, filelist):
@@ -170,9 +170,18 @@
except getopt.error, e:
errorprint(_('Options Error: %s.') % e)
usage()
+
+ # check for --version and --help here to survive the dir sanity check below
+ for arg, a in gopts:
+ if arg in ['-h','--help']:
+ usage(0)
+ if arg in ['-V','--version']:
+ print '%s' % __version__
+ sys.exit(0)
+
# make sure our dir makes sense before we continue
if len(argsleft) != 1:
- errorprint(_('Error: Only one directory allowed per run.'))
+ errorprint(_('Error: Exactly one directory allowed/needed per run.'))
usage()
else:
directory = argsleft[0]
@@ -181,9 +190,6 @@
for arg,a in gopts:
if arg in ['-h','--help']:
usage()
- elif arg in ['-V', '--version']:
- print '%s' % __version__
- sys.exit(0)
elif arg == '-v':
cmds['verbose'] = 1
elif arg == "-q":
@@ -210,7 +216,7 @@
cmds['pretty'] = 1
elif arg in ['-s', '--checksum']:
if a not in ['md5', 'sha']:
- errorprint(_('Error: checksums are: md5 or sha.'))
+ errorprint(_('Error: valid checksums types are: sha, md5.'))
usage()
else:
cmds['sumtype'] = a