Proposed change: add "-D" to download without installing

Jonathan Kamens <[email protected]>
Newsgroups gmane.linux.rpm.yum
Message-ID <[email protected]>
Greetings,

My company maintains Linux server appliances in the field at our client 
sites.  Our customer service is very high-touch -- when it's time to 
upgrade the appliances, members of our client services team visit each 
client in person and install the upgrade on-site.  Our appliance 
platform is RPM-based, and we distribute updates with yum, so "yum 
update" is part of pretty much every client upgrade.

The problem we run into is that it can take upwards of an hour for all 
of the RPMs to download before the upgrade actually starts.  We'd rather 
not have our client services team sitting around twiddling their thumbs 
for an hour waiting for bits to download, so what we're like to be able 
to do is to download all the RPMs in advance of the on-site client 
upgrade visit.  We'd like the process of doing this download to be as 
straightforward as possible; in particular, we'd like our client 
services folks to use yum for the download, just like they would use yum 
for the update.

I know about yumdownloader, and it can certainly be made to download 
packages, but it doesn't really have the "smarts" that we're looking for 
-- it won't calculate which packages to download automatically a la "yum 
update", and it won't put all the downloaded packages in the right 
subdirectories of /var/cache/yum.

Therefore, to solve this problem, I came up with the following minimal 
change to yum.  It is very useful to us, and I think it will be 
sufficiently useful to others that I'd like to ask you to consider 
merging it into the mainline.  The idea is simple: When "-D" is 
specified on the command line, yum should stop what it's doing after 
downloading but before installing.  Our client services folks can thus 
run "yum -D update" before going on-site, and then "yum update" when 
they get there to do the upgrade.

The implementation is also simple :-).  See the attached patch against 
yum 3.2.0 (or at least the version of yum 3.2.0 that's in Fedora Core).

Thanks,

  Jonathan Kamens

_______________________________________________
Yum mailing list
[email protected]
https://lists.dulug.duke.edu/mailman/listinfo/yum
yum-D.diff (text/x-patch, 2.3 KB)
--- config.py~	2007-05-16 23:25:51.000000000 -0400
+++ config.py	2007-06-17 19:54:58.000000000 -0400
@@ -613,6 +613,7 @@
     yumconf.yumvar = yumvars
     yumconf.uid = 0
     yumconf.cache = 0
+    yumconf.downloadonly = 0
     yumconf.progess_obj = None
     
     # propagate the debuglevel and errorlevel values:
--- yum.8.orig	2007-06-18 00:36:27.000000000 -0400
+++ yum.8	2007-06-18 00:36:07.000000000 -0400
@@ -174,6 +174,10 @@
 .IP "\fB\-C\fP" 
 Tells yum to run entirely from cache - does not download or update any
 headers unless it has to to perform the requested action.
+.IP "\fB\-D\fP" 
+Tells yum to stop after downloading packages into the cache but before
+installing them.  This allows you to prime the cache for a later install
+or update.
 .IP "\fB\-\-version\fP" 
 Reports the \fByum\fP version number and exits.
 .IP "\fB\-\-installroot=root\fP" 
--- cli.py~	2007-05-16 23:25:51.000000000 -0400
+++ cli.py	2007-06-17 20:14:01.000000000 -0400
@@ -346,7 +346,12 @@
         
         # unset the sigquit handler
         signal.signal(signal.SIGQUIT, signal.SIG_DFL)
-        
+
+        if self.conf.downloadonly == 1:
+            self.verbose_logger.log(yum.logginglevels.INFO_2,
+                                    'Exiting after successful download')
+            sys.exit(0)
+
         self.initActionTs() # make a new, blank ts to populate
         self.populateTs(keepold=0) # populate the ts
         self.ts.check() #required for ordering
@@ -1114,6 +1119,8 @@
             # if not root then caching is enabled
             if opts.cacheonly or self.base.conf.uid != 0:
                 self.base.conf.cache = 1
+            if opts.downloadonly:
+                self.base.conf.downloadonly = 1
 
             if opts.obsoletes:
                 self.base.conf.obsoletes = 1
@@ -1194,6 +1201,9 @@
         self.add_option("-C", "", dest="cacheonly",
                 action="store_true", default=False,
                 help="run entirely from cache, don't update cache")
+        self.add_option("-D", "", dest="downloadonly",
+                action="store_true", default=False,
+                help="download without installing")
         self.add_option("-c", "", dest="conffile", action="store", 
                 default='/etc/yum/yum.conf', help="config file location",
                 metavar=' [config file]')
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.