Blob Blame History Raw
diff --git a/COPYING b/COPYING
index e77696a..d159169 100644
--- a/COPYING
+++ b/COPYING
@@ -1,12 +1,12 @@
-		    GNU GENERAL PUBLIC LICENSE
-		       Version 2, June 1991
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 2, June 1991
 
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-                          675 Mass Ave, Cambridge, MA 02139, USA
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  Everyone is permitted to copy and distribute verbatim copies
  of this license document, but changing it is not allowed.
 
-			    Preamble
+                            Preamble
 
   The licenses for most software are designed to take away your
 freedom to share and change it.  By contrast, the GNU General Public
@@ -15,7 +15,7 @@ software--to make sure the software is free for all its users.  This
 General Public License applies to most of the Free Software
 Foundation's software and to any other program whose authors commit to
 using it.  (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.)  You can apply it to
+the GNU Lesser General Public License instead.)  You can apply it to
 your programs, too.
 
   When we speak of free software, we are referring to freedom, not
@@ -55,8 +55,8 @@ patent must be licensed for everyone's free use or not licensed at all.
 
   The precise terms and conditions for copying, distribution and
 modification follow.
-
-		    GNU GENERAL PUBLIC LICENSE
+
+                    GNU GENERAL PUBLIC LICENSE
    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
 
   0. This License applies to any program or other work which contains
@@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions:
     License.  (Exception: if the Program itself is interactive but
     does not normally print such an announcement, your work based on
     the Program is not required to print an announcement.)
-
+
 These requirements apply to the modified work as a whole.  If
 identifiable sections of that work are not derived from the Program,
 and can be reasonably considered independent and separate works in
@@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent
 access to copy the source code from the same place counts as
 distribution of the source code, even though third parties are not
 compelled to copy the source along with the object code.
-
+
   4. You may not copy, modify, sublicense, or distribute the Program
 except as expressly provided under this License.  Any attempt
 otherwise to copy, modify, sublicense or distribute the Program is
@@ -225,7 +225,7 @@ impose that choice.
 
 This section is intended to make thoroughly clear what is believed to
 be a consequence of the rest of this License.
-
+
   8. If the distribution and/or use of the Program is restricted in
 certain countries either by patents or by copyrighted interfaces, the
 original copyright holder who places the Program under this License
@@ -255,7 +255,7 @@ make exceptions for this.  Our decision will be guided by the two goals
 of preserving the free status of all derivatives of our free software and
 of promoting the sharing and reuse of software generally.
 
-			    NO WARRANTY
+                            NO WARRANTY
 
   11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
 FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
@@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
 PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
 POSSIBILITY OF SUCH DAMAGES.
 
-		     END OF TERMS AND CONDITIONS
-
-	    How to Apply These Terms to Your New Programs
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
 
   If you develop a new program, and you want it to be of the greatest
 possible use to the public, the best way to achieve this is to make it
@@ -291,7 +291,7 @@ convey the exclusion of warranty; and each file should have at least
 the "copyright" line and a pointer to where the full notice is found.
 
     <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) 19yy  <name of author>
+    Copyright (C) <year>  <name of author>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -303,16 +303,16 @@ the "copyright" line and a pointer to where the full notice is found.
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.
 
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+    You should have received a copy of the GNU General Public License along
+    with this program; if not, write to the Free Software Foundation, Inc.,
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 Also add information on how to contact you by electronic and paper mail.
 
 If the program is interactive, make it output a short notice like this
 when it starts in an interactive mode:
 
