refactoring - revised

Osamu Aoki osamu at debian.org
Sat Jan 9 08:29:54 UTC 2010


Hi,

I had some typo and some use configuration are better to be loaded before
system one but it must be done in regular order.

I changed my mind a little bit.  I propose as follows.

On Sat, Jan 09, 2010 at 03:37:15PM +0900, Osamu Aoki wrote:
...

1. re-factor code using "$PBUILDER_CACHEDIR" etc.

For example:

   1.1 calling program set following variables:
   
   PBPROFILE=""                                            (if without -p)
   PBPROFILE="profile"                                     (if with -p profile)
   PBUILDER_CACHEDIR=/var/cache/pbuilder                   (if normal pbuilder)
   PBUILDER_CACHEDIR=/var/cache/pbuilder${PBPROFILE:+/$PBPROFILE}  (if pbuilder with profile)
   PBUILDER_CACHEDIR=$HOME/pbuilder/cache                  (if {pbuilder,pdebuild}-uml)
   PBUILDER_CACHEDIR=$HOME/pbuilder/cache${PBPROFILE:+/$PBPROFILE} (if {pbuilder,pdebuild}-uml with profile)
   PBUILDER_PKGDATADIR=/usr/share/pbuilder
   PBUILDER_SYSCONFDIR=/etc/pbuilder

   (This moves current -uml choice is $HOME/tmp to $HOME/pbuilder/cache)

   1.2 standard loading program reads configuration data in the following order

   "$PBUILDER_SYSCONFDIR"/pbuilder/pbuilderrc-preload
   "$PBUILDER_SYSCONFDIR"/pbuilder/${PBPROFILE}/pbuilderrc-prelead  (if -n ${PBPROFILE})
   "$HOME"/.pbuilder/pbuilderrc-preload
   "$HOME"/.pbuilder/${PBPROFILE}/pbuilderrc-preload        (if -n ${PBPROFILE})
   "$PBUILDER_PKGDATADIR"/pbuilderrc
   "$PBUILDER_PKGDATADIR"/${PBPROFILE}/pbuilderrc           (if -n ${PBPROFILE})
   "$PBUILDER_SYSCONFDIR"/pbuilder/pbuilderrc
   "$PBUILDER_SYSCONFDIR"/pbuilder/${PBPROFILE}/pbuilderrc  (if -n ${PBPROFILE})
   "$HOME"/.pbuilder/pbuilderrc
   "$HOME"/.pbuilder/${PBPROFILE}/pbuilderrc                (if -n ${PBPROFILE})

   (Now order is clear.  Use config always override system ones. This is
    getting complicated though.  Should we do this?)

> 2. merge *-uml into main code. (next step?)
> 
>  pbuilder -p profile [create|update|build|login|clean|execute] [--options]
> 
>   options to contain --targz (default), --no-targz, --uml, --unionfs, .... which set 
>   PBUILDER_IMAGE_TYPE variable ...
> 
> 3. Add easy access to build environments.
> 
> If we do refactoring as described above, then we can also ship template
> configurations for each typical pbuilder scenario/profile:
>    /usr/share/pbuilder/sarge/pbuilderrc
>    /usr/share/pbuilder/lenny/pbuilderrc
>    /usr/share/pbuilder/sid/pbuilderrc
>    /usr/share/pbuilder/experimental/pbuilderrc
>    /usr/share/pbuilder/kermic/pbuilderrc
>    /usr/share/pbuilder/jaunty/pbuilderrc
>    ...
>    (With proper DISRIBUTION=, MIRROR=,...)
> 
> Use ${URL_DEBIAN_ARCHIVE} and ${URL_UBUNTU_ARCHIVE} in these files.
> Define as  ${URL_DEBIAN_ARCHIVE:-some default value} and
> ${URL_UBUNTU_ARCHIVE:-some default value} in
> /usr/share/pbuilder/pbuilderrc to allow local customization across all
> releases.

We can override this default from /etc/pbuilder/pbuilderrc-preload or
$HOME/.pbuilder/pbuilderrc-preload.  (The order of configuration file
parsing is important for this to work.)

...

Anyway, changing configuration structure was quite invasive.  That was
another reason I skipped when making intial patch.

Osamu




More information about the Pbuilder-maint mailing list