[65] in athena10

home help back first fref pref prev next nref lref last post

debathena-replace-conffiles idea

daemon@ATHENA.MIT.EDU (Tim Abbott)
Wed Jan 30 02:58:10 2008

Date: Wed, 30 Jan 2008 02:57:28 -0500 (EST)
From: Tim Abbott <tabbott@MIT.EDU>
To: athena10@MIT.EDU
Message-ID: <Pine.LNX.4.64L.0801292249260.23541@yaz-pistachio.mit.edu>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed

Current debathena configuration packages using the 
debathena-check-conffiles.mk interface are reasonably short but somewhat 
ugly (pam-config is particularly ugly because it has so many changes). 
Currently, debathena-ldap-config looks like:

---------------------------------------------------------------

DEB_AUTO_UPDATE_DEBIAN_CONTROL = 1
DEBATHENA_DIVERT_FILES_debathena-ldap-config += \
         /etc/ldap/ldap.conf.debathena
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/rules/debathena-divert.mk
include /usr/share/cdbs/1/rules/debathena-check-conffiles.mk

common-build-indep:: debian/ldap.conf.debathena

debian/ldap.conf.debathena: $(call debathena_check_conffiles,/etc/ldap/ldap.conf)
         perl -0pe ' \
             s/^#BASE.*$$/BASE\tdc=mit, dc=edu/m and \
             s/^#URI.*$$/URI\tldap:\/\/ldap.mit.edu\nTLS_CACERT\t\/usr\/share\/debathena-ssl-certificates\/mitCA.pem/m or die' $< > $@

clean::
         rm -f debian/ldap.conf.debathena

---------------------------------------------------------------

Packages like debathena-pam-config that change more than one configuration 
file tend to have several copies of much of the above code.

The new interface I'm considering would look something like:

--------------------------------------------------------------- 
DEB_AUTO_UPDATE_DEBIAN_CONTROL = 1
DEBATHENA_REPLACE_CONFFILES_debathena-ldap-config += \
 	/etc/ldap/ldap.conf.debathena
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/rules/debathena-replace-conffiles.mk
---------------------------------------------------------------

debathena-replace-conffiles would include debathena-divert.mk and 
debathena-check-conffiles.mk, registering /etc/ldap/ldap.conf.debathena 
for diversion and /etc/ldap/ldap.conf for checking.  It would do the 
actual modification using a script called something like
debian/deb_gen_ldap.conf.debathena, i.e.

debian/deb_gen_ldap.conf.debathena < debian/conffile-copies/etc/ldap/ldap.conf > debian/ldap.conf.debathena

where the first argument comes from the output of

$(call debathena_check_conffiles,/etc/ldap/ldap.conf) and the second 
argument is the basename of /etc/ldap/ldap.conf.debathena.

It would also setup the cleaning of debian/ldap.conf.debathena.

We would include the perl code to do the modifications in its own perl 
script, rather than how it is currently inlined in the rules file.  This 
would result in much more readable perl scripts for modifying 
configuration files (embedding perl code in Makefiles is annoying because 
you need to use $$ for perl variables and add \ at the end of each line, 
and perl syntax highlighting doesn't work by default in normal editors 
which tends to result in hard-to-read code).

Notice that this interface would not support a single package diverting 
two configuration files by the same name in different directories.  I 
think this is unlikely to be relevant for any real configuration package.

Looking through our existing packages using the debathena-check-conffiles 
system, all of them also divert the file by the corresponding name. 
nsswitch-config and gconf2-config sometimes use a template file (when it 
exists) for the configuration file, and so would not benefit as much from 
this new interface.

My draft module is currently available in 
/mit/debathena/packages/config/config-build-common/debathena-config-build-common-4.0/debathena-replace-conffiles.mk. 
It's primary implementation fault is it requires the .debathena to be at 
the end of the file name, but I don't consider this to be particularly 
important.

 	-Tim Abbott

home help back first fref pref prev next nref lref last post