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

[RFC PATCH 0/2] Running maintscripts for a different architecture

Dear dpkg developers,

in OE-Core (Yocto / OpenEmbedded Core), we cross-compile complete
distributions and create root filesystem images. You can choose between
several package formats (deb, ipk, rpm) and related managers.

Because these root filesystems usually are built for an architecture
(instruction set) that's incompatible with the build system's CPU, dpkg's
habit of chrooting into the 'instdir' before running maintscripts (if
the --root option was given) doesn't work.

To compensate, we can add a new option --cross-bootstrap, which stops
dpkg from chrooting and instead exports DPKG_INSTDIR for maintscripts.

Then we can adjust update-alternatives to use this variable, in order to
be able to use it in a cross-compile environment. Previously, we had to
use a different implementation of update-alternatives, that comes with

So far, I've successfully tested these patches to create root filesystems,
i.e. "update-alternatives --install". The other options still need testing,
but at least with an empty or unset DPKG_INSTDIR, nothing should have

The second patch has room for improvements, e.g. you seem to avoid
using predeclarations, and I believe calling alternative_path_classify()
from fileset_*() may violate your coding style. But I'd like to get some
feedback first, in order to be able fix it properly. I could also split
the patch into smaller components:

 1.) Predeclare/move/rename alternative_path_classify and enum
 2.) Replace direct use of stat with calls to alternative_path_classify
     where possible.
 3.) Predeclare/move xasprintf.
 4.) Introduce instdir.

Best regards,

Andreas Oberritter (2):
  dpkg: Add option --cross-bootstrap
  update-alternatives: Implement offline mode

 src/main.c                  |   3 +
 src/main.h                  |   1 +
 src/script.c                |   6 +-
 utils/update-alternatives.c | 162 ++++++++++++++++++++++++++++----------------
 4 files changed, 110 insertions(+), 62 deletions(-)


Reply to: