[yum-cvs] docs/repoquery.1 repoquery.py
Seth Vidal
skvidal at linux.duke.edu
Wed Sep 5 18:55:05 UTC 2007
docs/repoquery.1 | 8 ++++++++
repoquery.py | 27 +++++++++++++++++++++++++--
2 files changed, 33 insertions(+), 2 deletions(-)
New commits:
commit da6ad50922c4cee4db6c9a006797ef3345865119
Author: Seth Vidal <skvidal at fedoraproject.org>
Date: Wed Sep 5 14:53:26 2007 -0400
add --repofrompath and docs to repoquery
--repofrompath allows repoquery to query arbitrary paths as repositories
diff --git a/docs/repoquery.1 b/docs/repoquery.1
index 4b7e5ed..2b486be 100644
--- a/docs/repoquery.1
+++ b/docs/repoquery.1
@@ -20,6 +20,14 @@ Report program version and exit.
Specify which repository to query. Using this option disables all repositories
not explicitly enabled with --repoid option (can be used multiple times). By
default repoquery uses whatever repositories are enabled in YUM configuration.
+.IP "\fB\-\-repofrompath=<path/url>\fP"
+Specify a path or url to a repository (same path as in a baseurl) to add to
+the repositories for this query. This option can be used multiple times. If
+you want to view only the pkgs from this repository combine this with
+--repoid. The repoid of the paths specified are the last directory path
+segment. So if the path you specified was: '/some/place/named/my_repo/' then
+the repoid would be 'my_repo'. If the path was: 'http://server/path/my_repo'
+then the repoid would also by 'my_repo'.
.IP "\fB\-q\fP"
For rpmquery compatibility, doesn't do anything.
.IP "\fB\-h, \-\-help\fP"
diff --git a/repoquery.py b/repoquery.py
index 3fe7fee..244e390 100755
--- a/repoquery.py
+++ b/repoquery.py
@@ -24,6 +24,7 @@ import re
import fnmatch
import time
import os
+import os.path
import exceptions
from optparse import OptionParser
@@ -625,6 +626,8 @@ def main(args):
help="show all versions of packages")
parser.add_option("--repoid", action="append",
help="specify repoids to query, can be specified multiple times (default is all enabled)")
+ parser.add_option("--repofrompath", action="append",
+ help="specify paths of additional repositories - complete path required, can be specified multiple times.")
parser.add_option("--quiet", action="store_true",
help="quiet (no output to stderr)", default=True)
parser.add_option("--verbose", action="store_false",
@@ -714,6 +717,26 @@ def main(args):
repoq.doConfigSetup(fn=opts.conffile, debuglevel=initnoise)
else:
repoq.doConfigSetup(debuglevel=initnoise)
+
+ if opts.repofrompath:
+ # setup the fake repos
+ for repopath in opts.repofrompath:
+ if repopath[0] == '/':
+ baseurl = 'file://' + repopath
+ else:
+ baseurl = repopath
+
+ # get some kind of name - use the last dir name in the path
+ repopath = os.path.normpath(repopath)
+ repoid = repopath.split('/')[-1]
+
+ newrepo = yum.yumRepo.YumRepository(repoid)
+ newrepo.name = repopath
+ newrepo.baseurl = baseurl
+ newrepo.basecachedir = repoq.conf.cachedir
+ repoq.repos.add(newrepo)
+ repoq.repos.enableRepo(newrepo.id)
+
# Show what is going on, if --quiet is not set.
if not opts.quiet and sys.stdout.isatty():
@@ -738,7 +761,7 @@ def main(args):
if opts.show_dupes:
repoq.conf.showdupesfromrepos = True
-
+
if opts.repoid:
for repo in repoq.repos.findRepos('*'):
if repo.id not in opts.repoid:
@@ -747,7 +770,7 @@ def main(args):
repo.enable()
repoq.doRepoSetup()
-
+
for exp in regexs:
if exp.endswith('.src'):
needsource = 1
More information about the Yum-cvs-commits
mailing list