wok-stable rev 3440

Add slitaz-dev-tools (tazdev replace all scripts on tank)
author Christophe Lincoln <pankso@slitaz.org>
date Sun Jun 14 02:26:59 2009 +0200 (2009-06-14)
parents 13660dccc83b
children 79acaf03301f
files slitaz-dev-tools/receipt slitaz-dev-tools/stuff/README slitaz-dev-tools/stuff/tazdev slitaz-dev-tools/stuff/tazdev.conf
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/slitaz-dev-tools/receipt	Sun Jun 14 02:26:59 2009 +0200
     1.3 @@ -0,0 +1,18 @@
     1.4 +# SliTaz package receipt
     1.5 +
     1.6 +PACKAGE="slitaz-dev-tools"
     1.7 +VERSION="1.0"
     1.8 +CATEGORY="development"
     1.9 +SHORT_DESC="SliTaz developers and build host tools."
    1.10 +MAINTAINER="pankso@slitaz.org"
    1.11 +DEPENDS="tazwok"
    1.12 +WEB_SITE="http://www.slitaz.org/"
    1.13 +
    1.14 +# Rules to gen a SliTaz package suitable for Tazpkg.
    1.15 +genpkg_rules()
    1.16 +{
    1.17 +	mkdir -p $fs/etc/slitaz $fs/usr/bin
    1.18 +	cp stuff/tazdev $fs/usr/bin
    1.19 +	cp stuff/tazdev.conf $fs/etc/slitaz
    1.20 +	chown -R root.root $fs
    1.21 +}
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/slitaz-dev-tools/stuff/README	Sun Jun 14 02:26:59 2009 +0200
     2.3 @@ -0,0 +1,17 @@
     2.4 +SliTaz developers tools                                  http://www.slitaz.org/ 
     2.5 +===============================================================================
     2.6 +
     2.7 +
     2.8 +SliTaz developers and build host tools. This package provide tazdev utility and
     2.9 +tinyutils to help maintaining the distribution and automate packages compilation.
    2.10 +The package provide 'tazdev' and it defaut config file: /etc/slitaz/tazdev.conf
    2.11 +
    2.12 +
    2.13 +Website Devel corner:   http://www.slitaz.org/en/devel/
    2.14 +Mercurial repositories: http://hg.slitaz.org/
    2.15 +SliTaz Laboratories:    http://labs.slitaz.org/
    2.16 +Developers wiki:        http://labs.slitaz.org/wiki/distro
    2.17 +Build host:             http://tank.slitaz.org/
    2.18 +
    2.19 +
    2.20 +===============================================================================
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/slitaz-dev-tools/stuff/tazdev	Sun Jun 14 02:26:59 2009 +0200
     3.3 @@ -0,0 +1,133 @@
     3.4 +#!/bin/sh
     3.5 +# Tazdev - SliTaz developers and build host tool.
     3.6 +# System wide config file: /etc/slitaz/tazdev.conf
     3.7 +#
     3.8 +# (c) 2009 SliTaz GNU/Linux - GNU gpl v3
     3.9 +#
    3.10 +# Authors : Christophe Lincoln (Pankso) <pankso@slitaz.org>
    3.11 +#
    3.12 +
    3.13 +if [ -f /etc/slitaz/tazdev.conf ]; then
    3.14 +	. /etc/slitaz/tazdev.conf
    3.15 +elif [ -f $PWD/tazdev.conf ]; then
    3.16 +	. $PWD/tazdev.conf
    3.17 +else
    3.18 +	echo -e "\nNo config file found in /etc/slitaz or the current dir...\n"
    3.19 +	exit 0
    3.20 +fi
    3.21 +
    3.22 +usage()
    3.23 +{
    3.24 +	echo -e "\nSliTaz developers and build host tool\n
    3.25 +\033[1mUsage: \033[0m `basename $0` [command] [user] [stable|cooking]
    3.26 +\033[1mCommands: \033[0m\n
    3.27 +  usage      Print this short usage and command list.
    3.28 +  cmplog     Log 'tazwok cmp' result.
    3.29 +  update-wok Update Hg wok and copy it to the chroot wok.
    3.30 +  chroot     Mount virtual fs if needed and chroot into the build env.
    3.31 +  push       Upload new packages to the mirror.
    3.32 +  dry-push   Show what will be uploaded to the mirror. Do nothing.
    3.33 +  pull       Download new packages from the mirror.
    3.34 +  dry-pull   Show what will be downloaded from the mirror. Do nothing.\n"
    3.35 +}
    3.36 +
    3.37 +# Exit if user is not root.
    3.38 +check_root()
    3.39 +{
    3.40 +	if test $(id -u) != 0 ; then
    3.41 +	   echo -e "\nThis program requires being run as root.\n"
    3.42 +	   exit 0
    3.43 +	fi
    3.44 +}
    3.45 +
    3.46 +check_mirror()
    3.47 +{
    3.48 +	# ping -c 1 $MIRROR
    3.49 +	if [ -n "$2" ]; then
    3.50 +		USER=$2
    3.51 +	else
    3.52 +		echo -e "\nPlease specify a user.\n" && exit 0
    3.53 +	fi
    3.54 +	if [ "$3" = "stable" ]; then
    3.55 +		REMOTE_DIR=$MIRROR_DIR/stable/
    3.56 +		LOCAL_DIR=$STABLE/packages/
    3.57 +	else
    3.58 +		REMOTE_DIR=$MIRROR_DIR/cooking/
    3.59 +		LOCAL_DIR=$COOKING/packages/
    3.60 +	fi	
    3.61 +}
    3.62 +
    3.63 +case "$1" in
    3.64 +	cmplog)
    3.65 +		# Log 'tazwok cmp' for the web interface (can be used via a cron job).
    3.66 +		check_root
    3.67 +		tazwok cmp | grep ^[A-Z] | tee $CMP_LOG
    3.68 +		echo "Date: `date`" >> $CMP_LOG ;;
    3.69 +	update-wok)
    3.70 +		# Update the Hg wok and copy it to the chroot env. Hg wok id 
    3.71 +		# copied to the chroot wok to avoid messing with build result
    3.72 +		# file and so we can aslo modify receipt directly with affecting
    3.73 +		# the main Hg.
    3.74 +		check_root
    3.75 +		if [ "$2" = "stable" ]; then
    3.76 +			HG_WOK=$STABLE/wok
    3.77 +			CHROOT=$STABLE/chroot
    3.78 +		else
    3.79 +			HG_WOK=$COOKING/wok
    3.80 +			CHROOT_WOK=$COOKING/chroot/home/slitaz
    3.81 +		fi
    3.82 +		cd $HG_WOK
    3.83 +		hg pull && hg update
    3.84 +		echo -n "Copying Hg wok to the chroot... "
    3.85 +		cp -a $HG_WOK $CHROOT_WOK
    3.86 +		echo "Done" ;;
    3.87 +	chroot)
    3.88 +		# Chroot into a build env. Default to cookind configured in 
    3.89 +		# tazdev.conf
    3.90 +		check_root
    3.91 +		if [ "$1" = "stable" ]; then
    3.92 +			ROOTFS=$STABLE/chroot
    3.93 +		else
    3.94 +			ROOTFS=$COOKING/chroot
    3.95 +			[ -n "$1" ] && ROOTFS=$1
    3.96 +		fi
    3.97 +		# Mount virtual Kernel file systems and chroot but check that 
    3.98 +		# nobody else has done mounts
    3.99 +		if [ ! -d $ROOTFS/proc/1 ]; then
   3.100 +			mount -t proc proc $ROOTFS/proc
   3.101 +			mount -t sysfs sysfs $ROOTFS/sys
   3.102 +			mount -t devpts devpts $ROOTFS/dev/pts
   3.103 +			mount -t tmpfs shm $ROOTFS/dev/shm
   3.104 +		fi
   3.105 +		echo "Chrooting in $ROOTFS... "
   3.106 +		chroot $ROOTFS /bin/sh --login
   3.107 +		# Unmount virtual Kernel file systems on exit. and ensure we are the 
   3.108 +		# last user before unmounting !
   3.109 +		if [ "$(ps | grep $(basename $0) | grep -v grep | wc -l)" == "1" ]; then
   3.110 +			umount $ROOTFS/dev/shm
   3.111 +			umount $ROOTFS/dev/pts
   3.112 +			umount $ROOTFS/sys
   3.113 +			umount $ROOTFS/proc
   3.114 +		fi
   3.115 +		echo "Exiting of $ROOTFS chroot environment... " ;;
   3.116 +	push)
   3.117 +		check_mirror
   3.118 +		rsync -r -t -l -v -z --delete \
   3.119 +			$LOCAL_DIR -e ssh $USER@$HOST:$REMOTE_DIR ;;
   3.120 +	dry-push)
   3.121 +		check_mirror
   3.122 +		rsync -r -t -l -v -z --delete --dry-run \
   3.123 +			$LOCAL_DIR -e ssh $USER@$HOST:$REMOTE_DIR ;;
   3.124 +	pull)
   3.125 +		check_mirror
   3.126 +		rsync -r -t -l -v -z --delete \
   3.127 +			-e ssh $USER@$HOST:$REMOTE_DIR $LOCAL_DIR ;;
   3.128 +	dry-pull)
   3.129 +		check_mirror
   3.130 +		rsync -r -t -l -v -z --delete --dry-run \
   3.131 +			-e ssh $USER@$HOST:$REMOTE_DIR $LOCAL_DIR ;;
   3.132 +	usage|*)
   3.133 +		usage ;;
   3.134 +esac
   3.135 +
   3.136 +exit 0
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/slitaz-dev-tools/stuff/tazdev.conf	Sun Jun 14 02:26:59 2009 +0200
     4.3 @@ -0,0 +1,13 @@
     4.4 +# tazdev.conf: SliTaz Developers tool configuration file.
     4.5 +#
     4.6 +
     4.7 +# Path to 'tazwok cmp' log file.
     4.8 +CMP_LOG="/var/log/tazwok-cmp.log"
     4.9 +
    4.10 +# Path for the wok, chroot and packages directory of each version.
    4.11 +COOKING="/home/slitaz/cooking"
    4.12 +STABLE="/home/slitaz/stable"
    4.13 +
    4.14 +# Main mirror settings.
    4.15 +MIRROR="mirror.slitaz.org"
    4.16 +MIRROR_DIR="/var/www/slitaz/mirror/packages"