Richard W.M. Jones
2011-Mar-21 15:16 UTC
[Libguestfs] Initial look at porting febootstrap to SuSE
I looked at OpenSUSE 11.3 (x86-64) and the 'zypper' package manager. Background ---------- libguestfs needs febootstrap to build the so-called supermin appliance. Since febootstrap 3.x, this requires porting febootstrap to each specific Linux package management system. We've already done this for yum (Fedora), apt (Debian/Ubuntu) and PacMan (ArchLinux). A port is reasonably simple, provided your package manager supports the following operations as *non-root*: (1) Given a list of package names, we must be able to resolve all packages that have to be installed (recursively) to satisfy all dependencies. Made up example: ["dmidecode"] -> ["dmidecode", "glibc", "glibc-common"] (2) Download a named package from the repository. (eg. in yum this corresponds to 'yumdownloader') (3) Unpack the package and/or list files in the package and/or extract file(s) from the package. (eg. in RPM this is 'rpm2cpio') SuSE ---- Zypper is quite a powerful package manager (based on a SAT solver). Unfortunately the basic "zypper" program doesn't appear to support any of (1), (2) or (3), and also most operations require root (eg. "zypper install --download-only [package...]" unnecessarily needs root). However it also has an enormous C++ library component (libzypp). [There are some language bindings for this too, but since they are generated from SWIG they are fairly useless.] http://gitorious.org/opensuse/libzypp There are only very trivial examples in the library so it's hard to be sure, but it appears that writing a dependency lister that runs as non-root in C++ (ie. problem (1)) shouldn't be a huge problem. Similarly there are some obscure code fragments in the git repo which lead me to believe that it would be possible to write a non-root package downloader in C++ (ie. problem (2)). Problem (3) is already solved because rpm2cpio & cpio exist on SuSE. Conclusion ---------- Someone motivated to add SuSE support to febootstrap and familiar with libzypp could write the necessary extra tools in C++ in a short time. To modify febootstrap, take one of the existing package management modules as a starting point. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora