[createrepo] update to latest HEAD
Zdeněk Pavlas
zpavlas at fedoraproject.org
Wed Apr 17 15:15:23 UTC 2013
commit c40d75c27f1df27c7635f06ff6c9d8327e5e83fb
Author: Zdenek Pavlas <zpavlas at redhat.com>
Date: Wed Apr 17 17:15:13 2013 +0200
update to latest HEAD
createrepo-head.patch | 194 ++++++++++++++++++++++++++++++++++++++-----------
createrepo.spec | 17 ++++-
2 files changed, 165 insertions(+), 46 deletions(-)
---
diff --git a/createrepo-head.patch b/createrepo-head.patch
index c43f145..f478085 100644
--- a/createrepo-head.patch
+++ b/createrepo-head.patch
@@ -37,10 +37,10 @@ index 60bb9db..0b5738b 100644
$(MAKE) -C $$subdir install VERSION=$(VERSION) PKGNAME=$(PKGNAME); \
done
diff --git a/createrepo.bash b/createrepo.bash
-index 54ac8b2..f5a8bb7 100644
+index 54ac8b2..14b43d8 100644
--- a/createrepo.bash
+++ b/createrepo.bash
-@@ -1,11 +1,17 @@
+@@ -1,11 +1,22 @@
# bash completion for createrepo and friends
+_cr_compress_type()
@@ -49,6 +49,11 @@ index 54ac8b2..f5a8bb7 100644
+ | sed -ne 's/,/ /g' -ne 's/.*[Cc]ompression.*://p' )" -- "$2" ) )
+}
+
++_cr_checksum_type()
++{
++ COMPREPLY=( $( compgen -W 'md5 sha1 sha256 sha512' -- "$1" ) )
++}
++
_cr_createrepo()
{
COMPREPLY=()
@@ -59,7 +64,18 @@ index 54ac8b2..f5a8bb7 100644
--revision|-x|--excludes|--changelog-limit|--max-delta-rpm-size)
return 0
;;
-@@ -30,10 +36,24 @@ _cr_createrepo()
+@@ -18,8 +29,8 @@ _cr_createrepo()
+ COMPREPLY=( $( compgen -f -o plusdirs -X '!*.xml' -- "$2" ) )
+ return 0
+ ;;
+- -s|--sumtype)
+- COMPREPLY=( $( compgen -W 'md5 sha1 sha256 sha512' -- "$2" ) )
++ -s|--checksum)
++ _cr_checksum_type "$2"
+ return 0
+ ;;
+ -i|--pkglist|--read-pkgs-list)
+@@ -30,10 +41,24 @@ _cr_createrepo()
COMPREPLY=( $( compgen -f -o plusdirs -X '!*.rpm' -- "$2" ) )
return 0
;;
@@ -84,7 +100,7 @@ index 54ac8b2..f5a8bb7 100644
esac
if [[ $2 == -* ]] ; then
-@@ -42,9 +62,9 @@ _cr_createrepo()
+@@ -42,9 +67,9 @@ _cr_createrepo()
--cachedir --checkts --no-database --update --update-md-path
--skip-stat --split --pkglist --includepkg --outputdir
--skip-symlinks --changelog-limit --unique-md-filenames
@@ -97,7 +113,7 @@ index 54ac8b2..f5a8bb7 100644
else
COMPREPLY=( $( compgen -d -- "$2" ) )
fi
-@@ -63,10 +83,14 @@ _cr_mergerepo()
+@@ -63,10 +88,14 @@ _cr_mergerepo()
COMPREPLY=( $( compgen -d -- "$2" ) )
return 0
;;
@@ -113,7 +129,7 @@ index 54ac8b2..f5a8bb7 100644
} &&
complete -F _cr_mergerepo -o filenames mergerepo mergerepo.py
-@@ -78,17 +102,22 @@ _cr_modifyrepo()
+@@ -78,17 +107,27 @@ _cr_modifyrepo()
--version|-h|--help|--mdtype)
return 0
;;
@@ -121,12 +137,17 @@ index 54ac8b2..f5a8bb7 100644
+ _cr_compress_type "" "$2"
+ return 0
+ ;;
++ -s|--checksum)
++ _cr_checksum_type "$2"
++ return 0
++ ;;
esac
if [[ $2 == -* ]] ; then
- COMPREPLY=( $( compgen -W '--version --help --mdtype' -- "$2" ) )
+ COMPREPLY=( $( compgen -W '--version --help --mdtype --remove
-+ --compress --compress-type' -- "$2" ) )
++ --compress --no-compress --compress-type --checksum
++ --unique-md-filenames --simple-md-filenames' -- "$2" ) )
return 0
fi
@@ -139,32 +160,37 @@ index 54ac8b2..f5a8bb7 100644
fi
done
diff --git a/createrepo.spec b/createrepo.spec
-index 1e491cd..cdd8b6f 100644
+index 1e491cd..9a2179b 100644
--- a/createrepo.spec
+++ b/createrepo.spec
-@@ -1,4 +1,10 @@
+@@ -1,5 +1,17 @@
%{!?python_sitelib: %define python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
+
++%if ! 0%{?rhel}
++# we don't have this in rhel yet...
++BuildRequires: bash-completion
++%endif
++
+# disable broken /usr/lib/rpm/brp-python-bytecompile
+%define __os_install_post %{nil}
+%define compdir %(pkg-config --variable=completionsdir bash-completion)
+%if "%{compdir}" == ""
+%define compdir "/etc/bash_completion.d"
+%endif
-
++
Summary: Creates a common metadata repository
Name: createrepo
-@@ -10,8 +16,9 @@ Source: %{name}-%{version}.tar.gz
- URL: http://createrepo.baseurl.org/
+ Version: 0.9.9
+@@ -11,7 +23,7 @@ URL: http://createrepo.baseurl.org/
BuildRoot: %{_tmppath}/%{name}-%{version}root
BuildArchitectures: noarch
-+BuildRequires: bash-completion
Requires: python >= 2.1, rpm-python, rpm >= 0:4.1.1, libxml2-python
-Requires: yum-metadata-parser, yum >= 3.2.29, python-deltarpm
+Requires: yum-metadata-parser, yum >= 3.2.29, python-deltarpm, pyliblzma
%description
This utility will generate a common metadata repository from a directory of
-@@ -32,7 +39,7 @@ make DESTDIR=$RPM_BUILD_ROOT sysconfdir=%{_sysconfdir} install
+@@ -32,7 +44,7 @@ make DESTDIR=$RPM_BUILD_ROOT sysconfdir=%{_sysconfdir} install
%defattr(-, root, root)
%dir %{_datadir}/%{name}
%doc ChangeLog README COPYING COPYING.lib
@@ -173,7 +199,7 @@ index 1e491cd..cdd8b6f 100644
%{_datadir}/%{name}/*
%{_bindir}/%{name}
%{_bindir}/modifyrepo
-@@ -43,6 +50,9 @@ make DESTDIR=$RPM_BUILD_ROOT sysconfdir=%{_sysconfdir} install
+@@ -43,6 +55,9 @@ make DESTDIR=$RPM_BUILD_ROOT sysconfdir=%{_sysconfdir} install
%{python_sitelib}/createrepo
%changelog
@@ -1412,10 +1438,28 @@ index ac06196..f87ac6d 100644
except:
pass
diff --git a/docs/createrepo.8 b/docs/createrepo.8
-index e3c4c3b..ff359de 100644
+index e3c4c3b..eefd4bf 100644
--- a/docs/createrepo.8
+++ b/docs/createrepo.8
-@@ -53,7 +53,8 @@ gullible).
+@@ -37,6 +37,10 @@ cache of checksums of packages in the repository. In consecutive runs of
+ createrepo over the same repository of files that do not have a complete
+ change out of all packages this decreases the processing time dramatically.
+ .br
++.IP "\fB\--basedir\fP"
++Basedir for path to directories in the repodata, default is the current working
++directory.
++.br
+ .IP "\fB\--update\fP"
+ If metadata already exists in the outputdir and an rpm is unchanged
+ (based on file size and mtime) since the metadata was generated, reuse
+@@ -49,11 +53,15 @@ skip the stat() call on a --update, assumes if the filename is the same
+ then the file is still the same (only use this if you're fairly trusting or
+ gullible).
+ .br
++.IP "\fB\--update-md-path\fP"
++Use the existing repodata for --update, from this path.
++.br
+ .IP "\fB\-C --checkts\fP"
Don't generate repo metadata, if their timestamps are newer than its rpms.
This option decreases the processing time drastically again, if you happen
to run it on an unmodified repo, but it is (currently) mutual exclusive
@@ -1425,7 +1469,27 @@ index e3c4c3b..ff359de 100644
.br
.IP "\fB\--split\fP"
Run in split media mode. Rather than pass a single directory, take a set of
-@@ -104,7 +105,16 @@ Tells createrepo to generate deltarpms and the delta metadata
+@@ -61,7 +69,7 @@ directories corresponding to different volumes in a media set.
+ .br
+ .IP "\fB\-p --pretty\fP"
+ Output xml files in pretty format.
+-.IP "\fB\-V --version\fP"
++.IP "\fB\--version\fP"
+ Output version.
+ .IP "\fB\-h --help\fP"
+ Show help menu.
+@@ -89,6 +97,10 @@ Include the file's checksum in the metadata filename, helps HTTP caching (defaul
+ .IP "\fB\--simple-md-filenames\fP"
+ Do not include the file's checksum in the metadata filename.
+
++.IP "\fB\--retain-old-md\fP"
++Keep around the latest (by timestamp) N copies of the old repodata (so clients
++with older repomd.xml files can still access it). Default is 0.
++
+ .IP "\fB\--distro\fP"
+ Specify distro tags. Can be specified more than once. Optional syntax specifying a
+ cpeid(http://cpe.mitre.org/) --distro=cpeid,distrotag
+@@ -104,7 +116,16 @@ Tells createrepo to generate deltarpms and the delta metadata
paths to look for older pkgs to delta against. Can be specified multiple times
.IP "\fB\--num-deltas\fP int"
the number of older versions to make deltas against. Defaults to 1
@@ -1444,9 +1508,18 @@ index e3c4c3b..ff359de 100644
.SH "EXAMPLES"
Here is an example of a repository with a groups file. Note that the
diff --git a/genpkgmetadata.py b/genpkgmetadata.py
-index 8c98191..c46e441 100755
+index 8c98191..4528bf2 100755
--- a/genpkgmetadata.py
+++ b/genpkgmetadata.py
+@@ -22,7 +22,7 @@
+ import os
+ import sys
+ import re
+-from optparse import OptionParser
++from optparse import OptionParser,SUPPRESS_HELP
+ import time
+
+ import createrepo
@@ -37,6 +37,12 @@ def parse_args(args, conf):
Sanity check all the things being passed in.
"""
@@ -1460,10 +1533,19 @@ index 8c98191..c46e441 100755
_def = yum.misc._default_checksums[0]
_avail = yum.misc._available_checksums
parser = OptionParser(version = "createrepo %s" % createrepo.__version__)
-@@ -100,6 +106,8 @@ def parse_args(args, conf):
- parser.add_option("--simple-md-filenames", dest="simple_md_filenames",
- help="do not include the file's checksum in the filename, helps with proxies",
- default=False, action="store_true")
+@@ -95,11 +101,13 @@ def parse_args(args, conf):
+ parser.add_option("--changelog-limit", dest="changelog_limit",
+ default=None, help="only import the last N changelog entries")
+ parser.add_option("--unique-md-filenames", dest="unique_md_filenames",
+- help="include the file's checksum in the filename, helps with proxies",
++ help="include the file's checksum in the filename, helps with proxies (default)",
+ default=True, action="store_true")
+- parser.add_option("--simple-md-filenames", dest="simple_md_filenames",
+- help="do not include the file's checksum in the filename, helps with proxies",
+- default=False, action="store_true")
++ parser.add_option("--simple-md-filenames", dest="unique_md_filenames",
++ help="do not include the file's checksum in the filename",
++ action="store_false")
+ parser.add_option("--retain-old-md", default=0, type='int', dest='retain_old_md',
+ help="keep around the latest (by timestamp) N copies of the old repodata")
parser.add_option("--distro", default=[], action="append",
@@ -1480,7 +1562,7 @@ index 8c98191..c46e441 100755
help="number of workers to spawn to read rpms")
+ parser.add_option("--xz", default=False,
+ action="store_true",
-+ help="use xz for repodata compression")
++ help=SUPPRESS_HELP)
+ parser.add_option("--compress-type", default='compat', dest="compress_type",
+ help="which compression type to use")
+
@@ -1497,8 +1579,13 @@ index 8c98191..c46e441 100755
if opts.sumtype == 'sha1':
errorprint(_('Warning: It is more compatible to use sha instead of sha1'))
-@@ -155,6 +171,11 @@ def parse_args(args, conf):
-
+@@ -150,11 +166,13 @@ def parse_args(args, conf):
+ errorprint(_('--split and --checkts options are mutually exclusive'))
+ sys.exit(1)
+
+- if opts.simple_md_filenames:
+- opts.unique_md_filenames = False
+-
if opts.nodatabase:
opts.database = False
+
@@ -1509,7 +1596,7 @@ index 8c98191..c46e441 100755
# let's switch over to using the conf object - put all the opts into it
for opt in parser.option_list:
-@@ -240,6 +261,7 @@ def main(args):
+@@ -240,6 +258,7 @@ def main(args):
if mdgen.checkTimeStamps():
if mdgen.conf.verbose:
print _('repo is up to date')
@@ -1559,7 +1646,7 @@ index 05e5f5e..80cb1a8 100755
if __name__ == "__main__":
main(sys.argv[1:])
diff --git a/modifyrepo.py b/modifyrepo.py
-index 17094a4..acdde77 100755
+index 17094a4..bffe99a 100755
--- a/modifyrepo.py
+++ b/modifyrepo.py
@@ -1,11 +1,15 @@
@@ -1594,16 +1681,16 @@ index 17094a4..acdde77 100755
from yum.misc import checksum
from yum.repoMDObject import RepoMD, RepoMDError, RepoData
-@@ -39,6 +45,8 @@ class RepoMetadata:
+@@ -38,7 +44,7 @@ class RepoMetadata:
+ """ Parses the repomd.xml file existing in the given repo directory. """
self.repodir = os.path.abspath(repo)
self.repomdxml = os.path.join(self.repodir, 'repomd.xml')
- self.checksum_type = 'sha256'
-+ self.compress = False
+- self.checksum_type = 'sha256'
+ self.compress_type = _available_compression[-1] # best available
if not os.path.exists(self.repomdxml):
raise MDError, '%s not found' % self.repomdxml
-@@ -49,6 +57,35 @@ class RepoMetadata:
+@@ -49,6 +55,35 @@ class RepoMetadata:
except RepoMDError, e:
raise MDError, 'Could not parse %s' % self.repomdxml
@@ -1639,7 +1726,7 @@ index 17094a4..acdde77 100755
def add(self, metadata, mdtype=None):
""" Insert arbitrary metadata into this repository.
-@@ -63,8 +100,8 @@ class RepoMetadata:
+@@ -63,8 +98,8 @@ class RepoMetadata:
mdname = 'updateinfo.xml'
elif isinstance(metadata, str):
if os.path.exists(metadata):
@@ -1650,7 +1737,7 @@ index 17094a4..acdde77 100755
else:
oldmd = file(metadata, 'r')
md = oldmd.read()
-@@ -75,14 +112,19 @@ class RepoMetadata:
+@@ -75,27 +110,32 @@ class RepoMetadata:
else:
raise MDError, 'invalid metadata type'
@@ -1661,7 +1748,7 @@ index 17094a4..acdde77 100755
- if not mdtype:
- mdtype = mdname.split('.')[0]
-
-+ if self.compress or not mdname.split('.')[-1] in ('gz', 'bz2', 'xz'):
++ if self.compress and mdname.split('.')[-1] not in ('gz', 'bz2', 'xz'):
+ do_compress = True
+ mdname += '.' + self.compress_type
+ mdtype = self._get_mdtype(mdname, mdtype)
@@ -1676,8 +1763,13 @@ index 17094a4..acdde77 100755
newmd.write(md)
newmd.close()
print "Wrote:", destmd
-@@ -91,11 +133,8 @@ class RepoMetadata:
- csum, destmd = checksum_and_rename(destmd, self.checksum_type)
+
+ open_csum = checksum(self.checksum_type, metadata)
+- csum, destmd = checksum_and_rename(destmd, self.checksum_type)
++ if self.unique_md_filenames:
++ csum, destmd = checksum_and_rename(destmd, self.checksum_type)
++ else:
++ csum = checksum(self.checksum_type, destmd)
base_destmd = os.path.basename(destmd)
-
@@ -1690,7 +1782,7 @@ index 17094a4..acdde77 100755
new_rd = RepoData()
new_rd.type = mdtype
-@@ -103,20 +142,30 @@ class RepoMetadata:
+@@ -103,20 +143,30 @@ class RepoMetadata:
new_rd.checksum = (self.checksum_type, csum)
new_rd.openchecksum = (self.checksum_type, open_csum)
new_rd.size = str(os.stat(destmd).st_size)
@@ -1734,30 +1826,44 @@ index 17094a4..acdde77 100755
def main(args):
-@@ -124,7 +173,13 @@ def main(args):
+@@ -124,7 +174,23 @@ def main(args):
# query options
parser.add_option("--mdtype", dest='mdtype',
help="specific datatype of the metadata, will be derived from the filename if not specified")
- parser.usage = "modifyrepo [options] <input_metadata> <output repodata>"
+ parser.add_option("--remove", action="store_true",
+ help="remove specified file from repodata")
-+ parser.add_option("--compress", action="store_true", default=False,
-+ help="compress the new repodata before adding it to the repo")
++ parser.add_option("--compress", action="store_true", default=True,
++ help="compress the new repodata before adding it to the repo (default)")
++ parser.add_option("--no-compress", action="store_false", dest="compress",
++ help="do not compress the new repodata before adding it to the repo")
+ parser.add_option("--compress-type", dest='compress_type', default='gz',
+ help="compression format to use")
++ parser.add_option("-s", "--checksum", default='sha256', dest='sumtype',
++ help="specify the checksum type to use (default: sha256)")
++ parser.add_option("--unique-md-filenames", dest="unique_md_filenames",
++ help="include the file's checksum in the filename, helps with proxies (default)",
++ default=True, action="store_true")
++ parser.add_option("--simple-md-filenames", dest="unique_md_filenames",
++ help="do not include the file's checksum in the filename",
++ action="store_false")
+ parser.usage = "modifyrepo [options] [--remove] <input_metadata> <output repodata>"
(opts, argsleft) = parser.parse_args(args)
if len(argsleft) != 2:
-@@ -137,11 +192,28 @@ def main(args):
+@@ -137,11 +203,32 @@ def main(args):
except MDError, e:
print "Could not access repository: %s" % str(e)
return 1
+
+
++ repomd.checksum_type = opts.sumtype
++ repomd.unique_md_filenames = opts.unique_md_filenames
+ repomd.compress = opts.compress
-+ if opts.compress_type in _available_compression:
-+ repomd.compress_type = opts.compress_type
++ if opts.compress_type not in _available_compression:
++ print "Compression %s not available: Please choose from: %s" % (opts.compress_type, ', '.join(_available_compression))
++ return 1
++ repomd.compress_type = opts.compress_type
+
+ # remove
+ if opts.remove:
diff --git a/createrepo.spec b/createrepo.spec
index 71b8fbf..931328e 100644
--- a/createrepo.spec
+++ b/createrepo.spec
@@ -1,4 +1,10 @@
%{!?python_sitelib: %define python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
+
+%if ! 0%{?rhel}
+# we don't have this in rhel yet...
+BuildRequires: bash-completion
+%endif
+
# disable broken /usr/lib/rpm/brp-python-bytecompile
%define __os_install_post %{nil}
%define compdir %(pkg-config --variable=completionsdir bash-completion)
@@ -9,7 +15,7 @@
Summary: Creates a common metadata repository
Name: createrepo
Version: 0.9.9
-Release: 20%{?dist}
+Release: 21%{?dist}
License: GPLv2
Group: System Environment/Base
Source: %{name}-%{version}.tar.gz
@@ -18,7 +24,6 @@ Patch1: ten-changelog-limit.patch
URL: http://createrepo.baseurl.org/
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArchitectures: noarch
-BuildRequires: bash-completion
Requires: python >= 2.1, rpm-python, rpm >= 4.1.1, libxml2-python
Requires: yum-metadata-parser, yum >= 3.4.3-4, python-deltarpm, deltarpm, pyliblzma
BuildRequires: python
@@ -54,6 +59,14 @@ rm -rf $RPM_BUILD_ROOT
%{python_sitelib}/createrepo
%changelog
+* Wed Apr 17 2013 Zdenek Pavlas <zpavlas at redhat.com> - 0.9.9-21
+- update to latest HEAD
+- don't BuildRequire bash-completion in rhel
+- Fail for bad compress-type options to modifyrepo, like createrepo. BZ 886589
+- Fix options documentation. BZ 892657.
+- modifyrepo: fix --compress option bug. BZ 950724
+- modifyrepo: add --checksum and --{unique,simple}-md-filenames options
+
* Thu Mar 28 2013 Zdenek Pavlas <zpavlas at redhat.com> - 0.9.9-20
- package also %{compdir}'s parent
More information about the scm-commits
mailing list