Squid and *.rpm caching.

Hello all.
I have a network with openSuSE 11.0 workstations, which are connected to router with Squid. Iptables is redirecting all traffic to squid transparently. Some of the workstations are updated rarely, some often. I noticed, that rpms from repos are cached, but almost always Squid MISS them, because of different source mirror. This makes cache grow useless when the same rpms are downloaded by different stations. I’ve found python redirector named IntelligentMirror from Fedora, but Squid can’t start with it, and tells me:

Traceback (most recent call last):                                                                   
  File "/etc/squid/intelligentmirror/intelligentmirror.py", line 20, in <module>                     
    from config import readMainConfig, readStartupConfig                                             
  File "/etc/squid/intelligentmirror/config.py", line 33, in <module>                                
    import rpmUtils.transaction                                                                      
ImportError: No module named rpmUtils.transaction                                                    
2008/11/07 13:24:26| WARNING: redirector #9 (FD 16) exited                                           
2008/11/07 13:24:26| Too few redirector processes are running                                        
FATAL: The redirector helpers are crashing too rapidly, need help!                                   

Squid Cache (Version 3.0.STABLE5): Terminated abnormally.
CPU Usage: 0.144 seconds = 0.048 user + 0.096 sys        
Maximum Resident Size: 0 KB                              
Page faults with physical i/o: 0                         
Memory usage for squid via mallinfo():                   
        total space in arena:    2840 KB                 
        Ordinary blocks:         2807 KB      5 blks     
        Small blocks:               0 KB      0 blks     
        Holding blocks:          5376 KB     15 blks     
        Free Small blocks:          0 KB                 
        Free Ordinary blocks:      32 KB                 
        Total in use:            8183 KB 288%            
        Total free:                32 KB 1%              
Traceback (most recent call last):                       
  File "/etc/squid/intelligentmirror/intelligentmirror.py", line 20, in <module>
    from config import readMainConfig, readStartupConfig                        
  File "/etc/squid/intelligentmirror/config.py", line 33, in <module>           
    import rpmUtils.transaction                                                 
ImportError: No module named rpmUtils.transaction

All required packages are installed (python-urlgrabber, python-iniparse, rpm-python)

Is there any other way, best would be in Squid itself, to make Squid cache and HIT rpms?

Not the best solution but you can change download.opensuse.org to a specific close mirror on all the pc’s so the information can be found by squid…a simpler solution might be to redirect to a specific mirror using squirm in squid.

I also needed to install yum and, for my distro, in /etc/squid/intelligentmirror/config.py add (just before “import os”) :


import sys
sys.path.append('/usr/share/pyshared')