[yum-commits] Branch 'yum-3_2_X' - 5 commits - docs/yum.8 docs/yum.conf.5 Makefile yumcommands.py yum/config.py yum.spec yum/sqlitesack.py

James Antill james at osuosl.org
Fri Apr 9 20:59:37 UTC 2010


 Makefile          |    2 +-
 docs/yum.8        |   20 +++++++++++++++++++-
 docs/yum.conf.5   |   13 +++++++++++++
 yum.spec          |    5 +++++
 yum/config.py     |   27 ++++++++++++++++++++++++++-
 yum/sqlitesack.py |    1 -
 yumcommands.py    |    6 ++++++
 7 files changed, 70 insertions(+), 4 deletions(-)

New commits:
commit cf43ce922a58f6514a7bc76cdc326a89134379fc
Author: James Antill <james at and.org>
Date:   Fri Apr 9 16:59:16 2010 -0400

    Add more docs for version command

diff --git a/docs/yum.8 b/docs/yum.8
index d36b1cc..6761f1c 100644
--- a/docs/yum.8
+++ b/docs/yum.8
@@ -69,7 +69,7 @@ gnome\-packagekit application\&.
 .br
 .I \fR * repolist [all|enabled|disabled] 
 .br
-.I \fR * version [all|installed|available|group-*|grouplist|groupinfo]
+.I \fR * version [ all | installed | available | group-* | nogroups* | grouplist | groupinfo ]
 .br
 .I \fR * history [info|list|summary|redo|undo|new] 
 .br
@@ -266,6 +266,24 @@ information is listed. The version is calculated by taking a sha1 hash of the
 packages (in sorted order), and the checksum_type/checksum_data entries from
 the yumdb. Note that this rpmdb version is now also used significantly within
 yum (esp. in yum history).
+
+The version command will now show "groups" of packages as a separate version,
+and so takes sub-commands:
+
+"version grouplist" - List the defined version groups.
+
+"version groupinfo" - Get the complete list of packages within one or more version groups.
+
+"version installed" - This is the default, only show the version information for installed packages.
+
+"version available" - Only show the version information for available packages.
+
+"version all" - Show the version information for installed and available packages.
+
+"version nogroups | nogroups-*" - Just show the main version information.
+
+"version group-*" - Just show the grouped version information, if more arguments are given then only show the data for those groups.
+
 .IP
 .IP "\fBhistory\fP"
 The history command allows the user to view what has happened in past
commit 3ec0eb7fe87f339c71539636282c018d278d04c5
Author: James Antill <james at and.org>
Date:   Fri Apr 9 16:46:08 2010 -0400

     Disallow symlinks, for variables (although it is root only), and tweak docs
    
     Add the vars directory on install, to make it easier for users.
     Own the vars directory in the specfile.
     Also add uuid, history, plugins and yumdb as %ghost files.

diff --git a/Makefile b/Makefile
index d75b220..f20795f 100644
--- a/Makefile
+++ b/Makefile
@@ -34,7 +34,7 @@ install:
 	install -m 755 bin/yum-updatesd.py $(DESTDIR)/usr/sbin/yum-updatesd
 
 	mkdir -p $(DESTDIR)/var/cache/yum
-	mkdir -p $(DESTDIR)/var/lib/yum	
+	mkdir -p $(DESTDIR)/var/lib/yum/vars
 
 	for d in $(SUBDIRS); do make PYTHON=$(PYTHON) DESTDIR=`cd $(DESTDIR); pwd` -C $$d install; [ $$? = 0 ] || exit 1; done
 
diff --git a/docs/yum.conf.5 b/docs/yum.conf.5
index 54e7bf9..f4ce88d 100644
--- a/docs/yum.conf.5
+++ b/docs/yum.conf.5
@@ -771,16 +771,17 @@ configuration file variable will not be replaced.
 
 .LP
 As of 3.2.28, any file in <installroot>/<persistdir>/vars is turned into
-a variable named after the filename (or overrides any of the above varaibles).
+a variable named after the filename (or overrides any of the above variables).
 The obvious exception is that you cannot use these variables in the definition
 of persistdir itself.
 
 Note that no warnings/errors are given if the files are unreadable, so creating
 files that only root can read may be confusing for users.
 
-Also note that all new line characters are removed, as a convienience, but no
-other checking is performed on the data. This means it's possible to have bad
-character data in baseurl etc.
+Also note that only the first line will be read and all new line 
+characters are removed, as a convenience. However, no other checking is 
+performed on the data. This means it is possible to have bad character 
+data in any value.
 
 .SH "FILES"
 .nf
diff --git a/yum.spec b/yum.spec
index 3a724cd..48e5fea 100644
--- a/yum.spec
+++ b/yum.spec
@@ -91,6 +91,11 @@ exit 0
 /usr/lib/python?.?/site-packages/rpmUtils
 %dir /var/cache/yum
 %dir /var/lib/yum
+%dir /var/lib/yum/vars
+%ghost /var/lib/yum/uuid
+%ghost /var/lib/yum/history
+%ghost /var/lib/yum/plugins
+%ghost /var/lib/yum/yumdb
 %{_mandir}/man*/yum.*
 %{_mandir}/man*/yum-shell*
 
diff --git a/yum/config.py b/yum/config.py
index e13eb12..ea8bcbf 100644
--- a/yum/config.py
+++ b/yum/config.py
@@ -882,8 +882,12 @@ def readMainConfig(startupconf):
     except OSError:
         fsvars = []
     for fsvar in fsvars:
