RPM Repo: Clone just Source packages

repositoryyum

As part of a project, I need to rebuild source RPMs from the really convenient Remi Yum repo(Source RPMS).

The search for some way to efficiently get those packages was not a very successful venture(common keywords lead to very polluted results on Google). reposync can do this, but only as an add-on to cloning the RPM portion of the repo. What I need is something that does this just for the sources.

Any leads to doing this efficiently?

Note: Inefficient solution already applied:

extractXPathAttr.pl 'http://rpms.famillecollet.com/SRPMS/'  '//tr/td[2]/a[1]' 'href'  |\
    grep src.rpm |\
    xargs -I{} wget 'http://rpms.famillecollet.com/SRPMS/{}'

(extractXPathAttr.pl extracts the required attribute of the elements specified by the XPath from the given URL. I'll put it up on github once it's cleaned up and documented.)

Best Answer

reposync can be used for just the sources.

It does not matter if the source repo is enabled under /etc/yum.repos.d/ or not. Just as long as there is a source repo under there it will reposync with it enabled or not.

Make sure that you specify the name of the source repository along with the --source option:

reposync -n --source -r foobar-source

Versions used in this answer: rpm -q yum-utils yum-utils-1.1.31-42.el7.noarch cat /etc/redhat-release CentOS Linux release 7.4.1708 (Core)