-    Gnomovision version 69, Copyright (C) 19yy name of author
+    Gnomovision version 69, Copyright (C) year name of author
     Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
     This is free software, and you are welcome to redistribute it
     under certain conditions; type `show c' for details.
@@ -335,5 +335,5 @@ necessary.  Here is a sample; alter the names:
 This General Public License does not permit incorporating your program into
 proprietary programs.  If your program is a subroutine library, you may
 consider it more useful to permit linking proprietary applications with the
-library.  If this is what you want to do, use the GNU Library General
+library.  If this is what you want to do, use the GNU Lesser General
 Public License instead of this License.
diff --git a/ChangeLog b/ChangeLog
index bc802f6..e9be2e4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3370,7 +3370,7 @@
 2008-08-04  James Antill <james@and.org>
 
 	* yum-builddep.py: Allow yum-builddep to use "extras"
-	(installed/not-available pacakges
+	(installed/not-available packages
 
 2008-08-04  James Antill <james@and.org>
 
diff --git a/debuginfo-install.py b/debuginfo-install.py
index 177c6c3..0f026f1 100755
--- a/debuginfo-install.py
+++ b/debuginfo-install.py
@@ -7,11 +7,11 @@
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Library General Public License for more details.
+# GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 # Copyright 2007 Seth Vidal
 
 import sys
@@ -52,7 +52,12 @@ class DebugInfoInstall(YumUtilBase):
                         action="store_true",
                         help="Turn off automatic installation/update of the yum debuginfo plugin")
 
-        self.main()
+        self.done = set()
+        try:
+            self.main()
+        except yum.Errors.YumBaseError, e:
+            print e
+            sys.exit(1)
 
     def doUtilConfigSetup(self, *args, **kwargs):
         """ We override this to get our extra option out. """
@@ -117,6 +122,9 @@ class DebugInfoInstall(YumUtilBase):
         sys.exit(self.doUtilTransaction())
 
     def di_try_install(self, po):
+        if po in self.done:
+            return
+        self.done.add(po)
         if po.name.endswith('-debuginfo'): # Wildcard matches produce this
             return
         di_name = '%s-debuginfo' % po.name
@@ -156,6 +164,10 @@ class DebugInfoInstall(YumUtilBase):
                                 self.di_try_install(deppo)
                             except yum.Errors.InstallError, e:
                                 self.logger.critical('Could not find debuginfo pkg for dependency package %s' % deppo)
+
+        for pkgname in u:
+            self.logger.critical('Could not find a package for: %s' % pkgname)
+
         #  This is kinda hacky, accessing the option from the plugins code
         # but I'm not sure of a better way of doing it
         if not self.no_debuginfo_plugin and self.tsInfo:
diff --git a/docs/Makefile b/docs/Makefile
index d01c1e4..acb8559 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -1,7 +1,9 @@
 DOCS = repoquery package-cleanup repo-rss yumdownloader yum-builddep yum-changelog reposync \
        yum-list-data yum-filter-data yum-verify yum-utils yum-aliases yum-debug-dump yum-versionlock \
        yum-groups-manager debuginfo-install repodiff yum-fs-snapshot \
-       show-installed show-changed-rco
+       show-installed show-changed-rco yum-debug-restore \
+       find-repos-of-install needs-restarting repo-graph repoclosure \
+       repomanage repotrack verifytree yum-config-manager
 DOCS5 = yum-changelog.conf yum-versionlock.conf yum-fs-snapshot.conf
 DOCS8 = yum-security yum-complete-transaction yumdb
 
diff --git a/docs/debuginfo-install.1 b/docs/debuginfo-install.1
index a47e28a..a829869 100644
--- a/docs/debuginfo-install.1
+++ b/docs/debuginfo-install.1
@@ -1,7 +1,7 @@
 .\" debuginfo-install
 .TH "debuginfo-install" "1" "21 October 2008" "James Antill" ""
 .SH "NAME"
-debuginfo-install
+debuginfo-install \- install debuginfo packages and their dependencies
 .SH "SYNOPSIS"
 \fBdebuginfo-install\fP package
 .SH "DESCRIPTION"
diff --git a/docs/find-repos-of-install.1 b/docs/find-repos-of-install.1
new file mode 100644
index 0000000..77be909
--- /dev/null
+++ b/docs/find-repos-of-install.1
@@ -0,0 +1,51 @@
+.\" find-repos-of-install
+.TH "find-repos-of-install" "1" "13 January 2013" "" ""
+.SH "NAME"
+find-repos-of-install \- report which Yum repository a package was installed from
+.SH "SYNOPSIS"
+\fBfind-repos-of-install\fP [options] package1 [package2...]
+.SH "DESCRIPTION"
+.PP
+\fBfind-repos-of-install\fP is a program which reports the Yum repository that
+a specified package was installed from.
+.PP
+.SH "OPTIONS"
+.IP "\fB\-\-version\fP"
+Report program version and exit.
+.IP "\fB\-h, \-\-help\fP"
+Display a help message, and then quit.
+.IP "\fB\-\-repoid=REPOID\fP"
+Specify repo ids to query, can be specified multiple times (default is
+all enabled).
+.IP "\fB\-\-enablerepo=ENABLEREPOS\fP"
+In addition to the default set, query the given additional repository, even if
+it is disabled in YUM configuration.  Can be used multiple times.
+.IP "\fB\-\-disablerepo=DISABLEREPOS\fP"
+Do not query the given repository, even if it is enabled in YUM
+configuration.  Can be used multiple times.
+.IP "\fB\-\-repofrompath=REPOID,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 for the repository is specified by REPOID.
+.IP "\fB\-C, \-\-cache\fP"
+Tells repoquery to run entirely from YUM cache - does not download any metadata
+or update the cache. Queries in this mode can fail or give partial/incorrect
+results if the cache isn't fully populated beforehand with eg "yum makecache".
+.IP "\fB\-\-tempcache\fP"
+Use a temp dir for storing/accessing yum-cache.
+.IP "\fB\-\-sync2yumdb\fP"
+Sync anything that is found to the yumdb, if available.
+
+.PP
+.SH "SEE ALSO"
+.nf
+.I yum.conf (5)
+http://yum.baseurl.org/
+.fi
+
+.PP
+.SH AUTHORS
+.nf
+See the Authors file included with this program.
+.fi
diff --git a/docs/needs-restarting.1 b/docs/needs-restarting.1
new file mode 100644
index 0000000..74b1904
--- /dev/null
+++ b/docs/needs-restarting.1
@@ -0,0 +1,29 @@
+.\" needs-restarting
+.TH "needs-restarting" "1" "13 January 2013" "" ""
+.SH "NAME"
+needs-restarting \- report running processes that have been updated
+.SH "SYNOPSIS"
+\fBneeds-restarting\fP [options]
+.SH "DESCRIPTION"
+.PP
+\fBneeds-restarting\fP is a program that reports a list of process ids that
+started running before they or some component that they use were updated.
+.PP
+.SH "OPTIONS"
+.IP "\fB\-h, \-\-help\fP"
+Display a help message, and then quit.
+.IP "\fB\-u, \-\-useronly\fP"
+Show processes for my userid only.
+
+.PP
+.SH "SEE ALSO"
+.nf
+.I yum.conf (5)
+http://yum.baseurl.org/
+.fi
+
+.PP
+.SH "AUTHORS"
+.nf
+See the Authors file included with this program.
+.fi
diff --git a/docs/package-cleanup.1 b/docs/package-cleanup.1
index 867cf4d..61959ac 100644
--- a/docs/package-cleanup.1
+++ b/docs/package-cleanup.1
@@ -1,7 +1,7 @@
 .\" package-cleanup 
 .TH "package-cleanup" "1" "03 November 2005" "Gijs Hollestelle" ""
 .SH "NAME"
-package-cleanup
+package-cleanup \- clean up locally installed, duplicate, or orphaned packages
 .SH "SYNOPSIS"
 \fBpackage-cleanup\fP [options] <item ...>
 .SH "DESCRIPTION"
@@ -14,7 +14,7 @@ Use alternative config file (default is /etc/yum.conf).
 .IP "\fB\-h, \-\-help\fP"
 Help; display a help message and then quit\&.
 .IP "\fB\-q, \-\-quiet\fP" 
-Print out nothing unecessary.
+Print out nothing unnecessary.
 .IP "\fB\-v, \-\-version\fP" 
 Report program version and exit.
 .IP "\fB\-y\fP" 
@@ -36,6 +36,8 @@ Scan for duplicates in the local RPM database.
 .IP "\fB\-\-cleandupes\fP"
 Scan for duplicates in the local RPM database and clean out the
 older versions.
+.IP "\fB\-\-count <COUNT>\fP"
+Number of duplicate/kernel packages to keep on the system (default 2)
 .PP 
 .SH "LEAVES OPTIONS" 
 .IP "\fB\-\-all\fP"
@@ -49,21 +51,19 @@ When listing leaf nodes do not list development packages.
 When listing leaf nodes do not list packages with files in bin directories.
 .PP 
 .SH "OLDKERNELS OPTIONS" 
-.IP "\fB\-\-count <COUNT>\fP"
-Number of kernel packages to keep on the system (default 2)
 .IP "\fB\-\-keepdevel\fP"
 Do not remove kernel-devel packages when removing kernels
 
 .SH "EXAMPLES"
 .IP "List all dependency problems:"
-\fBpackage-cleanup --problems\fP
+\fBpackage-cleanup \-\-problems\fP
 .IP "List all packages that are not in any Yum repository:"
-\fBpackage-cleanup --orphans\fP 
+\fBpackage-cleanup \-\-orphans\fP
 .IP "Remove old kernels keeping 3 and leaving old kernel-devel packages installed:"
-\fBpackage-cleanup --oldkernels --count=3 --keepdevel\fP
+\fBpackage-cleanup \-\-oldkernels \-\-count=3 \-\-keepdevel\fP
 .PP 
 .IP "List all leaf packages with no files in a bin directory whose name begins with either 'perl' or 'python':"
-\fBpackage-cleanup --leaves --exclude-bin --leaf-regex="^(perl)|(python)"\fP
+\fBpackage-cleanup \-\-leaves \-\-exclude\-bin \-\-leaf\-regex="^(perl)|(python)"\fP
 .PP
 .SH "FILES"
 As package-cleanup uses YUM libraries for retrieving all the information, it
diff --git a/docs/repo-graph.1 b/docs/repo-graph.1
new file mode 100644
index 0000000..9bdbb20
--- /dev/null
+++ b/docs/repo-graph.1
@@ -0,0 +1,32 @@
+.\" repo-graph
+.TH "repo-graph" "1" "13 January 2013" "" ""
+.SH "NAME"
+repo-graph \- output a full package dependency graph in dot format
+.SH "SYNOPSIS"
+\fBrepo-graph\fP [options]
+.SH "DESCRIPTION"
+.PP
+\fBrepo-graph\fP is a program that generates a full package dependency list
+from a yum repository and outputs it in dot format.
+.PP
+.SH "OPTIONS"
+.IP "\fB\-h, \-\-help\fP"
+Display a help message, and then quit.
+.IP "\fB\-\-repoid=REPOID\fP"
+Specify repo ids to query, can be specified multiple times (default is
+all enabled).
+.IP "\fB\-c CONFIG\fP"
+Config file to use (defaults to /etc/yum.conf).
+
+.PP
+.SH "SEE ALSO"
+.nf
+.I yum.conf (5)
+http://yum.baseurl.org/
+.fi
+
+.PP
+.SH "AUTHORS"
+.nf
+See the Authors file included with this program.
+.fi
diff --git a/docs/repo-rss.1 b/docs/repo-rss.1
index 90788b8..62e00cc 100644
--- a/docs/repo-rss.1
+++ b/docs/repo-rss.1
@@ -1,7 +1,7 @@
 .\" repo-rss
 .TH "repo-rss" "1" "2005" "Seth Vidal" ""
 .SH "NAME"
-repo-rss
+repo-rss \- generates an RSS feed from one or more Yum repositories
 .SH "SYNOPSIS"
 \fBrepo-rss\fP [options] repoid1 [repoid2...]
 .SH "DESCRIPTION"
@@ -28,7 +28,7 @@ default for non-root users.
 
 .SH "EXAMPLES"
 .IP "Generate an RSS for the updates-released repository and save it as updates-release.xml:"
-\fBrepo-rss -f updates-released.xml updates-released\fP
+\fBrepo-rss \-f updates-released.xml updates-released\fP
 .PP 
 .SH "FILES"
 As repo-rss uses YUM libraries for retrieving all the information, it
diff --git a/docs/repoclosure.1 b/docs/repoclosure.1
new file mode 100644
index 0000000..e0f7091
--- /dev/null
+++ b/docs/repoclosure.1
@@ -0,0 +1,57 @@
+.\" repoclosure
+.TH "repoclosure" "1" "13 January 2013" "" ""
+.SH "NAME"
+repoclosure \- display a list of unresolved dependencies for a yum repository
+.SH "SYNOPSIS"
+\fBrepoclosure\fP [options]
+.SH "DESCRIPTION"
+.PP
+\fBrepoclosure\fP is a program that reads package metadata from one or more yum
+repositories, checks all dependencies, and displays a list of packages with
+unresolved dependencies.
+.PP
+.SH "OPTIONS"
+.IP "\fB\-h, \-\-help\fP"
+Display a help message, and then quit.
+.IP "\fB\-c CONFIG, \-\-config=CONFIG\fP"
+Config file to use (defaults to /etc/yum.conf).
+.IP "\fB\-a ARCH, \-\-arch=ARCH\fP"
+Check packages of the given archs, can be specified multiple times (default:
+current arch).
+.IP "\fB\-\-basearch=BASEARCH\fP"
+Set the basearch for yum to run as.
+.IP "\fB\-b, \-\-builddeps\fP"
+Check build dependencies only (needs source repos enabled).
+.IP "\fB\-l LOOKASIDE, \-\-lookaside=LOOKASIDE\fP"
+Specify a lookaside repo id to query, can be specified multiple times.
+.IP "\fB\-r REPOID, \-\-repoid=REPOID\fP"
+Specify repo ids to query, can be specified multiple times (default is
+all enabled).
+.IP "\fB\-t, \-\-tempcache\fP"
+Use a temp dir for storing/accessing yum-cache.
+.IP "\fB\-q, \-\-quiet\fP"
+Run quietly: no warnings printed to stderr.
+.IP "\fB\-n, \-\-newest\fP"
+Check only the newest packages in the repos.
+.IP "\fB\-\-repofrompath=REPOID,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 for the repository is specified by REPOID.
+.IP "\fB\-p PKG, \-\-pkg=PKG\fP"
+Check closure for this package only
+.IP "\fB\-g GROUP, \-\-group=GROUP\fP"
+Check closure for packages in this group only
+
+.PP
+.SH "SEE ALSO"
+.nf
+.I yum.conf (5)
+http://yum.baseurl.org/
+.fi
+
+.PP
+.SH "AUTHORS"
+.nf
+See the Authors file included with this program.
+.fi
diff --git a/docs/repodiff.1 b/docs/repodiff.1
index c421c5d..75a8860 100644
--- a/docs/repodiff.1
+++ b/docs/repodiff.1
@@ -1,37 +1,45 @@
 .\" repodiff
 .TH "repodiff" "1" "21 October 2008" "James Antill" ""
 .SH "NAME"
-repodiff
+repodiff \- list differences between two or more Yum repositories
 .SH "SYNOPSIS"
-\fBrepodiff\fP --old=old_repo_baseurl --new=new_repo_baseurl
+\fBrepodiff\fP \-\-old=old_repo_baseurl \-\-new=new_repo_baseurl
 .SH "DESCRIPTION"
 .PP 
 \fBrepodiff\fP is a program which will list differences between two sets of 
 repositories.  \fBNote\fP that by default only source packages are compared.
 .PP 
 .SH "GENERAL OPTIONS"
-.IP "\fB\-\-old, -o\fP"
-Add a repo. as an old repo.
-.IP "\fB\-\-new, -n\fP"
-Add a repo. as an new repo.
-.IP "\fB\-\-archlist, -a\fP"
+.IP "\fB\-\-old, \-o\fP"
+Add a repo. as an old repo. Note that if you prefix the url with "mirror:" then
+the following url is treated as a mirror and not a baseurl.
+.IP "\fB\-\-new, \-n\fP"
+Add a repo. as an new repo. Note that if you prefix the url with "mirror:" then
+the following url is treated as a mirror and not a baseurl.
+.IP "\fB\-\-archlist, \-a\fP"
 Add architectures to change the default from just comparing source packages.
 Note that if you want the same as a native
 "x86_64" architecture machine you just need to pass "x86_64" (this is different
 from earlier versions where you needed to specify
 "x86_64,athlon,i686,i586,i486,i386,noarch" and you still got "src").
-.IP "\fB\-\-size, -s\fP"
-Ouput additional data about the size of the changes.
-.IP "\fB\-\-compare-arch\fP"
+.IP "\fB\-\-size, \-s\fP"
+Output additional data about the size of the changes.
+.IP "\fB\-\-compare\-arch\fP"
 Normally packages are just compared based on their name, this flag makes the
 comparison also use the arch. So foo.i386 and foo.x86_64 are different.
+.IP "\fB\-\-simple\fP"
+Output a simple one line message for modified packages.
+.IP "\fB\-\-downgrade\fP"
+Split the data for modified packages between upgraded and downgraded packages.
 .SH "EXAMPLES"
 .IP "Compare source pkgs in two local repos:"
-\fBrepodiff --old=/tmp/repo-old --new=/tmp/repo-new\fP
+\fBrepodiff \-\-old=/tmp/repo-old \-\-new=/tmp/repo-new\fP
 .IP "Compare x86_64 compat. binary pkgs in two remote repos, and two local one:"
-\fBrepodiff -a x86_64 --old=http://example.com/repo1-old --old=/tmp/repo-old --new=http://example.com/repo1-new --new=/tmp/repo-new\fP
+\fBrepodiff \-a x86_64 \-\-old=http://example.com/repo1-old \-\-old=/tmp/repo-old \-\-new=http://example.com/repo1-new \-\-new=/tmp/repo-new\fP
 .IP "Compare x86_64 compat. binary pkgs, but also compare arch:"
-\fBrepodiff -a x86_64 --compare-arch --old=http://example.com/repo1-old --old=/tmp/repo-old --new=http://example.com/repo1-new --new=/tmp/repo-new\fP
+\fBrepodiff \-a x86_64 \-\-compare\-arch \-\-old=http://example.com/repo1-old \-\-old=/tmp/repo-old \-\-new=http://example.com/repo1-new \-\-new=/tmp/repo-new\fP
+.IP "Compare two releases of Fedora (15 => 16):"
+\fBrepodiff \-\-old='mirror:https://mirrors.fedoraproject.org/metalink?repo=fedora-source-15&arch=i386' \-\-new='mirror:https://mirrors.fedoraproject.org/metalink?repo=fedora-source-16&arch=i386' \-\-size \-\-simple \-\-downgrade\fP
 .PP 
 
 .SH "SEE ALSO"
diff --git a/docs/repomanage.1 b/docs/repomanage.1
new file mode 100644
index 0000000..4d336a5
--- /dev/null
+++ b/docs/repomanage.1
@@ -0,0 +1,38 @@
+.\" repomanage
+.TH "repomanage" "1" "13 January 2013" "" ""
+.SH "NAME"
+repomanage \- list the newest or oldest RPM packages in a directory
+.SH "SYNOPSIS"
+\fBrepomanage\fP [options] directory
+.SH "DESCRIPTION"
+.PP
+\fBrepomanage\fP is a program to manage a directory of RPM packages. It
+displays a list of the newest or oldest packages in a directory for easy
+piping to xargs or similar programs.
+.PP
+.SH "OPTIONS"
+.IP "\fB\-h, \-\-help\fP"
+Display a help message, and then quit.
+.IP "\fB\-o, \-\-old\fP"
+Print the oldest packages.
+.IP "\fB\-n, \-\-new\fP"
+Print the newest packages.
+.IP "\fB\-s, \-\-space\fP"
+Space-separated instead of newline-separated output.
+.IP "\fB\-k KEEP, \-\-keep=KEEP\fP"
+Newest N packages to keep - defaults to 1.
+.IP "\fB\-c, \-\-nocheck\fP"
+Do not check package payload signatures/digests.
+
+.PP
+.SH "SEE ALSO"
+.nf
+.I yum.conf (5)
+http://yum.baseurl.org/
+.fi
+
+.PP
+.SH "AUTHORS"
+.nf
+See the Authors file included with this program.
+.fi
diff --git a/docs/repoquery.1 b/docs/repoquery.1
index f5a8c5d..30fda8a 100644
--- a/docs/repoquery.1
+++ b/docs/repoquery.1
@@ -1,11 +1,11 @@
 .\" repoquery 
 .TH "repoquery" "1" "17 October 2005" "Panu Matilainen" ""
 .SH "NAME"
-repoquery
+repoquery \- query information from Yum repositories
 .SH "SYNOPSIS"
 \fBrepoquery\fP [options] <item ...>
 .br
-\fBrepoquery\fP -a [options] 
+\fBrepoquery\fP \-a [options]
 .SH "DESCRIPTION"
 .PP 
 \fBrepoquery\fP is a program for querying information from YUM repositories
@@ -18,7 +18,7 @@ List valid queryformat tags and exit..
 Report program version and exit.
 .IP "\fB\-\-repoid=<repo>\fP"
 Specify which repository to query. Using this option disables all repositories
-not explicitly enabled with --repoid option (can be used multiple times). By
+not explicitly enabled with \-\-repoid option (can be used multiple times). By
 default repoquery uses whatever repositories are enabled in YUM configuration.
 .IP "\fB\-\-enablerepo=<repo>\fP"
 In addition to the default set, query the given additional repository, even if
@@ -30,7 +30,7 @@ configuration.  Can be used multiple times.
 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 for the repository is specified by <repoid>.
+\-\-repoid. The repoid for the repository is specified by <repoid>.
 .IP "\fB\-\-plugins\fP"
 Enable YUM plugin support.
 .IP "\fB\-q, \-\-query\fP"
@@ -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
@@ -64,13 +71,13 @@ config just use: \-\-setopt=option=value for repo options use: \-\-setopt=repoid
 .PP 
 .SH "PACKAGE QUERY OPTIONS" 
 .IP "\fB\-i, \-\-info\fP"
-Show general information about package similarly to "rpm -qi"
+Show general information about package similarly to "rpm \-qi"
 .IP "\fB\-l, \-\-list\fP"
 List files in package.
 .IP "\fB\-R, \-\-requires\fP"
 List package dependencies.
 .IP "\fB\-\-resolve\fP"
-When used with --requires, resolve capabilities to originating packages.
+When used with \-\-requires, resolve capabilities to originating packages.
 .IP "\fB\-\-provides\fP"
 List capabilities package provides.
 .IP "\fB\-\-obsoletes\fP"
@@ -81,7 +88,7 @@ List capabilities conflicting with package.
 List package changelog.
 .IP "\fB\-\-location\fP"
 Show a location where the package could be downloaded from.
-For example: \fBwget `repoquery --location yum`\fP
+For example: \fBwget `repoquery \-\-location yum`\fP
 .IP "\fB\-s, \-\-source\fP"
 Show package source RPM name. 
 .IP "\fB\-\-srpm\fP"
@@ -95,16 +102,16 @@ Use name-epoch:version-release.architecture output format (default)
 .IP "\fB\-\-envra\fP"
 Use epoch:name-version-release.architecture output format 
 (easier to parse than nevra)
-.IP "\fB\--qf=FORMAT, \-\-queryformat=FORMAT\fP"
+.IP "\fB\-\-qf=FORMAT, \-\-queryformat=FORMAT\fP"
 Specify custom output format for queries. You can add ":date", ":day" and
 ":isodate" to all the tags that are a time, and you can add ":k", ":m", ":g",
 ":t" and ":h" to sizes. You can also specify field width as in
 sprintf (Eg. %-20{name})
 .IP "\fB\-\-output [text|ascii-tree|dot-tree]\fP"
-Output format which can be used with --requires/--whatrequires/--obsoletes/--conflicts.
+Output format which can be used with \-\-requires/\-\-whatrequires/\-\-obsoletes/\-\-conflicts.
 Default output is 'text'.
 .IP "\fB\-\-level [all|any int]\fP"
-In combination with --output ascii-tree|dot-tree this option specifies the
+In combination with \-\-output ascii-tree|dot-tree this option specifies the
 number of level to print on the tree. Default level is 'all'.
 .PP 
 
@@ -112,6 +119,8 @@ number of level to print on the tree. Default level is 'all'.
 .IP "\fB\-a, \-\-all\fP"
 Query all available packages (for rpmquery compatibility / shorthand for 
 repoquery '*')
+.IP "\fB\--show-duplicates\fP"
+Query all versions of packages.
 .IP "\fB\-f, \-\-file FILE\fP"
 Query package owning FILE.
 .IP "\fB\-\-whatobsoletes CAPABILITY\fP"
@@ -123,14 +132,15 @@ Query all packages that provide CAPABILITY.
 .IP "\fB\-\-whatrequires CAPABILITY\fP"
 Query all packages that require CAPABILITY.
 .IP "\fB\-\-alldeps\fP"
-When used with --whatrequires, look for non-explicit dependencies in
+When used with \-\-whatrequires, look for non-explicit dependencies in
 addition to explicit ones (e.g. files and Provides in addition to
 package names).  This is the default.
 .IP "\fB\-\-exactdeps\fP"
-When used with --whatrequires, search for dependencies only exactly as given.
-This is effectively the opposite of --alldeps.
+When used with \-\-whatrequires, search for dependencies only exactly as given.
+This is effectively the opposite of \-\-alldeps.
 .IP "\fB\-\-recursive\fP"
-When used with --whatrequires, query packages recursively.
+When used with \-\-whatrequires, and \-\-requires \-\-resolve, query packages
+recursively.
 .IP "\fB\-\-archlist=ARCH1[,ARCH2...]\fP"
 Limit the query to packages of given architecture(s). Valid values are all
 architectures known to rpm/yum such as 'i386' and 'src' for
@@ -166,19 +176,19 @@ Query groups instead of packages.
 
 .SH "EXAMPLES"
 .IP "List all packages whose name contains 'perl':"
-\fBrepoquery '*perl*'\fP
+\fBrepoquery \(aq*perl*\(aq\fP
 .IP "List all packages depending on openssl:"
-\fBrepoquery --whatrequires openssl\fP 
+\fBrepoquery \-\-whatrequires openssl\fP
 .IP "List all package names and the repository they come from, nicely formatted:"
-\fBrepoquery -a --qf "%-20{repoid} %{name}"\fP
+\fBrepoquery \-a \-\-qf "%-20{repoid} %{name}"\fP
 .IP "List name and summary of all available updates (if any), nicely formatted:"
-\fBrepoquery -a --pkgnarrow=updates --qf "%{name}:\\n%{summary}\\n"\fP
+\fBrepoquery \-a \-\-pkgnarrow=updates \-\-qf "%{name}:\\n%{summary}\\n"\fP
 .IP "List optional packages in base group:"
-\fBrepoquery -g --grouppkgs=optional -l base\fP
+\fBrepoquery \-g \-\-grouppkgs=optional \-l base\fP
 .IP "List build requirements from 'anaconda' source rpm:"
-\fBrepoquery --requires anaconda.src\fP
+\fBrepoquery \-\-requires anaconda.src\fP
 .IP "List packages which BuildRequire gail-devel"
-\fBrepoquery --archlist=src --whatrequires gail-devel\fP
+\fBrepoquery \-\-archlist=src \-\-whatrequires gail-devel\fP
   NB: This command will only work if you have repositories enabled which include srpms.
 
 .\"TODO: Add more examples...
@@ -204,7 +214,7 @@ of the following:
 .br
 \fBepoch:name-ver-rel.arch\fP
 .IP
-For example: \fBrepoquery -l kernel-2.4.1-10.i686\fP
+For example: \fBrepoquery \-l kernel-2.4.1-10.i686\fP
 .br
 Additionally wildcards (shell-style globs) can be used.
 
diff --git a/docs/reposync.1 b/docs/reposync.1
index c1bc818..29043fb 100644
--- a/docs/reposync.1
+++ b/docs/reposync.1
@@ -1,7 +1,7 @@
 .\" reposync
 .TH "reposync" "1" "27 April 2007" "" ""
 .SH "NAME"
-reposync - synchronize yum repositories to a local directory
+reposync \- synchronize yum repositories to a local directory
 .SH "SYNOPSIS"
 \fBreposync\fP [options]
 .SH "DESCRIPTION"
@@ -14,7 +14,7 @@ Display a help message, and then quit.
 Config file to use (defaults to /etc/yum.conf).
 .IP "\fB\-a ARCH, \-\-arch=ARCH\fP"
 Act as if running the specified arch (default: current arch, note: does
-not override $releasever).
+not override $releasever. x86_64 is a superset for i*86.).
 .IP "\fB\-\-source\fP"
 Also download .src.rpm files.
 .IP "\fB\-r REPOID, \-\-repoid=REPOID\fP"
@@ -26,21 +26,26 @@ Use a temp dir for storing/accessing yum-cache.
 Path to download packages to: defaults to current directory.
 .IP "\fB\-g, \-\-gpgcheck\fP"
 Remove packages that fail GPG signature checking after downloading.
+exit status is '1' if at least one package was removed.
 .IP "\fB\-u, \-\-urls\fP"
 Just list urls of what would be downloaded, don't download.
-.IP "\fB\-n, \-\-newest-only\fP"
+.IP "\fB\-l, \-\-plugins\fP"
+Enable yum plugin support.
+.IP "\fB\-n, \-\-newest\-only\fP"
 Download only newest packages per-repo.
 .IP "\fB\-q, \-\-quiet\fP"
 Output as little information as possible.
 .SH "EXAMPLES"
 .IP "Sync all packages from the 'updates' repo to the current directory:"
-\fB reposync --repoid=updates\fP
+\fB reposync \-\-repoid=updates\fP
 .IP "Sync only the newest packages from the 'updates' repo to the current directory:"
-\fB reposync -n --repoid=updates\fP
+\fB reposync \-n \-\-repoid=updates\fP
 .IP "Sync packages from the 'updates' and 'extras' repos to the current directory:"
-\fB reposync --repoid=updates --repoid=extras\fP
+\fB reposync \-\-repoid=updates \-\-repoid=extras\fP
 .IP "Sync all packages from the 'updates' repo to the \fBrepos\fP directory:"
-\fB reposync -p repos --repoid=updates\fP
+\fB reposync \-p repos \-\-repoid=updates\fP
+.IP "Sync all packages from the 'updates' repo to the \fBrepos\fP directory excluding x86_64 arch. Edit \fI/etc/yum.conf\fR adding option \fBexclude=*.x86_64\fR. Then: 
+\fBreposync \-p repos \-\-repoid=updates\fP
 .SH "FILES"
 \fBreposync\fP uses the yum libraries for retrieving information and
 packages. If no configuration file is specified, the default yum
diff --git a/docs/repotrack.1 b/docs/repotrack.1
new file mode 100644
index 0000000..6b46ed0
--- /dev/null
+++ b/docs/repotrack.1
@@ -0,0 +1,44 @@
+.\" repotrack
+.TH "repotrack" "1" "13 January 2013" "" ""
+.SH "NAME"
+repotrack \- track a package and its dependencies and download them
+.SH "SYNOPSIS"
+\fBrepotrack\fP [options] package1 [package2...]
+.SH "DESCRIPTION"
+.PP
+\fBrepotrack\fP is a program for keeping track of a particular package and its
+dependencies. It will download one or more packages and all dependencies.
+.PP
+.SH "OPTIONS"
+.IP "\fB\-h, \-\-help\fP"
+Display a help message, and then quit.
+.IP "\fB\-c CONFIG, \-\-config=CONFIG\fP"
+Config file to use (defaults to /etc/yum.conf).
+.IP "\fB\-a ARCH, \-\-arch=ARCH\fP"
+Act as if running the specified arch (default: current arch).
+.IP "\fB\-r REPOID, \-\-repoid=REPOID\fP"
+Specify repo ids to query, can be specified multiple times (default is
+all enabled).
+.IP "\fB\-t, \-\-tempcache\fP"
+Use a temp dir for storing/accessing yum-cache.
+.IP "\fB\-p DESTDIR, \-\-download_path=DESTDIR\fP"
+Path to download packages to.
+.IP "\fB\-u, \-\-urls\fP"
+Instead of downloading RPMs, list the URLs that would be downloaded.
+.IP "\fB\-n, \-\-newest\fP"
+Toggle downloading only the newest packages (defaults to newest-only).
+.IP "\fB\-q, \-\-quiet\fP"
+Output as little information as possible.
+
+.PP
+.SH "SEE ALSO"
+.nf
+.I yum.conf (5)
+http://yum.baseurl.org/
+.fi
+
+.PP
+.SH "AUTHORS"
+.nf
+See the Authors file included with this program.
+.fi
diff --git a/docs/show-changed-rco.1 b/docs/show-changed-rco.1
index 3e3b62c..a88c942 100644
--- a/docs/show-changed-rco.1
+++ b/docs/show-changed-rco.1
@@ -1,17 +1,17 @@
 .\" show-changed-rco
 .TH "show-installed" "1" "30 March 2011" "James Antill" ""
 .SH "NAME"
-show\-changed-\-rco
+show\-changed\-rco \- show changes in an RPM package
 .SH "SYNOPSIS"
-\fBshow\-changed-\-rco\fP [options]
+\fBshow\-changed\-rco\fP [options]
 .SH "DESCRIPTION"
 .PP
-\fBshow\-changed-\-rco\fP gives a compact description of the changes to a
+\fBshow\-changed\-rco\fP gives a compact description of the changes to a
 packages Requires, Conflicts and Obsoletes data from the installed (or old) to
 a specified rpm file.
 .SH OPTIONS
 .TP
-.IP \-h, \-\-help
+.IP "\fB\-h, \-\-help\fP"
 show this help message and exit
 .IP "\fB\-C, \-\-cache\fP" 
 Tells repoquery to run entirely from YUM cache - does not download any metadata
@@ -22,7 +22,7 @@ Use alternative config file (default is /etc/yum.conf).
 
 .IP "\fB\-\-repoid=<repo>\fP"
 Specify which repository to query. Using this option disables all repositories
-not explicitly enabled with --repoid option (can be used multiple times). By
+not explicitly enabled with \-\-repoid option (can be used multiple times). By
 default repoquery uses whatever repositories are enabled in YUM configuration.
 .IP "\fB\-\-enablerepo=<repo>\fP"
 In addition to the default set, query the given additional repository, even if
@@ -34,13 +34,13 @@ configuration.  Can be used multiple times.
 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 for the repository is specified by <repoid>.
+\-\-repoid. The repoid for the repository is specified by <repoid>.
 
-.IP "\fB\-\-old-packages=<pkg>\fP"
+.IP "\fB\-\-old\-packages=<pkg>\fP"
 Explicitly list the valid old packages to match the new packages against.
-.IP "\fB\-\-ignore-arch\fP"
+.IP "\fB\-\-ignore\-arch\fP"
 Ignore arch. so you can compare foo-2.i686 to foo-1.x86_64.
-.IP "\fB\-\-skip-new\fP"
+.IP "\fB\-\-skip\-new\fP"
 Only give output for packages which we've found an old package for.
 
 .PP 
diff --git a/docs/show-installed.1 b/docs/show-installed.1
index 7072b63..0907ea2 100644
--- a/docs/show-installed.1
+++ b/docs/show-installed.1
@@ -1,7 +1,7 @@
 .\" show-installed
 .TH "show-installed" "1" "21 October 2010" "Florian Festi" ""
 .SH "NAME"
-show\-installed
+show\-installed \- show installed RPM packages and descriptions
 .SH "SYNOPSIS"
 \fBshow\-installed\fP [options]
 .SH "DESCRIPTION"
@@ -16,10 +16,10 @@ show this help message and exit
 yum, kickstart or human; yum gives the result as a yum command line; kickstart the content of a %packages section; "human" readable is default.
 .TP
 .B \-i INPUT, \-\-input=INPUT
-File to read the package list from instead of using the rpmdb. \- for stdin. The file must contain package names only separated by white space (including newlines). rpm \-qa \-\-qf='%{name}\\n' produces proper output.
+File to read the package list from instead of using the rpmdb. \- for stdin. The file must contain package names only separated by white space (including newlines). rpm \-qa \-\-qf=\(aq%{name}\\n\(aq produces proper output.
 .TP
 .B \-o OUTPUT, \-\-output=OUTPUT
-File to write the result to. Stdout is used if option is omited.
+File to write the result to. Stdout is used if option is omitted.
 .TP
 .B \-q, \-\-quiet
 Do not show warnings.
diff --git a/docs/verifytree.1 b/docs/verifytree.1
new file mode 100644
index 0000000..1389e0f
--- /dev/null
+++ b/docs/verifytree.1
@@ -0,0 +1,33 @@
+.\" verifytree
+.TH "verifytree" "1" "13 January 2013" "" ""
+.SH "NAME"
+verifytree \- verify that a local yum repository is consistent
+.SH "SYNOPSIS"
+\fBverifytree\fP [options] directory
+.SH "DESCRIPTION"
+.PP
+\fBverifytree\fP is a program that verifies whether a local yum repository is
+consistent.
+.PP
+.SH "OPTIONS"
+.IP "\fB\-h, \-\-help\fP"
+Display a help message, and then quit.
+.IP "\fB\-a, \-\-checkall\fP"
+Check all packages in the repository.
+.IP "\fB\-t TESTOPIA, \-\-testopia=TESTOPIA\fP"
+Report results to the given testopia run number.
+.IP "\fB\-r, \-\-treeinfo\fP"
+Check the checksums of listed files in a .treeinfo file, if available.
+
+.PP
+.SH "SEE ALSO"
+.nf
+.I yum.conf (5)
+http://yum.baseurl.org/
+.fi
+
+.PP
+.SH "AUTHORS"
+.nf
+See the Authors file included with this program.
+.fi
diff --git a/docs/yum-aliases.1 b/docs/yum-aliases.1
index c0f148d..62fae3e 100644
--- a/docs/yum-aliases.1
+++ b/docs/yum-aliases.1
@@ -26,9 +26,9 @@ last form creates a new alias.
 .PP 
 .SH Explanation of alias to final result conversion
 .PP 
-When you type an aliased command, like "yum --disableexcludes UPT lsu" using
+When you type an aliased command, like "yum \-\-disableexcludes UPT lsu" using
 the default aliases, the yum-aliases plugin first takes the first "command", by
-skiping over any options, and then looks up the result (in this case "UPT" is converted to "--enablerepo=updates-tesintg"). If there is a match, then it will
+skipping over any options, and then looks up the result (in this case "UPT" is converted to "\-\-enablerepo=updates-testing"). If there is a match, then it will
 replace the aliased "command" in the argument list and try again (again
 skipping over any options). By convention, in the default aliases list, alias
 "commands" that are in all CAPS only add options so you can join together a
@@ -49,19 +49,19 @@ yum
 .B alias
 rm remove
 .PP
-To always add the --skip-broken --disableexcludes=all --obsoletes options to
+To always add the \-\-skip\-broken \-\-disableexcludes=all \-\-obsoletes options to
 the update command (but leaving the upgrade option alone), you could use:
 .IP
 yum
 .B alias
-update \\update  --skip-broken --disableexcludes=all --obsoletes
+update \\update  \-\-skip\-broken \-\-disableexcludes=all \-\-obsoletes
 .PP
 To override the default "up" alias to use the above update command, and never
 ask for confirmation, you could use:
 .IP
 yum
 .B alias
-up update -y
+up update \-y
 .br
 
 
diff --git a/docs/yum-builddep.1 b/docs/yum-builddep.1
index 4e6c1d7..ac7601e 100644
--- a/docs/yum-builddep.1
+++ b/docs/yum-builddep.1
@@ -1,7 +1,7 @@
 .\" yum-builddep
 .TH "yum-builddep" "1" "17 July 2005 " "Panu Matilainen" ""
 .SH "NAME"
-yum-builddep
+yum-builddep \- install missing dependencies for building an RPM package
 .SH "SYNOPSIS"
 \fByum-builddep\fP package
 .SH "DESCRIPTION"
diff --git a/docs/yum-changelog.1 b/docs/yum-changelog.1
index 64910dc..c7b5486 100644
--- a/docs/yum-changelog.1
+++ b/docs/yum-changelog.1
@@ -14,12 +14,12 @@ is a Yum plugin for viewing package changelogs before/after updating.
 yum will invoke
 .BR yum-changelog(1)
 plugin if the
-.B --changelog
+.B \-\-changelog
 option or the
 .B changelog
 command is used with yum.
 .SH OPTIONS
-.IP --changelog
+.IP \-\-changelog
 Show changelog delta of updated packages
 .SH COMMANDS
 .IP changelog
@@ -53,7 +53,7 @@ changelog stats. 33 pkgs, 12 source pkgs, 1 changelog
 .br
 .br
 # yum update ktechlab
-.B --changelog
+.B \-\-changelog
 .br
 Loading "changelog" plugin
 .br
diff --git a/docs/yum-complete-transaction.8 b/docs/yum-complete-transaction.8
index 945eee8..965c0b1 100644
--- a/docs/yum-complete-transaction.8
+++ b/docs/yum-complete-transaction.8
@@ -1,13 +1,13 @@
 .\" yum-complete-transaction
 .TH "yum-complete-transaction" "8" "10 December 2007" "Seth Vidal" ""
 .SH "NAME"
-yum-complete-transaction
+yum-complete-transaction \- attempt to complete failed or aborted Yum transactions
 .SH "SYNOPSIS"
 \fByum-complete-transaction\fP [options]
 .SH "GENERAL OPTIONS"
 .IP "\fB\-h, \-\-help\fP"
 Help; display a help message and then quit\&.
-.IP "\fB\-\-cleanup-only\fP" 
+.IP "\fB\-\-cleanup\-only\fP"
 Only clean up only transaction journal files and exit\&.
 
 .SH "DESCRIPTION"
diff --git a/docs/yum-config-manager.1 b/docs/yum-config-manager.1
new file mode 100644
index 0000000..81b895b
--- /dev/null
+++ b/docs/yum-config-manager.1
@@ -0,0 +1,39 @@
+.\" yum-config-manager
+.TH "yum-config-manager" "1" "13 January 2013" "" ""
+.SH "NAME"
+yum-config-manager \- manage yum configuration options and yum repositories
+.SH "SYNOPSIS"
+\fByum-config-manager\fP [options]
+.SH "DESCRIPTION"
+.PP
+\fByum-config-manager\fP is a program that can manage main yum configuration
+options, toggle which repositories are enabled or disabled, and add new
+repositories.
+.PP
+.SH "OPTIONS"
+.IP "\fB\-h, \-\-help\fP"
+Display a help message, and then quit.
+.IP "\fB\-\-save\fP"
+Save the current options (useful with \-\-setopt).
+.IP "\fB\-\-enable\fP"
+Enable the specified repos (automatically saves).
+.IP "\fB\-\-disable\fP"
+Disable the specified repos (automatically saves).
+.IP "\fB\-\-add\-repo=ADDREPO\fP"
+Add (and enable) the repo from the specified file or url.
+.SH "ADDITIONAL OPTIONS"
+Yum-config-manager inherits all other options from yum. See the yum(8)
+man page for more information.
+
+.PP
+.SH "SEE ALSO"
+.nf
+.I yum.conf (5)
+http://yum.baseurl.org/
+.fi
+
+.PP
+.SH "AUTHORS"
+.nf
+See the Authors file included with this program.
+.fi
diff --git a/docs/yum-debug-dump.1 b/docs/yum-debug-dump.1
index 0e65a07..3f1e2e5 100644
--- a/docs/yum-debug-dump.1
+++ b/docs/yum-debug-dump.1
@@ -1,7 +1,7 @@
 .\" yum-debug-dump
 .TH "yum-debug-dump" "1" "28 April 2008" "Seth Vidal" ""
 .SH "NAME"
-yum-debug-dump
+yum-debug-dump \- write system RPM configuration to a debug-dump file
 .SH "SYNOPSIS"
 \fByum-debug-dump\fP
 .SH "DESCRIPTION"
@@ -10,11 +10,15 @@ yum-debug-dump
 lot of information useful to developers trying to debug a problem.
 .PP
 By default it will output a file to the current working directory named
-yum_debug_dump.txt.gz. This file contains no private information but does
+yum_debug_dump-<hostname>-<time>.txt.gz. This file contains no private
+information but does
 contain a complete list of all packages you have installed, all packages
 available in any repository, important configuration and system information.
 You can view this file using the 'zless' command.
 .PP 
+You can use the coresponding program \fByum-debug-restore\fP to act on this file
+and restore a set of packages (much like dump/restore).
+.PP 
 .SH "FILES"
 As yum-debug-dump uses YUM libraries for retrieving all the information, it
 relies on YUM configuration for its default values like which repositories
@@ -29,6 +33,7 @@ to use. Consult YUM documentation for details:
 .PP 
 .SH "SEE ALSO"
 .nf
+.I yum-debug-restore (1)
 .I yum.conf (5)
 http://yum.baseurl.org/
 .fi 
diff --git a/docs/yum-debug-restore.1 b/docs/yum-debug-restore.1
new file mode 100644
index 0000000..c9d388d
--- /dev/null
+++ b/docs/yum-debug-restore.1
@@ -0,0 +1,62 @@
+.\" yum-debug-dump
+.TH "yum-debug-restore" "1" "15 December 2011" "James Antill" ""
+.SH "NAME"
+yum-debug-restore \- replay Yum transactions captured in a debug-dump file
+.SH "SYNOPSIS"
+\fByum-debug-restore\fP
+.SH "DESCRIPTION"
+.PP 
+\fByum-debug-restore\fP is a program which takes a gzipped file created by
+\fByum-debug-dump\fP and acts on the information about installed packages
+contained within.
+.PP
+
+.SH "GENERAL OPTIONS"
+.IP "\fB\-\-output\fP"
+Output the commands that would be run to stdout.
+.IP "\fB\-\-shell=<file>\fP"
+Output the commands that would be run to a file.
+.IP "\fB\-\-install\-latest\fP"
+Ask yum to install the latest version of the given packages, instead of the
+version that was installed in the debug-dump file.
+.IP "\fB\-\-ignore\-arch\fP"
+Ignore the architecture of the packages, so you can "restore" an i386 debug-dump
+on an x86_64 machine.
+.IP "\fB\-\-filter\-types=[install,remove,update,downgrade]\fP"
+Only perform the given types of commands, so you can filter to just upgrades
+and installs.
+
+.SH "FILES"
+As yum-debug-restore uses YUM libraries for retrieving all the information, it
+relies on YUM configuration for its default values like which repositories
+to use. Consult YUM documentation for details:
+.PP
+.nf 
+/etc/yum.conf
+/etc/yum/repos.d/
+/var/cache/yum/
+.fi 
+
+.PP 
+.SH "SEE ALSO"
+.nf
+.I yum-debug-dump (1)
+.I yum.conf (5)
+http://yum.baseurl.org/
+.fi 
+
+.PP 
+.SH "AUTHORS"
+.nf 
+See the Authors file included with this program.
+.fi 
+
+.PP 
+.SH "BUGS"
+There are of course no bugs, but should you find any, you should first
+consult the FAQ section on http://yum.baseurl.org/wiki/Faq and if unsuccessful
+in finding a resolution contact the mailing list: yum-devel@lists.baseurl.org.
+To file a bug use http://bugzilla.redhat.com for Fedora/RHEL/Centos
+related bugs and http://yum.baseurl.org/report for all other bugs.
+
+.fi
diff --git a/docs/yum-filter-data.1 b/docs/yum-filter-data.1
index 6d7f1e4..75a8236 100644
--- a/docs/yum-filter-data.1
+++ b/docs/yum-filter-data.1
@@ -16,52 +16,52 @@ is treated as a match.
 These are the options added to yum that are available in the "list updates", 
 "info updates", "check-update" and "update" commands. They are:
 .PP 
-.IP "\fB\--filter-vendors\fP"
+.IP "\fB\-\-filter\-vendors\fP"
 This option includes packages which have a vendor which matches one of the
 passed vendor wildcard strings, or is unknown. Note that vendors can have
 spaces in their value, so "," is the only way to specify multiple vendors as one
 option argument.
-.IP "\fB\--filter-rpm-groups\fP"
+.IP "\fB\-\-filter\-rpm\-groups\fP"
 This option includes packages which have a group which matches one of the
 passed rpm group wildcard strings, or is unknown. Note that rpm groups can have
 spaces in their value, so "," is the only way to specify multiple rpm groups as
 one option argument.
-.IP "\fB\--filter-packagers\fP"
+.IP "\fB\-\-filter\-packagers\fP"
 This option includes packages which have a packager which matches one of the
 passed packager wildcard strings, or is unknown. Note that vendors can have
 spaces in their value, so "," is the only way to specify multiple packagers as
 one option argument.
-.IP "\fB\--filter-licenses\fP"
+.IP "\fB\-\-filter\-licenses\fP"
 This option includes packages which have a license which matches one of the
 passed license wildcard strings, or is unknown. Note that licenses can have
 spaces in their value, so "," is the only way to specify multiple licenses as
 one option argument.
-.IP "\fB\--filter-arches\fP"
+.IP "\fB\-\-filter\-arches\fP"
 This option includes packages which have a arch which matches one of the
 passed arch wildcard strings, or is unknown.
-.IP "\fB\--filter-committers\fP"
+.IP "\fB\-\-filter\-committers\fP"
 This option includes packages which have a committer which matches one of the
 passed committer wildcard strings, or is unknown. Note that committers can have
 spaces in their value, so "," is the only way to specify multiple committers as
 one option argument. Also, committer values are so loosely formed that they 
-could contain commas too, it is recommeneded to not do that but you can work
+could contain commas too, it is recommended to not do that but you can work
 around it by using "?".
-.IP "\fB\--filter-buildhosts\fP"
+.IP "\fB\-\-filter\-buildhosts\fP"
 This option includes packages which have a buildhost which matches one of the
 passed buildhost wildcard strings, or is unknown.
-.IP "\fB\--filter-urls\fP"
+.IP "\fB\-\-filter\-urls\fP"
 This option includes packages which have a url which matches one of the
 passed url wildcard strings, or is unknown.
-.IP "\fB\--filter-package-sizes\fP"
+.IP "\fB\-\-filter\-package\-sizes\fP"
 This option includes packages which have a packagesize which is within one of
 the passed packagesize ranges, or is unknown.
-.IP "\fB\--filter-archive-sizes\fP"
+.IP "\fB\-\-filter\-archive\-sizes\fP"
 This option includes packages which have a archivesize which is within one of
 the passed archivesize ranges, or is unknown.
-.IP "\fB\--filter-installed-sizes\fP"
+.IP "\fB\-\-filter\-installed\-sizes\fP"
 This option includes packages which have a installedsize which is within one of
 the passed installedsize ranges, or is unknown.
-.IP "\fB\--filter-groups\fP"
+.IP "\fB\-\-filter\-groups\fP"
 This option includes packages which are in a yum group which matches one of the
 passed yum group id strings, or is unknown. Note that yum groups can have
 spaces in their value, so "," is the only way to specify multiple yum groups as
@@ -73,27 +73,27 @@ one option argument.
 .PP
 To list all updates that are 1 MB or less use:
 .IP
-yum --filter-package-sizes=-1m check-update
+yum \-\-filter\-package\-sizes=-1m check-update
 .PP
 To apply updates that Dan Walsh has committed use:
 .IP
-yum --filter-committers='Dan Walsh *' update
+yum \-\-filter\-committers=\(aqDan Walsh *\(aq update
 .PP
 To list updates for a specific group use:
 .IP
-yum --filter-rpm-groups='App*/Sys*' list updates
+yum \-\-filter\-rpm\-groups=\(aqApp*/Sys*\(aq list updates
 .PP
 To apply updates to a specific set of groups use:
 .IP
-yum --filter-rpm-groups='App*/System,Devel*/Lib*,System Environment/Base' update
+yum \-\-filter\-rpm\-groups=\(aqApp*/System,Devel*/Lib*,System Environment/Base\(aq update
 .PP
 To list updates for a set of yum groups use:
 .IP
-yum --filter-groups='PostgreSQL Database,Web Server' list updates
+yum \-\-filter\-groups=\(aqPostgreSQL Database,Web Server\(aq list updates
 .PP
 To apply updates to a specific set of yum groups use:
 .IP
-yum --filter-groups='KDE,Core,Printing Support' update
+yum \-\-filter\-groups=\(aqKDE,Core,Printing Support\(aq update
 
 .SH "SEE ALSO"
 .nf
@@ -109,7 +109,7 @@ James Antill <james.antill@redhat.com>.
 
 .SH "BUGS"
 Currently yum can't filter packages in all of the commands, so for instance
-"yum list 'yum*'" doesn't get the results filtered.
+"yum list \(aqyum*\(aq" doesn't get the results filtered.
 
 Apart from that there are no bugs, but should you find any, you should first
 consult the FAQ section on http://yum.baseurl.org/wiki/Faq and if unsuccessful
diff --git a/docs/yum-fs-snapshot.conf.5 b/docs/yum-fs-snapshot.conf.5
index a4b4f02..68bb2e8 100644
--- a/docs/yum-fs-snapshot.conf.5
+++ b/docs/yum-fs-snapshot.conf.5
@@ -20,6 +20,10 @@ utilizes configuration options in the form of
 .IP exclude
 This is a space delimited list of the mount points you do not wish to have
 snapshotted by this plugin.
+.SH OPTION
+.IP create_snapshots_in_post
+This is a boolean value used to control whether snapshots are also created
+after running the yum transaction.
 .SH OPTION - [lvm] section
 .IP enabled
 This is a boolean value used to control whether LVM snapshots will be
@@ -27,8 +31,9 @@ created for filesystems built on LVM logical volumes.
 .SH OPTION - [lvm] section
 .IP lvcreate_size_args
 This is the space delimited lvcreate argument list that is used to
-specify the size of the snapshot LV.  Valid lvcreate size options are -l
-or -L.  If not specified then LVM snapshots will not be created.
+specify the size of the snapshot LV.  Valid lvcreate size options are \-l
+or \-L.  If not specified then LVM snapshots will not be created for
+volumes that are not thinly provisioned.
 .SH AUTHOR
 .RS
 Josef Bacik <josef@toxicpanda.com>
diff --git a/docs/yum-groups-manager.1 b/docs/yum-groups-manager.1
index f49bde9..9854884 100644
--- a/docs/yum-groups-manager.1
+++ b/docs/yum-groups-manager.1
@@ -1,12 +1,12 @@
 .\" yum-groups-manager
 .TH "yum-groups-manager" "1" "23 August 2008" "" ""
 .SH "NAME"
-yum-groups-manager - create and edit yum's group metadata
+yum-groups-manager \- create and edit yum's group metadata
 .SH "SYNOPSIS"
 \fByum-groups-manager\fP [options] [packages]
 .SH "DESCRIPTION"
 \fByum-groups-manager\fP is used to create or edit a group metadata file for a
-yum repository. This is often much easier than writting/editing the XML by hand.
+yum repository. This is often much easier than writing/editing the XML by hand.
 The \fByum-groups-manager\fP can load an entire file of groups metadata and
 either create a new group or edit an existing group and then write all of the
 groups metadata back out.
@@ -43,7 +43,7 @@ Change the integer which controls the order groups are presented in, for example
 in yum grouplist.
 .IP "\fB\-\-load\fP"
 Load the groups metadata information from the specified file, before
-performing any operataions. This option can be specified multiple times.
+performing any operations. This option can be specified multiple times.
 .IP "\fB\-\-save\fP"
 Save the result to this file, you can specify the name of a file you are
 loading from as the data will only be saved when all the operations have been
@@ -77,11 +77,11 @@ in yum.
 
 .SH "EXAMPLES"
 .IP "Create a new group metadata file, with a group called yum containing all the packages that start with yum:"
-\fB yum-groups-manager --name YUM --save groups.xml 'yum*'\fP
+\fB yum-groups-manager \-\-name YUM \-\-save groups.xml \(aqyum*\(aq\fP
 .IP "After the above command, load the groups.xml data, work with the yum group, make the group not user visible, and remove the yum-skip-broken and yum-priorities packages from it:"
-\fB yum-groups-manager -n YUM --merge groups.xml --remove yum-skip-broken yum-priorities --not-user-visible\fP
+\fB yum-groups-manager \-n YUM \-\-merge groups.xml \-\-remove yum-skip-broken yum-priorities \-\-not\-user\-visible\fP
 .IP "After the above commands, add a description and a translated name to the yum group:"
-\fB yum-groups-manager -n YUM --merge groups.xml --description 'This is a group with most of the yum packages in it' --translated-name 'en:yum packages'\fP
+\fB yum-groups-manager \-n YUM \-\-merge groups.xml \-\-description \(aqThis is a group with most of the yum packages in it\(aq \-\-translated\-name \(aqen:yum packages\(aq\fP
 .SH "FILES"
 \fByum-groups-manager\fP uses the yum libraries for retrieving information and
 packages. If no configuration file is specified, the default yum
@@ -103,7 +103,7 @@ See the Authors file included with this program.
 .fi
 .SH "BUGS"
 .nf
-There are a couple of options you can't set, yet. Most notabley you cannot put
+There are a couple of options you can't set, yet. Most notably you cannot put
 package names into the conditional section (where they are installed with
 groupinstall only if another package is installed).
 
diff --git a/docs/yum-list-data.1 b/docs/yum-list-data.1
index d855104..a5477d6 100644
--- a/docs/yum-list-data.1
+++ b/docs/yum-list-data.1
@@ -61,7 +61,7 @@ added yum \fIcommand\fPs are:
 .PP 
 all of which take the same arguments as the list and info yum commands. The
 difference between the list and info varieties is that the info versions lists
-all the packages under each agregation.
+all the packages under each aggregation.
 .PP
 .br 
 .br 
@@ -118,7 +118,7 @@ more than one group at a time.
 .IP
 .PP 
 It is worth noting that some of the above data can be "unknown", to yum, at
-which point a seperate aggregation called "-- Unknown --" is listed.
+which point a separate aggregation called "-- Unknown --" is listed.
 .SH "EXAMPLES"
 .PP
 To list all the groups that have an update, along with the number of packages in each group, use:
@@ -127,7 +127,7 @@ yum list-rpm-groups updates
 .PP
 To list all the committers to packages that have yum in their name, use:
 .IP
-yum list-committers 'yum*'
+yum list-committers \(aqyum*\(aq
 .PP
 To list ranges of the sizes of packages installed or available, use:
 .IP
diff --git a/docs/yum-security.8 b/docs/yum-security.8
index 7e260b0..c7d9c8b 100644
--- a/docs/yum-security.8
+++ b/docs/yum-security.8
@@ -6,13 +6,13 @@ yum security plugin
 \fByum\fP [options] [command] [package ...]
 .SH "DESCRIPTION"
 .PP 
-This plugin extends \fByum\fP to allow lists and updates to be limited using security relevant criteria
+This plugin extends \fByum\fP to allow lists and updates to be limited using security relevant criteria.
 .PP 
-added yum \fIcommand\fPs are:
+Added yum \fIcommand\fPs are:
 .br 
 .I \fR yum update-minimal
 .PP 
-This works like the update command, but if you have the the package foo-1
+This works like the update command, but if you have the package foo-1
 installed and have foo-2 and foo-3 available with updateinfo.xml then
 update-minimal will update you to foo-3.
 .br 
@@ -22,7 +22,7 @@ update-minimal will update you to foo-3.
 .br 
 .I \fR yum updateinfo summary
 .PP 
-all of the last three take these \fIsub-command\fPs:
+All of the last three take these \fIsub-command\fPs:
 .br 
 .I \fR yum updateinfo * all
 .br 
@@ -108,40 +108,40 @@ distribution.
 .SH "GENERAL OPTIONS"
 There are four options added to yum that are available in the "list updates", "info updates", "check-update" and "update" commands. They are:
 .PP 
-.IP "\fB\--advisory\fP"
-This option includes packages coresponding to the advisory ID, Eg. FEDORA-2201-123.
-.IP "\fB\--bz\fP"
+.IP "\fB\-\-advisory\fP"
+This option includes packages corresponding to the advisory ID, Eg. FEDORA-2201-123.
+.IP "\fB\-\-bz\fP"
 This option includes packages that say they fix a Bugzilla ID, Eg. 123.
-.IP "\fB\--cve\fP"
+.IP "\fB\-\-cve\fP"
 This option includes packages that say they fix a CVE - Common Vulnerabilities and Exposures ID (http://cve.mitre.org/about/), Eg. CVE-2201-0123.
-.IP "\fB\--bugfixes\fP"
+.IP "\fB\-\-bugfixes\fP"
 This option includes packages that say they fix a bugfix issue.
-.IP "\fB\--security\fP"
+.IP "\fB\-\-security\fP"
 This option includes packages that say they fix a security issue.
 .PP
 .PP
 
 .SH "EXAMPLES"
 .PP
-To list all updates that are security relevant, and get a reutrn code on whether there are security updates use:
+To list all updates that are security relevant, and get a return code on whether there are security updates use:
 .IP
-yum --security check-update
+yum \-\-security check-update
 .PP
 To upgrade packages that have security errata (upgrades to the latest
 available package) use:
 .IP
-yum --security update
+yum \-\-security update
 .PP
 To upgrade packages that have security errata (upgrades to the last
 security errata package) use:
 .IP
-yum --security update-minimal
+yum \-\-security update-minimal
 .PP
 To get a list of all BZs that are fixed for packages you have installed use:
 .IP
 yum updateinfo list bugzillas
 .PP
-To get a list of all security advisoryies, including the ones you have already
+To get a list of all security advisories, including the ones you have already
 installed use:
 .IP
 yum updateinfo list all security
@@ -152,15 +152,15 @@ yum updateinfo info FEDORA-2707-4567
 .PP
 To update packages to the latest version which contain fixes for Bugzillas 123, 456 and 789; and all security updates use:
 .IP
-yum --bz 123 --bz 456 --bz 789 --security update
+yum \-\-bz 123 \-\-bz 456 \-\-bz 789 \-\-security update
 .PP
 To update to the packages which just update Bugzillas 123, 456 and 789; and all security updates use:
 .IP
-yum --bz 123 --bz 456 --bz 789 --security update-minimal
+yum \-\-bz 123 \-\-bz 456 \-\-bz 789 \-\-security update-minimal
 .PP
 To get an info list of the latest packages which contain fixes for Bugzilla 123; CVEs CVE-2207-0123 and CVE-2207-3210; and Fedora advisories FEDORA-2707-4567 and FEDORA-2707-7654 use:
 .IP
-yum --bz 123 --cve CVE-2207-0123 --cve CVE-2207-3210 --advisory FEDORA-2707-4567 --advisory FEDORA-2707-7654 info updates
+yum \-\-bz 123 \-\-cve CVE-2207-0123 \-\-cve CVE-2207-3210 \-\-advisory FEDORA-2707-4567 \-\-advisory FEDORA-2707-7654 info updates
 .PP
 To get a list of packages which are "new".
 .IP
@@ -183,8 +183,8 @@ James Antill <james.antill@redhat.com>.
 .fi
 
 .SH "BUGS"
-The update-minimal command ignores the --obsoletes flag.
+The update-minimal command ignores the \-\-obsoletes flag.
 
-The update-minimal command can only directly affect things atm., so if you update pkgA minimally but that requires an update to pkgB then pkgB will be updated to the newest version by the depsolver. Also the above will happen even if you've also minimally updated pkgB, if either the direct (minimal) update for pkgB happens after or if the minimal update for pkgB doesn't satisy the requirements of pkgA.
+The update-minimal command can only directly affect things atm., so if you update pkgA minimally but that requires an update to pkgB then pkgB will be updated to the newest version by the depsolver. Also the above will happen even if you've also minimally updated pkgB, if either the direct (minimal) update for pkgB happens after or if the minimal update for pkgB doesn't satisfy the requirements of pkgA.
 
-The main "problem" is that if the data is not correct the plugin cannot work correctly. For instance "--bz 123" will not fix BZ 123 if a package is updated to fix that BZ without referencing that it does so in the updateinfo.xml.
+The main "problem" is that if the data is not correct the plugin cannot work correctly. For instance "\-\-bz 123" will not fix BZ 123 if a package is updated to fix that BZ without referencing that it does so in the updateinfo.xml.
diff --git a/docs/yum-utils.1 b/docs/yum-utils.1
index fa830b6..3f858a8 100644
--- a/docs/yum-utils.1
+++ b/docs/yum-utils.1
@@ -15,8 +15,9 @@ yum\-utils \- tools for manipulating repositories and extended package managemen
 \fBrepoquery\fR \- query yum repositories and get additional information on the them
 \fBreposync\fR \- synchronize a remote yum repository to a local directory using yum to retrieve packages
 \fBrepotrack\fR \- track packages and its dependencies and downloads them
+\fBshow-changed-rco\fR \- list of changes to a package Requires, Conflicts and Obsoletes data from installed to a specified rpm file
 \fBshow-installed\fR \- gives a compact description of packages installed and makes use of comps groups in repositories
-\fBverifytree\fR - verify that a local yum repository is consistent
+\fBverifytree\fR \- verify that a local yum repository is consistent
 \fByum\-builddep\fR \- installs missing dependencies to build a specified package
 \fByum\-complete\-transaction\fR \- finds incomplete or aborted yum transactions and attempts to complete them
 \fByum\-config\-manager\fR \- toggle yum repositories, add new repositories and set main yum configuration options
@@ -32,6 +33,6 @@ is a collection of tools and programs for managing yum repositories, installing
 .SH "NOTES"
 See respective tools for additional help for commands without a manual page
 .SH "SEE ALSO"
-debuginfo\-install(1), package\-cleanup(1), repodiff(1), repoquery(1), reposync(1), repo\-rss(1), yumdownloader(1), yum\-builddep(1), yum\-debug\-dump(1), yum\-groups\-manager(1), yumdb(8), yum\-complete\-transaction(8)
+debuginfo\-install(1), package\-cleanup(1), repodiff(1), repoquery(1), reposync(1), repo\-rss(1), show\-changed\-rco(1), show\-installed(1), yumdownloader(1), yum\-builddep(1), yum\-debug\-dump(1), yum\-groups\-manager(1), yumdb(8), yum\-complete\-transaction(8)
 .SH "AUTHOR"
 Shawn Starr <shawn.starr@rogers.com>
diff --git a/docs/yum-verify.1 b/docs/yum-verify.1
index 706c38e..5246a1c 100644
--- a/docs/yum-verify.1
+++ b/docs/yum-verify.1
@@ -6,7 +6,7 @@ yum verify plugin
 \fByum\fP [options] verify [package ...]
 .SH "DESCRIPTION"
 .PP 
-This plugin extends \fByum\fP with some commands that give verification information on the installed system, much like rpm -V. You can change how the verification is done and which files it applies to.
+This plugin extends \fByum\fP with some commands that give verification information on the installed system, much like rpm \-V. You can change how the verification is done and which files it applies to.
 .PP 
 added yum \fIcommand\fPs are:
 .br 
@@ -24,12 +24,12 @@ only verify packages that are installed on the system.
 .br 
 .PP 
 .IP "\fBverify\fP"
-Is the generic verification command, and is intented to give the most useful
+Is the generic verification command, and is intended to give the most useful
 output. It removes all false matches due to multilib and ignores changes to
 configuration files by default.
 .IP
 .IP "\fBverify-rpm\fP"
-Is meant to be 100% compatible with rpm -V output, and any differences should be
+Is meant to be 100% compatible with rpm \-V output, and any differences should be
 considered as bugs.
 .IP
 .IP "\fBverify-all\fP"
@@ -39,29 +39,29 @@ Is used to list all the differences, including some that rpm itself will ignore.
 These are the options added to yum that are available in the verify commands.
 They are:
 .PP 
-.IP "\fB\--verify-filenames\fP"
+.IP "\fB\-\-verify\-filenames\fP"
 This option is used to limit the filenames that the packages will perform
 verification.
-.IP "\fB\--verify-configuration-files\fP"
+.IP "\fB\-\-verify\-configuration\-files\fP"
 This option is only useful in the generic verify command, and will
 enable/disable verification of files that are tagged as configuration files.
 .SH "EXAMPLES"
 .PP
-To do the same as rpm -Va, use:
+To do the same as rpm \-Va, use:
 .IP
 yum verify-rpm
 .PP
 To verify the packages starting with the name yum, use:
 .IP
-yum verify 'yum*'
+yum verify \(aqyum*\(aq
 .PP
 To verify the binaries that are in a bin directory, use:
 .IP
-yum verify --verify-filenames='*bin/*'
+yum verify \-\-verify\-filenames=\(aq*bin/*\(aq
 .PP
 To verify all include files, Eg. for multilib problems, use:
 .IP
-yum verify-all --verify-filenames='/usr/include/*'
+yum verify-all \-\-verify\-filenames=\(aq/usr/include/*\(aq
 
 .SH "SEE ALSO"
 .nf
@@ -77,7 +77,7 @@ James Antill <james.antill@redhat.com>.
 
 .SH "BUGS"
 .nf
-Currently yum-verify does not do verify-script checking or dependancy checking,
+Currently yum-verify does not do verify-script checking or dependency checking,
 only file checking.
 
 Should you find any other bugs, you should first
diff --git a/docs/yum-versionlock.1 b/docs/yum-versionlock.1
index f68665e..f7cd467 100644
--- a/docs/yum-versionlock.1
+++ b/docs/yum-versionlock.1
@@ -3,7 +3,7 @@
 .\"
 .TH YUM-VERSIONLOCK 1 "28 December 2009" "" "User Manuals"
 .SH NAME
-yum-versionlock - Version lock rpm packages
+yum-versionlock \- Version lock rpm packages
 .SH SYNOPSIS
 .B yum-versionlock
 [ package-name [ package-name]] ...
@@ -67,7 +67,7 @@ Panu Matilainen <pmatilai@laiskiainen.org>
 .br
 James Antill <james@and.org>
 .br
-Documetation modified by:
+Documentation modified by:
 .br
 Gerhardus Geldenhuis <gerhardus.geldenhuis@gmail.com>
 .SH "SEE ALSO"
diff --git a/docs/yumdb.8 b/docs/yumdb.8
index 63a3c6b..600a3a9 100644
--- a/docs/yumdb.8
+++ b/docs/yumdb.8
@@ -1,7 +1,7 @@
 .\" yumdb command
 .TH "yumdb" "8" "8 April 2010" "James Antill" ""
 .SH "NAME"
-yumdb command
+yumdb \- query and alter the Yum database
 .SH "SYNOPSIS"
 \fByumdb\fP [command] [packages ...]
 .SH "DESCRIPTION"
diff --git a/docs/yumdownloader.1 b/docs/yumdownloader.1
index a8a3b16..e290268 100644
--- a/docs/yumdownloader.1
+++ b/docs/yumdownloader.1
@@ -1,7 +1,7 @@
 .\" yumdownloader
 .TH "yumdownloader" "1" "28 November 2005" "Gijs Hollestelle" ""
 .SH "NAME"
-yumdownloader
+yumdownloader \- download RPM packages from Yum repositories
 .SH "SYNOPSIS"
 \fByumdownloader\fP [options] package1 [package2...]
 .SH "DESCRIPTION"
@@ -31,9 +31,9 @@ for more information
 
 .SH "EXAMPLES"
 .IP "Download the kernel RPM to /var/tmp:"
-\fByumdownloader --destdir /var/tmp kernel\fP
+\fByumdownloader \-\-destdir /var/tmp kernel\fP
 .IP "List the URL for the kernel and kernel-smp RPMs:"
-\fByumdownloader --urls kernel kernel-smp\fP 
+\fByumdownloader \-\-urls kernel kernel-smp\fP
 .PP 
 .SH "FILES"
 As yumdownloader uses YUM libraries for retrieving all the information, it
diff --git a/find-repos-of-install.py b/find-repos-of-install.py
index 0578295..aac29ea 100644
--- a/find-repos-of-install.py
+++ b/find-repos-of-install.py
@@ -7,11 +7,11 @@
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Library General Public License for more details.
+# GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 # copyright 2008 red hat, inc
 
 import sys
diff --git a/needs-restarting.py b/needs-restarting.py
index 6bc883f..a6946b0 100755
--- a/needs-restarting.py
+++ b/needs-restarting.py
@@ -8,11 +8,11 @@
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Library General Public License for more details.
+# GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 # Copyright 2009 Red Hat Inc
 # written by Seth Vidal
 
@@ -40,6 +40,7 @@
 import sys
 import os
 import yum
+import yum.misc
 import glob
 import stat
 from optparse import OptionParser
@@ -76,18 +77,18 @@ def get_open_files(pid):
     files = []
     smaps = '/proc/%s/smaps' % pid
     try:
-        maps = open(smaps, 'r')
+        maps = open(smaps, 'r').readlines()
     except (IOError, OSError), e:
         print "Could not open %s" % smaps
         return files
 
-    for line in maps.readlines():
-        if line.find('fd:') == -1:
+    for line in maps:
+        slash = line.find('/')
+        if slash == -1 or line.find('00:') != -1: # if we don't have a '/' or if we fine 00: in the file then it's not _REALLY_ a file
             continue
         line = line.replace('\n', '')
-        slash = line.find('/')
         filename = line[slash:]
-        filename = filename.replace('(deleted)', '') #only mildly retarded
+        #filename = filename.replace('(deleted)', '') #only mildly retarded
         filename = filename.strip()
         if filename not in files:
             files.append(filename)
@@ -106,7 +107,7 @@ def main(args):
     if opts.useronly:
         myuid = os.getuid()
     
-    needing_restart = []
+    needing_restart = set()
 
     for pid in return_running_pids(uid=myuid):
         try:
@@ -117,12 +118,43 @@ def main(args):
         for fn in get_open_files(pid):
             if found_match:
                 break
-            
-            for pkg in my.rpmdb.searchFiles(fn):
+            just_fn = fn.replace('(deleted)', '')
+            just_fn = just_fn.strip()            
+            bogon = False
+            # if the file is in a pkg which has been updated since we started the pid - then it needs to be restarted            
+            for pkg in my.rpmdb.searchFiles(just_fn):
                 if float(pkg.installtime) > float(pid_start):
-                    needing_restart.append(pid)
+                    needing_restart.add(pid)
                     found_match = True
+                    continue
+                if just_fn in pkg.ghostlist:
+                    bogon = True
+                    break
+            
+            if bogon:
+                continue
 
+            # if the file is deleted 
+            if fn.find('(deleted)') != -1: 
+                # and it is from /*bin/* then it needs to be restarted 
+                if yum.misc.re_primary_filename(just_fn):
+                    needing_restart.add(pid)
+                    found_match = True
+                    continue
+
+                # if the file is from an old ver of an installed pkg - then assume it was just updated but the 
+                # new pkg doesn't have the same file names. Fabulous huh?!
+                my.conf.cache = False
+                for oldpkg in my.pkgSack.searchFiles(just_fn): # ghostfiles are always bogons
+                    if just_fn in oldpkg.ghostlist:
+                        continue
+                    if my.rpmdb.installed(oldpkg.name):
+                        needing_restart.add(pid)
+                        found_match = True
+                        break
+
+           
+            
     for pid in needing_restart:
         try:
             cmdline = open('/proc/' +pid+ '/cmdline', 'r').read()
diff --git a/package-cleanup.py b/package-cleanup.py
index 4794369..acad9f2 100755
--- a/package-cleanup.py
+++ b/package-cleanup.py
@@ -12,11 +12,11 @@
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Library General Public License for more details.
+# GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 #
 #
 
@@ -119,34 +119,6 @@ class PackageCleanup(YumUtilBase):
                                  'removing kernels')
         self.optparser.add_option_group(kernelgrp)
     
-    def _find_missing_deps(self, pkgs):
-        """find any missing dependencies for any installed package in pkgs"""
-        # XXX - move into rpmsack/rpmdb
-        
-        providers = {} # To speed depsolving, don't recheck deps that have 
-                       # already been checked
-        problems = []
-        for po in pkgs:
-            for (req,flags,ver)  in po.requires:
-                    
-                if req.startswith('rpmlib'): continue # ignore rpmlib deps
-                if (req,flags,ver) not in providers:
-                    resolve_sack = self.rpmdb.whatProvides(req,flags,ver)
-                else:
-                    resolve_sack = providers[(req,flags,ver)]
-                    
-                if len(resolve_sack) < 1:
-                    flags = yum.depsolve.flags.get(flags, flags)
-                    missing = miscutils.formatRequire(req,ver,flags)
-                    problems.append((po, "requires %s" % missing))
-                                    
-                else:
-                    # Store the resolve_sack so that we can re-use it if another
-                    # package has the same requirement
-                    providers[(req,flags,ver)] = resolve_sack
-        
-        return problems
-
     def _find_installed_duplicates(self, ignore_kernel=True):
         """find installed duplicate packages returns a dict of 
            pkgname = [[dupe1, dupe2], [dupe3, dupe4]] """
@@ -282,18 +254,29 @@ class PackageCleanup(YumUtilBase):
         else:
             kver = runningkernel
             krel = ""
-        remove = kernels[count:]
+
+        #  This is roughly what we want, but when there are multiple packages
+        # we want to keep N of each.
+        # remove = kernels[count:]
+        kern_name_map = {}
+        for kern in kernels:
+            if kern.name not in kern_name_map:
+                kern_name_map[kern.name] = []
+            kern_name_map[kern.name].append(kern)
+        remove = []
+        for kern in kern_name_map.values():
+            remove.extend(kern[count:])
         
         toremove = []
         # Remove running kernel from remove list
         for kernel in remove:
-            if kernel.version == kver and krel.startswith(kernel.release):
+            if kernel.version == kver and kernel.release == krel:
                 print "Not removing kernel %s-%s because it is the running kernel" % (kver,krel)
             else:
                 toremove.append(kernel)
         
             
-        # Now extend the list with all kernel-devel pacakges that either
+        # Now extend the list with all kernel-devel packages that either
         # have no matching kernel installed or belong to a kernel that is to
         # be removed
         if not keepdevel: 
@@ -314,9 +297,9 @@ class PackageCleanup(YumUtilBase):
             self.setCacheDir()
         
         if opts.problems:
-            issues = self._find_missing_deps(self.rpmdb.returnPackages())
-            for (pkg, prob) in issues:
-                print 'Package %s %s' % (pkg.hdr.sprintf(opts.qf), prob)
+            issues = self.rpmdb.check_dependencies()
+            for prob in issues:
+                print 'Package %s' % prob
 
             if issues:
                 sys.exit(1)
diff --git a/plugins/aliases/aliases.py b/plugins/aliases/aliases.py
index 5cb08a1..9277c9b 100644
--- a/plugins/aliases/aliases.py
+++ b/plugins/aliases/aliases.py
@@ -44,7 +44,7 @@ class AliasedCommand:
 
     def doCheck(self, base, basecmd, extcmds):
         if recursive: # shouldn't happen
-            raise PluginYumExit('And error has occured for %s, please create a bug report')
+            raise PluginYumExit('And error has occurred for %s, please create a bug report')
 
         raise PluginYumExit('%s is an alias not a command, however recursive processing is turned off')
     doCommand = doCheck
diff --git a/plugins/auto-update-debuginfo/auto-update-debuginfo.py b/plugins/auto-update-debuginfo/auto-update-debuginfo.py
index 39993ad..9ff927c 100644
--- a/plugins/auto-update-debuginfo/auto-update-debuginfo.py
+++ b/plugins/auto-update-debuginfo/auto-update-debuginfo.py
@@ -38,7 +38,7 @@ def _check_man_disable(mdrs, di):
 def enable_debuginfo_repos(yb, conduit):
     mdrs = set()
     opts, args = conduit.getCmdLine()
-    if opts is not None and hasattr(opts.repos) :
+    if hasattr(opts, 'repos'):
         for opt, repoexp in opts.repos:
             if opt == '--disablerepo':
                 mdrs.add(repoexp)
diff --git a/plugins/changelog/changelog.py b/plugins/changelog/changelog.py
index 16144c6..d09281a 100644
--- a/plugins/changelog/changelog.py
+++ b/plugins/changelog/changelog.py
@@ -102,7 +102,7 @@ class ChangeLogCommand:
         return ['changelog', 'ChangeLog']
 
     def getUsage(self):
-        return "<date>|<number>|all [PACKAGE|all|installed|updates|extras|obsoletes|recent]"
+        return "[<date>|<number>|all] [PACKAGE|all|installed|updates|extras|obsoletes|recent]"
 
     def getSummary(self):
         return """\
@@ -212,6 +212,15 @@ Display changelog data, since a specified time, on a group of packages"""
                     msg = "Argument -- %s -- is not valid: %s" % (since, to_str(e))
                     raise PluginYumExit(msg)
 
+                if self._since_dto == dateutil_parser.parse('garbage', fuzzy=True):
+                    # 'since' was a package name, not a date
+                    extcmds.insert(0, since)
+
+                    # assume since="all"
+                    self._since_all = True
+                    self._since_dto = None
+                    self._since_tt  = None
+
         ypl = base.returnPkgLists(extcmds)
         self.show_data(msg, ypl.installed, 'Installed Packages')
         self.show_data(msg, ypl.available, 'Available Packages')
diff --git a/plugins/downloadonly/downloadonly.conf b/plugins/downloadonly/downloadonly.conf
deleted file mode 100644
index 8e4d76c..0000000
--- a/plugins/downloadonly/downloadonly.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-[main]
-enabled=1
diff --git a/plugins/downloadonly/downloadonly.py b/plugins/downloadonly/downloadonly.py
deleted file mode 100644
index 8486bb0..0000000
--- a/plugins/downloadonly/downloadonly.py
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/python
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Library General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# by Menno Smits
-
-from yum.plugins import PluginYumExit, TYPE_INTERACTIVE
-
-requires_api_version = '2.1'
-plugin_type = (TYPE_INTERACTIVE,)
-
-def config_hook(conduit):
-    parser = conduit.getOptParser()
-    if hasattr(parser, 'plugin_option_group'):
-        parser = parser.plugin_option_group
-
-    parser.add_option('', '--downloadonly', dest='dlonly', action='store_true',
-           default=False, help="don't update, just download")
-    parser.add_option('', '--downloaddir', dest='dldir',
-                      action='store', default=None,
-                      help="specifies an alternate directory to store packages")
-
-def postreposetup_hook(conduit):
-    opts, commands = conduit.getCmdLine()
-    if opts.dldir:
-        repos = conduit.getRepos()
-        rlist = repos.listEnabled()
-        for repo in rlist:
-            repo.setAttribute('pkgdir',opts.dldir)
-           
-
-def postdownload_hook(conduit):
-    opts, commands = conduit.getCmdLine()
-    # Don't die on errors, or we'll never see them.
-    if not conduit.getErrors() and opts.dlonly:
-        raise PluginYumExit('exiting because --downloadonly specified ')
diff --git a/plugins/fedorakmod/fedorakmod.py b/plugins/fedorakmod/fedorakmod.py
index b3aed61..82a43d5 100644
--- a/plugins/fedorakmod/fedorakmod.py
+++ b/plugins/fedorakmod/fedorakmod.py
@@ -37,7 +37,7 @@ kernelVariants = ["bigmem", "enterprise", "smp", "hugemem", "PAE",
                   "guest", "hypervisor", "xen0", "xenU", "xen"]
 
 def getRunningKernel():
-    # Taken from the installonlyn.py plugin writen by Jeremy Katz
+    # Taken from the installonlyn.py plugin written by Jeremy Katz
     # Copyright 2005  Red Hat, Inc. 
     # Modified by Jack Neely to return a kernel provides tuple
     """This takes the output of uname and figures out the (version, release)
diff --git a/plugins/fs-snapshot/fs-snapshot.conf b/plugins/fs-snapshot/fs-snapshot.conf
index 3a67c69..9ada717 100644
--- a/plugins/fs-snapshot/fs-snapshot.conf
+++ b/plugins/fs-snapshot/fs-snapshot.conf
@@ -1,5 +1,6 @@
 [main]
 enabled = 1
+create_snapshots_in_post = 0
 
 [lvm]
 enabled = 0
diff --git a/plugins/fs-snapshot/fs-snapshot.py b/plugins/fs-snapshot/fs-snapshot.py
index 5094881..4f99b6a 100644
--- a/plugins/fs-snapshot/fs-snapshot.py
+++ b/plugins/fs-snapshot/fs-snapshot.py
@@ -21,7 +21,7 @@ This plugin creates a snapshot before any yum update or yum remove operation on
 any btrfs filesystem that is affected by the update/remove operation.
 
 This is a giant hammer.  Please be aware that if you rollback to a previous
-snapshot that any other changes that occured to the filesystem after the
+snapshot that any other changes that occurred to the filesystem after the
 snapshot takes place will not be in the snapshot.  You of course can mount the
 newer version elsewhere and copy the new versions of the files back to your
 rolled-back snapshot.  You have been warned.
@@ -62,6 +62,9 @@ def kernel_supports_dm_snapshot_merge():
         dm_snapshot_merge_checked = 1
     return dm_snapshot_merge_support
 
+def is_thin_volume(volume):
+    return volume["segtype"] == "thin"
+
 def inspect_volume_lvm(conduit, volume):
     """
     If volume is an LVM logical volume:
@@ -79,25 +82,28 @@ def inspect_volume_lvm(conduit, volume):
     if device.startswith("/dev/mapper/"):
         # convert /dev/mapper name to /dev/vg/lv for use with LVM2 tools
         # - 'dmsetup splitname' will collapse any escaped characters
-        p = Popen(["/sbin/dmsetup", "splitname", "--separator", "/",
-                   "--noheadings",
-                   "-o", "vg_name,lv_name", device], stdout=PIPE, stderr=PIPE)
+        p = Popen(["/sbin/dmsetup", "splitname", "--separator", " ",
+                   "--noheadings", "-c",
+                   device], stdout=PIPE, stderr=PIPE)
         err = p.wait()
         if err:
             return 0
         output = p.communicate()[0]
-        device = output.strip().replace("/dev/mapper/", "/dev/")
+        device = "/".join(output.split()[:2])
+        device = device.replace("/dev/mapper/", "/dev/")
         volume["device"] = device
 
     # Check if device is managed by lvm
     # - FIXME filter out snapshot (and other) LVs; for now just rely
     #   on 'lvcreate' to prevent snapshots of unsupported LV types
-    p = Popen(["/sbin/lvs", device], stdout=PIPE, stderr=PIPE)
+    p = Popen(["/sbin/lvs", "--noheadings", "-o", "segtype", device], stdout=PIPE, stderr=PIPE)
     err = p.wait()
     if not err:
+        volume["segtype"] = p.communicate()[0].strip()
+
         # FIXME allow creating snapshot LVs even if kernel doesn't
         # support snapshot-merge based system rollback? make configurable?
-        if not kernel_supports_dm_snapshot_merge():
+        if not is_thin_volume(volume) and not kernel_supports_dm_snapshot_merge():
             conduit.error(1, "fs-snapshot: skipping volume: %s, "
                           "kernel doesn't support snapshot-merge" % device)
             return 0
@@ -216,6 +222,14 @@ def _create_btrfs_snapshot(conduit, snapshot_tag, volume):
         return 1
     return 2
 
+def add_lvm_tag_to_snapshot(conduit, tag, snap_volume):
+    p = Popen(["/sbin/lvchange", "--addtag", tag, snap_volume],
+              stdout=PIPE, stderr=PIPE)
+    err = p.wait()
+    if err:
+        conduit.error(1, "fs-snapshot: couldn't add tag to snapshot: %s" %
+                      snap_volume)
+
 def _create_lvm_snapshot(conduit, snapshot_tag, volume):
     """
     Create LVM snapshot LV and tag it with $snapshot_tag.
@@ -223,16 +237,18 @@ def _create_lvm_snapshot(conduit, snapshot_tag, volume):
       has enough free space to accommodate a snapshot LV.
     - Also assumes user has configured 'lvcreate_size_args'.
     """
-    lvcreate_size_args = conduit.confString('lvm', 'lvcreate_size_args',
-                                            default=None)
-    if not lvcreate_size_args:
-        conduit.error(1, "fs-snapshot: 'lvcreate_size_args' was not provided "
-                      "in the '[lvm]' section of the config file")
-        return 1
+    if not is_thin_volume(volume):
+        lvcreate_size_args = conduit.confString('lvm', 'lvcreate_size_args',
+                                                default=None)
 
-    if not lvcreate_size_args.startswith("-L") and not lvcreate_size_args.startswith("-l"):
-        conduit.error(1, "fs-snapshot: 'lvcreate_size_args' did not use -L or -l")
-        return 1
+        if not lvcreate_size_args:
+            conduit.error(1, "fs-snapshot: 'lvcreate_size_args' was not provided "
+                          "in the '[lvm]' section of the config file")
+            return 1
+
+        if not lvcreate_size_args.startswith("-L") and not lvcreate_size_args.startswith("-l"):
+            conduit.error(1, "fs-snapshot: 'lvcreate_size_args' did not use -L or -l")
+            return 1
 
     device = volume["device"]
     if device.count('/') != 3:
@@ -259,7 +275,8 @@ def _create_lvm_snapshot(conduit, snapshot_tag, volume):
                  (mntpnt, device, snap_lvname))
     # Create snapshot LV
     lvcreate_cmd = ["/sbin/lvcreate", "-s", "-n", snap_lvname]
-    lvcreate_cmd.extend(lvcreate_size_args.split())
+    if not is_thin_volume(volume):
+        lvcreate_cmd.extend(lvcreate_size_args.split())
     lvcreate_cmd.append(device)
     p = Popen(lvcreate_cmd, stdout=PIPE, stderr=PIPE)
     err = p.wait()
@@ -270,16 +287,18 @@ def _create_lvm_snapshot(conduit, snapshot_tag, volume):
     # Add tag ($snapshot_tag) to snapshot LV
     # - should help facilitate merge of all snapshot LVs created
     #   by a yum transaction, e.g.: lvconvert --merge @snapshot_tag
-    p = Popen(["/sbin/lvchange", "--addtag", snapshot_tag, snap_device],
-              stdout=PIPE, stderr=PIPE)
-    err = p.wait()
-    if err:
-        conduit.error(1, "fs-snapshot: couldn't add tag to snapshot: %s" %
-                      snap_device)
+    if add_lvm_tag_to_snapshot(conduit, snapshot_tag, snap_device):
         return 1
+    if conduit._base.__plugin_fs_snapshot_post_snapshot_tag == snapshot_tag:
+        # Add tag to allow other tools (e.g. snapper) to link pre
+        # and post snapshot LVs together
+        pre_snap_lv_name = "%s_%s" % (device, conduit._base.__plugin_fs_snapshot_pre_snapshot_tag)
+        pre_snapshot_tag = "yum_fs_snapshot_pre_lv_name=" + pre_snap_lv_name
+        if add_lvm_tag_to_snapshot(conduit, pre_snapshot_tag, snap_device):
+            return 1
     return 2
 
-def pretrans_hook(conduit):
+def create_snapshots(conduit):
     """
     This runs before the transaction starts.  Try to snapshot anything and
     everything that is snapshottable, since we do not know what an RPM will
@@ -287,6 +306,10 @@ def pretrans_hook(conduit):
     """
     # common snapshot tag format: yum_${year}${month}${day}${hour}${minute}${sec}
     snapshot_tag = "yum_" + time.strftime("%Y%m%d%H%M%S")
+    if not conduit._base.__plugin_fs_snapshot_pre_snapshot_tag:
+        conduit._base.__plugin_fs_snapshot_pre_snapshot_tag = snapshot_tag
+    else:
+        conduit._base.__plugin_fs_snapshot_post_snapshot_tag = snapshot_tag
 
     volumes = get_volumes(conduit)
     for volume in volumes:
@@ -296,3 +319,13 @@ def pretrans_hook(conduit):
         elif rc == 2 and hasattr(conduit, 'registerPackageName'):
             # A snapshot was successfully created
             conduit.registerPackageName("yum-plugin-fs-snapshot")
+
+def pretrans_hook(conduit):
+    conduit._base.__plugin_fs_snapshot_pre_snapshot_tag = None
+    conduit._base.__plugin_fs_snapshot_post_snapshot_tag = None
+    create_snapshots(conduit)
+
+def posttrans_hook(conduit):
+    create_snapshots_in_post = conduit.confBool('main', 'create_snapshots_in_post', default=0)
+    if create_snapshots_in_post:
+        create_snapshots(conduit)
diff --git a/plugins/keys/keys.py b/plugins/keys/keys.py
index 3342576..4d2ca96 100644
--- a/plugins/keys/keys.py
+++ b/plugins/keys/keys.py
@@ -31,6 +31,15 @@ except:
 requires_api_version = '2.1'
 plugin_type = (TYPE_INTERACTIVE,)
 
+def gpgkey_fingerprint_ascii(gpg_cert, chop=4):
+    ''' Given a key_info data from getgpgkeyinfo(), return an ascii
+    fingerprint. Chop every 4 ascii values, as that is what GPG does. '''
+    fp = yum.pgpmsg.str_to_hex(gpg_cert.public_key.fingerprint())
+    if chop:
+        fp = [fp[i:i+chop] for i in range(0, len(fp), chop)]
+        fp = " ".join(fp)
+    return fp
+
 def match_keys(patterns, key, globs=True):
     for pat in patterns:
         if pat == key.keyid:
@@ -250,7 +259,7 @@ Key ID     : %s
        time.ctime(key.createts),
        gpg_cert.version, gpg_cert.user_id,
        yum.pgpmsg.algo_pk_to_str[gpg_cert.public_key.pk_algo],
-       yum.pgpmsg.str_to_hex(gpg_cert.public_key.fingerprint()),
+       gpgkey_fingerprint_ascii(gpg_cert),
        yum.pgpmsg.str_to_hex(gpg_cert.public_key.key_id()))
 
 
diff --git a/plugins/local/local.py b/plugins/local/local.py
index c45a1ce..cab69c5 100644
--- a/plugins/local/local.py
+++ b/plugins/local/local.py
@@ -146,7 +146,7 @@ def _reposetup(conduit):
              if repo.id == "_local"]
     if lrepo:
         lrepo = lrepo[0]
-        os.unlink("%s/cachecookie" % lrepo.cachedir)
+        yum.misc.unlink_f("%s/cachecookie" % lrepo.cachedir)
         return
 
     conf_fname = '/etc/yum.repos.d/_local.repo'
diff --git a/plugins/priorities/priorities.py b/plugins/priorities/priorities.py
index 202c203..ce98583 100644
--- a/plugins/priorities/priorities.py
+++ b/plugins/priorities/priorities.py
@@ -161,9 +161,19 @@ def exclude_hook(conduit):
                                 conduit.delPackage(po)
                                 cnt += 1
                                 conduit.info(3," --> %s from %s excluded (priority)" % (po,po.repoid))
+                                # Remove all occurances of this package
+                                for p in conduit.getPackages(repo):
+                                    if p.name==po.name:
+                                        conduit.delPackage(p)
+                                        cnt += 1
+                                        conduit.info(3," --> %s from %s excluded (priority)" % (p,p.repoid))
                                 break
     if cnt:
         conduit.info(2, '%d packages excluded due to repository priority protections' % cnt)
+    if check_obsoletes:
+        #  Atm. the update object doesn't get updated when we manually exclude
+        # things ... so delete it. This needs to be re-written.
+        conduit._base.up = None
 
 def _pkglist_to_dict(pl, priority, addArch = False):
     out = dict()
diff --git a/plugins/tmprepo/tmprepo.py b/plugins/tmprepo/tmprepo.py
index e60dd4d..ec51f5b 100644
--- a/plugins/tmprepo/tmprepo.py
+++ b/plugins/tmprepo/tmprepo.py
@@ -91,7 +91,7 @@ def add_dir_repo(base, trepo, cleanup):
         os.chmod(trepo_data, 0755)
     trepo_name = os.path.basename(os.path.dirname(trepo_path))
     tmp_fname  = "%s/tmp-%s.repo" % (trepo_data, trepo_name)
-    repoid     = "T-%4.4s-%x" % (trepo_name, int(time.time()))
+    repoid     = "T-%0.4s-%x" % (trepo_name, int(time.time()))
     tpc = 'true'
     if not lpgpgcheck:
         tpc = 'false'
@@ -133,7 +133,7 @@ def add_repomd_repo(base, repomd):
     AutoCleanupDir(trepo_data)
     trepo_name = os.path.basename(os.path.dirname(os.path.dirname(repomd)))
     tmp_fname  = "%s/tmp-%s.repo" % (trepo_data, trepo_name)
-    repoid     = "T-%4.4s-%x" % (trepo_name, int(time.time()))
+    repoid     = "T-%0.4s-%x" % (trepo_name, int(time.time()))
     pgpgcheck, rgpgcheck = rpgpgcheck, rrgpgcheck
     if repomd.startswith("file:"):
         pgpgcheck, rgpgcheck = lpgpgcheck, lrgpgcheck
diff --git a/plugins/versionlock/versionlock.py b/plugins/versionlock/versionlock.py
index 40756b2..dfe4dd3 100644
--- a/plugins/versionlock/versionlock.py
+++ b/plugins/versionlock/versionlock.py
@@ -56,6 +56,23 @@ def _read_locklist():
         raise PluginYumExit('Unable to read version lock configuration: %s' % e)
     return locklist
 
+def _match(ent, patterns):
+    # there should be an API for this in Yum
+    (n, v, r, e, a) = splitFilename(ent)
+    for name in (
+        '%s' % n,
+        '%s.%s' % (n, a),
+        '%s-%s' % (n, v),
+        '%s-%s-%s' % (n, v, r),
+        '%s-%s-%s.%s' % (n, v, r, a),
+        '%s:%s-%s-%s.%s' % (e, n, v, r, a),
+        '%s-%s:%s-%s.%s' % (n, e, v, r, a),
+    ):
+        for pat in patterns:
+            if fnmatch.fnmatch(name, pat):
+                return True
+    return False
+
 class VersionLockCommand:
     created = 1247693044
 
@@ -99,9 +116,13 @@ class VersionLockCommand:
             if not pkgs:
                 pkgs = base.pkgSack.returnPackages(patterns=extcmds)
 
+            done = set()
+            for ent in _read_locklist():
+                (n, v, r, e, a) = splitFilename(ent)
+                done.add((n, a, e, v, r))
+
             fo = open(filename, 'a')
             count = 0
-            done = set()
             for pkg in pkgs:
                 #  We ignore arch, so only add one entry for foo-1.i386 and
                 # foo-1.x86_64.
@@ -155,12 +176,7 @@ class VersionLockCommand:
             out = os.fdopen(out, 'w', -1)
             count = 0
             for ent in _read_locklist():
-                found = False
-                for match in extcmds:
-                    if fnmatch.fnmatch(ent, match):
-                        found = True
-                        break
-                if found:
+                if _match(ent, extcmds):
                     print "Deleting versionlock for:", ent
                     count += 1
                     continue
@@ -170,6 +186,7 @@ class VersionLockCommand:
             if not count:
                 os.unlink(tmpfilename)
                 return 1, ['Error: versionlock delete: no matches']
+            os.chmod(tmpfilename, 0644)
             os.rename(tmpfilename, filename)
             return 0, ['versionlock deleted: ' + str(count)]
 
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 581da0a..d85030c 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -28,7 +28,6 @@ plugins/ps/ps.py
 plugins/auto-update-debuginfo/auto-update-debuginfo.py
 plugins/show-leaves/show-leaves.py
 plugins/list-data/list-data.py
-plugins/downloadonly/downloadonly.py
 plugins/allowdowngrade/allowdowngrade.py
 plugins/tsflags/tsflags.py
 plugins/merge-conf/merge-conf.py
diff --git a/repo-check.py b/repo-check.py
index 7c4ae77..2aa8bde 100755
--- a/repo-check.py
+++ b/repo-check.py
@@ -7,11 +7,11 @@
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Library General Public License for more details.
+# GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 import sys
 sys.path.insert(0,'/usr/share/yum-cli')
@@ -239,4 +239,4 @@ class RepoCheck(YumUtilBase):
 if __name__ == '__main__':
     setup_locale()
     util = RepoCheck()
-    
\ No newline at end of file
+    
diff --git a/repo-graph.py b/repo-graph.py
index bb901a8..bca41d0 100755
--- a/repo-graph.py
+++ b/repo-graph.py
@@ -7,11 +7,11 @@
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Library General Public License for more details.
+# GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 # (c) 2005 Panu Matilainen <pmatilai@laiskiainen.org>
 
 # generates graphviz .dot's from repomd data
diff --git a/repo-rss.py b/repo-rss.py
index 4a2917c..871e338 100755
--- a/repo-rss.py
+++ b/repo-rss.py
@@ -8,11 +8,11 @@
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Library General Public License for more details.
+# GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 # seth vidal 2005 (c) etc etc
 
 import yum
@@ -144,7 +144,7 @@ class RepoRSS:
             changelog += '%s - %s\n%s\n\n' % (date, author, desc)
         description = '<p><strong>%s</strong> - %s</p>\n\n' % (escape(pkg.name), 
                                             escape(pkg.returnSimple('summary')))
-        description += '<p>%s</p>\n\n<p><strong>Change Log:</strong></p>\n\n' % escape(pkg.returnSimple('description').encode('utf-8').replace("\n", "<br />\n"))
+        description += '<p>%s</p>\n\n<p><strong>Change Log:</strong></p>\n\n' % escape(to_unicode(pkg.returnSimple('description')).encode('utf-8').replace("\n", "<br />\n"))
         description += escape('<pre>%s</pre>' % escape(to_unicode(changelog).encode('utf-8')))
         item.newChild(None, 'description', description)
         
@@ -222,6 +222,8 @@ def main(options, args):
             sys.exit(1)
     
     recent = my.getRecent(days=days)
+    recent.sort(key=lambda pkg: pkg.returnSimple('filetime'))
+    recent.reverse()
     if options.groups:
         comps = Comps()
         for repo in my.repos.listEnabled():
diff --git a/repoclosure.py b/repoclosure.py
index e710d8c..f895f84 100755
--- a/repoclosure.py
+++ b/repoclosure.py
@@ -8,11 +8,11 @@
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Library General Public License for more details.
+# GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 # seth vidal 2005 (c) etc etc
 
 
@@ -166,7 +166,7 @@ class RepoClosure(yum.YumBase):
 
         for pkg in pkgs:
             if pkg.repoid in self.lookaside:
-                # don't attempt to resolve dependancy issues for
+                # don't attempt to resolve dependency issues for
                 # packages from lookaside repositories
                 continue
             for (req, flags, (reqe, reqv, reqr)) in pkg.returnPrco('requires'):
@@ -298,12 +298,12 @@ def main():
                 req = '%s %s' % (req, v)
             
             my.logger.info('     %s' % req)
+    if baddeps:
+        sys.exit(1)
 
 if __name__ == "__main__":
     try:
         main()
     except (yum.Errors.YumBaseError, ValueError), e:
         print >> sys.stderr, str(e)
-        sys.exit(1)
-        
-        
+        sys.exit(2)
diff --git a/repodiff.py b/repodiff.py
index 67c162e..21be5af 100755
--- a/repodiff.py
+++ b/repodiff.py
@@ -10,8 +10,8 @@
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 # (c) 2007 Red Hat. Written by skvidal@fedoraproject.org
 
 import yum
@@ -22,8 +22,16 @@ import locale
 import rpmUtils.arch
 from yum.i18n import to_unicode
 
+from urlgrabber.progress import format_number
+
 from optparse import OptionParser
 
+def bkMG(num):
+    ''' Call format_number() but deals with negative numbers. '''
+    if num >= 0:
+        return format_number(num)
+    return '-' + format_number(-num)
+
 class DiffYum(yum.YumBase):
     def __init__(self):
         yum.YumBase.__init__(self)
@@ -43,8 +51,14 @@ class DiffYum(yum.YumBase):
         # make our new repo obj
         newrepo = yum.yumRepo.YumRepository(repoid)
         newrepo.name = repoid
-        newrepo.baseurl = [baseurl]
+        if baseurl.startswith("mirror:"):
+            newrepo.mirrorlist = baseurl[len("mirror:"):]
+        elif baseurl.startswith("/"):
+            newrepo.baseurl = ["file:" + baseurl]
+        else:
+            newrepo.baseurl = [baseurl]
         newrepo.basecachedir = self.dy_basecachedir
+        newrepo.base_persistdir = self.dy_basecachedir
         newrepo.metadata_expire = 0
         newrepo.timestamp_check = False
         # add our new repo
@@ -157,6 +171,8 @@ def parseArgs(args):
                       help="When comparing binary repos. also compare the arch of packages, to see if they are different")
     parser.add_option("-s", "--size", default=False, action='store_true',
                       help="Output size changes for any new->old packages")
+    parser.add_option("--downgrade", default=False, action='store_true',
+                      help="Output upgrade/downgrade separately")
     parser.add_option("--simple",  default=False, action='store_true',
                       help="output simple format")
     (opts, argsleft) = parser.parse_args()
@@ -177,6 +193,47 @@ def parseArgs(args):
     
     return opts
 
+def _out_mod(opts, oldpkg, pkg, sizechange):
+    if opts.simple:
+        if opts.compare_arch:
+            msg = "%s: %s ->  %s" % (pkg.name, oldpkg, pkg)
+        else:
+            msg = "%s: %s-%s-%s ->  %s-%s-%s" % (pkg.name, oldpkg.name, 
+                                                 oldpkg.ver, oldpkg.rel,
+                                                 pkg.name, pkg.ver,
+                                                 pkg.rel)
+    else:
+        if opts.compare_arch:
+            msg = "%s" % pkg
+        else:
+            msg = "%s-%s-%s" % (pkg.name, pkg.ver, pkg.rel)
+        dashes = "-" * len(msg) 
+        msg += "\n%s\n" % dashes
+        # get newest clog time from the oldpkg
+        # for any newer clog in pkg
+        # print it
+        oldlogs = oldpkg.changelog
+        if len(oldlogs):
+            #  Don't sort as that can screw the order up when time is the
+            # same.
+            oldtime    = oldlogs[0][0]
+            oldauth    = oldlogs[0][1]
+            oldcontent = oldlogs[0][2]
+            for (t, author, content) in  pkg.changelog:
+                if t < oldtime:
+                    break
+                if ((t == oldtime) and (author == oldauth) and
+                    (content == oldcontent)):
+                    break
+                tm = datetime.date.fromtimestamp(int(t))
+                tm = tm.strftime("%a %b %d %Y")
+                msg += "* %s %s\n%s\n\n" % (tm, to_unicode(author),
+                                            to_unicode(content))
+            if opts.size:
+                msg += "\nSize change: %s bytes\n" % sizechange
+
+    print msg
+
 def main(args):
     opts = parseArgs(args)
 
@@ -221,6 +278,11 @@ def main(args):
     total_sizechange = 0
     add_sizechange = 0
     remove_sizechange = 0
+    mod_sizechange = 0
+    up_sizechange = 0
+    down_sizechange = 0
+    upgraded_pkgs = 0
+    downgraded_pkgs = 0
     if ygh.add:
         for pkg in sorted(ygh.add):
             if opts.compare_arch:
@@ -243,49 +305,32 @@ def main(args):
     if ygh.modified:
         print '\nUpdated Packages:\n'
         for (pkg, oldpkg) in sorted(ygh.modified):
+            if opts.downgrade and pkg.verLT(oldpkg):
+                continue
+
+            upgraded_pkgs += 1
+            sizechange = None
             if opts.size:
                 sizechange = int(pkg.size) - int(oldpkg.size)
-                total_sizechange += sizechange
-            
-            if opts.simple:
-                if opts.compare_arch:
-                    msg = "%s: %s ->  %s" % (pkg.name, oldpkg, pkg)
-                else:
-                    msg = "%s: %s-%s-%s ->  %s-%s-%s" % (pkg.name, oldpkg.name, 
-                                                         oldpkg.ver, oldpkg.rel,
-                                                         pkg.name, pkg.ver,
-                                                         pkg.rel)
-            else:
-                if opts.compare_arch:
-                    msg = "%s" % pkg
+                if opts.downgrade:
+                    up_sizechange += sizechange
                 else:
-                    msg = "%s-%s-%s" % (pkg.name, pkg.ver, pkg.rel)
-                dashes = "-" * len(msg) 
-                msg += "\n%s\n" % dashes
-                # get newest clog time from the oldpkg
-                # for any newer clog in pkg
-                # print it
-                oldlogs = oldpkg.changelog
-                if len(oldlogs):
-                    #  Don't sort as that can screw the order up when time is the
-                    # same.
-                    oldtime    = oldlogs[0][0]
-                    oldauth    = oldlogs[0][1]
-                    oldcontent = oldlogs[0][2]
-                    for (t, author, content) in  pkg.changelog:
-                        if t < oldtime:
-                            break
-                        if ((t == oldtime) and (author == oldauth) and
-                            (content == oldcontent)):
-                            break
-                        tm = datetime.date.fromtimestamp(int(t))
-                        tm = tm.strftime("%a %b %d %Y")
-                        msg += "* %s %s\n%s\n\n" % (tm, to_unicode(author),
-                                                    to_unicode(content))
-                    if opts.size:
-                        msg += "\nSize Change: %s bytes\n" % sizechange
-
-            print msg
+                    mod_sizechange += sizechange
+            _out_mod(opts, oldpkg, pkg, sizechange)
+
+        if opts.downgrade:
+            print '\nDowngraded Packages:\n'
+            for (pkg, oldpkg) in sorted(ygh.modified):
+                if pkg.verGT(oldpkg):
+                    continue
+
+                downgraded_pkgs += 1
+                sizechange = None
+                if opts.size:
+                    sizechange = int(pkg.size) - int(oldpkg.size)
+                    down_sizechange += sizechange
+                _out_mod(opts, oldpkg, pkg, sizechange)
+
 
     if (not ygh.add and not ygh.remove and not ygh.modified and
         not my.pkgSack.searchNevra(arch='src')):
@@ -294,11 +339,34 @@ def main(args):
     print '\nSummary:'
     print 'Added Packages: %s' % len(ygh.add)
     print 'Removed Packages: %s' % len(ygh.remove)
-    print 'Modified Packages: %s' % len(ygh.modified)
+    if not opts.downgrade:
+        print 'Modified Packages: %s' % len(ygh.modified)
+    else:
+        print 'Upgraded Packages: %s' % upgraded_pkgs
+        print 'Downgraded Packages: %s' % downgraded_pkgs
     if opts.size:
-        print 'Size of added packages: %s' % add_sizechange
-        print 'Size change of modified packages: %s' % total_sizechange
-        print 'Size of removed packages: %s' % remove_sizechange
+        print 'Size of added packages: %s (%s)' % (add_sizechange,
+                                                   bkMG(add_sizechange))
+
+        if not opts.downgrade:
+            msg = 'Size change of modified packages: %s (%s)'
+            print msg % (mod_sizechange, bkMG(mod_sizechange))
+
+            total_sizechange = add_sizechange +mod_sizechange -remove_sizechange
+        else:
+            msg = 'Size change of upgraded packages: %s (%s)'
+            print msg % (up_sizechange, bkMG(up_sizechange))
+            msg = 'Size change of downgraded packages: %s (%s)'
+            print msg % (down_sizechange, bkMG(down_sizechange))
+
+            total_sizechange = (add_sizechange +
+                                up_sizechange + down_sizechange -
+                                remove_sizechange)
+
+        msg = 'Size of removed packages: %s (%s)'
+        print msg % (remove_sizechange, bkMG(remove_sizechange))
+        msg = 'Size change: %s (%s)'
+        print msg % (total_sizechange, bkMG(total_sizechange))
     
       
 if __name__ == "__main__":
diff --git a/repomanage.py b/repomanage.py
index ff77e0d..bef3b03 100755
--- a/repomanage.py
+++ b/repomanage.py
@@ -8,11 +8,11 @@
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Library General Public License for more details.
+# GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 # (c) Copyright Seth Vidal 2004
 
diff --git a/repoquery.py b/repoquery.py
index a3bb111..64976ec 100755
--- a/repoquery.py
+++ b/repoquery.py
@@ -8,11 +8,11 @@
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Library General Public License for more details.
+# GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 # (c) pmatilai@laiskiainen.org
 
 
@@ -25,7 +25,6 @@ import fnmatch
 import time
 import os
 import os.path
-import exceptions
 import urlparse
 
 from optparse import OptionParser
@@ -74,6 +73,15 @@ querytags = [ 'name', 'version', 'release', 'epoch', 'arch', 'summary',
               'installedsize', 'archivesize', 'packagesize', 'repoid', 
               'requires', 'provides', 'conflicts', 'obsoletes',
               'relativepath', 'hdrstart', 'hdrend', 'id',
+              'checksum', 'pkgid', 'committer', 'committime',
+              'ui_evr', 'evr', 'ui_nevra', 'ui_envra',
+              'ui_from_repo', 'base_package_name', 'size', 'xattr_origin_url',
+              'ui_evra', 'ui_nevr', 'na', 'vr', 'vra', 'evr', 'evra',
+              'nvr', 'nvra', 'nevr', 'nevra', 'envr', 'envra',
+
+              'repo.<attr of the repo object>',
+              'yumdb.<attr of the yumdb object>',
+              '<attr of the yum object>'
             ]
 
 def sec2isodate(timestr):
@@ -114,7 +122,7 @@ convertmap = { 'date': sec2date,
                'h':  size2h,
              }
 
-class queryError(exceptions.Exception):
+class queryError(Exception):
     def __init__(self, value=None):
         Exception.__init__(self)
         self.value = value
@@ -316,12 +324,13 @@ class pkgQuery:
         print "%s%s [%s]" % (indent, str(req), str(val))
 
     # These are common helpers for the --tree-* options...
-    @staticmethod
-    def _tree_print_req(req, val, level):
+    def _tree_print_req(self, req, val, level):
         indent = ''
         if level:
             indent = ' |  ' * (level - 1) + ' \_  '
-        print "%s%s [%s]" % (indent, str(req), str(val))
+        self.pkg = req
+        self.name = req.name
+        print "%s%s [%s]" % (indent, self.fmt_queryformat(), str(val))
     def _tree_pkg2uniq(self, pkg):
         """ Turn a pkg into a "unique" req."""
         if self.yb and self.yb.conf.showdupesfromrepos:
@@ -365,6 +374,7 @@ class pkgQuery:
                 kw['dot'] = DotPlot()
         elif 'dot' not in kw.keys() or kw['dot'] is None:
             kw['dot'] = None
+        dot      = kw['dot']
         
         if str(kw['tree_level']).lower() != 'all':
             try: 
@@ -375,6 +385,15 @@ class pkgQuery:
         if not 'output' in kw.keys():
             kw['output'] = 'ascii-tree'
 
+        #  Level means something a bit different for dot, because we have to
+        # lookup it's packages ... but we don't for ascii. *sigh*
+        if dot is None:
+            self._tree_print_req(pkg, req, level)
+            lim = level + 1
+            if str(kw['tree_level']).lower() != 'all' and \
+                int(kw['tree_level']) < int(lim):
+                return
+
         __req2pkgs = {}
         def req2pkgs(ignore, req):
             req = str(req)
@@ -406,6 +425,8 @@ class pkgQuery:
                     providers = matches.keys()
 
 
+            except yum.Errors.RepoError:
+                raise
             except yum.Errors.YumBaseError, err:
                 print >>sys.stderr, "No package provides %s" % req
                 return []
@@ -413,14 +434,9 @@ class pkgQuery:
             __req2pkgs[req] = providers
             return providers 
         
-        dot = kw['dot']
-        
         tups = getattr(pkg, prco_type)
         rpkgs, loc_reqs = self._tree_maybe_add_pkgs(all_reqs, tups, req2pkgs)
-        if dot is None:
-            self._tree_print_req(pkg, req, level)
-            lim = level + 1
-        else:
+        if dot is not None:
             dot.addPackage(pkg, rpkgs)
             lim = level + 2
         nlevel = level + 1
@@ -449,6 +465,7 @@ class pkgQuery:
 
     def fmt_tree_obsoletes(self, **kw):
         pkg      = kw.get('pkg', self.pkg)
+        req      = kw.get('req', 'cmd line')
         level    = kw.get('level', 0)
         all_reqs = kw.get('all_reqs', {})
         
@@ -457,6 +474,7 @@ class pkgQuery:
                 kw['dot'] = DotPlot()
         elif 'dot' not in kw.keys() or kw['dot'] is None:
             kw['dot'] = None
+        dot      = kw['dot']
         
         if str(kw['tree_level']).lower() != 'all':
             try: 
@@ -467,6 +485,15 @@ class pkgQuery:
         if not 'output' in kw.keys():
             kw['output'] = 'ascii-tree'
         
+        #  Level means something a bit different for dot, because we have to
+        # lookup it's packages ... but we don't for ascii. *sigh*
+        if dot is None:
+            self._tree_print_req(pkg, req, level)
+            lim = level + 1
+            if str(kw['tree_level']).lower() != 'all' and \
+                int(kw['tree_level']) < int(lim):
+                return
+
         def obs2pkgs():
             if self.yb is None:
                 return []
@@ -496,10 +523,7 @@ class pkgQuery:
         else:
             reason = 'cmd line'
         rpkgs = obs2pkgs()
-        if dot is None:
-            self._tree_print_req(pkg, reason, level)
-            lim = level + 1
-        else:
+        if dot is not None:
             dot.addPackage(pkg, rpkgs)
             lim = level + 2
         all_reqs[pkg] = None
@@ -514,6 +538,7 @@ class pkgQuery:
                 self._tree_print_req(rpkg, '', nlevel)
                 continue
             self.fmt_tree_obsoletes(pkg=rpkg, level=nlevel, all_reqs=all_reqs,
+                                    req = pkg.name,
                                     tree_level = kw['tree_level'],
                                     output = kw['output'],
                                     dot = dot)
@@ -527,6 +552,7 @@ class pkgQuery:
         if kw['output'].lower() == 'dot-tree':
             if 'dot' not in kw.keys() or kw['dot'] is None:
                 kw['dot'] = DotPlot()
+        dot      = kw['dot']
 
         if str(kw['tree_level']).lower() != 'all':
             try: 
@@ -537,6 +563,15 @@ class pkgQuery:
         if not 'output' in kw.keys():
             kw['output'] = 'ascii-tree'
 
+        #  Level means something a bit different for dot, because we have to
+        # lookup it's packages ... but we don't for ascii. *sigh*
+        if dot is None:
+            self._tree_print_req(pkg, req, level)
+            lim = level + 1
+            if str(kw['tree_level']).lower() != 'all' and \
+                int(kw['tree_level']) < int(lim):
+                return
+
         __prov2pkgs = {}
         def prov2pkgs(prov, ignore):
             if str(prov) in __prov2pkgs:
@@ -562,6 +597,8 @@ class pkgQuery:
                         arequirers = [pkg for pkg in areqs
                                       if pkg.pkgtup not in skip]
 
+            except yum.Errors.RepoError:
+                raise
             except yum.Errors.YumBaseError, err:
                 print >>sys.stderr, "No package provides %s" % str(prov)
                 return []
@@ -575,12 +612,8 @@ class pkgQuery:
         
         tups = pkg.provides + filetupes
         rpkgs, loc_reqs = self._tree_maybe_add_pkgs(all_reqs, tups, prov2pkgs)
-        dot = kw['dot']
         
-        if dot is None:
-            self._tree_print_req(pkg, req, level)
-            lim = level + 1
-        else:
+        if dot is not None:
             dot.addPackage(pkg, rpkgs)
             lim = level + 2
         nlevel = level + 1
@@ -719,13 +752,13 @@ class groupQuery:
             raise queryError("Invalid group query: %s" % method)
 
     # XXX temporary hack to make --group -a query work
-    def fmt_queryformat(self):
+    def fmt_queryformat(self, **kw):
         return self.fmt_nevra()
 
-    def fmt_nevra(self):
+    def fmt_nevra(self, **kw):
         return ["%s - %s" % (self.id, self.name)]
 
-    def fmt_list(self):
+    def fmt_list(self, **kw):
         pkgs = []
         for t in self.grouppkgs.split(','):
             if t == "mandatory":
@@ -741,10 +774,10 @@ class groupQuery:
             
         return pkgs
         
-    def fmt_requires(self):
+    def fmt_requires(self, **kw):
         return self.group.mandatory_packages
 
-    def fmt_info(self):
+    def fmt_info(self, **kw):
         return ["%s:\n\n%s\n" % (self.name, self.group.description)]
 
 
@@ -826,6 +859,8 @@ class YumBaseQuery(yum.YumBase):
                     pkgs = self.pkgSack.returnNewestByNameArch(**kwargs)
                 except yum.Errors.PackageSackError:
                     pkgs = []
+                except yum.Errors.RepoError, e:
+                    raise queryError(e)
         else:
             what = self.options.pkgnarrow
             ygh = self.doPackageLists(what, **kwargs)
@@ -848,6 +883,8 @@ class YumBaseQuery(yum.YumBase):
             matches = yum.YumBase.searchPackageProvides(self, [str(depstring)])
             provider = matches.keys()
             # provider.extend(yum.YumBase.returnPackagesByDep(self, depstring))
+        except yum.Errors.RepoError:
+            raise
         except yum.Errors.YumBaseError, err:
             self.logger.error("No package provides %s" % depstring)
         return self.queryPkgFactory(provider)
@@ -1008,12 +1045,12 @@ class YumBaseQuery(yum.YumBase):
 
     def fmt_whatrequires(self, name, **kw):
         pkgs = {}
-        done = [] # keep track of names we have already visited
+        done = set() # keep track of names we have already visited
 
         def require_recursive(name):
             if name in done:
                 return
-            done.append(name)
+            done.add(name)
 
             provs = [name]
                     
@@ -1054,10 +1091,21 @@ class YumBaseQuery(yum.YumBase):
 
     def fmt_requires(self, name, **kw):
         pkgs = {}
-        for pkg in self.returnByName(name):
+        done = set()
+        def require_recursive(pkg):
+            if pkg.name in done:
+                return
+            done.add(pkg.name)
+
             for req in pkg.prco("requires"):
                 for res in self.fmt_whatprovides(req):
                     pkgs[(res.name, res.pkg.arch)] = res
+                    if self.options.recursive:
+                        require_recursive(res)
+
+        for pkg in self.returnByName(name):
+            require_recursive(pkg)
+
         return pkgs.values()
 
     def fmt_location(self, name):
@@ -1070,6 +1118,44 @@ class YumBaseQuery(yum.YumBase):
                 loc.append("%s/%s" % (repo.urls[0], pkg['relativepath']))
         return loc
 
+    def _parseSetOpts(self, setopts):
+        """parse the setopts list handed to us and saves the results as
+           repo_setopts and main_setopts in the yumbase object"""
+
+        repoopts = {}
+        mainopts = yum.misc.GenericHolder()
+        mainopts.items = []
+
+        bad_setopt_tm = []
+        bad_setopt_ne = []
+
+        for item in setopts:
+            vals = item.split('=')
+            if len(vals) > 2:
+                bad_setopt_tm.append(item)
+                continue
+            if len(vals) < 2:
+                bad_setopt_ne.append(item)
+                continue
+            k,v = vals
+            period = k.find('.')
+            if period != -1:
+                repo = k[:period]
+                k = k[period+1:]
+                if repo not in repoopts:
+                    repoopts[repo] = yum.misc.GenericHolder()
+                    repoopts[repo].items = []
+                setattr(repoopts[repo], k, v)
+                repoopts[repo].items.append(k)
+            else:
+                setattr(mainopts, k, v)
+                mainopts.items.append(k)
+
+        self.main_setopts = mainopts
+        self.repo_setopts = repoopts
+
+        return bad_setopt_tm, bad_setopt_ne
+
 
 def main(args):
 
@@ -1198,6 +1284,10 @@ def main(args):
     parser.add_option("--search-fields", action="append", dest="searchfields",
                       default=[],
                       help="search fields to search using --search")
+    parser.add_option("--installroot", default="/", help="set install root")
+    parser.add_option("", "--setopt", dest="setopts", default=[],
+                     action="append",
+                     help="set arbitrary config and repo options")
                       
 
     (opts, regexs) = parser.parse_args()
@@ -1261,9 +1351,10 @@ def main(args):
     if opts.srpm:
         needsource = 1
     if opts.whatrequires:
-        sackops.append("whatrequires")
         if opts.output != 'text':
             pkgops.append("tree_what_requires")
+        else:
+            sackops.append("whatrequires")
     if opts.whatprovides:
         sackops.append("whatprovides")
     if opts.whatobsoletes:
@@ -1280,7 +1371,6 @@ def main(args):
         needgroup = 1
     if opts.installed:
         opts.pkgnarrow = 'installed'
-        opts.disablerepos = ['*']
 
     if opts.nevra:
         pkgops.append("nevra")
@@ -1303,6 +1393,13 @@ def main(args):
         
     repoq = YumBaseQuery(pkgops, sackops, opts)
 
+    # go through all the setopts and set the global ones
+    bad_setopt_tm, bad_setopt_ne = repoq._parseSetOpts(opts.setopts)
+
+    if repoq.main_setopts:
+        for opt in repoq.main_setopts.items:
+            setattr(opts, opt, getattr(repoq.main_setopts, opt))
+
     # silence initialisation junk from modules etc unless verbose mode
     initnoise = (not opts.quiet) * 2
     repoq.preconf.releasever = opts.releasever
@@ -1312,7 +1409,26 @@ def main(args):
         repoq.preconf.fn = opts.conffile
     repoq.preconf.debuglevel = initnoise
     repoq.preconf.init_plugins = opts.plugins
-    repoq.conf
+    repoq.preconf.root = opts.installroot
+    try:
+        repoq.conf
+    except YumBaseError, e:
+        repoq.logger.error(e)
+        sys.exit(1)
+
+    for item in  bad_setopt_tm:
+        msg = "Setopt argument has multiple values: %s"
+        repoq.logger.warning(msg % item)
+    for item in  bad_setopt_ne:
+        msg = "Setopt argument has no value: %s"
+        repoq.logger.warning(msg % item)
+    # now set  all the non-first-start opts from main from our setopts
+    if repoq.main_setopts:
+        for opt in repoq.main_setopts.items:
+            if not hasattr(repoq.conf, opt):
+                msg ="Main config did not have a %s attr. before setopt"
+                repoq.logger.warning(msg % opt)
+            setattr(repoq.conf, opt, getattr(repoq.main_setopts, opt))
 
     if opts.repofrompath:
         # setup the fake repos
@@ -1327,8 +1443,13 @@ def main(args):
             else:
                 baseurl = repopath
                 
-            repoq.add_enable_repo(repoid, baseurls=[baseurl], 
-                    basecachedir=repoq.conf.cachedir)
+            try:
+                repoq.add_enable_repo(repoid, baseurls=[baseurl],
+                                      basecachedir=repoq.conf.cachedir,
+                                      timestamp_check=False)
+            except yum.Errors.DuplicateRepoError, e:
+                repoq.logger.error(e)
+                sys.exit(1)
             if not opts.quiet:
                 repoq.logger.info( "Added %s repo from %s" % (repoid,repopath))
 
@@ -1359,6 +1480,13 @@ def main(args):
     if opts.show_dupes:
         repoq.conf.showdupesfromrepos = True
             
+
+    if opts.pkgnarrow == 'installed':
+        # Just use a blunt hammer here, to make everyone sane:
+        opts.repoid = []
+        opts.disablerepos = ['*']
+        opts.enablerepos  = []
+
     if opts.repoid:
         found_repos = set()
         for repo in repoq.repos.findRepos('*'):
@@ -1380,6 +1508,14 @@ def main(args):
             for repo in repoq.repos.findRepos(repo_match):
                 repo.enable()
 
+    while True:
+        try: repoq.doLock(); break
+        except yum.Errors.LockError, e: pass
+        repoq.logger.error(e)
+        if repoq.conf.exit_on_lock:
+            sys.exit(50)
+        time.sleep(2)
+
     try:
         if not hasattr(repoq, 'arch'):
             repoq.doSackSetup(archlist=archlist)
@@ -1396,10 +1532,15 @@ def main(args):
     except (yum.Errors.RepoError, yum.Errors.GroupsError), e:
         repoq.logger.error(e)
         sys.exit(1)
+
     try:
         repoq.runQuery(regexs)
+    except yum.Errors.RepoError, e:
+        repoq.logger.error(e)
+        sys.exit(1)
     except queryError, e:
         repoq.logger.error(e)
+        sys.exit(1)
 
 if __name__ == "__main__":
     misc.setup_locale()
diff --git a/reposync.py b/reposync.py
index 7950854..b1ee285 100755
--- a/reposync.py
+++ b/reposync.py
@@ -11,8 +11,8 @@
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 # copyright 2006 Duke University
 # author seth vidal
 
@@ -47,7 +47,7 @@ from yum.constants import *
 from yum.packageSack import ListPackageSack
 import rpmUtils.arch
 import logging
-from urlgrabber.progress import TextMeter
+from urlgrabber.progress import TextMeter, TextMultiFileMeter
 import urlgrabber
 
 # for yum 2.4.X compat
@@ -96,7 +96,7 @@ def parseArgs():
     parser.add_option("-c", "--config", default='/etc/yum.conf',
         help='config file to use (defaults to /etc/yum.conf)')
     parser.add_option("-a", "--arch", default=None,
-        help='act as if running the specified arch (default: current arch, note: does not override $releasever)')
+        help='act as if running the specified arch (default: current arch, note: does not override $releasever. x86_64 is a superset for i*86.)')
     parser.add_option("--source", default=False, dest="source", action="store_true",
                       help='operate on source packages')
     parser.add_option("-r", "--repoid", default=[], action='append',
@@ -153,15 +153,27 @@ def main():
         opts.tempcache = True
 
     if opts.tempcache:
-        cachedir = getCacheDir()
-        if cachedir is None:
+        if not my.setCacheDir(force=True):
             print >> sys.stderr, "Error: Could not make cachedir, exiting"
             sys.exit(50)
-            
-        my.repos.setCacheDir(cachedir)
+        my.conf.uid = 1 # force locking of user cache
     elif opts.cachedir:
         my.repos.setCacheDir(opts.cachedir)
 
+    # Lock if they've not given an explicit cachedir
+    if not opts.cachedir:
+        try:
+            my.doLock()
+        except yum.Errors.LockError, e:
+            print >> sys.stderr, "Error: %s" % e
+            sys.exit(50)
+
+    #  Use progress bar display when downloading repo metadata
+    # and package files ... needs to be setup before .repos (ie. RHN/etc.).
+    if not opts.quiet:
+        my.repos.setProgressBar(TextMeter(fo=sys.stdout), TextMultiFileMeter(fo=sys.stdout))
+    my.doRepoSetup()
+
     if len(opts.repoid) > 0:
         myrepos = []
         
@@ -182,13 +194,6 @@ def main():
         print >> sys.stderr, "Error: Can't use --norepopath with multiple repositories"
         sys.exit(1)
 
-    # Use progress bar display when downloading repo metadata
-    # and package files
-    if not opts.quiet:
-        my.repos.setProgressBar(TextMeter(fo=sys.stdout))
-
-    my.doRpmDBSetup()
-    my.doRepoSetup()
     try:
         arches = rpmUtils.arch.getArchList(opts.arch)
         if opts.source:
@@ -199,6 +204,7 @@ def main():
         # maybe this shouldn't be entirely fatal
         sys.exit(1)
     
+    exit_code = 0
     for repo in my.repos.listEnabled():
         reposack = ListPackageSack(my.pkgSack.returnPackages(repoid=repo.id))
 
@@ -277,73 +283,47 @@ def main():
             urlgrabber.progress.text_meter_total_size(remote_size)
 
         download_list.sort(sortPkgObj)
-        n = 0
+        if opts.urls:
+            for pkg in download_list:
+                print urljoin(pkg.repo.urls[0], pkg.relativepath)
+            return 0
+
+        # create dest dir
+        if not os.path.exists(local_repo_path):
+            os.makedirs(local_repo_path)
+
+        # set localpaths
         for pkg in download_list:
-            n = n + 1
-            repo = my.repos.getRepo(pkg.repoid)
-            remote = pkg.returnSimple('relativepath')
-            local = local_repo_path + '/' + remote
-            localdir = os.path.dirname(local)
-            if not os.path.exists(localdir):
-                os.makedirs(localdir)
-
-            sz = int(pkg.returnSimple('packagesize'))
-            if os.path.exists(local) and os.path.getsize(local) == sz:
-                
-                if not opts.quiet:
-                    my.logger.error("[%s: %-5d of %-5d ] Skipping existing %s" % (repo.id, n, len(download_list), remote))
-                continue
-    
-            if opts.urls:
-                baseurl = None
-                if repo.urls[0][-1] != '/':
-                    baseurl = repo.urls[0] + '/'
-                else:
-                    baseurl = repo.urls[0]
-                    url = urljoin(baseurl,remote)
-                    print '%s' % url
-                continue
-    
-            # make sure the repo subdir is here before we go on.
-            if not os.path.exists(local_repo_path):
-                try:
-                    os.makedirs(local_repo_path)
-                except IOError, e:
-                    my.logger.error("Could not make repo subdir: %s" % e)
-                    my.closeRpmDB()
-                    sys.exit(1)
-            
-            # Disable cache otherwise things won't download            
-            repo.cache = 0
-            if not opts.quiet:
-                my.logger.info( '[%s: %-5d of %-5d ] Downloading %s' % (repo.id, n, len(download_list), remote))
-            pkg.localpath = local # Hack: to set the localpath we want.
-            try:
-                path = repo.getPackage(pkg)
-            except yum.Errors.RepoError, e:
-                my.logger.error("Could not retrieve package %s. Error was %s" % (pkg, str(e)))
-                local_size += sz
-                continue
-
-            local_size += sz
-            if hasattr(urlgrabber.progress, 'text_meter_total_size'):
-                urlgrabber.progress.text_meter_total_size(remote_size, local_size)
-            if opts.gpgcheck:
+            rpmfn = os.path.basename(pkg.remote_path)
+            pkg.localpath = os.path.join(local_repo_path, rpmfn)
+            pkg.repo.copy_local = True
+            pkg.repo.cache = 0
+
+        # use downloader from YumBase
+        probs = my.downloadPkgs(download_list)
+        if probs:
+            exit_code = 1
+            for key in probs:
+                for error in probs[key]:
+                    my.logger.error('%s: %s', key, error)
+
+        if opts.gpgcheck:
+            for pkg in download_list:
                 result, error = my.sigCheckPkg(pkg)
                 if result != 0:
+                    rpmfn = os.path.basename(pkg.remote_path)
                     if result == 1:
-                        my.logger.warning('Removing %s, due to missing GPG key.' % os.path.basename(remote))
+                        my.logger.warning('Removing %s, due to missing GPG key.' % rpmfn)
                     elif result == 2:
-                        my.logger.warning('Removing %s due to failed signature check.' % os.path.basename(remote))
+                        my.logger.warning('Removing %s due to failed signature check.' % rpmfn)
                     else:
-                        my.logger.warning('Removing %s due to failed signature check: %s' % (os.path.basename(remote), error))
-                    os.unlink(path)
+                        my.logger.warning('Removing %s due to failed signature check: %s' % rpmfn)
+                    os.unlink(pkg.localpath)
+                    exit_code = 1
                     continue
 
-            if not os.path.exists(local) or not os.path.samefile(path, local):
-                shutil.copy2(path, local)
-
     my.closeRpmDB()
+    sys.exit(exit_code)
 
 if __name__ == "__main__":
     main()
diff --git a/repotrack.py b/repotrack.py
index ed26b9f..6c6a18c 100755
--- a/repotrack.py
+++ b/repotrack.py
@@ -7,11 +7,11 @@
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Library General Public License for more details.
+# GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 # (c) 2005 seth vidal skvidal at phy.duke.edu
 
 
diff --git a/show-changed-rco.py b/show-changed-rco.py
index 3489247..f314ef0 100755
--- a/show-changed-rco.py
+++ b/show-changed-rco.py
@@ -10,11 +10,11 @@
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Library General Public License for more details.
+# GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 import yum
 
@@ -194,6 +194,21 @@ def main():
     if opts.conffile is not None:
         yb.preconf.fn = opts.conffile
 
+    # setup the fake repos
+    for repo in opts.repofrompath or []:
+        tmp = tuple(repo.split(','))
+        if len(tmp) != 2:
+            yb.logger.error("Error: Bad repofrompath argument: %s" %repo)
+            continue
+        repoid,repopath = tmp
+        if repopath[0] == '/':
+            baseurl = 'file://' + repopath
+        else:
+            baseurl = repopath
+        yb.add_enable_repo(repoid, baseurls=[baseurl],
+                           basecachedir=yb.conf.cachedir)
+        yb.logger.info("Added %s repo from %s" % (repoid, repopath))
+
     if opts.cache:
         yb.conf.cache = 1
     elif not yb.setCacheDir():
diff --git a/show-installed.py b/show-installed.py
index 737f97e..65aae11 100755
--- a/show-installed.py
+++ b/show-installed.py
@@ -360,7 +360,7 @@ def __main__():
                      choices=('kickstart','human','yum'), default="human",
                      help='yum, kickstart or human; yum gives the result as a yum command line; kickstart the content of a %packages section; "human" readable is default.')
     parser.add_option("-i", "--input", dest="input", action="store", default=None, help="File to read the package list from instead of using the rpmdb. - for stdin. The file must contain package names only separated by white space (including newlines). rpm -qa --qf='%{name}\\n' produces proper output.")
-    parser.add_option("-o", "--output", dest="output", action="store", default=None, help="File to write the result to. Stdout is used if option is omited.")
+    parser.add_option("-o", "--output", dest="output", action="store", default=None, help="File to write the result to. Stdout is used if option is omitted.")
     parser.add_option("-q", "--quiet", dest="quiet", action="store_true", help="Do not show warnings.")
     parser.add_option("-e", "--no-excludes", dest="excludes",
                       action="store_false", default=True,
diff --git a/test/yum-utils-pylintrc b/test/yum-utils-pylintrc
index 1a03789..def5613 100644
--- a/test/yum-utils-pylintrc
+++ b/test/yum-utils-pylintrc
@@ -1,6 +1,6 @@
 # lint Python modules using external checkers.
 # 
-# This is the main checker controling the other ones and the reports
+# This is the main checker controlling the other ones and the reports
 # generation. It is itself both a raw checker and an astng checker in order
 # to:
 # * handle message activation / deactivation at the module level
@@ -101,12 +101,12 @@ include-ids=yes
 # written in a file name "pylint_global.[txt|html]".
 files-output=no
 
-# Tells wether to display a full report or only the messages
+# Tells whether to display a full report or only the messages
 reports=yes
 
 # Python expression which should return a note less than 10 (10 is the highest
 # note).You have access to the variables errors warning, statement which
-# respectivly contain the number of errors / warnings messages and the total
+# respectively contain the number of errors / warnings messages and the total
 # number of statements analyzed. This is used by the global evaluation report
 # (R0004).
 evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
@@ -187,7 +187,7 @@ bad-functions=input
 # 
 [VARIABLES]
 
-# Tells wether we should check for unused import in __init__ files.
+# Tells whether we should check for unused import in __init__ files.
 init-import=no
 
 # A regular expression matching names used for dummy variables (i.e. not used).
@@ -202,7 +202,7 @@ additional-builtins=
 # 
 [TYPECHECK]
 
-# Tells wether missing members accessed in mixin class should be ignored. A
+# Tells whether missing members accessed in mixin class should be ignored. A
 # mixin class is detected if its name ends with "mixin" (case insensitive).
 ignore-mixin-members=yes
 
@@ -246,7 +246,7 @@ int-import-graph=
 # checks for :
 # * methods without self as first argument
 # * overridden methods signature
-# * access only to existant members via self
+# * access only to existent members via self
 # * attributes not defined in the __init__ method
 # * supported interfaces implementation
 # * unreachable code
diff --git a/verifytree.py b/verifytree.py
index d1fe5e2..78e8264 100755
--- a/verifytree.py
+++ b/verifytree.py
@@ -7,11 +7,11 @@
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Library General Public License for more details.
+# GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 # copyright (c) 2008 Red Hat, Inc - written by Seth Vidal and Will Woods
 
 import yum
@@ -130,6 +130,11 @@ def main():
     
     parser.add_option("-a","--checkall",action="store_true",default=False,
             help="Check all packages in the repo")
+    parser.add_option("--nocomps", "--nogroups",action="store_true",
+                      default=False,
+            help="Do not read and check comps")
+    parser.add_option("--noplugins",action="store_true",default=False,
+            help="Do not load any plugins")
     parser.add_option("-t","--testopia",action="store",type="int",
             help="Report results to the given testopia run number")
     parser.add_option("-r","--treeinfo", action="store_true", default=False,
@@ -159,6 +164,8 @@ def main():
     basedir = url.replace('file://', '') # for a normal path thing
 
     my = yum.YumBase()
+    if opts.noplugins:
+        my.preconf.init_plugins = False
     my.conf.cachedir = getCacheDir()
     my.repos.disableRepo('*')
     newrepo = yum.yumRepo.YumRepository(repoid)
@@ -211,25 +218,26 @@ def main():
     else:
         report('REPODATA','PASSED')
 
-    print "Checking groups (comps.xml):"
-    try:
-        print "  verifying comps.xml with yum"
-        b = my.comps.compscount
-    except Errors.GroupsError, e:
-        print '  comps file missing or unparseable'
-        report('COMPS','FAILED')
-        retval = retval | BAD_COMPS
-
-    if not (retval & BAD_COMPS):
-        print "  verifying comps.xml grammar with xmllint"
-        comps = newrepo.getGroups()
-        r = os.system("xmllint --noout --nowarning --relaxng %s %s" % 
-            (SCHEMA,comps))
-        if r != 0:
-            retval = retval | BAD_COMPS
+    if not opts.nocomps:
+        print "Checking groups (comps.xml):"
+        try:
+            print "  verifying comps.xml with yum"
+            b = my.comps.compscount
+        except Errors.GroupsError, e:
+            print '  comps file missing or unparseable'
             report('COMPS','FAILED')
-        else:
-            report('COMPS','PASSED')
+            retval = retval | BAD_COMPS
+
+        if not (retval & BAD_COMPS):
+            print "  verifying comps.xml grammar with xmllint"
+            comps = newrepo.getGroups()
+            r = os.system("xmllint --noout --nowarning --relaxng %s %s" % 
+                (SCHEMA,comps))
+            if r != 0:
+                retval = retval | BAD_COMPS
+                report('COMPS','FAILED')
+            else:
+                report('COMPS','PASSED')
 
     # if we've got a .treeinfo file and we are told to check it, then do so
     tr_path = basedir + '/.treeinfo'
@@ -243,7 +251,7 @@ def main():
     if opts.checkall:
         print "Checking all packages"
         sack = my.pkgSack
-    elif not (retval & BAD_COMPS):
+    elif not (retval & BAD_COMPS or opts.nocomps):
         print "Checking mandatory @core packages"
         group = my.comps.return_group('core')
         for pname in group.mandatory_packages:
diff --git a/yum-builddep.py b/yum-builddep.py
index d7a37c3..b9e682a 100755
--- a/yum-builddep.py
+++ b/yum-builddep.py
@@ -8,17 +8,18 @@
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Library General Public License for more details.
+# GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 import sys
 sys.path.insert(0,'/usr/share/yum-cli')
 
 import yum
 from yum.misc import setup_locale
+from yum.i18n import exception2msg
 import yum.Errors
 from utils import YumUtilBase
 
@@ -26,6 +27,8 @@ import logging
 import rpmUtils
 import rpm
 
+rhn_source_repos = False
+
 # Copied from yumdownloader (need a yum-utils python module ;)
 # This is to fix Bug 469
 # To convert from a pkg to a source pkg, we have a problem in that all we have
@@ -61,6 +64,9 @@ class YumBuildDep(YumUtilBase):
         self.logger = logging.getLogger("yum.verbose.cli.yumbuildep")                             
         # Add util commandline options to the yum-cli ones
         self.optparser = self.getOptionParser() 
+        if hasattr(rpm, 'reloadConfig'):
+            self.optparser.add_option("--target",
+                              help="set target architecture for spec parsing")
         self.main()
 
     def main(self):
@@ -118,9 +124,16 @@ class YumBuildDep(YumUtilBase):
         # enable the -source repos for enabled primary repos
         archlist = rpmUtils.arch.getArchList() + ['src']    
         for repo in self.repos.listEnabled():
-            if not repo.id.endswith('-source'):
+            issource_repo = repo.id.endswith('-source')
+            if rhn_source_repos and repo.id.endswith('-source-rpms'):
+                issource_repo = True
+            if rhn_source_repos and (not repo.id.endswith('-source-rpms') and
+                                     repo.id.endswith('-rpms')):
+                srcrepo = '%s-source,%s-source-rpms' % (repo.id, repo.id[:-5])
+            elif not issource_repo:
                 srcrepo = '%s-source' % repo.id
             else:
+                # Need to change the arch.
                 repo.close()
                 self.repos.disableRepo(repo.id)
                 srcrepo = repo.id
@@ -140,6 +153,7 @@ class YumBuildDep(YumUtilBase):
                     sys.exit(1)
 
     def install_deps(self, deplist):
+        errors = set()
         for dep in deplist:
             self.logger.debug(' REQ:  %s' % dep)                
             if dep.startswith("rpmlib("): 
@@ -152,10 +166,13 @@ class YumBuildDep(YumUtilBase):
                 pkg = self.returnPackageByDep(dep)
                 self.logger.info(' --> %s' % pkg)
                 self.install(pkg)
-                
             except yum.Errors.YumBaseError, e:
-                self.logger.error("Error: %s" % e)
-                sys.exit(1)
+                errors.add(exception2msg(e))
+
+        if errors:
+            for i in sorted(errors):
+                self.logger.error("Error: %s" % i)
+            sys.exit(1)
 
     # go through each of the pkgs, figure out what they are/where they are 
     # if they are not a local package then run
@@ -170,10 +187,14 @@ class YumBuildDep(YumUtilBase):
         specnames = []
         srpms = []
         specworks = False
+        reloadworks = False
 
         # See if we can use spec files for buildrequires
         if hasattr(rpm, 'spec') and hasattr(rpm.spec, 'sourceHeader'):
             specworks = True
+        # See if we can reload rpm configuration
+        if hasattr(rpm, 'reloadConfig'):
+            reloadworks = True
 
         for arg in self.cmds:
             if arg.endswith('.src.rpm'):
@@ -206,22 +227,30 @@ class YumBuildDep(YumUtilBase):
                     sys.exit(1)
                     
         toActOn = []
+        # Get the best matching srpms
         for newpkg in srpms:
-            toActOn.extend(_best_convert_pkg2srcpkgs(self, opts, newpkg))
-        # Get the best matching srpm
-        toActOn = self.bestPackagesFromList(toActOn, 'src')
+            srcpkg = _best_convert_pkg2srcpkgs(self, opts, newpkg)
+            toActOn.extend(self.bestPackagesFromList(srcpkg, 'src'))
 
         for srpm in toActOn:
             self.logger.info('Getting requirements for %s' % srpm)
             self.install_deps(srpm.requiresList())
     
         for name in specnames:
+            # (re)load rpm config for target if set
+            if reloadworks and opts.target:
+                rpm.reloadConfig(opts.target)
+
             try:
                 spec = rpm.spec(name)
             except ValueError:
                 self.logger.error("Bad spec: %s" % name)
                 continue
 
+            # reset default rpm config after each parse to avoid side-effects
+            if reloadworks:
+                rpm.reloadConfig()
+
             buildreqs = []
             for d in rpm.ds(spec.sourceHeader, 'requires'):
                 buildreqs.append(d.DNEVR()[2:])
diff --git a/yum-complete-transaction.py b/yum-complete-transaction.py
index c5074ab..3a9f305 100755
--- a/yum-complete-transaction.py
+++ b/yum-complete-transaction.py
@@ -8,11 +8,11 @@
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Library General Public License for more details.
+# GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 import sys
 sys.path.insert(0,'/usr/share/yum-cli')
@@ -93,7 +93,7 @@ except ImportError:
         return to_complete_items
 
 class YumCompleteTransaction(YumUtilBase):
-    NAME = 'yum-complete-transactions'
+    NAME = 'yum-complete-transaction'
     VERSION = '1.0'
     USAGE = """
     yum-complete-transaction: completes unfinished yum transactions which occur due to error, failure
@@ -115,7 +115,8 @@ class YumCompleteTransaction(YumUtilBase):
         else:
             self.optparser_grp = self.optparser
         self.addCmdOptions()
-        self.main()
+        try: self.main()
+        finally: self.unlock()
 
     def clean_up_ts_files(self, timestamp, path, disable=False):
 
diff --git a/yum-config-manager.py b/yum-config-manager.py
index 50f5123..df90885 100755
--- a/yum-config-manager.py
+++ b/yum-config-manager.py
@@ -153,7 +153,7 @@ if (not args and not opts.addrepo) or 'main' in args:
         ybc = yb.conf
         writeRawConfigFile(fn, 'main', ybc.yumvar,
                            ybc.cfg.options, ybc.iteritems, ybc.optionobj,
-                           only)
+                           only=yb.main_setopts.items)
 
 if opts.enable or opts.disable:
     opts.save = True
@@ -161,7 +161,8 @@ if opts.enable or opts.disable:
         only = ['enabled']
 
 if args:
-    repos = yb.repos.findRepos(','.join(args))
+    repos = yb.repos.findRepos(','.join(args),
+                               name_match=True, ignore_case=True)
 else:
     repos = yb.repos.listEnabled()
 
diff --git a/yum-debug-dump.py b/yum-debug-dump.py
index 4653f3c..67d943f 100755
--- a/yum-debug-dump.py
+++ b/yum-debug-dump.py
@@ -8,11 +8,11 @@
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Library General Public License for more details.
+# GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 ## (c) 2008 Red Hat. Written by skvidal@fedoraproject.org
 
 import os
diff --git a/yum-debug-restore.py b/yum-debug-restore.py
index fd95741..1d827f4 100755
--- a/yum-debug-restore.py
+++ b/yum-debug-restore.py
@@ -8,11 +8,11 @@
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Library General Public License for more details.
+# GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 ## (c) 2008 Red Hat. Written by skvidal@fedoraproject.org
 ##                                james@fedoraproject.org
 
@@ -107,11 +107,15 @@ def pkg_data2list(yb, opkgtups, opkgmaps, install_latest, ignore_arch):
     ret = []
     npkgtups = set()
     npkgmaps = {}
+    installonly = set(yb.conf.installonlypkgs)
     for po in sorted(yb.rpmdb.returnPackages()):
         arch = po.arch
         if ignore_arch:
             arch = None
         if False: pass
+        elif po.name in installonly:
+            if not po.pkgtup in opkgtups:
+                ret.append(("remove", pkgtup2str(po.pkgtup)))
         elif (po.name, arch) not in opkgmaps:
             ret.append(("remove", str(po)))
         elif po.pkgtup not in opkgtups:
@@ -129,6 +133,8 @@ def pkg_data2list(yb, opkgtups, opkgmaps, install_latest, ignore_arch):
             npkgmaps[(po.name, None)] = po
 
     for name, arch in sorted(opkgmaps):
+        if name in installonly:
+            continue # done separately
         if ignore_arch and arch is not None:
             continue
         if (name, arch) in npkgmaps:
@@ -139,6 +145,9 @@ def pkg_data2list(yb, opkgtups, opkgmaps, install_latest, ignore_arch):
             ret.append(("install", "%s.%s" % (name, arch)))
         else:
             ret.append(("install", pkgtup2str(opkgmaps[(name, arch)])))
+    for pkgtup in opkgtups:
+        if pkgtup[0] in installonly and not pkgtup in npkgtups:
+            ret.append(("install", pkgtup2str(pkgtup)))
     return ret
 
 def main():
@@ -223,10 +232,8 @@ def main():
         sys.exit(0)
 
     # Want to do the transaction, hacky method
-    if xtra_args:
-        os.system("yum shell %s %s" % (" ".join(xtra_args), fo.name))
-    else:
-        os.system("yum shell %s" % fo.name)
+    xtra_args.append('--setopt=installonly_limit=0')
+    os.system("yum shell %s %s" % (" ".join(xtra_args), fo.name))
 
 if __name__ == "__main__":
     main()
diff --git a/yum-groups-manager.py b/yum-groups-manager.py
index 2cf73c8..c536092 100755
--- a/yum-groups-manager.py
+++ b/yum-groups-manager.py
@@ -204,7 +204,7 @@ def main():
             sys.exit(50)
 
     if not loaded_files and opts.remove:
-        yb.logger.error("Can't remove package(s) when we havn't loaded any")
+        yb.logger.error("Can't remove package(s) when we haven't loaded any")
         sys.exit(50)
 
     group = None
@@ -213,7 +213,7 @@ def main():
     if group is None and opts.name:
         group = comps.return_group(opts.name)
     if group is None and opts.remove:
-        yb.logger.error("Can't remove package(s) from non-existant group")
+        yb.logger.error("Can't remove package(s) from non-existent group")
         sys.exit(50)
 
     if group is None:
diff --git a/yum-util-cli-template b/yum-util-cli-template
index 8bfdbcd..250ebc9 100644
--- a/yum-util-cli-template
+++ b/yum-util-cli-template
@@ -7,7 +7,7 @@
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Library General Public License for more details.
+# GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
diff --git a/yum-utils.bash b/yum-utils.bash
index 1d37231..65bff76 100644
--- a/yum-utils.bash
+++ b/yum-utils.bash
@@ -1,3 +1,6 @@
+# need functions from yum.bash
+type -t _yum >/dev/null || . $(pkg-config --variable=completionsdir bash-completion)/yum
+
 # bash completion for yum-utils
 
 _yu_init_completion()
@@ -100,7 +103,7 @@ _yu_repo_graph()
             return 0
             ;;
         --repoid)
-            _yum_repolist all "$cur" 2>/dev/null
+            _yum_helper repolist all "$cur" 2>/dev/null
             return 0
             ;;
         -c)
@@ -136,7 +139,7 @@ _yu_repo_rss()
 
     COMPREPLY=( $( compgen -W '--help -f -l -t -d -r --tempcache -g -a -c' \
         -- "$2" ) )
-    [[ $2 == -* ]] || _yum_repolist all "$2" 2>/dev/null || return 0
+    [[ $2 == -* ]] || _yum_helper repolist all "$2" 2>/dev/null || return 0
 } &&
 complete -F _yu_repo_rss -o filenames repo-rss repo-rss.py
 
@@ -155,7 +158,7 @@ _yu_repoclosure()
             return 0
             ;;
         -l|--lookaside|-r|--repoid)
-            _yum_repolist all "$cur" 2>/dev/null
+            _yum_helper repolist all "$cur" 2>/dev/null
             return 0
             ;;
         -p|--pkg)
@@ -163,7 +166,7 @@ _yu_repoclosure()
             return 0
             ;;
         -g|--group)
-            _yum_grouplist "" "$cur" 2>/dev/null
+            _yum_helper groups list all "$cur" 2>/dev/null
             return 0
             ;;
     esac
@@ -188,26 +191,23 @@ _yu_repoquery()
     done
 
     case $prev in
-        -h|--help|--version|-f|--file|--qf|--queryformat|--resolve|--archlist|\
-        --whatprovides|--whatrequires|--whatobsoletes|--whatconflicts|\
-        --repofrompath|--level|--search-fields)
+        -h|--help|--version|--qf|--queryformat|--archlist|--repofrompath|\
+        --setopt)
+            return 0
+            ;;
+        -f|--file)
+            COMPREPLY=( $( compgen -f -o plusdirs -- "$cur" ) )
             return 0
             ;;
         -l|--list|-i|--info|-R|--requires)
             if $groupmode ; then
-                _yum_grouplist "" "$cur" 2>/dev/null
+                _yum_helper groups list all "$cur" 2>/dev/null
             else
                 declare -F _yum_atgroups &>/dev/null && \
                     _yum_atgroups "$cur" || _yum_list all "$cur" 2>/dev/null
             fi
             return 0
             ;;
-        --provides|--obsoletes|--conflicts|--groupmember|--changelog|\
-        --location|--nevra|--envra|--nvr|-s|--source)
-            declare -F _yum_atgroups &>/dev/null && \
-                _yum_atgroups "$cur" || _yum_list all "$cur" 2>/dev/null
-            return 0
-            ;;
         --grouppkgs)
             COMPREPLY=( $( compgen -W 'all default optional mandatory' \
                 -- "$cur" ) )
@@ -219,38 +219,56 @@ _yu_repoquery()
             return 0
             ;;
         --repoid)
-            _yum_repolist all "$cur" 2>/dev/null
+            _yum_helper repolist all "$cur" 2>/dev/null
             return 0
             ;;
         --enablerepo)
-            _yum_repolist disabled "$cur" 2>/dev/null
+            _yum_helper repolist disabled "$cur" 2>/dev/null
             return 0
             ;;
         --disablerepo)
-            _yum_repolist enabled "$cur" 2>/dev/null
+            _yum_helper repolist enabled "$cur" 2>/dev/null
             return 0
             ;;
         -c|--config)
             COMPREPLY=( $( compgen -f -o plusdirs -X '!*.conf' -- "$cur" ) )
             return 0
             ;;
+        --level)
+            COMPREPLY=( $( compgen -W '{1..9} all' -- "$cur" ) )
+            return 0
+            ;;
         --output)
             COMPREPLY=( $( compgen -W 'text ascii-tree dot-tree' -- "$cur" ) )
             return 0
             ;;
+        --search-fields)
+            COMPREPLY=( $( compgen -W 'name summary description' -- "$cur" ) )
+            return 0
+            ;;
+        --installroot)
+            COMPREPLY=( $( compgen -d -- "$cur" ) )
+            return 0
+            ;;
     esac
 
     $split && return 0
 
-    COMPREPLY=( $( compgen -W '--version --help --list --info --file
-        --queryformat --groupmember --all --requires --provides --obsoletes
-        --conflicts --changelog --location --nevra --envra --nvr --source
-        --srpm --resolve --exactdeps --recursive --whatprovides --whatrequires
-        --whatobsoletes --whatconflicts --group --grouppkgs --archlist
-        --pkgnarrow --installed --show-duplicates --repoid --enablerepo
-        --disablerepo --repofrompath --plugins --quiet --verbose --cache
-        --tempcache --querytags --config --level --output --search
-        --search-fields' -- "$cur" ) )
+    if [[ $cur == -* ]] ; then
+        COMPREPLY=( $( compgen -W '--version --help --list --info --file
+            --queryformat --groupmember --all --requires --provides --obsoletes
+            --conflicts --changelog --location --nevra --envra --nvr --source
+            --srpm --resolve --exactdeps --recursive --whatprovides
+            --whatrequires --whatobsoletes --whatconflicts --group --grouppkgs
+            --archlist --pkgnarrow --installed --show-duplicates --repoid
+            --enablerepo --disablerepo --repofrompath --plugins --quiet
+            --verbose --cache --tempcache --querytags --config --level --output
+            --search --search-fields --setopt --installroot' -- "$cur" ) )
+        return 0
+    fi
+
+    declare -F _yum_atgroups &>/dev/null && \
+        _yum_atgroups "$cur" || _yum_list all "$cur" 2>/dev/null
 } &&
 complete -F _yu_repoquery -o filenames repoquery repoquery.py
 
@@ -278,8 +296,8 @@ _yu_yumdb()
 
     if [ $COMP_CWORD -le 1 ] ; then
         COMPREPLY=( $( compgen -W 'get set del rename rename-force copy search
-            exist unset info shell --version --help --noplugins --config' \
-                -- "$cur" ) )
+            exist unset info sync undeleted shell --version --help --noplugins
+            --config' -- "$cur" ) )
     fi
 } &&
 complete -F _yu_yumdb -o filenames yumdb yumdb.py
@@ -299,7 +317,7 @@ _yu_repodiff()
     $split && return 0
 
     COMPREPLY=( $( compgen -W '--version --help --new --old --quiet --archlist
-        --size --simple' -- "$cur" ) )
+        --compare-arch --size --downgrade --simple' -- "$cur" ) )
 } &&
 complete -F _yu_repodiff repodiff repodiff.py
 
@@ -311,6 +329,13 @@ _yu_builddep()
 
     _yum_complete_baseopts "$cur" "$prev" && return 0
 
+    case $prev in
+        --target)
+            declare -F _rpm_buildarchs &>/dev/null && _rpm_buildarchs
+            return 0
+            ;;
+    esac
+
     $split && return 0
 
     if [[ $cur == -* ]] ; then
@@ -363,6 +388,36 @@ _yu_debug_dump()
 } &&
 complete -F _yu_debug_dump -o filenames yum-debug-dump yum-debug-dump.py
 
+# yumdownloader
+_yu_yumdownloader()
+{
+    local cur prev words=() split=false
+    _yu_init_completion "$2" "$3"
+
+    _yum_complete_baseopts "$cur" "$prev" 2>/dev/null && return 0
+
+    case $prev in
+        --destdir)
+            COMPREPLY=( $( compgen -d -- "$cur" ) )
+            return 0
+            ;;
+        --archlist)
+            return 0
+            ;;
+    esac
+
+    $split && return 0
+
+    if [[ $cur == -* ]] ; then
+        COMPREPLY=( $( compgen -W '$( _yum_baseopts 2>/dev/null ) --destdir
+            --urls --resolve --source --archlist' -- "$cur" ) )
+        return 0
+    fi
+
+    _yum_list all "$cur"
+} &&
+complete -F _yu_yumdownloader -o filenames yumdownloader yumdownloader.py
+
 # Local variables:
 # mode: shell-script
 # sh-basic-offset: 4
diff --git a/yum-utils.spec b/yum-utils.spec
index ce7fb64..e22d692 100644
--- a/yum-utils.spec
+++ b/yum-utils.spec
@@ -1,4 +1,11 @@
+%if 0%{?rhel}
+%define package_yum_updatesd 0
+%else
+%define package_yum_updatesd 1
+%endif
+
 %{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
+%define pluginhome /usr/lib/yum-plugins
 
 Summary: Utilities based around the yum package manager
 Name: yum-utils
@@ -10,7 +17,8 @@ Source: http://yum.baseurl.org/download/yum-utils/%{name}-%{version}.tar.gz
 URL: http://yum.baseurl.org/download/yum-utils/
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildArch: noarch
-Requires: yum >= 3.2.29
+# For new findRepos() API.
+Requires: yum >= 3.4.3-96
 Requires: python-kitchen
 BuildRequires: python-devel >= 2.4
 BuildRequires: gettext
@@ -105,18 +113,6 @@ Requires: yum >= 3.0
 This plugin allows you to specify optional transaction flags on the yum
 command line
 
-%package -n yum-plugin-downloadonly
-Summary: Yum plugin to add downloadonly command option
-Group: System Environment/Base
-Provides: yum-downloadonly = %{version}-%{release}
-Obsoletes: yum-downloadonly < 1.1.20-0
-Conflicts: yum-downloadonly < 1.1.20-0
-Requires: yum >= 3.0
-
-%description -n yum-plugin-downloadonly
-This plugin adds a --downloadonly flag to yum so that yum will only download
-the packages and not install/update them.
-
 %package -n yum-plugin-priorities
 Summary: plugin to give priorities to packages from different repos
 Group: System Environment/Base
@@ -130,6 +126,7 @@ This plugin allows repositories to have different priorities.
 Packages in a repository with a lower priority can't be overridden by packages
 from a repository with a higher priority even if repo has a later version.
 
+%if %{package_yum_updatesd}
 %package -n yum-plugin-refresh-updatesd
 Summary: Tell yum-updatesd to check for updates when yum exits
 Group: System Environment/Base
@@ -143,6 +140,7 @@ Requires: yum-updatesd
 yum-refresh-updatesd tells yum-updatesd to check for updates when yum exits.
 This way, if you run 'yum update' and install all available updates, puplet
 will almost instantly update itself to reflect this.
+%endif
 
 %package -n yum-plugin-merge-conf
 Summary: Yum plugin to merge configuration changes when installing packages
@@ -290,7 +288,7 @@ This plugin allows the user to run arbitrary actions immediately following a
 transaction when specified packages are changed.
 
 %package -n yum-NetworkManager-dispatcher
-Summary: NetworkManager script which tells yum to check it's cache on network change
+Summary: NetworkManager script which tells yum to check its cache on network change
 Group: System Environment/Base
 Requires: yum >= 3.2.17
 
@@ -395,9 +393,7 @@ plugins="\
  protectbase \
  versionlock \
  tsflags \
- downloadonly \
  priorities \
- refresh-updatesd \
  merge-conf \
  security \
  upgrade-helper \
@@ -418,14 +414,20 @@ plugins="\
  puppetverify \
 "
 
-mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/yum/pluginconf.d/ $RPM_BUILD_ROOT/usr/lib/yum-plugins/
+%if %{package_yum_updatesd}
+plugins="$plugins \
+ refresh-updatesd \
+"
+%endif
+
+mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/yum/pluginconf.d/ $RPM_BUILD_ROOT/%pluginhome
 mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/yum/post-actions
 
 cd plugins
 for plug in $plugins; do
     install -m 644 $plug/*.conf $RPM_BUILD_ROOT/%{_sysconfdir}/yum/pluginconf.d/
-    install -m 644 $plug/*.py $RPM_BUILD_ROOT/usr/lib/yum-plugins/
-    %{__python} -c "import compileall; compileall.compile_dir('$RPM_BUILD_ROOT/usr/lib/yum-plugins', 1)"
+    install -m 644 $plug/*.py $RPM_BUILD_ROOT/%pluginhome
+    %{__python} -c "import compileall; compileall.compile_dir('$RPM_BUILD_ROOT/%pluginhome', 1)"
 done
 install -m 644 aliases/aliases $RPM_BUILD_ROOT/%{_sysconfdir}/yum/aliases.conf
 install -m 644 versionlock/versionlock.list $RPM_BUILD_ROOT/%{_sysconfdir}/yum/pluginconf.d/
@@ -469,8 +471,8 @@ fi
 %{_bindir}/yum-builddep
 %{_bindir}/yum-config-manager
 %{_bindir}/yum-debug-dump
-%{_bindir}/yum-groups-manager
 %{_bindir}/yum-debug-restore
+%{_bindir}/yum-groups-manager
 %{_bindir}/show-installed
 %{_bindir}/show-changed-rco
 %{_sbindir}/yum-complete-transaction
@@ -487,10 +489,19 @@ fi
 %{_mandir}/man1/show-installed.1.*
 %{_mandir}/man1/yum-builddep.1.*
 %{_mandir}/man1/yum-debug-dump.1.*
+%{_mandir}/man1/yum-debug-restore.1.*
 %{_mandir}/man8/yum-complete-transaction.8.*
 %{_mandir}/man1/yum-groups-manager.1.*
 %{_mandir}/man8/yumdb.8.*
 %{_mandir}/man1/yumdownloader.1.*
+%{_mandir}/man1/find-repos-of-install.1.*
+%{_mandir}/man1/needs-restarting.1.*
+%{_mandir}/man1/repo-graph.1.*
+%{_mandir}/man1/repoclosure.1.*
+%{_mandir}/man1/repomanage.1.*
+%{_mandir}/man1/repotrack.1.*
+%{_mandir}/man1/verifytree.1.*
+%{_mandir}/man1/yum-config-manager.1.*
 
 %files -n yum-updateonboot
 %defattr(-, root, root)
@@ -502,7 +513,7 @@ fi
 %defattr(-, root, root)
 %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/changelog.conf
 %doc COPYING
-/usr/lib/yum-plugins/changelog.*
+%{pluginhome}/changelog.*
 %{_mandir}/man1/yum-changelog.1.*
 %{_mandir}/man5/yum-changelog.conf.5.*
 
@@ -510,20 +521,20 @@ fi
 %defattr(-, root, root)
 %doc COPYING
 %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/fastestmirror.conf
-/usr/lib/yum-plugins/fastestmirror*.*
+%{pluginhome}/fastestmirror*.*
 
 %files -n yum-plugin-protectbase
 %defattr(-, root, root)
 %doc COPYING
 %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/protectbase.conf
-/usr/lib/yum-plugins/protectbase.*
+%{pluginhome}/protectbase.*
 
 %files -n yum-plugin-versionlock
 %defattr(-, root, root)
 %doc plugins/versionlock/README COPYING
 %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/versionlock.conf
 %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/versionlock.list
-/usr/lib/yum-plugins/versionlock.*
+%{pluginhome}/versionlock.*
 %{_mandir}/man1/yum-versionlock.1.*
 %{_mandir}/man5/yum-versionlock.conf.5.*
 
@@ -531,85 +542,81 @@ fi
 %defattr(-, root, root)
 %doc COPYING
 %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/tsflags.conf
-/usr/lib/yum-plugins/tsflags.*
-
-%files -n yum-plugin-downloadonly
-%defattr(-, root, root)
-%doc COPYING
-%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/downloadonly.conf
-/usr/lib/yum-plugins/downloadonly.*
+%{pluginhome}/tsflags.*
 
 %files -n yum-plugin-priorities
 %defattr(-, root, root)
 %doc COPYING
 %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/priorities.conf
-/usr/lib/yum-plugins/priorities.*
+%{pluginhome}/priorities.*
 
+%if %{package_yum_updatesd}
 %files -n yum-plugin-refresh-updatesd
 %defattr(-, root, root)
 %doc COPYING
 %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/refresh-updatesd.conf
-/usr/lib/yum-plugins/refresh-updatesd.*
+%{pluginhome}/refresh-updatesd.*
+%endif
 
 %files -n yum-plugin-merge-conf
 %defattr(-, root, root)
 %doc COPYING
 %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/merge-conf.conf
-/usr/lib/yum-plugins/merge-conf.*
+%{pluginhome}/merge-conf.*
 
 %files -n yum-plugin-security
 %defattr(-, root, root)
 %doc COPYING
 %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/security.conf
-/usr/lib/yum-plugins/security.*
+%{pluginhome}/security.*
 %{_mandir}/man8/yum-security.8.*
 
 %files -n yum-plugin-upgrade-helper
 %defattr(-, root, root)
 %doc COPYING
 %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/upgrade-helper.conf
-/usr/lib/yum-plugins/upgrade-helper.*
+%{pluginhome}/upgrade-helper.*
 
 %files -n yum-plugin-aliases
 %defattr(-, root, root)
 %doc COPYING
 %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/aliases.conf
 %config(noreplace) %{_sysconfdir}/yum/aliases.conf
-/usr/lib/yum-plugins/aliases.*
+%{pluginhome}/aliases.*
 %{_mandir}/man1/yum-aliases.1.*
 
 %files -n yum-plugin-list-data
 %defattr(-, root, root)
 %doc COPYING
 %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/list-data.conf
-/usr/lib/yum-plugins/list-data.*
+%{pluginhome}/list-data.*
 %{_mandir}/man1/yum-list-data.1.*
 
 %files -n yum-plugin-filter-data
 %defattr(-, root, root)
 %doc COPYING
 %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/filter-data.conf
-/usr/lib/yum-plugins/filter-data.*
+%{pluginhome}/filter-data.*
 %{_mandir}/man1/yum-filter-data.1.*
 
 %files -n yum-plugin-tmprepo
 %defattr(-, root, root)
 %doc COPYING
 %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/tmprepo.conf
-/usr/lib/yum-plugins/tmprepo.*
+%{pluginhome}/tmprepo.*
 
 %files -n yum-plugin-verify
 %defattr(-, root, root)
 %doc COPYING
 %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/verify.conf
-/usr/lib/yum-plugins/verify.*
+%{pluginhome}/verify.*
 %{_mandir}/man1/yum-verify.1.*
 
 %files -n yum-plugin-keys
 %defattr(-, root, root)
 %doc COPYING
 %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/keys.conf
-/usr/lib/yum-plugins/keys.*
+%{pluginhome}/keys.*
 
 %files -n yum-NetworkManager-dispatcher
 %defattr(-, root, root)
@@ -619,13 +626,13 @@ fi
 %files -n yum-plugin-remove-with-leaves
 %defattr(-, root, root)
 %doc COPYING
-/usr/lib/yum-plugins/remove-with-leaves.*
+%{pluginhome}/remove-with-leaves.*
 %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/remove-with-leaves.conf
 
 %files -n yum-plugin-post-transaction-actions
 %defattr(-, root, root)
 %doc COPYING
-/usr/lib/yum-plugins/post-transaction-actions.*
+%{pluginhome}/post-transaction-actions.*
 %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/post-transaction-actions.conf
 %doc plugins/post-transaction-actions/sample.action
 # Default *.action file dropping dir.
@@ -634,19 +641,19 @@ fi
 %files -n yum-plugin-rpm-warm-cache
 %defattr(-, root, root)
 %doc COPYING
-/usr/lib/yum-plugins/rpm-warm-cache.*
+%{pluginhome}/rpm-warm-cache.*
 %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/rpm-warm-cache.conf
 
 %files -n yum-plugin-auto-update-debug-info
 %defattr(-, root, root)
 %doc COPYING
-/usr/lib/yum-plugins/auto-update-debuginfo.*
+%{pluginhome}/auto-update-debuginfo.*
 %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/auto-update-debuginfo.conf
 
 %files -n yum-plugin-show-leaves
 %defattr(-, root, root)
 %doc COPYING
-/usr/lib/yum-plugins/show-leaves.*
+%{pluginhome}/show-leaves.*
 %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/show-leaves.conf
 
 %files -n yum-plugin-local
@@ -654,13 +661,13 @@ fi
 %doc COPYING
 %ghost %{_sysconfdir}/yum.repos.d/_local.repo
 %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/local.conf
-/usr/lib/yum-plugins/local.*
+%{pluginhome}/local.*
 
 %files -n yum-plugin-fs-snapshot
 %defattr(-, root, root)
 %doc COPYING
 %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/fs-snapshot.conf
-/usr/lib/yum-plugins/fs-snapshot.*
+%{pluginhome}/fs-snapshot.*
 %{_mandir}/man1/yum-fs-snapshot.1.*
 %{_mandir}/man5/yum-fs-snapshot.conf.5.*
 
@@ -668,13 +675,13 @@ fi
 %defattr(-, root, root)
 %doc COPYING
 %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/ps.conf
-/usr/lib/yum-plugins/ps.*
+%{pluginhome}/ps.*
 
 %files -n yum-plugin-puppetverify
 %defattr(-, root, root)
 %doc COPYING
 %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/puppetverify.conf
-/usr/lib/yum-plugins/puppetverify.*
+%{pluginhome}/puppetverify.*
 
 %changelog
 * Thu Aug 10 2011 Tim Lauridsen <timlau@fedoraproject.org> 
diff --git a/yumdb.py b/yumdb.py
index 8a4888e..c50159e 100755
--- a/yumdb.py
+++ b/yumdb.py
@@ -7,8 +7,24 @@ import fnmatch
 import yum
 import shlex
 
+import os
+import glob
+
 parser = None
 
+# FIXME: Internal knowledge
+def _load_all_package_paths(db_path):
+    # glob the path and get a dict of pkgs to their subdir
+    glb = '%s/*/*/' % db_path
+    pkgdirs = glob.glob(glb)
+    _packages = {}
+    for d in pkgdirs:
+        if d[-1] == '/':
+            d = d[:-1]
+        pkgid = os.path.basename(d).split('-')[0]
+        _packages[pkgid] = d
+    return _packages
+
 def setup_opts():
     version = "0.0.1"
     vers_txt = "Manage yum groups metadata version %s" % version
@@ -25,6 +41,7 @@ def setup_opts():
       unset?        <key> [pkg-wildcard]...
       info          [pkg-wildcard]...
       sync          [pkg-wildcard]...
+      undeleted
       shell         [filename]...
 """
     parser =  optparse.OptionParser(usage = usage_txt, version = vers_txt)
@@ -99,8 +116,8 @@ def run_cmd(yb, args, inshell=False):
                 delattr(pkg.yumdb_info, ykey)
             print pkg
             print " " * 4, ykey, '<unset>'
-    elif args[0] == 'search' and len(args) > 2:
-        args.pop(0)
+    elif args[0] in ('search', 'search-q', 'search-quiet') and len(args) > 2:
+        cmd = args.pop(0)
         ykey = args.pop(0)
         done = False
         # Maybe need some API so we don't have to load everything?
@@ -115,10 +132,11 @@ def run_cmd(yb, args, inshell=False):
                     break
             if not found:
                 continue
-            if done: print ''
+            if done and cmd == 'search': print ''
             done = True
             print pkg
-            print " " * 4, ykey, '=', yval
+            if cmd == 'search':
+                print " " * 4, ykey, '=', yval
     elif args[0] in ['exist?', 'exist', 'exists'] and len(args) > 1:
         args.pop(0)
         ykey = args.pop(0)
@@ -183,6 +201,14 @@ def run_cmd(yb, args, inshell=False):
                 if ykey not in ndata:
                     continue
                 print " " * 4, ykey, '=', getattr(pkg.yumdb_info, ykey)
+    elif args[0] == 'undeleted':
+        yumdb_packages = _load_all_package_paths(yb.rpmdb.yumdb.conf.db_path)
+        for pkg in sorted(yb.rpmdb.returnPackages()):
+            if pkg.pkgid in yumdb_packages:
+                del yumdb_packages[pkg.pkgid]
+        for pkgid in yumdb_packages:
+            print "%s: %s" % (pkgid, yumdb_packages[pkgid])
+
     elif args[0] == 'shell' and not inshell:
         args.pop(0)
         if args:
diff --git a/yumdownloader.py b/yumdownloader.py
index e6107d4..4c5eefb 100755
--- a/yumdownloader.py
+++ b/yumdownloader.py
@@ -7,11 +7,11 @@
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Library General Public License for more details.
+# GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 import sys
 import os
@@ -22,6 +22,7 @@ import yum
 from yum.misc import setup_locale
 from yum.packages import parsePackages
 from yum.Errors import RepoError
+from yum.i18n import exception2msg
 from utils import YumUtilBase
 
 from urlparse import urljoin
@@ -31,6 +32,8 @@ import shutil
 import rpmUtils
 import logging
 
+rhn_source_repos = False
+
 # This is to fix Bug 469
 # To convert from a pkg to a source pkg, we have a problem in that all we have
 # is "sourcerpm", which can be a different nevra ... but just to make it fun
@@ -68,7 +71,11 @@ class YumDownloader(YumUtilBase):
                           
         # Add util commandline options to the yum-cli ones
         self.optparser = self.getOptionParser() 
-        self.main()
+        try:
+            self.main()
+        except (OSError, IOError), e:
+            self.logger.error(exception2msg(e))
+            sys.exit(1)
 
     def main(self):
         # Add command line option specific to yumdownloader
@@ -77,7 +84,7 @@ class YumDownloader(YumUtilBase):
         try:
             opts = self.doUtilConfigSetup()
         except yum.Errors.RepoError, e:
-            self.logger.error(str(e))
+            self.logger.error(exception2msg(e))
             sys.exit(50)
                 
         # Check if there is anything to do.
@@ -92,53 +99,27 @@ class YumDownloader(YumUtilBase):
             
         # Setup yum (Ts, RPM db, Repo & Sack)
         self.doUtilYumSetup(opts)
-        # Setup source repos
-        if opts.source:
-            self.setupSourceRepos()
         # Do the real action
         self.exit_code = self.downloadPackages(opts)
         
     def setupSourceRepos(self):
         # enable the -source repos for enabled primary repos
-        archlist = rpmUtils.arch.getArchList() + ['src']    
-        # Ok, we have src and bin repos. What we want to do here is:
-        #
-        # 1. _enable_ source repos for which the bin repos are enabled.
-        # 2. _disable_ the _other_ src repos.
-        #
-        # ...also we don't want to disable the src repos. for #1 and then
-        # re-enable them as then we get annoying messages and call .close() on
-        # them losing the primarydb data etc.
 
-        # Get all src repos.
-        src_repos = {}
-        for repo in self.repos.findRepos('*-source'):
-            src_repos[repo.id] = False
+        enabled = {}
+        for repo in self.repos.findRepos('*'):
+            enabled[repo.id] = repo.isEnabled()
 
-        #  Find the enabled bin repos, and mark their respective *-source repo.
-        # as good.
-        for repo in self.repos.listEnabled():
-            if repo.id not in src_repos:
-                srcrepo = '%s-source' % repo.id
-                if srcrepo in src_repos:
-                    src_repos[srcrepo] = True
+        for repo in self.repos.findRepos('*'):
+            if repo.id.endswith('-source'):
+                primary = repo.id[:-7]
+            elif rhn_source_repos and repo.id.endswith('-source-rpms'):
+                primary = repo.id[:-12] + '-rpms'
+            else:
+                continue
 
-        # Toggle src repos that are set the wrong way
-        for repo in self.repos.findRepos('*-source'):
-            if     repo.isEnabled() and not src_repos[repo.id]:
-                repo.close()
-                self.repos.disableRepo(repo.id)
-            if not repo.isEnabled() and     src_repos[repo.id]:
+            if not repo.isEnabled() and enabled.get(primary):
                 self.logger.info('Enabling %s repository' % repo.id)
                 repo.enable()
-                # Setup the repo, without a cache
-                repo.setup(0)
-                try:
-                    # Setup pkgSack with 'src' in the archlist
-                    self._getSacks(archlist=archlist, thisrepo=repo.id)
-                except yum.Errors.YumBaseError, msg:
-                    self.logger.critical(str(msg))
-                    sys.exit(1)
         
     def downloadPackages(self,opts):
         
@@ -177,7 +158,7 @@ class YumDownloader(YumUtilBase):
                     installable = self.returnPackagesByDep(pkg)
                     installable = yum.misc.unique(installable)
                 except yum.Errors.YumBaseError, msg:
-                    self.logger.error(str(msg))
+                    self.logger.error(exception2msg(msg))
                     continue
 
             if not installable: # doing one at a time, apart from groups
@@ -211,57 +192,35 @@ class YumDownloader(YumUtilBase):
             self.resolveDeps()
             # Add newly added packages to the toDownload list
             for pkg in self.tsInfo.getMembers():
-                if not pkg in toDownload:
-                    toDownload.append(pkg)
+                if pkg.ts_state in ('i', 'u') and pkg.po not in toDownload:
+                    toDownload.append(pkg.po)
         if len(toDownload) == 0:
             self.logger.error('Nothing to download')
             sys.exit(1)
+        if opts.urls:
+            for pkg in toDownload:
+                print urljoin(pkg.repo.urls[0], pkg.relativepath)
+            return 0
 
-        exit_code = 0
+        # create dest dir
+        if not os.path.exists(opts.destdir):
+            os.makedirs(opts.destdir)
+
+        # set localpaths
         for pkg in toDownload:
-            n,a,e,v,r = pkg.pkgtup
-            packages =  self.pkgSack.searchNevra(n,e,v,r,a)
-            packages.sort()
-            last = None
-            for download in packages:
-                if download.pkgtup == last :
-                    continue
-                last = download.pkgtup
-                repo = self.repos.getRepo(download.repoid)
-                remote = download.returnSimple('relativepath')
-                if opts.urls:
-                    url = urljoin(repo.urls[0]+'/',remote)
-                    self.logger.info('%s' % url)
-                    continue
-                local = os.path.basename(remote)
-                if not os.path.exists(opts.destdir):
-                    os.makedirs(opts.destdir)
-                local = os.path.join(opts.destdir, local)
-                if (os.path.exists(local) and 
-                    os.path.getsize(local) == int(download.returnSimple('packagesize'))):
-                    self.logger.error("%s already exists and appears to be complete" % local)
-                    continue
-                # Disable cache otherwise things won't download
-                repo.cache = 0
-                download.localpath = local # Hack: to set the localpath we want.
-                try:
-                    checkfunc = (self.verifyPkg, (download, 1), {})
-                    path = repo.getPackage(download, checkfunc=checkfunc)
-                except IOError, e:
-                    self.logger.error("Cannot write to file %s. Error was: %s" % (local, e))
-                    exit_code = 2
-                    continue
-                except RepoError, e:
-                    self.logger.error("Could not download/verify pkg %s: %s" % (download, e))
-                    exit_code = 2
-                    continue
-    
-                if not os.path.exists(local) or not os.path.samefile(path, local):
-                    progress = TextMeter()
-                    progress.start(basename=os.path.basename(local),
-                                   size=os.stat(path).st_size)
-                    shutil.copy2(path, local)
-                    progress.end(progress.size)
+            rpmfn = os.path.basename(pkg.remote_path)
+            pkg.localpath = os.path.join(opts.destdir, rpmfn)
+            pkg.repo.copy_local = True
+            pkg.repo.cache = 0
+
+        # use downloader from YumBase
+        exit_code = 0
+        probs = self.downloadPkgs(toDownload)
+        if probs:
+            exit_code = 2
+            for key in probs:
+                for error in probs[key]:
+                    self.logger.error('%s: %s', key, error)
         return exit_code
                     
     def _groupPackages(self,pkglist):
@@ -279,6 +238,9 @@ class YumDownloader(YumUtilBase):
         """do a default setup for all the normal/necessary yum components,
            really just a shorthand for testing"""
         try:
+            # Setup source repos
+            if opts.source:
+                self.setupSourceRepos()
             self._getRepos(doSetup = True)
             # if '--source' is used the add src to the archlist
             if opts.source:
@@ -291,18 +253,11 @@ class YumDownloader(YumUtilBase):
                 archlist = rpmUtils.arch.getArchList()
             self._getSacks(archlist=archlist)
         except yum.Errors.YumBaseError, msg:
-            self.logger.critical(str(msg))
+            self.logger.critical(exception2msg(msg))
             sys.exit(1)
 
-    def _removeEnabledSourceRepos(self):
-        ''' Disable all enabled *-source repos.'''
-        for repo in self.repos.listEnabled():
-            if repo.id.endswith('-source'):
-                repo.close()
-                self.repos.disableRepo(repo.id)
-
     def addCmdOptions(self):
-        # this if for compability with old API (utils.py from yum < 3.2.23)
+        # this if for compatibility with old API (utils.py from yum < 3.2.23)
         if hasattr(self,'getOptionGroup'): # check if the group option API is available
             group = self.getOptionGroup()
         else: