wok rev 8832

slitaz-dev-tools is now a meta package
author Christophe Lincoln <pankso@slitaz.org>
date Thu Feb 24 16:15:12 2011 +0100 (2011-02-24)
parents ab1063270c2d
children 808826645cc2
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 --- a/slitaz-dev-tools/receipt	Thu Feb 24 16:10:32 2011 +0100
     1.2 +++ b/slitaz-dev-tools/receipt	Thu Feb 24 16:15:12 2011 +0100
     1.3 @@ -1,18 +1,15 @@
     1.4  # SliTaz package receipt
     1.5  
     1.6  PACKAGE="slitaz-dev-tools"
     1.7 -VERSION="1.2.1"
     1.8 -CATEGORY="development"
     1.9 -SHORT_DESC="SliTaz developers and build host tools."
    1.10 +VERSION="1.0"
    1.11 +CATEGORY="meta"
    1.12 +SHORT_DESC="SliTaz developers tools meta package."
    1.13  MAINTAINER="pankso@slitaz.org"
    1.14 -DEPENDS="rsync"
    1.15 +DEPENDS="rsync tazdev tazchroot libtaz tazwok mercurial"
    1.16  WEB_SITE="http://www.slitaz.org/"
    1.17  
    1.18  # Rules to gen a SliTaz package suitable for Tazpkg.
    1.19  genpkg_rules()
    1.20  {
    1.21 -	mkdir -p $fs/etc/slitaz $fs/usr/bin
    1.22 -	cp stuff/tazdev $fs/usr/bin
    1.23 -	cp stuff/tazdev.conf $fs/etc/slitaz
    1.24 -	chown -R root.root $fs
    1.25 +	mkdir -p $fs/usr
    1.26  }
     2.1 --- a/slitaz-dev-tools/stuff/README	Thu Feb 24 16:10:32 2011 +0100
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,18 +0,0 @@
     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 provides the tazdev utility 
     2.9 -and tinyutils to help maintain the distribution and automate packages compilation.
    2.10 -The package provides 'tazdev' and its default 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 -Build bot:              http://bb.slitaz.org/
    2.19 -
    2.20 -
    2.21 -===============================================================================
     3.1 --- a/slitaz-dev-tools/stuff/tazdev	Thu Feb 24 16:10:32 2011 +0100
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,356 +0,0 @@
     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 -	if [ -f $PWD/tazdev.conf ]; then
    3.16 -		. $PWD/tazdev.conf
    3.17 -	fi
    3.18 -else
    3.19 -	echo -e "\nNo config file found in /etc/slitaz or the current dir...\n"
    3.20 -	exit 0
    3.21 -fi
    3.22 -
    3.23 -usage()
    3.24 -{
    3.25 -	echo -e "\nSliTaz developers and build host tool\n
    3.26 -\033[1mUsage: \033[0m `basename $0` [command] [user] [stable|cooking|experimental|path]
    3.27 -\033[1mCommands: \033[0m\n
    3.28 - usage          Print this short usage and command list.
    3.29 - projects-stats Display statistics about your projects (-ps).
    3.30 - cmplog         Log 'tazwok cmp' result (or use tazbb).
    3.31 - update-wok     Update Hg wok and copy it to the chroot wok.
    3.32 - update-www     Update SliTaz Website repo from Hg.
    3.33 - chroot         Mount virtual fs if needed and chroot into the build env.
    3.34 - gen-chroot     Generate a chroot using the last cooking base rootfs.
    3.35 - clean-chroot   Clean a chroot environment (skip root/ and home/).
    3.36 - purge          Remove obsolete packages and obsolete source tarballs.
    3.37 - dry-purge      Show obsolete packages and obsolete source tarballs.
    3.38 - push           Upload new packages to the main mirror (-p).
    3.39 - dry-push       Show what will be uploaded to the mirror. Does nothing (-dp).
    3.40 - pull           Download new packages from the main mirror.
    3.41 - dry-pull       Show what will be downloaded from the mirror. Does nothing.
    3.42 - relpkg         Archive and upload new package/project version.\n"
    3.43 -}
    3.44 -
    3.45 -# Exit if user is not root.
    3.46 -check_root()
    3.47 -{
    3.48 -	if test $(id -u) != 0 ; then
    3.49 -	   echo -e "\nThis program requires being run as root.\n"
    3.50 -	   exit 0
    3.51 -	fi
    3.52 -}
    3.53 -
    3.54 -status()
    3.55 -{
    3.56 -	local CHECK=$?
    3.57 -	echo -en "\033[70G"
    3.58 -	if [ $CHECK = 0 ]; then
    3.59 -		echo "Done"
    3.60 -	else
    3.61 -		echo "Failed"
    3.62 -	fi
    3.63 -	return $CHECK
    3.64 -}
    3.65 -
    3.66 -get_version()
    3.67 -{
    3.68 -	if [ "$2" = "stable" ]; then
    3.69 -		VERSION=stable
    3.70 -		SLITAZ=$STABLE
    3.71 -	elif [ -n "$2" ]; then
    3.72 -		# Undigest - custom ?
    3.73 -		VERSION=$2
    3.74 -		SLITAZ=/home/slitaz/$2
    3.75 -	else
    3.76 -		VERSION=cooking
    3.77 -		SLITAZ=$COOKING
    3.78 -	fi
    3.79 -	ROOTFS=$SLITAZ/chroot
    3.80 -	HG_WOK=$SLITAZ/wok
    3.81 -	BUILD_WOK=$SLITAZ/chroot/home/slitaz/wok
    3.82 -}
    3.83 -
    3.84 -check_mirror()
    3.85 -{
    3.86 -	# ping -c 1 $MIRROR
    3.87 -	if [ -n "$2" ]; then
    3.88 -		USER=$2
    3.89 -	else
    3.90 -		USER=$USER
    3.91 -	fi
    3.92 -	if [ "$2" = "stable" ] || [ "$3" = "stable" ]; then
    3.93 -		REMOTE_DIR=$MIRROR_PKGS/stable/
    3.94 -		LOCAL_DIR=$STABLE/packages/
    3.95 -	elif [ "$2" = "experimental" ] || [ "$3" = "experimental" ]; then
    3.96 -		REMOTE_DIR=$MIRROR_PKGS/experimental/
    3.97 -		LOCAL_DIR=$EXPERIMENTAL/packages/
    3.98 -	else
    3.99 -		REMOTE_DIR=$MIRROR_PKGS/cooking/
   3.100 -		LOCAL_DIR=$COOKING/packages/
   3.101 -	fi
   3.102 -}
   3.103 -
   3.104 -# Mount virtual Kernel file systems and chroot but check that nobody
   3.105 -# else has done mounts
   3.106 -mount_chroot()
   3.107 -{
   3.108 -	if [ ! -d $ROOTFS/proc/1 ]; then
   3.109 -		echo -n "Mounting virtual filesystems..."
   3.110 -		mount -t proc proc $ROOTFS/proc
   3.111 -		mount -t sysfs sysfs $ROOTFS/sys
   3.112 -		mount -t devpts devpts $ROOTFS/dev/pts
   3.113 -		mount -t tmpfs shm $ROOTFS/dev/shm
   3.114 -		status
   3.115 -	fi
   3.116 -}
   3.117 -
   3.118 -# Unmount virtual Kernel file systems on exit and ensure we are the last
   3.119 -# user before unmounting !
   3.120 -umount_chroot()
   3.121 -{
   3.122 -	# Not working. Buggy ps ?
   3.123 -	#sleep 6
   3.124 -	ps=$(ps | grep `basename $0` | grep -v grep | wc -l)
   3.125 -	if [ "$ps" == "1" ]; then
   3.126 -		echo -ne "\Unmounting virtual filesystems..."
   3.127 -		umount $ROOTFS/dev/shm
   3.128 -		umount $ROOTFS/dev/pts
   3.129 -		umount $ROOTFS/sys
   3.130 -		umount $ROOTFS/proc
   3.131 -		status
   3.132 -	else
   3.133 -		echo -e "\nProcess: $ps\n"
   3.134 -		ps | grep `basename $0` | grep -v grep
   3.135 -		echo -e "\nLeaving virtual filesystems unmounted (`pidof tazdev`)...\n"
   3.136 -	fi
   3.137 -}
   3.138 -
   3.139 -# Get the last cooking base rootfs, extract and configure.
   3.140 -gen_new_chroot()
   3.141 -{
   3.142 -	echo -e "\nGenerating new chroot in : $ROOTFS"
   3.143 -	echo "================================================================================"
   3.144 -	mkdir -p $ROOTFS && cd $ROOTFS
   3.145 -	wget $DL_URL/boot/cooking/rootfs-base.gz
   3.146 -	echo -n "Extracting the rootfs..."
   3.147 -	lzma d rootfs-base.gz -so | cpio -id
   3.148 -	rm rootfs-base.gz
   3.149 -	echo -n "Creating resolv.conf..."
   3.150 -	cat /etc/resolv.conf > etc/resolv.conf
   3.151 -	status
   3.152 -	echo "================================================================================"
   3.153 -	echo -e "Ready to chroot. Use 'tazdev chroot [version|path]'"
   3.154 -	echo -e "Example: tazdev chroot $ROOTFS\n"
   3.155 -}
   3.156 -
   3.157 -# Remove obsolate slitaz packages
   3.158 -purge_packages()
   3.159 -{
   3.160 -	arg=$1
   3.161 -	TMP_FILE=/tmp/tazdev.$$
   3.162 -	ls $BUILD_WOK | while read pkg; do
   3.163 -		[ -f $BUILD_WOK/$pkg/taz/*/receipt ] || continue
   3.164 -		EXTRAVERSION=""
   3.165 -		. $BUILD_WOK/$pkg/taz/*/receipt
   3.166 -		echo $PACKAGE-$VERSION$EXTRAVERSION.tazpkg
   3.167 -	done > $TMP_FILE
   3.168 -	ls $SLITAZ/chroot/home/slitaz/packages | while read pkg; do
   3.169 -		case "$pkg" in
   3.170 -		*.tazpkg)
   3.171 -			grep -q ^$pkg$ $TMP_FILE && continue
   3.172 -			echo Remove $pkg
   3.173 -			[ "$arg" == "purge" ] &&
   3.174 -			rm -f $SLITAZ/chroot/home/slitaz/packages/$pkg ;;
   3.175 -		esac
   3.176 -	done
   3.177 -	rm -f $TMP_FILE
   3.178 -}
   3.179 -
   3.180 -# Remove obsolate source tarballs
   3.181 -purge_sources()
   3.182 -{
   3.183 -	arg=$1
   3.184 -	TMP_FILE=/tmp/tazdev.$$
   3.185 -	ls $BUILD_WOK | while read pkg; do
   3.186 -		[ -f $BUILD_WOK/$pkg/receipt ] || continue
   3.187 -		TARBALL=""
   3.188 -		. $BUILD_WOK/$pkg/receipt
   3.189 -		[ -n "$TARBALL" ] && echo $TARBALL
   3.190 -		grep SOURCES_REPOSITORY/ $BUILD_WOK/$pkg/receipt | sed \
   3.191 -		-e 's|.*SOURCES_REPOSITORY/\([^ ]*\)\( .*\)$|\1|' \
   3.192 -		-e 's|.*SOURCES_REPOSITORY/\([^ ]*\)$|\1|' | sort | uniq | \
   3.193 -		sed "s|['\"/]||g" | while read file ; do
   3.194 -			eval echo $file 2> /dev/null
   3.195 -		done
   3.196 -	done > $TMP_FILE
   3.197 -	ls $SLITAZ/chroot/home/slitaz/src | while read pkg; do
   3.198 -		grep -q ^$pkg$ $TMP_FILE && continue
   3.199 -		echo Remove $pkg
   3.200 -		[ "$arg" == "purge" ] &&
   3.201 -		rm -f $SLITAZ/chroot/home/slitaz/src/$pkg
   3.202 -	done
   3.203 -	rm -f $TMP_FILE
   3.204 -}
   3.205 -
   3.206 -case "$1" in
   3.207 -	cmplog)
   3.208 -		# Log 'tazwok cmp' for the web interface (can be used via a cron job).
   3.209 -		check_root
   3.210 -		echo -e "Starting 'tazwok cmp' (can be long)...\n"
   3.211 -		tazwok cmp | grep ^[A-Z] | tee $CMP_LOG
   3.212 -		echo "Date: `date`" >> $CMP_LOG ;;
   3.213 -	'-ps'|projects-stats)
   3.214 -		echo -e "\nStatistics for: $PROJECTS\n"
   3.215 -		echo -n "Project" && echo -ne "\033[24G Size" && echo -ne "\033[38G Revision"
   3.216 -		echo -ne "\033[48G Version" && echo -e "\033[64G Files"
   3.217 -		echo "================================================================================"
   3.218 -		cd $PROJECTS
   3.219 -		for proj in *
   3.220 -		do
   3.221 -			rev=""
   3.222 -			echo -n "$proj"
   3.223 -			size=`du -sh $proj | awk '{ print $1 }'`
   3.224 -			echo -ne "\033[24G $size"
   3.225 -			if [ -d $proj/.hg ]; then
   3.226 -				cd $proj
   3.227 -				rev=`hg head --template '{rev}\n'`
   3.228 -				vers=`hg tags | head -n 2 | tail -n 1 | cut -d " " -f 1`
   3.229 -				echo -ne "\033[38G $rev"
   3.230 -				echo -ne "\033[48G $vers" && cd ..
   3.231 -			fi
   3.232 -			files=`find $proj -type f | wc -l`
   3.233 -			echo -e "\033[64G $files"
   3.234 -		done
   3.235 -		echo "================================================================================"
   3.236 -		echo "" ;;
   3.237 -	update-wok)
   3.238 -		# Update the Hg wok and copy it to the chroot env. Hg wok is
   3.239 -		# copied to the chroot wok to avoid messing with build result
   3.240 -		# file and so we can also modify receipt directly without affecting
   3.241 -		# the Hg wok.
   3.242 -		check_root
   3.243 -		get_version $@
   3.244 -		echo ""
   3.245 -		echo "Hg wok    : $HG_WOK"
   3.246 -		echo "Build wok : $BUILD_WOK"
   3.247 -		cd $HG_WOK
   3.248 -		hg pull && hg update
   3.249 -		echo -n "Copying Hg wok to the build wok... "
   3.250 -		cp -a $HG_WOK/* $BUILD_WOK
   3.251 -		cp -a $HG_WOK/.hg $BUILD_WOK
   3.252 -		status && echo "" ;;
   3.253 -	update-www)
   3.254 -		# Update website from repo.
   3.255 -		echo ""
   3.256 -		cd $WEBSITE && hg pull && hg update
   3.257 -		echo "" ;;
   3.258 -	chroot)
   3.259 -		# Chroot into a build env. Default to cooking configured in
   3.260 -		# tazdev.conf
   3.261 -		check_root
   3.262 -		get_version $@
   3.263 -		mount_chroot
   3.264 -		echo -e "\nChrooting in $ROOTFS...\n"
   3.265 -		chroot $ROOTFS /bin/sh --login
   3.266 -		umount_chroot
   3.267 -		echo -e "Exiting $ROOTFS chroot environment...\n" ;;
   3.268 -	gen-chroot)
   3.269 -		check_root
   3.270 -		get_version $@
   3.271 -		# Dont break another env.
   3.272 -		if [ -d $ROOTFS/bin ]; then
   3.273 -			echo -e "\nA chroot environment already exists in : $ROOTFS\n"
   3.274 -			exit 1
   3.275 -		fi
   3.276 -		gen_new_chroot ;;
   3.277 -	clean-chroot)
   3.278 -		# Keep root/ and /home they may have a build wok, custom scripts, etc.
   3.279 -		check_root
   3.280 -		if [ -z "$2" ]; then
   3.281 -			echo -e "\nPlease specify the path to the chroot environment to clean.\n"
   3.282 -			exit 0
   3.283 -		else
   3.284 -			ROOTFS=$2
   3.285 -			if [ ! -d "$ROOTFS" ]; then
   3.286 -				echo -e "\nWarning : $ROOTFS doesn't exist!\n"
   3.287 -				exit 1
   3.288 -			fi
   3.289 -		fi
   3.290 -		if [ -d $ROOTFS/proc/1 ]; then
   3.291 -			echo -e "\nWarning : $ROOTFS/proc mounted!\n"
   3.292 -			exit 1
   3.293 -		fi
   3.294 -		cd $ROOTFS || exit 1
   3.295 -		echo -e "\nCleaning chroot in: $ROOTFS"
   3.296 -		echo "================================================================================"
   3.297 -		for i in bin dev etc init lib media mnt proc sbin sys tmp usr var
   3.298 -		do
   3.299 -			echo -n "Removing: $i (`du -sh $i | awk '{ print $1 }'`)... "
   3.300 -			rm -rf $i
   3.301 -			status
   3.302 -		done
   3.303 -		echo "================================================================================"
   3.304 -		echo "" ;;
   3.305 -	'-p'|push)
   3.306 -		check_mirror $@
   3.307 -		rsync -r -t -l -v -z --delete \
   3.308 -			$LOCAL_DIR -e ssh $USER@$MIRROR:$REMOTE_DIR ;;
   3.309 -	'-dp'|dry-push)
   3.310 -		check_mirror $@
   3.311 -		rsync -r -t -l -v -z --delete --dry-run \
   3.312 -			$LOCAL_DIR -e ssh $USER@$MIRROR:$REMOTE_DIR ;;
   3.313 -	pull)
   3.314 -		check_mirror $@
   3.315 -		rsync -r -t -l -v -z --delete \
   3.316 -			-e ssh $USER@$MIRROR:$REMOTE_DIR $LOCAL_DIR ;;
   3.317 -	dry-pull)
   3.318 -		check_mirror $@
   3.319 -		rsync -r -t -l -v -z --delete --dry-run \
   3.320 -			-e ssh $USER@$MIRROR:$REMOTE_DIR $LOCAL_DIR ;;
   3.321 -	purge|dry-purge)
   3.322 -		check_root
   3.323 -		get_version $@
   3.324 -		purge_packages $1
   3.325 -		purge_sources $1 ;;
   3.326 -	relpkg)
   3.327 -		[ -z "$MIRROR_SOURCES" ] && MIRROR_SOURCES="/var/www/slitaz/mirror/sources"
   3.328 -		if [ -z $2 ] || [ -z $3 ]; then
   3.329 -			echo -e "\nUsage: $0 relpkg package version\n"
   3.330 -			exit 0
   3.331 -		fi
   3.332 -		PACKAGE=$2
   3.333 -		VERSION=$3
   3.334 -		echo ""
   3.335 -		cd $PROJECTS/$PACKAGE
   3.336 -		# Sanity check
   3.337 -		if ! grep -q $VERSION$ .hgtags; then
   3.338 -			echo "Missing Hg tag for version: $VERSION"
   3.339 -			echo -e "You may want to: hg tag $VERSION && hg push\n"
   3.340 -			exit 0
   3.341 -		fi
   3.342 -		# Archive
   3.343 -		echo -n "Creating tarball and md5sum for: $PACKAGE-$VERSION... "
   3.344 -		hg archive -t tgz $PACKAGE-$VERSION.tar.gz
   3.345 -		md5sum $PACKAGE-$VERSION.tar.gz > $PACKAGE-$VERSION.md5
   3.346 -		echo "Done"
   3.347 -		# Upload
   3.348 -		echo -n "Do you wish to upload tarball to the mirror [N/y] ? "
   3.349 -		read upload
   3.350 -		if [ "$upload" = "y" ]; then
   3.351 -			echo "Uploading to: $MIRROR/sources/${PACKAGE#slitaz-}"
   3.352 -			scp $PACKAGE-$VERSION.tar.gz $PACKAGE-$VERSION.md5 \
   3.353 -				$USER@$MIRROR:$MIRROR_SOURCES/${PACKAGE#slitaz-}
   3.354 -		fi ;;
   3.355 -	usage|*)
   3.356 -		usage ;;
   3.357 -esac
   3.358 -
   3.359 -exit 0
     4.1 --- a/slitaz-dev-tools/stuff/tazdev.conf	Thu Feb 24 16:10:32 2011 +0100
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,20 +0,0 @@
     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 -EXPERIMENTAL="/home/slitaz/experimental"
    4.14 -
    4.15 -# Path to the Website repo.
    4.16 -WEBSITE="/home/slitaz/www/website"
    4.17 -PROJECTS="$HOME/Projects"
    4.18 -
    4.19 -# Main mirror to push and download (ISO, rootfs. etc).
    4.20 -MIRROR="mirror.slitaz.org"
    4.21 -DL_URL="http://mirror.switch.ch/ftp/mirror/slitaz"
    4.22 -MIRROR_PKGS="/var/www/slitaz/mirror/packages"
    4.23 -MIRROR_SOURCES="/var/www/slitaz/mirror/sources"