[CentOS] CentOS 6: Yum downloadonly changes local source repositories

Tue Feb 13 17:05:59 UTC 2018
Danny Smit <danny.smit.0 at gmail.com>

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