[Spacewalk-list] script to create webserver accessible repo of packages under Spacewalk channels

Matthew Patton mpatton at inforelay.com
Sat Sep 1 07:22:34 UTC 2012


On Mon, 27 Aug 2012 19:46:59 -0400, Matthew Patton <mpatton at inforelay.com>  
wrote:

> On https://fedorahosted.org/spacewalk/wiki/BrainBox there is a requst  
> for:
> <quote>
> Allow a channel to be available as a raw yum repo. This would work for  
> building tools like mock. I often have to keep rpms around in 2 spots so  
> I can perform mock biulds. Please, please fix this. --stahnma
>   Seconded, it would also make migration, manual changes easier? An  
> export as yum repo hierarchy button somewhere? and would help with Koji  
> integration. -- Phil
> </quote>

I apologize to the list for the pitiful effort of my previous post.

Turns out Satellite generates repodata for each channel and stuffs it into  
/var/cache/rhn/repodata. So I wrote a vastly better script that extracts  
the information and symlinks into the hierarchy Satellite maintains. This  
obviates the need to spend 2x on disk space or maintain a separate  
repository. If you should have a 'mrepo' configuration that is uploaded  
into Satellite, this script can be trivially extended to remove the  
original RPM and symlink into the Satellite's copy.

Please note the script just takes the first match should there be an exact  
filename match. It also doesn't deal with EPOCH but it appears Satellite  
does it's own housecleaning in that regard.

If you write a yum repo file and put it somewhere that Apache can access  
it, and likewise symlink into /var/cache/rhn/repodata, any remote yum  
client can take full advantage of the Satellite channels without having to  
join. This is particularly useful when you want to install the rhn-client  
packages on a system that has no existing ties to Satellite.


Here's an example HTTP-visible repo file with some channels:

[centos-6-updates-x86_64]
name=CentOS 6 - Updates (x86_64)
baseurl=http://spacewalk/pub/channels/centos-6-updates-x86_64
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
enabled=1
gpgcheck=1

[epel-6-x86_64]
name=Extra Packages for Enterprise Linux 6 (x86_64)
baseurl=http://spacewalk/pub/channels/epel-6-x86_64
gpgkey=http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6
enabled=1
gpgcheck=1


The script itself is at
http://pastebin.com/UUmcF4yT


-- 
Cloud Services Architect, Senior System Administrator
InfoRelay Online Systems (www.inforelay.com)




More information about the Spacewalk-list mailing list