Un parc à jour

Tags: , ,
No Comments »

Sur le “SuperPlan Mini” qui héberge désormais iMil.net, les services sont portés par des DomUs paravirtualisés Xen. Ces machines virtuelles fonctionnent avec les mêmes versions de noyau, d’espace utilisateur et surtout, de packages. Je ne partage pas via NFS l’espace utilisateur car je ne garantis pas la sécurité des applications hébergées sur l’une et l’autre des VMs (du php, beaucoup trop de php…).

Afin de simplifier la mise à jour des packages, j’utilise, devinez quoi: pkgin. Seulement voila, comme je l’expliquais quelques posts plus bas, j’ai besoin de spécifier certaines options à quelques packages, et de fait, je ne peux pas uniquement fonder mes mises à jour sur les paquets binaires fournis par le Projet NetBSD.
Dans l’exemple qui suit, on considèrera une machine “maître”, à qui revient la bonne gestion des packages et qui exporte son repertoire /usr/pkgsrc en NFS :

$ cat /etc/exports
/usr/pkgsrc  -alldirs -maproot=root -network 10.20.30.0 -mask 255.255.255.0
$ tail -3 /etc/rc.conf
rpcbind=yes
mountd=yes
nfs_server=yes

Voici la méthodologie que j’utilise pour le moment, pas trop fastidieuse mais tout de même pas d’une convivialité extrème :

  • Sur la machine maitre
  • Mise à jour des binaires sur la machine “maître” :
    # pkgin up && pkgin fug
    
  • Remplacement des packages “custom” (je pourrais le faire avec pkg_chk, ce serait probablement plus propre)
    # cd /usr/pkgsrc/chat/irssi && make replace clean
    
  • Regénération de tous les packages :
    # pkg_tarup -a -d /usr/pkgsrc/packages/All/ '*'
    
  • Préparation du pkg_summary :
    # cd /usr/pkgsrc/packages/All/
    # pkg_info -X * |bzip2 -c > pkg_summary.bz2
    
  • Sur les machines “slave”
  • Renseignement du repository local :
    $ cat /usr/pkg/etc/pkgin/repositories.conf
    file:///usr/pkgsrc/packages/All
    
  • Mise à jour de la base et des packages
    # pkgin up && pkgin fug
    

Et le tour est joué.

Maintenant, toi aussi tu peux zuipzuip !

Tags: , ,
2 Comments »

Et oui, ami des bureaux qui tournicottent, car on peut lire dans l’annonce officielle de pkgsrc-2009Q4 la phrase suivante :

the “Package of the Quarter” award is hereby awarded jointly to
clang, the compiler and lowlevel virtual machine infrastructure
nominated by Matthias Drochner, and to compiz, the compositing window
manager, nominated by iMil.

Parce que pour ne rien gâcher, c’est un package of the quarter :)

Ajoutons à cela le dernier post d’Hubert qui annonce :

Staying with driver games, iMil writes me that there’s documentation on getting DRI, AIGLX, Composite and Compiz going with NetBSD 5.0 available in the O(ther)NetBSD Wiki now.

The documentation covers how to enable the Direct Rendering Manager (DRI), setting up and configuring Modular X.org, assuring that everything’s in place, and how to get Compitz going. Mmm, wobbly windows at last! :-)

Je pense qu’on peut raisonnablement se dire qu’un bon petit pkgin in compiz compiz-fusion-plugins-main compiz-fusion-plugins-extra compizconfig-backend-gconf compiz-bcop ccsm suivi de la lecture de cette documentation devrait en ravir plus d’un.

Ah, et pour xorg-modular, c’est par ici.

Et maintenant, en vrai

Tags: , ,
4 Comments »

“T’es mignon iMil avec tes machins développés à 3 grammes, mais en vrai, c’est utilisable ?”

Mais si, je vous ai entendu penser ça tout fort.

Et en réponse à cet affront manifeste, voici une mise en place d’apache chrooté prêt à recevoir un Wordpress utilisant la machinerie présentée dans le post précédent :

[~/services] pwd
/home/imil/services
(root@korriban)
[~/services] cat etc/apache-chroot.conf
SETSDIR=/home/imil/binary/sets
SVCDIR=/home/imil/services/apache
CHROOTDIR=${SVCDIR}/chroot
# do not add a trailing slash in the following variable
SETSURL=ftp://ftp.fr.netbsd.org/pub/NetBSD/NetBSD-5.0.1/amd64/binary/sets
SETS="base xbase etc" # xbase required for apache (expat)
PREFIX="/usr/pkg"
PACKAGES="/home/imil/packages"
PKGLIST="sqlite3 pkgin perl apr apr-util apache xmlcatmgr libxml2 php php5-mysql libmm libmcrypt php5-mcrypt ap22-php5 ap22-rpaf php5-mbstring php5-zlib"
MOUNTS="/dev ${PACKAGES} /home/imilnet"
CPFILES="${SVCDIR}/root"
SERVICES="apache postfix"
PREFIX="/usr/pkg"

J’ai préparé les fichiers suivants, prêts à être copiés dans le chroot :

(root@korriban)
[~/services] find apache/root
apache/root
apache/root/etc
apache/root/etc/hosts
apache/root/etc/rc.conf
apache/root/etc/resolv.conf
apache/root/etc/postfix
apache/root/etc/postfix/main.cf
apache/root/usr
apache/root/usr/pkg
apache/root/usr/pkg/etc
apache/root/usr/pkg/etc/php.ini
apache/root/usr/pkg/etc/pkgin
apache/root/usr/pkg/etc/pkgin/repositories.conf
apache/root/usr/pkg/etc/httpd
apache/root/usr/pkg/etc/httpd/httpd.conf
apache/root/usr/pkg/etc/httpd/httpd-vhosts.conf

On n’oubliera evidemment pas de placer dans etc/rc.conf les valeurs suivantes :

(root@korriban)
[~/services] cat apache/root/etc/rc.conf
if [ -r /etc/defaults/rc.conf ]; then
        . /etc/defaults/rc.conf
fi

rc_configured=YES

apache=YES
postfix=YES

À noter que Wordpress considère qu’un MTA local est disponible, d’où la nénessité de démarrer postfix. La configuration de ce dernier est tout à fait basique: myhostname, mydomain, inet_interfaces (localhost) et surtout relayhost.

Le fichier php.ini est affublé des extensions nécessaires :

extension=mysql.so
extension=mcrypt.so
extension=mbstring.so
extension=zlib.so

Les fichiers httpd.conf et httpd-vhosts.conf sont à configurer selon vos besoins.

Dès lors :

(root@korriban)
[~/services] bin/mksvcchroot.sh create etc/apache-chroot.conf
/home/imil/services/apache/chroot-NetBSD-5.0.1
fetching binary sets... done
creating chroot... extracting: base xbase etc done
preparing packages...sqlite3 Creating binary package: sqlite3-3.6.17
Creating package /home/imil/packages/sqlite3-3.6.17
Using SrcDir value of /usr/pkg
pkgin Creating binary package: pkgin-0.2.5
Creating package /home/imil/packages/pkgin-0.2.5
Using SrcDir value of /usr/pkg
perl Creating binary package: perl-5.10.0nb6
Creating package /home/imil/packages/perl-5.10.0nb6
Using SrcDir value of /usr/pkg
apr Creating binary package: apr-1.3.9
Creating package /home/imil/packages/apr-1.3.9
Using SrcDir value of /usr/pkg
apr-util Creating binary package: apr-util-1.3.9
Creating package /home/imil/packages/apr-util-1.3.9
Using SrcDir value of /usr/pkg
apache Creating binary package: apache-2.2.13nb3
Creating package /home/imil/packages/apache-2.2.13nb3
Using SrcDir value of /usr/pkg
xmlcatmgr Creating binary package: xmlcatmgr-2.2nb1
Creating package /home/imil/packages/xmlcatmgr-2.2nb1
Using SrcDir value of /usr/pkg
libxml2 Creating binary package: libxml2-2.7.3nb1
Creating package /home/imil/packages/libxml2-2.7.3nb1
Using SrcDir value of /usr/pkg
php Creating binary package: php-5.2.12
Creating package /home/imil/packages/php-5.2.12
Using SrcDir value of /usr/pkg
php5-mysql Creating binary package: php5-mysql-5.2.12
Creating package /home/imil/packages/php5-mysql-5.2.12
Using SrcDir value of /usr/pkg
libmm Creating binary package: libmm-1.4.2nb1
Creating package /home/imil/packages/libmm-1.4.2nb1
Using SrcDir value of /usr/pkg
libmcrypt Creating binary package: libmcrypt-2.5.8
Creating package /home/imil/packages/libmcrypt-2.5.8
Using SrcDir value of /usr/pkg
php5-mcrypt Creating binary package: php5-mcrypt-5.2.12
Creating package /home/imil/packages/php5-mcrypt-5.2.12
Using SrcDir value of /usr/pkg
ap22-php5 Creating binary package: ap22-php5-5.2.12nb1
Creating package /home/imil/packages/ap22-php5-5.2.12nb1
Using SrcDir value of /usr/pkg
ap22-rpaf Creating binary package: ap22-rpaf-0.5
Creating package /home/imil/packages/ap22-rpaf-0.5
Using SrcDir value of /usr/pkg
php5-mbstring Creating binary package: php5-mbstring-5.2.12
Creating package /home/imil/packages/php5-mbstring-5.2.12
Using SrcDir value of /usr/pkg
php5-zlib Creating binary package: php5-zlib-5.2.12nb1
Creating package /home/imil/packages/php5-zlib-5.2.12nb1
Using SrcDir value of /usr/pkg
done
null-mounting... /dev /home/imil/packages /home/imilnet done
installing packages... sqlite3 pkgin Executing '/bin/mkdir -p '/usr/pkg'/etc/pkgin'
pkgin-0.2.5: copying /usr/pkg/share/examples/pkgin/repositories.conf.example to /usr/pkg/etc/pkgin/repositories.conf
===========================================================================
$NetBSD: MESSAGE,v 1.1.1.1 2009/06/08 13:58:26 imil Exp $

First steps before using pkgin.

. Modify /usr/pkg/etc/pkgin/repositories.conf to suit your platform
. Initialize the database :

        # pkgin update

===========================================================================
perl apr apr-util apache apache-2.2.13nb3: Creating group ``www''
apache-2.2.13nb3: Creating user ``www''
useradd: Warning: home directory `/nonexistent' doesn't exist, and -m was not specified
apache-2.2.13nb3: copying /usr/pkg/share/examples/httpd/extra/httpd-autoindex.conf to /usr/pkg/etc/httpd/httpd-autoindex.conf
apache-2.2.13nb3: copying /usr/pkg/share/examples/httpd/extra/httpd-dav.conf to /usr/pkg/etc/httpd/httpd-dav.conf
apache-2.2.13nb3: copying /usr/pkg/share/examples/httpd/extra/httpd-default.conf to /usr/pkg/etc/httpd/httpd-default.conf
apache-2.2.13nb3: copying /usr/pkg/share/examples/httpd/extra/httpd-info.conf to /usr/pkg/etc/httpd/httpd-info.conf
apache-2.2.13nb3: copying /usr/pkg/share/examples/httpd/extra/httpd-languages.conf to /usr/pkg/etc/httpd/httpd-languages.conf
apache-2.2.13nb3: copying /usr/pkg/share/examples/httpd/extra/httpd-manual.conf to /usr/pkg/etc/httpd/httpd-manual.conf
apache-2.2.13nb3: copying /usr/pkg/share/examples/httpd/extra/httpd-mpm.conf to /usr/pkg/etc/httpd/httpd-mpm.conf
apache-2.2.13nb3: copying /usr/pkg/share/examples/httpd/extra/httpd-multilang-errordoc.conf to /usr/pkg/etc/httpd/httpd-multilang-errordoc.conf
apache-2.2.13nb3: copying /usr/pkg/share/examples/httpd/extra/httpd-ssl.conf to /usr/pkg/etc/httpd/httpd-ssl.conf
apache-2.2.13nb3: copying /usr/pkg/share/examples/httpd/extra/httpd-userdir.conf to /usr/pkg/etc/httpd/httpd-userdir.conf
apache-2.2.13nb3: copying /usr/pkg/share/examples/httpd/extra/httpd-vhosts.conf to /usr/pkg/etc/httpd/httpd-vhosts.conf
apache-2.2.13nb3: copying /usr/pkg/share/examples/httpd/httpd.conf to /usr/pkg/etc/httpd/httpd.conf
apache-2.2.13nb3: copying /usr/pkg/share/examples/httpd/magic to /usr/pkg/etc/httpd/magic
apache-2.2.13nb3: copying /usr/pkg/share/examples/httpd/mime.types to /usr/pkg/etc/httpd/mime.types
===========================================================================
The following files should be created for apache-2.2.13nb3:

        /etc/rc.d/apache (m=0755)
            [/usr/pkg/share/examples/rc.d/apache]

===========================================================================
xmlcatmgr xmlcatmgr-2.2nb1: copying /usr/pkg/share/examples/xmlcatmgr/catalog.etc.sgml to /usr/pkg/etc/sgml/catalog
xmlcatmgr-2.2nb1: copying /usr/pkg/share/examples/xmlcatmgr/catalog.etc.xml to /usr/pkg/etc/xml/catalog
xmlcatmgr-2.2nb1: copying /usr/pkg/share/examples/xmlcatmgr/catalog.share.sgml to /usr/pkg/share/sgml/catalog
xmlcatmgr-2.2nb1: copying /usr/pkg/share/examples/xmlcatmgr/catalog.share.xml to /usr/pkg/share/xml/catalog
===========================================================================
$NetBSD: MESSAGE,v 1.5 2004/01/23 17:12:16 jmmv Exp $

The following catalogs have been installed:

        * /usr/pkg/etc/sgml/catalog
          System wide SGML catalog.  Can be edited by the administrator and
          is not changed by packages.  This is the *default* catalog when
          working in SGML mode.

        * /usr/pkg/etc/xml/catalog
          System wide XML catalog.  Can be edited by the administrator and
          is not changed by packages.  This is the *default* catalog when
          working in XML mode.

        * /usr/pkg/share/sgml/catalog
          Handles SGML stuff installed under /usr/pkg/share/sgml.
          Automatically handled by packages.

        * /usr/pkg/share/xml/catalog
          Handles XML stuff installed under /usr/pkg/share/xml.
          Automatically handled by packages.

===========================================================================
libxml2 php php-5.2.11: copying /usr/pkg/share/examples/php/php.ini-recommended to /usr/pkg/etc/php.ini
===========================================================================
$NetBSD: MESSAGE,v 1.9 2007/10/09 19:19:10 martti Exp $

To process PHP scripts, you will need a PHP-enabled HTTP server.  You may
either configure the HTTP server to use the PHP CGI binary located in

        /usr/pkg/libexec/cgi-bin/php

or you may install a PHP module for your HTTP server, e.g. www/ap-php.

Note that php-openssl is no longer a separate package as of version
5.0.5nb1 because the main PHP5 package has it built-in now.

As of version 5.2.1nb3 PEAR is no longer installed by default with the
php package.  In order to use PEAR packages with PHP you will need to
install the lang/pear package.
===========================================================================
pkg_add: A different version of php-5.2.12 is already installed: php-5.2.11
pkg_add: 1 package addition failed
php5-mysql ===========================================================================
$NetBSD: MESSAGE,v 1.1.1.1 2005/10/31 09:21:40 xtraeme Exp $

To use the ``mysqlhotcopy'' script, you'll have to install the following
packages:

        databases/p5-DBD-mysql
        devel/p5-File-Temp

===========================================================================
===========================================================================
$NetBSD: MESSAGE.module,v 1.2 2004/11/05 21:50:11 jdolecek Exp $

To enable this module, add the following to /usr/pkg/etc/php.ini:

    extension=mysql.so

and make sure extension_dir points to the dir where mysql.so is.

Then restart your PHP5-enabled HTTP server to load this module.
===========================================================================
libmm libmcrypt php5-mcrypt ===========================================================================
$NetBSD: MESSAGE.module,v 1.2 2004/11/05 21:50:11 jdolecek Exp $

To enable this module, add the following to /usr/pkg/etc/php.ini:

    extension=mcrypt.so

and make sure extension_dir points to the dir where mcrypt.so is.

Then restart your PHP5-enabled HTTP server to load this module.
===========================================================================
ap22-php5 ===========================================================================
$NetBSD: MESSAGE,v 1.2 2005/03/30 03:25:00 darcy Exp $

In order to use this module in your Apache 1.x installation, you need to
add the following to your httpd.conf file:

  LoadModule php5_module lib/httpd/mod_php5.so
  AddType application/x-httpd-php .php

You may also add following if you still use .php3 files:

  AddType application/x-httpd-php .php3

For Apache 2.x installation, you need following:

  LoadModule php5_module lib/httpd/mod_php5.so
  AddHandler application/x-httpd-php .php

You may also add following if you still use .php3 files:

  AddHandler application/x-httpd-php .php3

===========================================================================
ap22-rpaf php5-mbstring ===========================================================================
$NetBSD: MESSAGE.module,v 1.2 2004/11/05 21:50:11 jdolecek Exp $

To enable this module, add the following to /usr/pkg/etc/php.ini:

    extension=mbstring.so

and make sure extension_dir points to the dir where mbstring.so is.

Then restart your PHP5-enabled HTTP server to load this module.
===========================================================================
php5-zlib ===========================================================================
$NetBSD: MESSAGE.module,v 1.2 2004/11/05 21:50:11 jdolecek Exp $

To enable this module, add the following to /usr/pkg/etc/php.ini:

    extension=zlib.so

and make sure extension_dir points to the dir where zlib.so is.

Then restart your PHP5-enabled HTTP server to load this module.
===========================================================================
done
copying files... done
copying services scripts...cp: /usr/pkg/share/examples/rc.d/postfix: No such file or directory
done
starting services...Starting apache.
postfix: rebuilding /etc/mail/aliases (missing /etc/mail/aliases.db)
postfix/postfix-script: starting the Postfix mail system
done

Notre apache est prêt à répondre aux requetes.

Vous n’aurez pas manqué de remarquer que j’ai ajouté pkgin aux packages à installer dans le chroot, ce qui nous permettra de maintenir ce dernier de cette façon :

(imil@korriban)
[~] sudo chroot services/apache/chroot-NetBSD-5.0.1 /bin/ksh
# pkgin up
processing local summary...
updating database: 100%
downloading pkg_summary.bz2: 100%
processing remote summary (ftp://ftp.fr.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/5.0/All)...
updating database: 100%
# pkgin fug
calculating dependencies for ap22-php5-5.2.12nb1...
calculating dependencies for ap22-rpaf-0.5...
calculating dependencies for apache-2.2.14...
calculating dependencies for apr-1.3.9...
calculating dependencies for apr-util-1.3.9...
calculating dependencies for libmcrypt-2.5.8...
calculating dependencies for libmm-1.4.2nb1...
calculating dependencies for libxml2-2.7.6...
calculating dependencies for mysql-client-5.0.88...
calculating dependencies for perl-5.10.1...
calculating dependencies for php-5.2.12...
calculating dependencies for php5-mbstring-5.2.12...
calculating dependencies for php5-mcrypt-5.2.12...
calculating dependencies for php5-mysql-5.2.12...
calculating dependencies for php5-zlib-5.2.12nb1...
calculating dependencies for pkgin-0.2.5...
calculating dependencies for sqlite3-3.6.21nb1...
calculating dependencies for xmlcatmgr-2.2nb1...
5 packages to be upgraded: sqlite3-3.6.17 apache-2.2.13nb3 perl-5.10.0nb6 php-5.2.11 libxml2-2.7.3nb1
5 packages to be installed: libxml2-2.7.6 perl-5.10.1 php-5.2.12 apache-2.2.14 sqlite3-3.6.21nb1 (23M to download, 86M to install)
proceed ? [y/N] y
downloading packages...
downloading libxml2-2.7.6.tgz: 100%
downloading perl-5.10.1.tgz: 100%
downloading php-5.2.12.tgz: 100%
downloading apache-2.2.14.tgz: 100%
downloading sqlite3-3.6.21nb1.tgz: 100%
removing packages to be upgraded...
removing sqlite3-3.6.17...
Package `sqlite3-3.6.17' is still required by other packages:
        pkgin-0.2.5
