Profile support and refactoring

Loïc Minier lool at dooz.org
Mon Jan 11 17:57:43 UTC 2010


On Sun, Jan 10, 2010, Osamu Aoki wrote:
> I think you are talking testlib.sh.  PBUILDER_CACHEDIR nicely into the
> same convention.  I see:
>   export PBUILDER_PKGLIBDIR="${PBUILDER_PKGLIBDIR:-$PBUILDER_ROOT/usr/lib/pbuilder}"
> and similar in codes you are touching.  Interesting offset is given
> with $PBUILDER_ROOT.  Do we need to do the same for $PBUILDER_CACHEDIR?
> Since pbuilderrc is read by pbuilder-loadconfig, is this good place to
> define it like:
>   export PBUILDER_CACHEDIR="${PBUILDER_CACHEDIR:-$PBUILDER_ROOT/var/cache/pbuilder}"

 Sure; I think it should get set to a default value if unset and before
 using it.  If you plan to use it in pbuilderrc, you should ensure it is
 set properly and overridable.

> This is redefined in pbuilder-satisfydepends-aptitude pbuilder-satisfydepends-classic
> but not in -gdebi, -experimental.  I guess this is because you are not
> touching -gdebi, -experimental.  

 Right; I added it progressively where I needed it for the testsuite; I
 thought that at some point there would be enough that we can fix all
 the pathnames.

> Isn't it better to have one code pbuilder-default-path and source it
> where needed to be maintainable (pbuilder-loadconfig, pbuilder-checkconfig,
> pbuilder-satisfydepends-*).  pbuilder-default-path is basically:
> 
> export PBUILDER_PKGLIBDIR="${PBUILDER_PKGLIBDIR:-$PBUILDER_ROOT/usr/lib/pbuilder}"
> export PBUILDER_PKGDATADIR="${PBUILDER_PKGDATADIR:-$PBUILDER_ROOT/usr/share/pbuilder}"
> export PBUILDER_SYSCONFDIR="${PBUILDER_SYSCONFDIR:-$PBUILDER_ROOT/etc}"
> export PBUILDER_CACHEDIR="${PBUILDER_CACHEDIR:-$PBUILDER_ROOT/var/cache/pbuilder}"

 Sure; it wasn't widespread to split it out, but that could easily be
 done.

> > >  * /etc/pbuilder
> > >    it contains /etc/pbuilder/pbuilderrc -> ../pbuilderrc
> > >    (This looks better place to keep real config)
> > 
> >  I think that should be the default system config for all profiles (or
> >  the default profile).
> > 
> >  I would like to have /etc/pbuilder/foo.pbuilderrc files which would
> >  override /etc/pbuilderrc.
> 
> There are 2 types of "override".  Before and after /etc/pbuilderrc.
> Since /etc/pbuilder/ directory only contains pbuilder related things,
> repeating "pbuilder" for all files seems redundant.  Imitating dpkg
> preinst/postinst, how about:
> 
>   /etc/pbuilder/foo.postrc
>   /etc/pbuilder/foo.prerc

 I'm not too hot about this.  Let's drive the changes when we have a
 specific use case/problem to solve and keep the current simple design
 for now.

> > > 1. re-factor code using "$PBUILDER_CACHEDIR" etc.
> > 
> >  Looks good
> > 
> > >    1.2 standard loading program reads configuration data in the following order
> ...
> I got your point on $PBUILDER_PKGDATADIR"/${PBPROFILE}/pbuilderrc and
> $HOME/.pbuilderrc (or likes).  Let's only take care as backward
> compatibility.  (Technically, you may be able to run pbuilder like
> program as user but with resource demanded, I agree person running this
> program is expected to have root access thus /etc is good enough. Maybe
> document this deprecated status.)
> 
> In light of all these, how about sourcing in following order:
> 
>   ${PBPROFILE:+PBUILDER_SYSCONFDIR/pbuilder/$PBPROFILE.prerc}
>   ${PBUILDER_PKGDATADIR}/pbuilderrc                (system wide)
>   ${PBUILDER_SYSCONFDIR}/pbuilderrc                (created by debconf)
>      this contains MIRRORSITE only as default.
>   ${PBPROFILE:+$PBUILDER_SYSCONFDIR/pbuilder/$PBPROFILE.postrc} 
>   ${HOME}/.pbuilderrc

 I don't see the point of the prerc/postrc stuff.  If you want to set
 values system-wide and the profile should not override them, then
 the profile should only set them if they aren't set.  Is that good
 enough?

> With the current source, there is no mechanism to switch default
> MIRRORSITE set by system in ${PBUILDER_PKGDATADIR}/pbuilderrc and
> MIRRORSITE set by debconf in ${PBUILDER_SYSCONFDIR}/pbuilderrc.  In
> order to enable such thing, thee should be some new mechanism to set
> MIRRORSITE depending on --distribution.

 Agreed.

> So function installaptlines in pbuilder-modules should source following
> corresponding file (if exist) to set default for $MIRRORSITE and
> optionally $OTHERMIRROR before sourcing */pbuilderrc etc.
> 
>   ${PBUILDER_PKGDATADIR}/distribution/experimental
>   ${PBUILDER_PKGDATADIR}/distribution/sid
>   ${PBUILDER_PKGDATADIR}/distribution/squeeze
>   ${PBUILDER_PKGDATADIR}/distribution/lenny
>   ${PBUILDER_PKGDATADIR}/distribution/lenny-backports
>   ${PBUILDER_PKGDATADIR}/distribution/volatile
>   ${PBUILDER_PKGDATADIR}/distribution/volatile-sloppy
>   ${PBUILDER_PKGDATADIR}/distribution/kermic
>   ${PBUILDER_PKGDATADIR}/distribution/jaunty

 I'm not sure we want so many files; I'd have to think a bit about this.
 I would probably prefer something like a shell script able to dump a
 sources.list snippet when given a dist or pseudo-dist as input.
 Perhaps the dput templates give us some good overview of the configs we
 want to support.  At least not more than a file per use case rather
 than per dist.
   Perhaps something like /usr/lib/pbuilder/pbuilder-aptconfig which
 would accept --dist sid or --dist karmic and an optional --vendor
 Debian or --vendor Ubuntu and default to guessing it from the
 current distro or from the host's vendor.  Or we could ship some
 sources.list files and sed the mirror in them.  e.g. we would
 distribute backports.org-sources.list and sed the default host with a
 mirror map.  The mirror map could be a config file of replacements to
 do (seds).  We would also sed the dist and components in these.  e.g.
 for ubuntu-sources.list:
      deb @@UBUNTU_MIRROR@@ @@DIST@@ @@COMPONENTS@@
 and for backports.org sources.list:
      deb @@BACKPORTS_MIRROR@@ @@DIST@@ @@COMPONENTS@@
      deb @@DEBIAN_MIRROR@@    @@DIST@@ @@COMPONENTS@@
 would also need a flag for -src entries.

> Problem is how to cope with debconf result in
> ${PBUILDER_SYSCONFDIR}/pbuilderrc.
> This needs some tweaking in debian/pbuilder.config

 Oh yes; it's a fragile piece.

-- 
Loïc Minier



More information about the Pbuilder-maint mailing list