Bug 18119

Summary: symlinks for managing sources.list.d/ (on/off)
Product: Sisyphus Reporter: Ivan Zakharyaschev <imz>
Component: apt-conf-sisyphusAssignee: placeholder <placeholder>
Status: NEW --- QA Contact: qa-sisyphus
Severity: enhancement    
Priority: P2 CC: glebfm, ldv, placeholder
Version: unstable   
Hardware: all   
OS: Linux   

Description Ivan Zakharyaschev 2008-12-06 05:58:38 MSK
apt-conf-sisyphus-5.0-alt2

I suggest to manage the on/off status of mirrors in /etc/apt/sources.list.d/ with symlinks, as it is done in apache2-common-2.2.5-alt1:

$ l /etc/httpd2/conf/mods-enabled/
total 1
drwxr-xr-x  2 root root 448 Ноя 29 22:04 ./
lrwxrwxrwx  1 root root  26 Ноя 29 22:04 cgi.load -> ../mods-available/cgi.load
drwxr-xr-x 16 root root 592 Ноя 29 20:55 ../
lrwxrwxrwx  1 root root  31 Авг 23  2007 setenvif.conf -> ../mods-available/setenvif.conf
lrwxrwxrwx  1 root root  31 Авг 23  2007 setenvif.load -> ../mods-available/setenvif.load
lrwxrwxrwx  1 root root  28 Июл 14  2007 alias.load -> ../mods-available/alias.load
lrwxrwxrwx  1 root root  33 Июл 14  2007 authz_host.load -> ../mods-available/authz_host.load
lrwxrwxrwx  1 root root  32 Июл 14  2007 autoindex.load -> ../mods-available/autoindex.load
lrwxrwxrwx  1 root root  26 Июл 14  2007 dir.load -> ../mods-available/dir.load
lrwxrwxrwx  1 root root  30 Июл 14  2007 include.load -> ../mods-available/include.load
lrwxrwxrwx  1 root root  33 Июл 14  2007 log_config.load -> ../mods-available/log_config.load
lrwxrwxrwx  1 root root  28 Июл 14  2007 logio.load -> ../mods-available/logio.load
lrwxrwxrwx  1 root root  27 Июл 14  2007 mime.conf -> ../mods-available/mime.conf
lrwxrwxrwx  1 root root  27 Июл 14  2007 mime.load -> ../mods-available/mime.load
lrwxrwxrwx  1 root root  34 Июл 14  2007 negotiation.load -> ../mods-available/negotiation.load
$ l /etc/httpd2/conf/mods-available/ | head
total 271
drwxr-xr-x 16 root root  592 Ноя 29 20:55 ../
drwxr-xr-x  2 root root 2200 Авг 23  2007 ./
-rw-r--r--  1 root root   66 Авг 19  2007 actions.load
-rw-r--r--  1 root root   62 Авг 19  2007 alias.load
-rw-r--r--  1 root root   60 Авг 19  2007 asis.load
-rw-r--r--  1 root root   72 Авг 19  2007 auth_basic.load
-rw-r--r--  1 root root   74 Авг 19  2007 auth_digest.load
-rw-r--r--  1 root root   72 Авг 19  2007 authn_anon.load
-rw-r--r--  1 root root   70 Авг 19  2007 authn_dbd.load
$ 

W.r.t. apt, that would mean that there is a /etc/apt/available-sources.list.d/ , which contains all the possible mirrors (uncommented), and the one that is actually used is pointed to by a symlink like:

/etc/apt/sources.list.d/alt_ftp.list -> /etc/apt/available-sources.list.d/alt_ftp.list

Doing symlinks is less distressing than commenting/uncommenting.

Also, the symlink-approach can be extended to switch between branches independently of mirror sites. E.g., 

/etc/apt/sources.list.d/alt_ftp.list -> /etc/apt/available-sources.list.d/selected-branch/alt_ftp.list

where

/etc/apt/available-sources.list.d/selected-branch -> /etc/apt/available-sources.list.d/Sisyphus/
Comment 1 Ivan Zakharyaschev 2008-12-06 19:37:11 MSK
Even if the second part of the suggestion is not implemented (/etc/apt/available-sources.list.d/selected-branch -> /etc/apt/available-sources.list.d/Sisyphus/), then the suggested approach still gives an advantage of easy switching between branches:

apt-conf-whatever contains all the possible URLs for the selected branch in /etc/apt/available-sources.list.d/* . You choose some of the sites by putting a symlink to /etc/apt/sources.list.d/ , say:

/etc/apt/sources.list.d/alt_ftp.list -> /etc/apt/available-sources.list.d/alt_ftp.list 

. Then switching to another branch is as easy as installing another apt-conf-aBranch package: it will replace the contents of /etc/apt/available-sources.list.d/*, but your symlink /etc/apt/sources.list.d/alt_ftp.list will still be valid and working.

(Compare this one action to the current process for switching to another branch:

1) install another apt-conf-aBranch;
2) merge the new files with your old uncommented ones (inconvenient!).)
Comment 2 Ivan Zakharyaschev 2008-12-06 19:43:20 MSK
I'd even prefer this second way of making the switching of branches easier, because it's simpler and clearer, than the initial suggestion of stacked symlinks.

(In reply to comment #1)
> . Then switching to another branch is as easy as installing another apt-conf-aBranch package: it will replace the contents of
> /etc/apt/available-sources.list.d/*, but your symlink /etc/apt/sources.list.d/alt_ftp.list will still be valid and working.