tazwok rev 22

Support for generic files copy (locale, pixmaps and .desktop)
author Christophe Lincoln <pankso@slitaz.org>
date Sat Feb 02 13:34:06 2008 +0100 (2008-02-02)
parents 6d82a9b36e5a
children 7750c6c6a4d4
files doc/developer.txt examples/receipt examples/tazwok.conf tazwok
line diff
     1.1 --- a/doc/developer.txt	Wed Jan 30 13:43:14 2008 +0100
     1.2 +++ b/doc/developer.txt	Sat Feb 02 13:34:06 2008 +0100
     1.3 @@ -16,8 +16,8 @@
     1.4  à télécharger, désarchiver, compiler et générer le paquet binaire. Pour
     1.5  fonctionner, Tazwok a aussi besoin d'un répertoire pour stocker les sources
     1.6  téléchargées ($SOURCES_REPOSITORY) et d'un répertoire pour les paquets générés
     1.7 -($PACKAGES_REPOSITORY). Taz utilise un fichier de configuration (tazwok.conf),
     1.8 -ce fichier peut se trouver dans /etc ou dans le répertoire courant.
     1.9 +($PACKAGES_REPOSITORY), ces valeurs peuvent être configurées via le fichier :
    1.10 +/etc/tazwok.conf.
    1.11  
    1.12  
    1.13  Coding style
    1.14 @@ -26,7 +26,7 @@
    1.15  est le SHell par défaut sur SliTaz. Le code est identé avec des tabulations,
    1.16  cela donne un script plus léger (en terme de octect). Les commentaires se
    1.17  mettent en English et devraient aider a s'y retouver. On peut créer de
    1.18 -nouvelles fonctions si nécessaire et ajouter des commandes qu'il faut tout
    1.19 +nouvelles fonctions si nécessaire et ajouter des commandes qu'il faut et tout
    1.20  de suite documenter (voir même avant pour en discuter sur la liste).
    1.21  
    1.22  
    1.23 @@ -34,7 +34,7 @@
    1.24  ---------------------
    1.25  Si vous découvez un bug dans le code, ou des commandes qui pourraient être
    1.26  plus courtes et mieux pensées, n'hésitez pas à vous inscrire sur la liste de
    1.27 -SliTaz ou à envoyer directemnt un mail au mainteneur actuel de Tazwok (voir
    1.28 +SliTaz ou à envoyer directement un mail au mainteneur actuel de Tazwok (voir
    1.29  le fichier AUTHORS contenu dans les sources).
    1.30  
    1.31  
    1.32 @@ -52,21 +52,16 @@
    1.33  génération des paquets. Le wok principalement utilisé est celui de la version
    1.34  Cooking (en cuisson), il contient les dernières recettes et fichiers. Pour
    1.35  installer un wok, on peut télécharger l'archive, désarchiver et configurer
    1.36 -Tazwok pour qu'il trouve les fichiers du wok. Exemple :
    1.37 +Tazwok pour qu'il trouve les fichiers du wok ou cloner le dépôt Mercurial.
    1.38 +Toute les infos d'utilisation du wok sont décrites sur la page Forge du site :
    1.39  
    1.40 - # cd /home/slitaz
    1.41 - # wget http://download.tuxfamily.org/slitaz/wok/cooking-wok.tar.gz
    1.42 - # tar xzf cooking-wok.tar.gz
    1.43 -
    1.44 -Configurer Tazwok pour lister les paquet disponibles :
    1.45 -
    1.46 - # tazwok list
    1.47 +    http://www.slitaz.org/devel/forge.html
    1.48  
    1.49  
    1.50  Cooklists - Liste de cuisson
    1.51  ----------------------------
    1.52 -Pour compiler une plusieurs paquets en une seule commande, on peut utiliser
    1.53 -des liste de paquets. Il y a des listes exemples dans le répertoire examples/
    1.54 +Pour compiler plusieurs paquets en une seule commande, on peut utiliser des 
    1.55 +listes de cuisson. Il y a des listes exemples dans le répertoire examples/
    1.56  de cette archive et dans le répertoire /usr/share/examples/tazwok/cooklists
    1.57  sur SliTaz.
    1.58  
     2.1 --- a/examples/receipt	Wed Jan 30 13:43:14 2008 +0100
     2.2 +++ b/examples/receipt	Sat Feb 02 13:34:06 2008 +0100
     2.3 @@ -2,19 +2,22 @@
     2.4  
     2.5  PACKAGE="bc"
     2.6  VERSION="1.06"
     2.7 -CATEGORY="base-apps"
     2.8 +CATEGORY="utilities"
     2.9  SHORT_DESC="Bc is a cmdline calculator."
    2.10 -MAINTAINER="pankso@slitaz.org"
    2.11 +MAINTAINER="name@example.org"
    2.12  TARBALL="$PACKAGE-$VERSION.tar.gz"
    2.13  WEB_SITE="http://www.gnu.org/software/bc/"
    2.14 -WGET_URL="http://ftp.gnu.org/pub/gnu/bc/$TARBALL"
    2.15 +WGET_URL="$GNU_MIRROR/$PACKAGE/$TARBALL"
    2.16  
    2.17  # Rules to configure and make the package.
    2.18  compile_rules()
    2.19  {
    2.20      cd $src
    2.21 -    ./configure --prefix=/usr --infodir=/usr/share/info \
    2.22 -    --mandir=/usr/share/man $CONFIGURE_ARGS
    2.23 +    ./configure \
    2.24 +    	--prefix=/usr \
    2.25 +    	--infodir=/usr/share/info \
    2.26 +    	--mandir=/usr/share/man \
    2.27 +    	$CONFIGURE_ARGS
    2.28      make
    2.29      make DESTDIR=$PWD/_pkg install
    2.30  }
    2.31 @@ -22,7 +25,7 @@
    2.32  # Rules to gen a SliTaz package suitable for Tazpkg.
    2.33  genpkg_rules()
    2.34  {
    2.35 -    mkdir -p $fs/usr/bin
    2.36 -    cp -a $_pkg/usr/bin/* $fs/usr/bin
    2.37 +    mkdir -p $fs/usr
    2.38 +    cp -a $_pkg/usr/bin $fs/usr
    2.39      strip -s $fs/usr/bin/*
    2.40  }
     3.1 --- a/examples/tazwok.conf	Wed Jan 30 13:43:14 2008 +0100
     3.2 +++ b/examples/tazwok.conf	Sat Feb 02 13:34:06 2008 +0100
     3.3 @@ -15,10 +15,17 @@
     3.4  # Default arguments for GNU configure.
     3.5  CONFIGURE_ARGS="--build=i486-pc-linux-gnu --host=i486-pc-linux-gnu"
     3.6  
     3.7 +# Translation files to include in packages, note that you can specifiy
     3.8 +# several locale.
     3.9 +LOCALE="fr"
    3.10 +
    3.11  # Mirrors URLs. To downloads source next from your location.
    3.12  # GNU mirror :
    3.13 +#
    3.14  GNU_MIRROR="ftp://sunsite.cnlab-switch.ch/mirror/gnu"
    3.15  # SourceForge mirror :
    3.16 +#
    3.17  SF_MIRROR="http://switch.dl.sourceforge.net/sourceforge"
    3.18  # Xorg mirror :
    3.19 +#
    3.20  XORG_MIRROR="ftp://ftp.solnet.ch/mirror/x.org/pub/X11R7.3/src"
     4.1 --- a/tazwok	Wed Jan 30 13:43:14 2008 +0100
     4.2 +++ b/tazwok	Sat Feb 02 13:34:06 2008 +0100
     4.3 @@ -8,7 +8,7 @@
     4.4  #
     4.5  # (C) 2007-2008 SliTaz - GNU General Public License.
     4.6  #
     4.7 -VERSION=1.3
     4.8 +VERSION=1.3.1
     4.9  
    4.10  ####################
    4.11  # Tazwok variables #
    4.12 @@ -272,6 +272,47 @@
    4.13  	fi
    4.14  }
    4.15  
    4.16 +# Copy all generic files (locale, pixmaps, .desktop). We use standard path,
    4.17 +# so some packages need to copy these files with the receipt and genpkg_rules.
    4.18 +# This function is executed by gen_package when 'tazwok genpkg'.
    4.19 +copy_generic_files()
    4.20 +{
    4.21 +	# In most case locale are in $_pkg/usr/share/locale so we copy files
    4.22 +	# using generic variables and $LOCALE from Tazwok config file.
    4.23 +	if [ ! "$LOCALE" = "" ]; then
    4.24 +		if [ -d "$_pkg/usr/share/locale" ]; then
    4.25 +			mkdir -p $fs/usr/share/locale
    4.26 +			for i in $LOCALE
    4.27 +			do
    4.28 +				cp -a $_pkg/usr/share/locale/$i \
    4.29 +					$fs/usr/share/locale 2>/dev/null
    4.30 +			done
    4.31 +		fi
    4.32 +	fi
    4.33 +	# Pixmaps. Some icons/images can be add trough genpkg_rules and
    4.34 +	# generic copy can be disable with GENERIC_PIXMAPS="no" in pkg receipt.
    4.35 +	if [ ! "$GENERIC_PIXMAPS" = "no" ]; then
    4.36 +		if [ -d "$_pkg/usr/share/pixmaps" ]; then
    4.37 +			mkdir -p $fs/usr/share/pixmaps
    4.38 +			cp -a $_pkg/usr/share/pixmaps/$PACKAGE.* \
    4.39 +				$fs/usr/share/pixmaps 2>/dev/null
    4.40 +			# Custom or home made PNG pixmap can be in stuff.
    4.41 +			if [ -f "stuff/$PACKAGE.png" ]; then
    4.42 +				cp -a stuff/$PACKAGE.png $fs/usr/share/pixmaps
    4.43 +			fi
    4.44 +		fi
    4.45 +	fi
    4.46 +	# Desktop entry (.desktop).
    4.47 +	if [ -d "$_pkg/usr/share/applications" ]; then
    4.48 +		cp -a $_pkg/usr/share/applications $fs/usr/share
    4.49 +		# Home made desktop file can be in stuff.
    4.50 +		if [ -f "stuff/$PACKAGE.desktop" ]; then
    4.51 +			mkdir -p $fs/usr/share/applications
    4.52 +			cp -a stuff/$PACKAGE.desktop $fs/usr/share/applications
    4.53 +		fi
    4.54 +	fi
    4.55 +}
    4.56 +
    4.57  # Creat a package tree and build the gziped cpio archive
    4.58  # to make a SliTaz (.tazpkg) package.
    4.59  gen_package()
    4.60 @@ -300,19 +341,20 @@
    4.61  		_pkg=$src/_pkg
    4.62  	fi
    4.63  	cd $WOK/$PACKAGE
    4.64 -	# Execute genpkg_rules to build the package.
    4.65 +	# Execute genpkg_rules and copy generic files to build the package.
    4.66  	echo ""
    4.67  	echo "Bulding $PACKAGE with the receipt..."
    4.68  	echo "================================================================================"
    4.69 -	if [ `cat $RECEIPT | grep genpkg_rules` ]; then
    4.70 +	if [ `cat $RECEIPT | grep ^genpkg_rules` ]; then
    4.71  		# Log process.
    4.72  		echo "executing genpkg_rules" >> $LOG
    4.73  		genpkg_rules
    4.74 +		copy_generic_files
    4.75  	else
    4.76  		echo "No package rules to gen $PACKAGE..."
    4.77 +		exit 1
    4.78  	fi
    4.79 -	# Copy the receipt and description (if exist) in
    4.80 -	# the binary package tree.
    4.81 +	# Copy the receipt and description (if exist) in the binary package tree.
    4.82  	cd $WOK/$PACKAGE
    4.83  	echo -n "Copying the receipt..."
    4.84  	cp receipt taz/$PACKAGE-$VERSION