[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Offline use of apt-cacher



On 1/24/06, Eduard Bloch <edi@gmx.de> wrote:
> #include <hallo.h>

Hi again,

> * Anuradha Ratnaweera [Mon, Jan 23 2006, 06:24:08PM]:
>
> > - Lazy online: we like apt-cacher to fetch a Packages/Release file
> > only if it old as set by a timeout.  So if one runs apt-get update
> > many times during a short period, only the first one will need to make
> > a HEAD/GET request.  (Lazy online has one tricky case if Packages file
> > does get update before timeout, but that can be handled neatly and
> > transparently as we are online).
>
> Fine... but don't you describe what is said in the comments in
> apt-cacher.conf?

Oops...  Please forgive my ignorance.  I think I rushed into check the
files in /usr/share/apt-cacher/ without reading the config file...

> So you basically want it to detect whether it's online and deliever the
> old version if it's offline? That would be a bit uncomfortable in the
> code because I would like to know up-front whether the file needs to be
> refreshed or not. And how to detect the off-line status quick enough,
> and not be confused with a timeout/slow server?

This means case 2 is also handled with apt-cacher as is, perfect! :-)

Having a small external program that sets expire_hours automatically
is fine with us.  I created this very crude sudo script which is run
just before Saegiri:

#!/bin/bash

cd /etc/apt-cacher/
cp -f apt-cacher.conf.orig apt-cacher.conf
num_interfaces=$(grep ':' /proc/net/dev | egrep -v 'lo:|:[[:space:]]*0' | wc -l)
[ $num_interfaces -ge 1 ] && \
    sed -i 's/^[[:space:]]*expire_hours[[:space:]]*=.*/expire_hours=10/' \
    /etc/apt-cacher/apt-cacher.conf

To complete this discussion, we need to clarify a couple of scenarios.
 Let's start with one.  I'll use an example to ease the explaination,
and let's assume expire_hours is set to 12.

- apt-get update is run at 09:00, and Packages/Release/Sources files
are actually fetched; the lists include version 1.0.1 of package x.
- package x is not in the cache.
- package x is upgraded to version 1.0.2 in the repository at 10:00.
- apt-get install x is run at 11:00 which will look for versin 1.0.1
and apt-cacher will get a 404.

Does apt-cacher mark the related Packages/Sources file(s) as `expired'
at that point, so that someone can correct the situation by running
apt-get update next time without waiting until 21:00?

Thanks in advance.

        Anuradha
--
http://www.linux.lk/~anuradha/
http://anuradha-ratnaweera.blogspot.com

Reply to: