[Yum-devel] [PATCH] repoquery: add --installroot option. BZ 988429

Zdenek Pavlas zpavlas at redhat.com
Mon Jul 29 12:40:44 UTC 2013

 docs/repoquery.1 | 7 +++++++
 repoquery.py     | 2 ++
 2 files changed, 9 insertions(+)

diff --git a/docs/repoquery.1 b/docs/repoquery.1
index 81601ac..30fda8a 100644
--- a/docs/repoquery.1
+++ b/docs/repoquery.1
@@ -57,6 +57,13 @@ the releasever information from outside the installroot.
 Note that with the default upstream cachedir, of /var/cache/yum, using this
 option will corrupt your cache (and you can use $releasever in your cachedir
 configuration to stop this).
+.IP "\fB\-\-installroot=root\fP"
+Specifies an alternative installroot, relative to which all packages will be
+installed. Think of this like doing "chroot <root> yum" except using
+\-\-installroot allows yum to work before the chroot is created.
+Note: You may also want to use the option \-\-releasever=/ when creating the
+installroot as otherwise the $releasever value is taken from the rpmdb within
+the installroot (and thus. will be empty, before creation).
 .IP "\fB\-\-setopt=option=value\fP"
 Set any config option in yum config or repo files. For options in the global 
 config just use: \-\-setopt=option=value for repo options use: \-\-setopt=repoid.option=value
diff --git a/repoquery.py b/repoquery.py
index e68c44c..7436fc4 100755
--- a/repoquery.py
+++ b/repoquery.py
@@ -1284,6 +1284,7 @@ def main(args):
     parser.add_option("--search-fields", action="append", dest="searchfields",
                       help="search fields to search using --search")
+    parser.add_option("--installroot", default="/", help="set install root")
     parser.add_option("", "--setopt", dest="setopts", default=[],
                      help="set arbitrary config and repo options")
@@ -1408,6 +1409,7 @@ def main(args):
         repoq.preconf.fn = opts.conffile
     repoq.preconf.debuglevel = initnoise
     repoq.preconf.init_plugins = opts.plugins
+    repoq.preconf.root = opts.installroot
     for item in  bad_setopt_tm:

More information about the Yum-devel mailing list