On Wed, 2004-08-04 at 06:46, Daniel Gagnon wrote: > I was wondering if there was a way for a user of Fedora Core 2 with > only a 56K modem to download update on a computer that have a > broadband connexion (but unfortunately, Windows) and carry them (on > CDs, probably) to the computer with the slow connexion. > > And how can yum be used in the process ? > Perhaps you could apply the following patch in /usr/share/yum, and then try the command: yum list downloads_for update > /tmp/yum-downloads After the "downloads_for" keywords follows any command line that would be a legal yum command without "list downloads_for". The output consists of two "words" per line, separated by tabs: 1) an absolute pathname starting with /var/cache/yum, and 2) an argument you could give to wget. There is one line per object yum would download if run without "list downloads_for". When you have arranged that the files have been downloaded and placed in the corresponding file names, I believe you can do yum -C update or whatever was the command after "list downloads_for". -Enrique --- save-yummain.py 2004-05-11 22:24:48.000000000 +0200 +++ yummain.py 2004-08-05 20:56:40.000000000 +0200 @@ -81,7 +81,7 @@ # version of yum conf.yumversion = __version__ # we'd like to have a log object now - log=Logger(threshold=conf.debuglevel, file_object=sys.stdout) + log=Logger(threshold=conf.debuglevel, file_object=sys.stderr) # syslog-style log if conf.uid == 0: logfd=os.open(conf.logfile, os.O_WRONLY | os.O_APPEND | os.O_CREAT, 0644) --- save-clientStuff.py 2004-05-11 22:24:48.000000000 +0200 +++ clientStuff.py 2004-08-05 20:44:05.000000000 +0200 @@ -1097,7 +1097,12 @@ pkgaction.listpkginfo(nulist, 'all', HeaderInfo, short) sys.exit(0) else: - if cmds[0] == 'updates': + if cmds[0] == 'downloads_for': + cmds.pop(0) + take_action(cmds, nulist, uplist, newlist, obsoleting, tsInfo, HeaderInfo, rpmDBInfo, obsoleted) + list_downloads(tsInfo) + sys.exit(0) + elif cmds[0] == 'updates': pkgaction.listpkginfo(uplist, 'updates', HeaderInfo, short) elif cmds[0] == 'available': pkgaction.listpkginfo(newlist, 'all', HeaderInfo, short) @@ -1168,8 +1173,37 @@ sys.exit(1) sys.exit(0) else: + log(2, _('Unknown command ' + basecmd)) usage() +def list_downloads(tsInfo): + """List all packages that would be downloaded, and their corresponding locations in the cache""" + for (name, arch) in tsInfo.NAkeys(): + state = tsInfo.state(name, arch) + if state in ['u', 'ud', 'iu', 'i' ]: # inst/update + pkghdr = tsInfo.getHeader(name, arch) + rpmloc = tsInfo.localRpmPath(name, arch) + if os.path.exists(rpmloc): + log(4, 'Checking cached RPM %s' % (os.path.basename(rpmloc))) + if not rpmUtils.checkRpmMD5(rpmloc): + errorlog(0, _('Damaged RPM %s, removing.') % (rpmloc)) + os.unlink(rpmloc) + else: + rpmobj = rpmUtils.RPM_Work(rpmloc) + hdre = pkghdr['epoch'] + hdrv = pkghdr['version'] + hdrr = pkghdr['release'] + (rpme, rpmv, rpmr) = rpmobj.evr() + if (rpme, rpmv, rpmr) != (hdre, hdrv, hdrr): + errorlog(2, _('NonMatching RPM version, %s, removing.') %(rpmloc)) + os.unlink(rpmloc) + + if os.path.exists(rpmloc): + pass + else: + remoterpmurl = tsInfo.remoteRpmUrl(name, arch) + print rpmloc, '\t', remoterpmurl + def download_packages(tsInfo): """download and check the packages needed for the transaction"""