[Rpm-metadata] 3 commits - createrepo.spec genpkgmetadata.py Makefile modifyrepo.py

zpavlas at osuosl.org zpavlas at osuosl.org
Fri Apr 5 13:27:43 UTC 2013


 Makefile          |    8 ++++++--
 createrepo.spec   |    9 ++++++++-
 genpkgmetadata.py |   11 ++++-------
 modifyrepo.py     |   16 ++++++++++++++--
 4 files changed, 32 insertions(+), 12 deletions(-)

New commits:
commit df2aa15487a497d69b00578be671f885efc8ffa2
Author: Zdenek Pavlas <zpavlas at redhat.com>
Date:   Fri Apr 5 15:26:16 2013 +0200

    modifyrepo: add --checksum and --{unique,simple}-md-filenames options

diff --git a/modifyrepo.py b/modifyrepo.py
index acdde77..b6129b7 100755
--- a/modifyrepo.py
+++ b/modifyrepo.py
@@ -44,7 +44,6 @@ 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.compress_type = _available_compression[-1] # best available
 
@@ -130,7 +129,10 @@ class RepoMetadata:
         print "Wrote:", destmd
 
         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)
 
         # Remove any stale metadata
@@ -179,6 +181,14 @@ def main(args):
                       help="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)
@@ -194,6 +204,8 @@ def main(args):
         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
commit e38425374bf3c0bc15c3fdf6181688625e59d433
Author: Zdenek Pavlas <zpavlas at redhat.com>
Date:   Fri Apr 5 15:12:46 2013 +0200

    Get rid of useless opts.simple_md_filenames option, update help.

diff --git a/genpkgmetadata.py b/genpkgmetadata.py
index c46e441..09bcba4 100755
--- a/genpkgmetadata.py
+++ b/genpkgmetadata.py
@@ -101,11 +101,11 @@ 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",
@@ -166,9 +166,6 @@ 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
     
commit 3d978def63bd955b94fe9de68426c1655e8c93d4
Author: Zdenek Pavlas <zpavlas at redhat.com>
Date:   Tue Mar 19 10:00:01 2013 +0100

    move bash-completion scripts to /usr/share/  BZ 923001

diff --git a/Makefile b/Makefile
index 60bb9db..0b5738b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,5 @@
 PKGNAME = createrepo
+ALIASES = mergerepo modifyrepo genpkgmetadata.py mergerepo.py modifyrepo.py
 VERSION=$(shell awk '/Version:/ { print $$2 }' ${PKGNAME}.spec)
 RELEASE=$(shell awk '/Release:/ { print $$2 }' ${PKGNAME}.spec)
 CVSTAG=createrepo-$(subst .,_,$(VERSION)-$(RELEASE))
@@ -26,6 +27,8 @@ docdir =
 includedir = ${prefix}/include
 oldincludedir = /usr/include
 mandir = ${prefix}/share/man
+compdir = $(shell pkg-config --variable=completionsdir bash-completion)
+compdir := $(or $(compdir), "/etc/bash_completion.d")
 
 pkgdatadir = $(datadir)/$(PKGNAME)
 pkglibdir = $(libdir)/$(PKGNAME)
@@ -33,7 +36,7 @@ pkgincludedir = $(includedir)/$(PKGNAME)
 top_builddir = 
 
 # all dirs
-DIRS = $(DESTDIR)$(bindir) $(DESTDIR)$(sysconfdir)/bash_completion.d \
+DIRS = $(DESTDIR)$(bindir) $(DESTDIR)$(compdir) \
 	$(DESTDIR)$(pkgdatadir) $(DESTDIR)$(mandir)
 
 
@@ -65,7 +68,8 @@ check:
 
 install: all installdirs
 	$(INSTALL_MODULES) $(srcdir)/$(MODULES) $(DESTDIR)$(pkgdatadir)
-	$(INSTALL_DATA) $(PKGNAME).bash $(DESTDIR)$(sysconfdir)/bash_completion.d
+	$(INSTALL_DATA) $(PKGNAME).bash $(DESTDIR)$(compdir)/$(PKGNAME)
+	(cd $(DESTDIR)$(compdir); for n in $(ALIASES); do ln -s $(PKGNAME) $$n; done)
 	for subdir in $(SUBDIRS) ; do \
 	  $(MAKE) -C $$subdir install VERSION=$(VERSION) PKGNAME=$(PKGNAME); \
 	done
diff --git a/createrepo.spec b/createrepo.spec
index eea7092..cdd8b6f 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()")}
+# 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,6 +16,7 @@ Source: %{name}-%{version}.tar.gz
 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, pyliblzma
 
@@ -32,7 +39,7 @@ make DESTDIR=$RPM_BUILD_ROOT sysconfdir=%{_sysconfdir} install
 %defattr(-, root, root)
 %dir %{_datadir}/%{name}
 %doc ChangeLog README COPYING COPYING.lib
-%{_sysconfdir}/bash_completion.d/
+%(dirname %{compdir})
 %{_datadir}/%{name}/*
 %{_bindir}/%{name}
 %{_bindir}/modifyrepo


More information about the Rpm-metadata mailing list