From skvidal at osuosl.org Fri Mar 5 18:18:30 2010 From: skvidal at osuosl.org (skvidal at osuosl.org) Date: Fri, 5 Mar 2010 18:18:30 +0000 (UTC) Subject: [Rpm-metadata] 2 commits - createrepo/__init__.py genpkgmetadata.py Message-ID: <20100305181830.4E3D8496F3F@yum.osuosl.org> createrepo/__init__.py | 5 ++++- genpkgmetadata.py | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) New commits: commit ba1853d5c8e54c8876f3a52801451643a5b5e116 Merge: 72af125... ce96384... Author: Seth Vidal Date: Fri Mar 5 13:18:32 2010 -0500 Merge branch 'master' of ssh://createrepo.baseurl.org/srv/projects/createrepo/git/createrepo * 'master' of ssh://createrepo.baseurl.org/srv/projects/createrepo/git/createrepo: Trim trailing whitespace. diff --cc createrepo/__init__.py index cb8ba16,d29c9d8..8704562 --- a/createrepo/__init__.py +++ b/createrepo/__init__.py @@@ -100,10 -100,9 +100,10 @@@ class MetaDataConfig(object) self.revision = str(int(time.time())) self.content_tags = [] # flat list of strings (like web 2.0 tags) self.distro_tags = []# [(cpeid(None allowed), human-readable-string)] + self.repo_tags = []# strings, forwhatever they are worth self.read_pkgs_list = None # filepath/name to write out list of pkgs # read in this run of createrepo - + class SimpleMDCallBack(object): def errorlog(self, thing): print >> sys.stderr, thing @@@ -803,12 -802,12 +803,12 @@@ class MetaDataGenerator reporoot = repodoc.newChild(None, "repomd", None) repons = reporoot.newNs('http://linux.duke.edu/metadata/repo', None) reporoot.setNs(repons) - rpmns = reporoot.newNs("http://linux.duke.edu/metadata/rpm", 'rpm') + rpmns = reporoot.newNs("http://linux.duke.edu/metadata/rpm", 'rpm') repopath = os.path.join(self.conf.outputdir, self.conf.tempdir) repofilepath = os.path.join(repopath, self.conf.repomdfile) - + revision = reporoot.newChild(None, 'revision', self.conf.revision) - if self.conf.content_tags or self.conf.distro_tags: + if self.conf.content_tags or self.conf.distro_tags or self.conf.repo_tags: tags = reporoot.newChild(None, 'tags', None) for item in self.conf.content_tags: c_tags = tags.newChild(None, 'content', item) diff --cc genpkgmetadata.py index 81e86c2,4ab4e9a..1c6a8b3 --- a/genpkgmetadata.py +++ b/genpkgmetadata.py @@@ -100,10 -100,8 +100,10 @@@ def parse_args(args, conf) default=False, action="store_true") parser.add_option("--distro", default=[], action="append", help="distro tag and optional cpeid: --distro" "'cpeid,textname'") - parser.add_option("--content", default=[], dest='content_tags', + parser.add_option("--content", default=[], dest='content_tags', action="append", help="tags for the content in the repository") + parser.add_option("--repo", default=[], dest='repo_tags', + action="append", help="tags to describe the repository itself") parser.add_option("--revision", default=None, help="user-specified revision for this repository") parser.add_option("--deltas", default=False, action="store_true", commit 72af125c317b2baeca125d9c24ab461c0bdcfc5a Author: Seth Vidal Date: Fri Mar 5 13:11:56 2010 -0500 add repo tags and --repo option to describe the repo itself. request from suse. diff --git a/createrepo/__init__.py b/createrepo/__init__.py index 0c0c7d8..cb8ba16 100644 --- a/createrepo/__init__.py +++ b/createrepo/__init__.py @@ -100,6 +100,7 @@ class MetaDataConfig(object): self.revision = str(int(time.time())) self.content_tags = [] # flat list of strings (like web 2.0 tags) self.distro_tags = []# [(cpeid(None allowed), human-readable-string)] + self.repo_tags = []# strings, forwhatever they are worth self.read_pkgs_list = None # filepath/name to write out list of pkgs # read in this run of createrepo @@ -807,10 +808,12 @@ class MetaDataGenerator: repofilepath = os.path.join(repopath, self.conf.repomdfile) revision = reporoot.newChild(None, 'revision', self.conf.revision) - if self.conf.content_tags or self.conf.distro_tags: + if self.conf.content_tags or self.conf.distro_tags or self.conf.repo_tags: tags = reporoot.newChild(None, 'tags', None) for item in self.conf.content_tags: c_tags = tags.newChild(None, 'content', item) + for item in self.conf.repo_tags: + c_tags = tags.newChild(None, 'repo', item) for (cpeid, item) in self.conf.distro_tags: d_tags = tags.newChild(None, 'distro', item) if cpeid: diff --git a/genpkgmetadata.py b/genpkgmetadata.py index 7877ba9..81e86c2 100755 --- a/genpkgmetadata.py +++ b/genpkgmetadata.py @@ -102,6 +102,8 @@ def parse_args(args, conf): help="distro tag and optional cpeid: --distro" "'cpeid,textname'") parser.add_option("--content", default=[], dest='content_tags', action="append", help="tags for the content in the repository") + parser.add_option("--repo", default=[], dest='repo_tags', + action="append", help="tags to describe the repository itself") parser.add_option("--revision", default=None, help="user-specified revision for this repository") parser.add_option("--deltas", default=False, action="store_true", From scop at osuosl.org Fri Mar 5 20:32:10 2010 From: scop at osuosl.org (Ville Skyttä) Date: Fri, 5 Mar 2010 20:32:10 +0000 (UTC) Subject: [Rpm-metadata] 3 commits - createrepo.bash createrepo.spec docs/createrepo.8 .gitignore Makefile Message-ID: <20100305203210.8625A496F3F@yum.osuosl.org> .gitignore | 1 Makefile | 6 ++- createrepo.bash | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ createrepo.spec | 3 + docs/createrepo.8 | 2 + 5 files changed, 106 insertions(+), 2 deletions(-) New commits: commit 9c7b182909dd17368ec2b7d2477c09e44d92e059 Author: Ville Skytt?? Date: Fri Mar 5 22:30:41 2010 +0200 Tell git to ignore tarballs. diff --git a/.gitignore b/.gitignore index 539da74..4e8d5fa 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ *.py[co] +*.tar.* commit 5d187d0da7d1474cd2984d30fabdab4b0e79cf83 Author: Ville Skytt?? Date: Fri Mar 5 22:29:01 2010 +0200 Document --repo in man page. diff --git a/docs/createrepo.8 b/docs/createrepo.8 index 7a077ce..de9112f 100644 --- a/docs/createrepo.8 +++ b/docs/createrepo.8 @@ -90,6 +90,8 @@ Specify distro tags. Can be specified more than once. Optional syntax specifying cpeid(http://cpe.mitre.org/) --distro=cpeid,distrotag .IP "\fB\--content\fP" Specify keyword/tags about the content of the repository. Can be specified more than once. +.IP "\fB\--repo\fP" +Specify keyword/tags about the repository itself. Can be specified more than once. .IP "\fB\--revision\fP" Arbitrary string for a repository revision. .IP "\fB\--deltas\fP" commit cc263d1ce5a36afe64427527588818d53b903b06 Author: Ville Skytt?? Date: Fri Feb 19 21:37:35 2010 +0200 Add bash completion. diff --git a/Makefile b/Makefile index 918614f..6b907d8 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,8 @@ pkgincludedir = $(includedir)/$(PKGNAME) top_builddir = # all dirs -DIRS = $(DESTDIR)$(bindir) $(DESTDIR)$(sysconfdir) $(DESTDIR)$(pkgdatadir) $(DESTDIR)$(mandir) +DIRS = $(DESTDIR)$(bindir) $(DESTDIR)$(sysconfdir)/bash_completion.d \ + $(DESTDIR)$(pkgdatadir) $(DESTDIR)$(mandir) # INSTALL scripts @@ -63,6 +64,7 @@ check: install: all installdirs $(INSTALL_MODULES) $(srcdir)/$(MODULES) $(DESTDIR)$(pkgdatadir) + $(INSTALL_DATA) $(PKGNAME).bash $(DESTDIR)$(sysconfdir)/bash_completion.d for subdir in $(SUBDIRS) ; do \ $(MAKE) -C $$subdir install VERSION=$(VERSION) PKGNAME=$(PKGNAME); \ done @@ -152,6 +154,7 @@ dailyfiles: $(srcdir)/COPYING.lib \ $(srcdir)/README \ $(srcdir)/$(PKGNAME).spec \ + $(srcdir)/$(PKGNAME).bash \ $(top_srcdir)/.disttmp/$$distdir for subdir in $(SUBDIRS) ; do \ $(MAKE) -C $$subdir dailyfiles VERSION=$(VERSION) PKGNAME=$(PKGNAME); \ @@ -167,6 +170,7 @@ distfiles: $(srcdir)/COPYING.lib \ $(srcdir)/README \ $(srcdir)/$(PKGNAME).spec \ + $(srcdir)/$(PKGNAME).bash \ $(top_srcdir)/.disttmp/$$distdir for subdir in $(SUBDIRS) ; do \ $(MAKE) -C $$subdir distfiles VERSION=$(VERSION) PKGNAME=$(PKGNAME); \ diff --git a/createrepo.bash b/createrepo.bash new file mode 100644 index 0000000..2a95e93 --- /dev/null +++ b/createrepo.bash @@ -0,0 +1,96 @@ +# bash completion for createrepo and friends + +_cr_createrepo() +{ + COMPREPLY=() + + case $3 in + --version|-h|--help|-u|--baseurl|--distro|--content|--repo|\ + --revision|-x|--excludes|--changelog-limit|--max-delta-rpm-size) + return 0 + ;; + --basedir|-c|--cachedir|--update-md-path|-o|--outputdir|\ + --oldpackagedirs) + COMPREPLY=( $( compgen -d -- "$2" ) ) + return 0 + ;; + -g|--groupfile) + COMPREPLY=( $( compgen -f -o plusdirs -X '!*.xml' -- "$2" ) ) + return 0 + ;; + -s|--sumtype) + COMPREPLY=( $( compgen -W 'md5 sha1 sha256 sha512' -- "$2" ) ) + return 0 + ;; + -i|--pkglist|--read-pkgs-list) + COMPREPLY=( $( compgen -f -o plusdirs -- "$2" ) ) + return 0 + ;; + -n|--includepkg) + COMPREPLY=( $( compgen -f -o plusdirs -X '!*.rpm' -- "$2" ) ) + return 0 + ;; + --num-deltas) + COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9' -- "$2" ) ) + return 0 + ;; + esac + + if [[ $2 == -* ]] ; then + COMPREPLY=( $( compgen -W '--version --help --quiet --verbose --profile + --excludes --basedir --baseurl --groupfile --checksum --pretty + --cachedir --checkts --database --update --update-md-path + --skip-stat --split --pkglist --includepkg --outputdir + --skip-symlinks --changelog-limit --unique-md-filenames + --simple-md-filenames --distro --content --repo --revision --deltas + --oldpackagedirs --num-deltas --read-pkgs-list + --max-delta-rpm-size' -- "$2" ) ) + else + COMPREPLY=( $( compgen -d -- "$2" ) ) + fi +} && +complete -F _cr_createrepo -o filenames createrepo genpkgmetadata.py + +_cr_mergerepo() +{ + COMPREPLY=() + + case $3 in + --version|-h|--help|-a|--archlist) + return 0 + ;; + -r|--repo|-o|--outputdir) + COMPREPLY=( $( compgen -d -- "$2" ) ) + return 0 + ;; + esac + + COMPREPLY=( $( compgen -W '--version --help --repo --archlist --database + --outputdir --nogroups --noupdateinfo' -- "$2" ) ) +} && +complete -F _cr_mergerepo -o filenames mergerepo mergerepo.py + +_cr_modifyrepo() +{ + COMPREPLY=() + + case $COMP_CWORD in + 1) + COMPREPLY=( $( compgen -f -o plusdirs -- "$2" ) ) + return 0 + ;; + 2) + COMPREPLY=( $( compgen -d -- "$2" ) ) + return 0 + ;; + esac +} && +complete -F _cr_modifyrepo -o filenames modifyrepo modifyrepo.py + +# Local variables: +# mode: shell-script +# sh-basic-offset: 4 +# sh-indent-comment: t +# indent-tabs-mode: nil +# End: +# ex: ts=4 sw=4 et filetype=sh diff --git a/createrepo.spec b/createrepo.spec index 57a0196..19db77b 100644 --- a/createrepo.spec +++ b/createrepo.spec @@ -22,7 +22,7 @@ rpm packages %install [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT -make DESTDIR=$RPM_BUILD_ROOT install +make DESTDIR=$RPM_BUILD_ROOT sysconfdir=%{_sysconfdir} install %clean [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT @@ -32,6 +32,7 @@ make DESTDIR=$RPM_BUILD_ROOT install %defattr(-, root, root) %dir %{_datadir}/%{name} %doc ChangeLog README COPYING COPYING.lib +%{_sysconfdir}/bash_completion.d/ %{_datadir}/%{name}/* %{_bindir}/%{name} %{_bindir}/modifyrepo