Danny Smit
2018-Feb-14 10:43 UTC
[CentOS] CentOS 6: Yum downloadonly changes local source repositories (and CentOS 7)
For what its worth, I managed to get around the problem with a small patch on yum itself: --- ORIG/usr/lib/python2.6/site-packages/yum/yumRepo.py 2017-03-22 05:32:26.000000000 +0000 +++ NEW/usr/lib/python2.6/site-packages/yum/yumRepo.py 2018-02-14 09:14:04.879902463 +0000 @@ -863,6 +863,7 @@ class YumRepository(Repository, config.R text=text, cache=cache, size=package.size, + copy_local=1, ) def getHeader(self, package, checkfunc = None, reget = 'simple', Although newer versions of yum do not rename the local package anymore, it still does not copy/download the package into the desired "downloaddir". I will try to report that upstream. Regards, Danny On Tue, Feb 13, 2018 at 6:05 PM, Danny Smit <danny.smit.0 at gmail.com> wrote:> Hi All, > > I'm trying to use yum with the downloadonly option to collect a set of > packages including dependencies. I noticed that even on CentOS 6 the > downloadonly option is currently a default feature of the core of yum > itself, which is nice. > > However something strange occurs when one of the repositories to > download from is a local repository, like: > > [custom-repo] > name=My custom repo > baseurl=file:///repositories/mycustomrepo/ > > I added such a repo to my yum configuration and then executed: > > yum install -y --downloadonly --downloaddir=downloads custom_package > > When executing the above the package in question is suddenly renamed from: > > /repositories/mycustomrepo/x86_64/custom_package-1.1-2.el6.x86_64.rpm > > to > > /repositories/mycustomrepo/x86_64/custom_package-1.1-2.el6 > > Note that the architecture part and file extension are removed with > the file in the local repo, where I wouldn't expect yum to even try to > change something there. > Also nothing is downloaded into the downloads dir as specified. > > Strangely when it concerns a package that comes from a repository that > is configured as an http URL, the download option works flawlessly. > > Has anyone else seen this behavior? Is it a bug? Or is there a way around this? > Actually I would even prefer not having to run yum as root for this, > unfortunately yum to require write access to lock files in /var/. > > Platform: CentOS 6.9 (also not working with CentOS 7, then it keeps > the file intact, but doesn't download either) > Yum: 3.2.29-81.el6.centos > > Kind regards, > Danny