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

[PATCH] add apt pinning support to LH1



Hi everyone,

after having build a good and strong stable live system, i've had the
need to pinning some packages from other repositories. I haven't done
it in live-helper and never tried. From reading this maillist I
thought it was possible, but it wasn't.

After looking at the source of lh_chroot_apt I had to agree in
everything with intrigeri
(http://lists.debian.org/debian-live/2009/06/msg00181.html).
config/chroot_apt/ was a trap.

>From my testings with live-helper 1.0.5+20091022.063654 there was no
way to get any pinning in the final image. I've created some apt.conf
and preferences files with differences in the comments to identify
them in the final image and placed them in chroot_apt and
chroot_local-includes. The results of this tests:

* lh_build with apt.conf and preferences in chroot_apt/ only:
  - final image will have no preferences and two apt.conf (apt.conf
and apt.conf.orig), both from chroot_apt/ - same file.
  - Same happens with deb packages in chroot_local-packages/.

* lh_build with apt.conf and preferences in chroot_apt/ and also in
chroot_local-includes/:
  - final image will have apt.conf from chroot_apt/ and apt.conf.orig
from chroot_local-includes/. No preferences file.
  - Same happens with deb packages in chroot_local-packages/.

* lh_build just with chroot_local-includes/ files:
  - only apt.conf in final image, no apt.conf.orig file and no preferences file.
  - Same happens with deb packages in chroot_local-packages/.

* lh_build as the first (files in chroot_apt/), but also with a file
named preferences.orig in chroot_local-includes/:
  - final image with identical apt.conf and apt.conf.orig and a
preferences (without .orig) file from chroot_local-includes/.
  - Same happens with deb packages in chroot_local-packages/.

So, I've changed lh_chroot_apt so everything works as it should. With
the following patch all those issues will not happen anymore:

* Using pinning in both config/chroot_apt and
config/chroot_local-includes/etc/apt will work now. The chroot is
built with chroot_apt pinning, then lh_chroot will run (among other
things) lh_chroot_local-includes. When the time comes to
lh_chroot_local-hooks the chroot will have the pinning from the
chroot_local-includes, not the chroot_apt ones, but I think it's the
expected way, because when hooks are executed, the includes are
already applied.

* If pinning is only present in chroot_apt, then this pinning will be
used to all installs and will be also in the final image.

* If pinning is only present in chroot_local-includes/etc/apt, it will
work only to the hooks and will be in the final image.

I'm no sed expert, so the sed commands could be improved. The first
sed command replaces the if condition in the install | install-binary
case where preferences is rm. Now upon lh_chroot_apt remove case the
additions are removed from the file with sed. The second sed command
only removes the first blank line added before the additions (echo >>
chroot/etc/apt/preferences). I couldn't get a better way to do this.
If someone knows the sed command to remove the rest of a file after
the occurence minus one line, please suggest it.

I've tested all the situations, but I'd like to have a confirmation
that this works and if not, what whas the problem.

This should have been done sooner, before the end of lh1 uploads to
debian repositories, but I've never had the need to pin packages
before this week. I hope that this patch gets applied in
live.debian.net repository.

Have fun,

Rui M. P. Bernardo


Reply to: