slitaz-dev-tools rev 291

Add: slitaz-release (A hellper script to release SliTaz stable :-)
author Christophe Lincoln <pankso@slitaz.org>
date Sun Mar 19 03:23:21 2017 +0100 (2017-03-19)
parents 4c3e0cb9e2b0
children 2835f5caf22d
files slitaz-release/README slitaz-release/slitaz-release
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/slitaz-release/README	Sun Mar 19 03:23:21 2017 +0100
     1.3 @@ -0,0 +1,24 @@
     1.4 +slitaz-release - SliTaz stable and cooking release helper
     1.5 +================================================================================
     1.6 +Doc: http://www.slitaz.org/en/devel/release.php
     1.7 +
     1.8 +
     1.9 +The slitaz-release script is designed to help SliTaz releases process on
    1.10 +all hosts: tank, pangolin, mirror and localy. 
    1.11 +
    1.12 +
    1.13 +	* Localy it will check release string into slitaz-base-files, the wok
    1.14 +	  and slitaz-doc repos as well as isolinux.cfg in syslinux package
    1.15 +	
    1.16 +	* On tank it will check for build chroot and ISO's
    1.17 +	
    1.18 +	* On Pangolin it will check for wok-stable and wok latest Hg tag
    1.19 +	
    1.20 +	* On mirror it will check for packages/[version] and uploaded ISO's
    1.21 +
    1.22 +
    1.23 +Examples:
    1.24 +
    1.25 +	# slitaz-release 5.0
    1.26 +	# slitaz-release 6.0 /path/to/local/repos
    1.27 +	
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/slitaz-release/slitaz-release	Sun Mar 19 03:23:21 2017 +0100
     2.3 @@ -0,0 +1,128 @@
     2.4 +#!/bin/sh
     2.5 +#
     2.6 +# slitaz-release - SliTaz stable and cooking release helper. The script
     2.7 +# will check hostname to handle host specifics release tasks (tank, pangolin,
     2.8 +# mirror, local)
     2.9 +#
    2.10 +# Copyright (C) 2017 SliTaz GNU/Linux - BSD License
    2.11 +#
    2.12 +#. /lib/libtaz.sh # Is not installed on pangolin & mirror (slitaz 4.0)
    2.13 +
    2.14 +version="$1"
    2.15 +
    2.16 +if [ "$2" ]; then
    2.17 +	local_repos="$2"
    2.18 +else
    2.19 +	local_repos="$HOME/Projects"
    2.20 +fi
    2.21 +
    2.22 +help() {
    2.23 +	cat << EOT
    2.24 +
    2.25 +$(colorize 032 "Usage:") slitaz-release [version] [repos_path]
    2.26 +
    2.27 +$(colorize 033 "Local repos   :") $local_repos
    2.28 +$(colorize 033 "Documentation :") http://www.slitaz.org/en/devel/release.php
    2.29 +
    2.30 +EOT
    2.31 +}
    2.32 +
    2.33 +# Colorize message
    2.34 +colorize() {
    2.35 +	: ${color=$1}
    2.36 +	shift
    2.37 +	case "$color" in
    2.38 +		0*) echo -e "\\033[${color:-38}m$@\\033[39m" ;;
    2.39 +		*)  echo -e "\\033[1;${color:-38}m$@\\033[0;39m" ;;
    2.40 +	esac; unset color
    2.41 +}
    2.42 +
    2.43 +title() {
    2.44 +	echo ""; colorize 033 "$@"
    2.45 +}
    2.46 +
    2.47 +check_string() {
    2.48 +	if [ "$slitaz_release" != "$version" ]; then
    2.49 +		colorize 031 "Wrong string: $slitaz_release"
    2.50 +		echo " * $1"
    2.51 +	else
    2.52 +		colorize 031 "SliTaz release: $version"
    2.53 +	fi
    2.54 +}
    2.55 +
    2.56 +#
    2.57 +# Handle commands
    2.58 +#
    2.59 +case "$1" in
    2.60 +	"") help; exit 0 ;;
    2.61 +esac
    2.62 +
    2.63 +#
    2.64 +# Handle host specifics task
    2.65 +#
    2.66 +case "$(hostname)" in
    2.67 +
    2.68 +	tank) 
    2.69 +		# Build host with chroots and builded ISO's
    2.70 +		slitaz="/home/slitaz"
    2.71 +		;;
    2.72 +	
    2.73 +	mirror) 
    2.74 +		# Host packages and official ISO's
    2.75 +		packages=""
    2.76 +		;;
    2.77 +	
    2.78 +	pangolin) 
    2.79 +		# Host all Hg repositories
    2.80 +		repos="/home/slitaz/repos"
    2.81 +		
    2.82 +		# Stable wok
    2.83 +		title "Checking repo: wok-stable" 
    2.84 +		cd $repos/wok-stable; hg up
    2.85 +		slitaz_release=$(hg parents --template '{latesttag}')
    2.86 +		check_string "stable wok is not yet tagged to $version"
    2.87 +		
    2.88 +		# Cooking wok
    2.89 +		title "Checking repo: wok"
    2.90 +		cd $repos/wok; hg up
    2.91 +		slitaz_release=$(hg parents --template '{latesttag}')
    2.92 +		check_string "cooking wok is not yet ready to be copied" ;;
    2.93 +	
    2.94 +	*)
    2.95 +		# Local Hg repos: set stable string and Hg tags
    2.96 +		for repo in slitaz-base-files slitaz-doc wok; do
    2.97 +			if [ ! -d "$local_repos/$repo" ]; then
    2.98 +				colorize 031 "Missing repos: $local_repos/$repo"; exit 1
    2.99 +			fi
   2.100 +		done
   2.101 +		
   2.102 +		# /etc/slitaz-release
   2.103 +		title "Checking file: /etc/slitaz-release" 
   2.104 +		base_files="$local_repos/slitaz-base-files/rootfs"
   2.105 +		slitaz_release=$(cat $base_files/etc/slitaz-release)
   2.106 +		check_string "slitaz-base-files must be modified and wok updated"
   2.107 +		
   2.108 +		# isolinux.cfg
   2.109 +		title "Checking file: isolinux.cfg" 
   2.110 +		isolinux_cfg="$local_repos/wok/syslinux/stuff/isolinux.cfg"
   2.111 +		slitaz_release=$(grep "MENU TITLE" $isolinux_cfg | cut -d " " -f 6)
   2.112 +		check_string "syslinux package must be modified and wok updated"
   2.113 +		
   2.114 +		# slitaz-doc
   2.115 +		title "Checking repo: slitaz-doc" 
   2.116 +		cd $local_repos/slitaz-doc
   2.117 +		slitaz_release=$(hg parents --template '{latesttag}')
   2.118 +		check_string "slitaz-doc should provide relnotes and be tagged"
   2.119 +		
   2.120 +		# wok: the current cooking wok will be copied to wok-stable on
   2.121 +		# Hg server and then it will continue it own life with security updates.
   2.122 +		# Tagging the wok let us have the initial state of the new release.
   2.123 +		title "Checking repo: wok" 
   2.124 +		cd $local_repos/wok
   2.125 +		slitaz_release=$(hg parents --template '{latesttag}')
   2.126 +		check_string "the wok should be tagged to $version"
   2.127 +		
   2.128 +		echo "" ;;
   2.129 +esac
   2.130 +
   2.131 +exit 0