Commandline options added:
--downloadonly: Don't update, just download.
--downloaddir=directory: Specifies alternative DL directory.
---
 cli.py          |    6 ++++++
 docs/yum.8      |    6 ++++++
 yum/__init__.py |    5 ++++-
 yum/repos.py    |    4 ++++
 4 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/cli.py b/cli.py
index cf2c369..4122d5d 100755
--- a/cli.py
+++ b/cli.py
@@ -2084,6 +2084,8 @@ class YumOptionParser(OptionParser):
                 self.base.conf.assumeyes = 1
             if opts.assumeno:
                 self.base.conf.assumeno  = 1
+            self.base.conf.downloadonly = opts.dlonly
+            self.base.conf.downloaddir = opts.dldir
 
             #  Treat users like root as much as possible:
             if not self.base.setCacheDir():
@@ -2305,6 +2307,10 @@ class YumOptionParser(OptionParser):
                 help=_("control whether color is used"))
         group.add_option("", "--releasever", dest="releasever", default=None, 
                 help=_("set value of $releasever in yum config and repo 
files"))
+        group.add_option("--downloadonly", dest="dlonly", action="store_true",
+                help=_("don't update, just download"))
+        group.add_option("--downloaddir", dest="dldir", default=None,
+                help=_("specifies an alternate directory to store packages"))
         group.add_option("", "--setopt", dest="setopts", default=[],
                 action="append", help=_("set arbitrary config and repo 
options"))
 
diff --git a/docs/yum.8 b/docs/yum.8
index dab01f6..65ff448 100644
--- a/docs/yum.8
+++ b/docs/yum.8
@@ -586,6 +586,12 @@ configuration to stop this).
 This option makes yum go slower, checking for things that shouldn't be possible
 making it more tolerant of external errors.
 .br
+.IP "\fB\-\-downloadonly\fP"
+Don't update, just download.
+.br
+.IP "\fB\-\-downloaddir=directory\fP"
+Specifies an alternate directory to store packages.
+.br
 .IP "\fB\-\-setopt=option=value\fP"
 Set any config option in yum config or repo files. For options in the global 
 config just use: \-\-setopt=option=value for repo options use: 
\-\-setopt=repoid.option=value
diff --git a/yum/__init__.py b/yum/__init__.py
index a159706..1479d33 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -2207,6 +2207,10 @@ much more problems).
         errors = {}
         def adderror(po, msg):
             errors.setdefault(po, []).append(msg)
+        downloadonly = getattr(self.conf, 'downloadonly', False)
+        if downloadonly:
+            # callers are expected to print this & DL errors, then exit
+            adderror('--downloadonly', _('Exiting as requested'))
 
         #  We close the history DB here because some plugins (presto) use
         # threads. And sqlite really doesn't like threads. And while I don't
@@ -2245,7 +2249,6 @@ much more problems).
             # way to save this, report the error and return
             if (self.conf.cache or repo_cached) and errors:
                 return errors
-                
 
         remote_pkgs.sort(mediasort)
         #  This is kind of a hack and does nothing in non-Fedora versions,
diff --git a/yum/repos.py b/yum/repos.py
index 6d4c20e..de5da1e 100644
--- a/yum/repos.py
+++ b/yum/repos.py
@@ -129,6 +129,10 @@ class RepoStorage:
             # so nothing else touches us
             if not repo.enabled:
                 self.disableRepo(repo.id)
+            else:
+                pkgdir = getattr(self.ayum.conf, 'downloaddir', None)
+                if pkgdir:
+                    repo.pkgdir = pkgdir
                 
         self._setup = True
         self.retrieveAllMD()
-- 
1.7.4.4

_______________________________________________
Yum-devel mailing list
[email protected]
http://lists.baseurl.org/mailman/listinfo/yum-devel

Reply via email to