package_config with boolean AND between classes (instead of OR)

Juergen Kahnert Juergen.Kahnert at DESY.de
Fri May 2 15:49:18 CEST 2008


Hi,

could we introduce a boolean AND between classes in package_config
files?

For example kernel packages depends on the architecture. So you could
use:

    package_config/I386:
    PACKAGES aptitude
    linux-image-2.6.18-6-686

    PACKAGES aptitude AFS
    openafs-modules-2.6.18-6-686

But if you like to install XEN kernels via "XEN" class on an i386
architecture you need something like this:

    package_config/XEN:
    PACKAGES aptitude
    linux-image-2.6.18-6-xen-686

    PACKAGES aptitude AFS
    openafs-modules-2.6.18-6-xen-686

But I386 is also defined, so you'll get all packages from both classes.
And what about other architecture (AMD64, ...) or even more distris like
Ubuntu feisty, gutsy, hardy also on more than one architecture? :-O


So I would like to use somthing like this:

    package_config/I386:
    PACKAGES aptitude !XEN
    linux-image-2.6.18-6-686

    PACKAGES aptitude AFS !XEN
    openafs-modules-2.6.18-6-686

    PACKAGES aptitude XEN
    linux-image-2.6.18-6-xen-686

    PACKAGES aptitude AFS !XEN
    openafs-modules-2.6.18-6-xen-686

And similar with AMD64 or others.


Is there any existing way to get such a behavior? If not, I propose to
add this patch (see attachment):

# diff -u install_packages.orig-3.2.4 install_packages
--- install_packages.orig-3.2.4 2008-05-02 14:58:20.000000000 +0200
+++ install_packages    2008-05-02 15:08:25.000000000 +0200
@@ -274,8 +274,15 @@
        # use packages on for a list of classes
        $doit = 0; # assume no class is defined
        @oclasses = split(/\s+/,$cllist);
-       # if a listed class is defined, add the packaes, otherwise skip these pa
-       foreach (@oclasses) { exists $classisdef{$_} and $doit = 1;}
+       # if all listed class are defined, add the packaes, otherwise skip these
+       foreach (@oclasses) {
+         if (/^!/) {
+           s/^!//;
+           not exists $classisdef{$_} and $doit = 1 or $doit = 0 or last;
+         }
+         else {
+           exists $classisdef{$_} and $doit = 1 or $doit = 0 or last;
+         }
       }
       next;
     }


Maybe it's better to use a complete set of boolean expressions: &, |, !, ()
But I could already work with this "AND-patch". ;)

Regards

    Jürgen Kahnert


-------------- nächster Teil --------------
Ein Dateianhang mit Bin?rdaten wurde abgetrennt...
Dateiname   : smime.p7s
Dateityp    : application/x-pkcs7-signature
Dateigr??e  : 1990 bytes
Beschreibung: nicht verf?gbar
URL         : http://lists.uni-koeln.de/pipermail/linux-fai-devel/attachments/20080502/a26d9e7a/attachment.bin 


More information about the linux-fai-devel mailing list