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

Matthew Patton mpatton at inforelay.com
Mon Aug 27 23:46:59 UTC 2012


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 wrote a simple (crude?) script to do just that. The $CWD is  
/var/www/html/pub/ but of course can be anything you like. I could  
(should?) have used 'sed' to do more rigorous RPM filename parsing but  
this was good enough for now. If you have package names with something  
like 'el6_[0-9]' instead of plain 'el6' you'll need to handle that. I took  
the easy way out and just symlinked them to 'el6'.



#!/bin/sh
for f in `find /var/satellite -type f -name \*.rpm`; do
   i=${f##*/}
   tmp=${i##*el}
   ver=el${tmp%%\.*}

   [ ! -e $ver/$i ] && ln -s $f $ver/
done

for d in el{5,6}; do
   (cd $d; createrepo  -Cc .cache --update --unique-md-filenames . )
done




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




More information about the Spacewalk-list mailing list