removing apache-2.2.13nb3...
Package `apache-2.2.13nb3' is still required by other packages:
        ap22-php5-5.2.12nb1
        ap22-rpaf-0.5
pkg_delete: Directory `/usr/pkg/share/httpd/manual/style/xsl' disappeared, skipping
===========================================================================
The following users are no longer being used by apache-2.2.13nb3,
and they can be removed if no other software is using them:

        www

===========================================================================
===========================================================================
The following groups are no longer being used by apache-2.2.13nb3,
and they can be removed if no other software is using them:

        www

===========================================================================
===========================================================================
The following files are no longer being used by apache-2.2.13nb3,
and they can be removed if no other packages are using them:

        /usr/pkg/etc/httpd/httpd.conf
        /usr/pkg/etc/httpd/httpd-vhosts.conf
        /etc/rc.d/apache

===========================================================================
===========================================================================
The following directories are no longer being used by apache-2.2.13nb3,
and they can be removed if no other packages are using them:

        /var/log/httpd

===========================================================================
removing perl-5.10.0nb6...
Package `perl-5.10.0nb6' is still required by other packages:
        mysql-client-5.0.88
removing php-5.2.11...
Package `php-5.2.11' is still required by other packages:
        php5-mysql-5.2.12
        php5-mcrypt-5.2.12
        ap22-php5-5.2.12nb1
        php5-mbstring-5.2.12
        php5-zlib-5.2.12nb1
===========================================================================
The following files are no longer being used by php-5.2.11,
and they can be removed if no other packages are using them:

        /usr/pkg/etc/php.ini

===========================================================================
===========================================================================
The following directories are no longer being used by php-5.2.11,
and they can be removed if no other packages are using them:

        /usr/pkg/lib/php/20040412

===========================================================================
removing libxml2-2.7.3nb1...
Package `libxml2-2.7.3nb1' is still required by other packages:
        ap22-php5-5.2.12nb1
installing packages...
installing libxml2-2.7.6...
installing perl-5.10.1...
installing php-5.2.12...
php-5.2.12: /usr/pkg/etc/php.ini already exists
===========================================================================
$NetBSD: MESSAGE,v 1.9 2007/10/09 19:19:10 martti Exp $

To process PHP scripts, you will need a PHP-enabled HTTP server.  You may
either configure the HTTP server to use the PHP CGI binary located in

        /usr/pkg/libexec/cgi-bin/php

or you may install a PHP module for your HTTP server, e.g. www/ap-php.

Note that php-openssl is no longer a separate package as of version
5.0.5nb1 because the main PHP5 package has it built-in now.

As of version 5.2.1nb3 PEAR is no longer installed by default with the
php package.  In order to use PEAR packages with PHP you will need to
install the lang/pear package.
===========================================================================
installing apache-2.2.14...
apache-2.2.14: copying /usr/pkg/share/examples/httpd/extra/httpd-autoindex.conf to /usr/pkg/etc/httpd/httpd-autoindex.conf
apache-2.2.14: copying /usr/pkg/share/examples/httpd/extra/httpd-dav.conf to /usr/pkg/etc/httpd/httpd-dav.conf
apache-2.2.14: copying /usr/pkg/share/examples/httpd/extra/httpd-default.conf to /usr/pkg/etc/httpd/httpd-default.conf
apache-2.2.14: copying /usr/pkg/share/examples/httpd/extra/httpd-info.conf to /usr/pkg/etc/httpd/httpd-info.conf
apache-2.2.14: copying /usr/pkg/share/examples/httpd/extra/httpd-languages.conf to /usr/pkg/etc/httpd/httpd-languages.conf
apache-2.2.14: copying /usr/pkg/share/examples/httpd/extra/httpd-manual.conf to /usr/pkg/etc/httpd/httpd-manual.conf
apache-2.2.14: copying /usr/pkg/share/examples/httpd/extra/httpd-mpm.conf to /usr/pkg/etc/httpd/httpd-mpm.conf
apache-2.2.14: copying /usr/pkg/share/examples/httpd/extra/httpd-multilang-errordoc.conf to /usr/pkg/etc/httpd/httpd-multilang-errordoc.conf
apache-2.2.14: copying /usr/pkg/share/examples/httpd/extra/httpd-ssl.conf to /usr/pkg/etc/httpd/httpd-ssl.conf
apache-2.2.14: copying /usr/pkg/share/examples/httpd/extra/httpd-userdir.conf to /usr/pkg/etc/httpd/httpd-userdir.conf
apache-2.2.14: /usr/pkg/etc/httpd/httpd-vhosts.conf already exists
apache-2.2.14: /usr/pkg/etc/httpd/httpd.conf already exists
apache-2.2.14: copying /usr/pkg/share/examples/httpd/magic to /usr/pkg/etc/httpd/magic
apache-2.2.14: copying /usr/pkg/share/examples/httpd/mime.types to /usr/pkg/etc/httpd/mime.types
===========================================================================
The following files are used by apache-2.2.14 and have
the wrong ownership and/or permissions:

        /etc/rc.d/apache (m=0755)

===========================================================================
installing sqlite3-3.6.21nb1...
processing local summary...
updating database: 100%
marking php5-zlib-5.2.12nb1 as non auto-removeable
marking php5-mbstring-5.2.12 as non auto-removeable
marking ap22-rpaf-0.5 as non auto-removeable
marking ap22-php5-5.2.12nb1 as non auto-removeable
marking php5-mcrypt-5.2.12 as non auto-removeable
marking libmcrypt-2.5.8 as non auto-removeable
marking libmm-1.4.2nb1 as non auto-removeable
marking php5-mysql-5.2.12 as non auto-removeable
marking php-5.2.12 as non auto-removeable
marking libxml2-2.7.6 as non auto-removeable
marking xmlcatmgr-2.2nb1 as non auto-removeable
marking apache-2.2.14 as non auto-removeable
marking apr-util-1.3.9 as non auto-removeable
marking apr-1.3.9 as non auto-removeable
marking perl-5.10.1 as non auto-removeable
marking pkgin-0.2.5 as non auto-removeable
marking sqlite3-3.6.21nb1 as non auto-removeable

Et là j’ai envie de dire: “ça claque ou bien ?”

Petits portages entre amis

Tags: ,
2 Comments »

Comme le diraient aussi bien Jean-Pierre Pernaut que Jean-Louis du bistrot-d’en-bas: “Et pour bien commencer l’année !”

[imil@temple ~/src/pkgin]$ ./pkgin -v
pkgin 0.3.2 for SunOS-5.10 i386

Suivi de près d’un

kamino:pkgin imil$ ./pkgin -v
pkgin 0.3.2 for Darwin-9.5.0 i386

Ou encore: pkgin compile et fonctionne désormais OOtB sous Solaris 10 et Mac OS X.

Alors ouais j’vous vois v’nir “oooh l’auuut’, y’nous r’fait l’coup du SunOS, l’arnaque”. Oui sauf que non. Il s’agit ici de Solaris 10, non d’OpenSolaris, et la nuance est de taille. En l’occurrence, en plus de quelques petits ajustements de code, vous noterez que le ld(1) fourni avec Solaris 10 ne supporte pas l’option -rpath, mais utilise plutot -R, les deux ayant la même finalité, ajouter des chemins de recherche de linkage.

J’ai résolu ce vilain conflit à l’aide de mon fâmeux configure.ac :

[...]
dnl permet d'obtenir plusieurs variables relatives à l'hôte
AC_CANONICAL_HOST
[...]
dnl simple case
case $host_os in
        sunos* | solaris*)
                RPATH="-Wl,-R"
                ;;
        *)
                RPATH="-Wl,-rpath"
                ;;
esac
dnl on demande la substitution dans le Makefile.in
AC_SUBST(RPATH)
[...]

Sans oublier de mettre à jour le Makefile.in afin de “variabiliser” -rpath / -R :

LDADD+=         -L${LOCALBASE}/lib @RPATH@,${LOCALBASE}/lib     \
                -lbz2 -lz -ltermcap -larchive @LIBS@

Vous trouverez l’ensemble du code sur le CVS de pkgin dont je vous encourage à tester le fonctionnement avant son import dans la prochaine branche de pkgsrc.

t’as fait de l’autoQUOI ??

Tags: , ,
2 Comments »

Ceux qui me connaissent et qui ont lu le post précédent ont peut-être cru à l’imposture: “. Basculement vers autoconf pour la génération du Makefile”

iMil ? c’est bien toi ?

Oui alors attention hein, pas d’affolement. Il s’agit réellement d’une utilisation très très light de ces outils que j’évite habituellement comme la peste. Tellement light que seul autoconf m’a été utile.

Mais reprenons. Ceux qui ont eu le courage de se plonger dans le code de pkgin se rappellent peut-être de ce genre de choses :

.if ${OPSYS} != "Linux"
LDADD+=         -lssl
.endif
.if ${OPSYS} == "Darwin" || ${OPSYS} == "SunOS"
LDADD+=         -lcrypto
.endif
.if ${OPSYS} == "DragonFly"
LDADD+=         -lutil
.endif
.if ${OPSYS} == "SunOS" || ${OPSYS} == "Linux"
LDADD+=         -lnbcompat
.endif
.if ${OPSYS} == "SunOS"
LDADD+=         -lnsl -lsocket -lresolv
LDADD+=         -Wl,-R -Wl,${LOCALBASE}/lib -L${LOCALBASE}/lib -lsqlite3
.else
LDADD+=         -Wl,-rpath -Wl,${LOCALBASE}/lib -L${LOCALBASE}/lib -lsqlite3
.endif

etc etc etc…

Ces petites plaisanteries, c’est mignon lorsqu’on adresse une ou deux plateformes, mais à la longue, ça devient parfaitement inmaintebable. Et c’est là qu’intervient autoconf; plutot que de tester le système sur lequel nous oeuvrons puis déduire quelle librairie / header inclure, nous allons plutot tester l’existence de fonctions particulières au sein du système visé.

La première chose à faire, c’est d’utiliser la commande autoscan. Cette dernière créera un fichier configure.scan, soit une sorte de template destiné à devenir configure.ac. Dans ce template, des tests assez basiques sur l’existence de certains headers ou autres fonctions sont présents.

Exemple simple, la directive AC_CHECK_LIB permet de verifier si une fonction fait ou pas partie d’une librairie. Cette macro prend en premier paramètre le nom de la fonction recherchée, en second la librairie dans laquelle rechercher, le 3ème parametre permet d’affecter une action en cas de succès, le 4eme en cas d’échec et enfin le dernier d’ajouter des librairies au test. Fort heureusement, dans la plupart des cas, nous n’utiliserons pas plus de trois paramètres :

AC_SEARCH_LIBS([sqlite3_open], [sqlite3],,
        AC_MSG_ERROR(SQLite3 not found.)
)

Dans l’exemple ci-dessus, on verifie que la fonction sqlite3_open existe bien dans la librairie libsqlite3, si tel n’est pas le cas -en particulier si la librairie elle même n’est pas présente ou pas trouvée-, nous arrêterons le script de configuration et afficherons un message d’erreur.
Notez que la macro AC_SEARCH_LIBS aura pour effet, en cas de succès, d’ajouter à la variable LIBS la librairie testée.

Et c’est bien là tout l’intérêt de la chose, car ce que nous souhaitons, c’est bénéficier d’un fichier Makefile générique qui se remplira des librairies-dépendances. En l’occurrence, c’est le fameux Makefile.in qui remplit cette fonction. En effet, à l’issue du non moins fameux configure, le fichier Makefile.in est complété avec les variables détéctées et le résultat publié dans un Makefile classique.
La bonne nouvelle, c’est que le Makefile.in peut tout à fait être sous la forme d’un BSD Makefile.

Voici par exemple un LDADD qui serait totalement complété par autoconf :

LDADD+=	@LIBS@

Il y a des dizaines, des centaines, des milliers de tutoriaux sur les autotools un peu partout sur le web, mais à mon humble avis une bonne partie d'entre eux brillent par leur faculté à rendre ces outils aussi repoussants qu'imbuvables. Par chance, je suis tombé sur deux liens qui m'ont grandement aidé à comprendre ce que je faisais: le premier est un des configure.ac les mieux foutus qu’il m’ait été donné de voir, il s’agit de celui d’apachetop, et il est truffé de bons exemples.
le second ressemble à un slideware mais regroupe de manière synthetique des informations d’habitude noyées dans 500 pages de documentation soporifiques. On notera en particulier le slide 12 qui liste les principales variables substituées.

Un dernier exemple relatif à la substitution de variables :

# check for humanize_number
AC_CHECK_FUNC([humanize_number],,
        # in DragonFly humanize_number is in libutil
        AC_SEARCH_LIBS([humanize_number], [util],,
                # don't have it, include humanize_number.c to SRCS
                [SRCS="humanize_number.c $SRCS"]
        )
)
AC_SUBST(SRCS)

Celui-ci est un tout petit peu plus complexe. Dans l’ordre, nous vérifions si la fonction humanize_number est présente dans la libc, si oui, nous ne faisons rien, autrement (notez les deux virgules), nous cherchons dans la libutil qui heberge cette fonction sous DragonFly BSD. Finalement, si nous ne trouvons toujours pas cette fonction, nous ajoutons le fichier humanize_number.c à la variable SRCS.
Cette variable n’étant pas automatiquement remplacée dans le fichier Makefile.in, nous indiquons à autoconf qu’il devra effectuer cette substitution grace à la macro AC_SUBST.

Finalement, à l’issue de l’ecriture du configure.ac et du Makefile.in associé, nous invoquons autoconf qui génèrera un script configure. L’execution de ce dernier produira un Makefile adapté à votre plateforme cible.

Convenient isn’t it ?

pkgin 0.3.0 dans ton wip

Tags: , , , , ,
2 Comments »

Pkgin 0.3.0 voit -enfin- le jour. Pas de changements fondamentaux dans le code de gestion d’install/upgrade mais plutot une tripotée de petits fixes issus d’utilisateurs-hackers autour du globe. Dans le désordre :

. Basculement vers autoconf pour la génération du Makefile
. Correction du bug d’affichage en console
. Pas mal de fixes autour de la standardisation des variables
. Le lookup du pkg_summary en bz2 ou gz est désormais automatique
. Gros ménage des conditions pour opensolaris
. substitution de variables dans repositories.conf ($arch et $osrelease)
. De traditionnels bugfixes
. Portage -encore un peu hors des clous- pour SunOS 5.8

Le soft est disponible sur pkgsrc-wip et si aucune plainte n’apparait, je mettrai à jour pkgsrc.

À vos torture tests !

WP Theme & Icons based on GlossyBlue by N.Design Studio
Banner from www.trynthlas.com
Entries RSS Comments RSS Log in