+        if os.path.link(dir_fsvars + fsvar):
+            continue
         try:
-            val = open(dir_fsvars + fsvar).read().replace('\n', '')
+            val = open(dir_fsvars + fsvar).readline()
+            if val and val[-1] == '\n':
+                val = val[:-1]
         except (OSError, IOError):
             continue
         yumvars[fsvar] = val
commit d2638b9d8b360713f9739a88dfa03e1e3ffab28b
Author: James Antill <james at and.org>
Date:   Fri Apr 9 16:14:27 2010 -0400

    Remove bad assert: yum list blah\*

diff --git a/yum/sqlitesack.py b/yum/sqlitesack.py
index 5887cb7..8a4ec8b 100644
--- a/yum/sqlitesack.py
+++ b/yum/sqlitesack.py
@@ -1599,7 +1599,6 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack):
             for (pat, rest) in patterns:
                 if rest == 'glob':
                     continue
-                assert rest == '='
                 for pkg in returnList:
                     if pkg.name == pat:
                         self._pkgnames_loaded.add(pkg.name)
commit 543344aa1346a5e3b37a6b813121f6078cfb9aa4
Author: James Antill <james at and.org>
Date:   Fri Apr 9 15:59:07 2010 -0400

    Add dynamic yumvars from the filesystem.

diff --git a/docs/yum.conf.5 b/docs/yum.conf.5
index fe195af..54e7bf9 100644
--- a/docs/yum.conf.5
+++ b/docs/yum.conf.5
@@ -769,6 +769,18 @@ These will be replaced with the value of the shell environment variable of
 the same name. If the shell environment variable does not exist then the
 configuration file variable will not be replaced.
 
+.LP
+As of 3.2.28, any file in <installroot>/<persistdir>/vars is turned into
+a variable named after the filename (or overrides any of the above varaibles).
+The obvious exception is that you cannot use these variables in the definition
+of persistdir itself.
+
+Note that no warnings/errors are given if the files are unreadable, so creating
+files that only root can read may be confusing for users.
+
+Also note that all new line characters are removed, as a convienience, but no
+other checking is performed on the data. This means it's possible to have bad
+character data in baseurl etc.
 
 .SH "FILES"
 .nf
diff --git a/yum/config.py b/yum/config.py
index d869a26..e13eb12 100644
--- a/yum/config.py
+++ b/yum/config.py
@@ -857,13 +857,15 @@ def readMainConfig(startupconf):
     yumvars['arch'] = startupconf.arch
     yumvars['releasever'] = startupconf.releasever
     yumvars['uuid'] = startupconf.uuid
+    # Note: We don't setup the FS yumvars here, because we want to be able to
+    #       use the core yumvars in persistdir. Which is the base of FS yumvars.
     
     # Read [main] section
     yumconf = YumConf()
     yumconf.populate(startupconf._parser, 'main')
 
     # Apply the installroot to directory options
-    for option in ('cachedir', 'logfile', 'persistdir'):
+    def _apply_installroot(yumconf, option):
         path = getattr(yumconf, option)
         ir_path = yumconf.installroot + path
         ir_path = ir_path.replace('//', '/') # os.path.normpath won't fix this and
@@ -871,6 +873,25 @@ def readMainConfig(startupconf):
         ir_path = varReplace(ir_path, yumvars)
         setattr(yumconf, option, ir_path)
     
+    _apply_installroot(yumconf, 'persistdir')
+
+    # Read the FS yumvars
+    try:
+        dir_fsvars = yumconf.persistdir + "/vars/"
+        fsvars = os.listdir(dir_fsvars)
+    except OSError:
+        fsvars = []
+    for fsvar in fsvars:
+        try:
+            val = open(dir_fsvars + fsvar).read().replace('\n', '')
+        except (OSError, IOError):
+            continue
+        yumvars[fsvar] = val
+
+    # These can use the above FS yumvars
+    for option in ('cachedir', 'logfile'):
+        _apply_installroot(yumconf, option)
+
     # Add in some extra attributes which aren't actually configuration values 
     yumconf.yumvar = yumvars
     yumconf.uid = 0
commit 8d3f214597e03e5f4e30c877351cf4926a241627
Author: James Antill <james at and.org>
Date:   Fri Apr 9 00:17:36 2010 -0400

    Allow users to see just specific version groups

diff --git a/yumcommands.py b/yumcommands.py
index 88c047f..9bc06ad 100644
--- a/yumcommands.py
+++ b/yumcommands.py
@@ -1237,6 +1237,9 @@ class VersionCommand(YumCommand):
                     _append_repos(cols, data[1])
                 if groups:
                     for grp in sorted(data[2]):
+                        if (vcmd.startswith("group-") and
+                            len(extcmds) > 1 and grp not in extcmds[1:]):
+                            continue
                         cols.append(("%s %s" % (_("Group-Installed:"), grp),
                                      str(data[2][grp])))
                         _append_repos(cols, data[3][grp])
@@ -1252,6 +1255,9 @@ class VersionCommand(YumCommand):
                         _append_repos(cols, data[1])
                 if groups:
                     for grp in sorted(data[2]):
+                        if (vcmd.startswith("group-") and
+                            len(extcmds) > 1 and grp not in extcmds[1:]):
+                            continue
                         cols.append(("%s %s" % (_("Group-Available:"), grp),
                                      str(data[2][grp])))
                         if verbose:


More information about the Yum-commits mailing list