Home | History | Annotate | Line # | Download | only in build
UpdatePoint revision 1.1.1.1.10.2
      1  1.1.1.1.10.2  snj #! /bin/sh
      2  1.1.1.1.10.2  snj 
      3  1.1.1.1.10.2  snj # showusage is set to 1 on any command-line syntax error
      4  1.1.1.1.10.2  snj showusage=0
      5  1.1.1.1.10.2  snj # are we playing by stable or dev rules?
      6  1.1.1.1.10.2  snj repo=
      7  1.1.1.1.10.2  snj # test is set to 1 if -t/--test is given to prevent modifications
      8  1.1.1.1.10.2  snj test=0
      9  1.1.1.1.10.2  snj 
     10  1.1.1.1.10.2  snj case "$#" in
     11  1.1.1.1.10.2  snj  1) repo=$1
     12  1.1.1.1.10.2  snj     ;;
     13  1.1.1.1.10.2  snj  2) repo=$2
     14  1.1.1.1.10.2  snj     case $1 in
     15  1.1.1.1.10.2  snj      -t|--test)
     16  1.1.1.1.10.2  snj 	test=1
     17  1.1.1.1.10.2  snj 	;;
     18  1.1.1.1.10.2  snj      *)
     19  1.1.1.1.10.2  snj 	showusage=1
     20  1.1.1.1.10.2  snj 	;;
     21  1.1.1.1.10.2  snj     esac
     22  1.1.1.1.10.2  snj     ;;
     23  1.1.1.1.10.2  snj  *) showusage=1
     24  1.1.1.1.10.2  snj     ;;
     25  1.1.1.1.10.2  snj esac
     26  1.1.1.1.10.2  snj 
     27  1.1.1.1.10.2  snj case "$repo" in
     28  1.1.1.1.10.2  snj  dev|stable)
     29  1.1.1.1.10.2  snj     ;;
     30  1.1.1.1.10.2  snj  '')
     31  1.1.1.1.10.2  snj     showusage=1
     32  1.1.1.1.10.2  snj     ;;
     33  1.1.1.1.10.2  snj  *) echo "Unexpected repo type: <$repo>!"
     34  1.1.1.1.10.2  snj     showusage=1
     35  1.1.1.1.10.2  snj     ;;
     36  1.1.1.1.10.2  snj esac
     37  1.1.1.1.10.2  snj 
     38  1.1.1.1.10.2  snj case "$showusage" in
     39  1.1.1.1.10.2  snj  1) echo "Usage: $0 [-t] <stable|dev>"
     40  1.1.1.1.10.2  snj     echo "No changes are made to packageinfo.sh if -t is given."
     41  1.1.1.1.10.2  snj     exit 1
     42  1.1.1.1.10.2  snj     ;;
     43  1.1.1.1.10.2  snj esac
     44  1.1.1.1.10.2  snj 
     45  1.1.1.1.10.2  snj 
     46  1.1.1.1.10.2  snj set -e
     47  1.1.1.1.10.2  snj  
     48  1.1.1.1.10.2  snj . ./packageinfo.sh
     49  1.1.1.1.10.2  snj 
     50  1.1.1.1.10.2  snj case "$repotype" in
     51  1.1.1.1.10.2  snj  $repo)
     52  1.1.1.1.10.2  snj     ;;
     53  1.1.1.1.10.2  snj  *) echo "You indicated repo type <$repo> but packageinfo.sh"
     54  1.1.1.1.10.2  snj     echo "indicates <$repotype>."
     55  1.1.1.1.10.2  snj     exit 1
     56  1.1.1.1.10.2  snj     ;;
     57  1.1.1.1.10.2  snj esac
     58  1.1.1.1.10.2  snj 
     59  1.1.1.1.10.2  snj ver_repo_mismatch=1
     60  1.1.1.1.10.2  snj 
     61  1.1.1.1.10.2  snj case "$minor" in
     62  1.1.1.1.10.2  snj  1|3|5|7|9)
     63  1.1.1.1.10.2  snj     case "$repo" in
     64  1.1.1.1.10.2  snj      dev)
     65  1.1.1.1.10.2  snj 	ver_repo_mismatch=0
     66  1.1.1.1.10.2  snj 	;;
     67  1.1.1.1.10.2  snj      stable)
     68  1.1.1.1.10.2  snj 	;;
     69  1.1.1.1.10.2  snj     esac
     70  1.1.1.1.10.2  snj     ;;
     71  1.1.1.1.10.2  snj  0|2|4|6|8)
     72  1.1.1.1.10.2  snj     case "$repo" in
     73  1.1.1.1.10.2  snj      dev)
     74  1.1.1.1.10.2  snj 	;;
     75  1.1.1.1.10.2  snj      stable)
     76  1.1.1.1.10.2  snj 	ver_repo_mismatch=0
     77  1.1.1.1.10.2  snj 	;;
     78  1.1.1.1.10.2  snj     esac
     79  1.1.1.1.10.2  snj     ;;
     80  1.1.1.1.10.2  snj esac
     81  1.1.1.1.10.2  snj 
     82  1.1.1.1.10.2  snj case "$ver_repo_mismatch" in
     83  1.1.1.1.10.2  snj  1) echo "Minor version <$minor> mismatches repotype <$repo>."
     84  1.1.1.1.10.2  snj     exit 1
     85  1.1.1.1.10.2  snj     ;;
     86  1.1.1.1.10.2  snj esac
     87  1.1.1.1.10.2  snj 
     88  1.1.1.1.10.2  snj # Do we want to bump the point?
     89  1.1.1.1.10.2  snj bp=1
     90  1.1.1.1.10.2  snj # Do we want to bump the beta point?
     91  1.1.1.1.10.2  snj bbp=0
     92  1.1.1.1.10.2  snj # Do we want to change the RC point? (n=no, z=empty rcpoint and zero
     93  1.1.1.1.10.2  snj # betapoint, i=incr)
     94  1.1.1.1.10.2  snj crcp=n
     95  1.1.1.1.10.2  snj # Do we want to change the prerelease value?
     96  1.1.1.1.10.2  snj setpr=0
     97  1.1.1.1.10.2  snj 
     98  1.1.1.1.10.2  snj # for stable:
     99  1.1.1.1.10.2  snj # if we are not in a beta or RC state, enter beta unless point is NEW.
    100  1.1.1.1.10.2  snj # if we are in a beta state:
    101  1.1.1.1.10.2  snj # - bump the beta point
    102  1.1.1.1.10.2  snj # else if we are in an RC state:
    103  1.1.1.1.10.2  snj # - if rcpoint is GO:
    104  1.1.1.1.10.2  snj # - - set rcpoint= (empty)
    105  1.1.1.1.10.2  snj # - - set prerelease= (empty)
    106  1.1.1.1.10.2  snj # - - set betapoint=0
    107  1.1.1.1.10.2  snj # - else
    108  1.1.1.1.10.2  snj # - - if rcpoint==(empty)
    109  1.1.1.1.10.2  snj # - - - (bump-point) and set rcpoint to 0 (and fall thru, so -RC1 is first)
    110  1.1.1.1.10.2  snj # - - bump the RC point
    111  1.1.1.1.10.2  snj 
    112  1.1.1.1.10.2  snj # for dev, we only want to bump-point and possibly clear prerelease, 
    113  1.1.1.1.10.2  snj # but we do not modify rcpoint nor betapoint.
    114  1.1.1.1.10.2  snj 
    115  1.1.1.1.10.2  snj case "$repo" in
    116  1.1.1.1.10.2  snj  dev)
    117  1.1.1.1.10.2  snj     case "$point" in
    118  1.1.1.1.10.2  snj      [Nn][Ee][Ww])
    119  1.1.1.1.10.2  snj 	crcp=z
    120  1.1.1.1.10.2  snj 	;;
    121  1.1.1.1.10.2  snj      *)
    122  1.1.1.1.10.2  snj 	# crcp=n
    123  1.1.1.1.10.2  snj 	;;
    124  1.1.1.1.10.2  snj     esac
    125  1.1.1.1.10.2  snj     # bp=1
    126  1.1.1.1.10.2  snj     ;;
    127  1.1.1.1.10.2  snj  stable)
    128  1.1.1.1.10.2  snj     case "$prerelease" in
    129  1.1.1.1.10.2  snj      '')
    130  1.1.1.1.10.2  snj 	case "$betapoint::$rcpoint::$point" in
    131  1.1.1.1.10.2  snj 	 *::*::NEW)
    132  1.1.1.1.10.2  snj 	    # new minor release (no p)
    133  1.1.1.1.10.2  snj 	    crcp=z
    134  1.1.1.1.10.2  snj 	    # bp=1
    135  1.1.1.1.10.2  snj 	    ;;
    136  1.1.1.1.10.2  snj 	 0::::*)
    137  1.1.1.1.10.2  snj 	    # start of first beta cycle for the next point release
    138  1.1.1.1.10.2  snj 	    setpr=1
    139  1.1.1.1.10.2  snj 	    newpr=beta
    140  1.1.1.1.10.2  snj 	    # bp=1
    141  1.1.1.1.10.2  snj 	    bbp=1
    142  1.1.1.1.10.2  snj 	    ;;
    143  1.1.1.1.10.2  snj 	 0::[Gg][Oo]::*)
    144  1.1.1.1.10.2  snj 	    # skip all -beta and -RC prereleases to the next point.
    145  1.1.1.1.10.2  snj 	    crcp=z
    146  1.1.1.1.10.2  snj 	    setpr=1
    147  1.1.1.1.10.2  snj 	    newpr=
    148  1.1.1.1.10.2  snj 	    # bp=1
    149  1.1.1.1.10.2  snj 	    # bbp=0
    150  1.1.1.1.10.2  snj 	    ;;
    151  1.1.1.1.10.2  snj 	 *) echo "betapoint is <$betapoint>, rcpoint is <$rcpoint>"
    152  1.1.1.1.10.2  snj 	    echo "betapoint must be 0 and rcpoint must be empty to start the"
    153  1.1.1.1.10.2  snj 	    echo "beta cycle."
    154  1.1.1.1.10.2  snj 	    exit 1
    155  1.1.1.1.10.2  snj 	    ;;
    156  1.1.1.1.10.2  snj 	esac
    157  1.1.1.1.10.2  snj 	;;
    158  1.1.1.1.10.2  snj      beta)
    159  1.1.1.1.10.2  snj 	case "$betapoint::$rcpoint" in
    160  1.1.1.1.10.2  snj 	 [1-9]*::*)
    161  1.1.1.1.10.2  snj 	    bp=0
    162  1.1.1.1.10.2  snj 	    bbp=1
    163  1.1.1.1.10.2  snj 	    ;;
    164  1.1.1.1.10.2  snj 	 0::) echo "betapoint is 0, rcpoint emtpy, and prerelease is beta."
    165  1.1.1.1.10.2  snj 	    echo "You probably intended prerelease=  (that is, empty).  It"
    166  1.1.1.1.10.2  snj 	    echo "will then be changed to beta by this script, starting the"
    167  1.1.1.1.10.2  snj 	    echo "first beta for the next point release."
    168  1.1.1.1.10.2  snj 	    exit 1
    169  1.1.1.1.10.2  snj 	    ;;
    170  1.1.1.1.10.2  snj 	 *)
    171  1.1.1.1.10.2  snj 	    bp=0
    172  1.1.1.1.10.2  snj 	    bbp=1
    173  1.1.1.1.10.2  snj 	    ;;
    174  1.1.1.1.10.2  snj 	esac
    175  1.1.1.1.10.2  snj 	case "$rcpoint" in
    176  1.1.1.1.10.2  snj 	 [Gg][Oo])
    177  1.1.1.1.10.2  snj 	    echo "prerelease is beta, rcpoint is GO, disallowed."
    178  1.1.1.1.10.2  snj 	    echo "rcpoint GO is allowed only when prerelease is RC or empty."
    179  1.1.1.1.10.2  snj 	    exit 1
    180  1.1.1.1.10.2  snj 	    ;;
    181  1.1.1.1.10.2  snj 	esac
    182  1.1.1.1.10.2  snj 	;;
    183  1.1.1.1.10.2  snj      rc|RC)
    184  1.1.1.1.10.2  snj 	case "$rcpoint" in
    185  1.1.1.1.10.2  snj 	 '')
    186  1.1.1.1.10.2  snj 	    case "$betapoint" in
    187  1.1.1.1.10.2  snj 	     0) # bp=1
    188  1.1.1.1.10.2  snj 		;;
    189  1.1.1.1.10.2  snj 	     *) bp=0
    190  1.1.1.1.10.2  snj 		;;
    191  1.1.1.1.10.2  snj 	    esac
    192  1.1.1.1.10.2  snj 	    crcp=i
    193  1.1.1.1.10.2  snj 	    ;;
    194  1.1.1.1.10.2  snj 	 [1-9]*)
    195  1.1.1.1.10.2  snj 	    bp=0
    196  1.1.1.1.10.2  snj 	    crcp=i
    197  1.1.1.1.10.2  snj 	    ;;
    198  1.1.1.1.10.2  snj 	 [Gg][Oo])
    199  1.1.1.1.10.2  snj 	    bp=0
    200  1.1.1.1.10.2  snj 	    crcp=z
    201  1.1.1.1.10.2  snj 	    setpr=1
    202  1.1.1.1.10.2  snj 	    newpr=
    203  1.1.1.1.10.2  snj 	    ;;
    204  1.1.1.1.10.2  snj 	 *) echo "Unexpected value for 'rcpoint' <$rcpoint>!"
    205  1.1.1.1.10.2  snj 	    exit 1
    206  1.1.1.1.10.2  snj 	    ;;
    207  1.1.1.1.10.2  snj 	esac
    208  1.1.1.1.10.2  snj 	;;
    209  1.1.1.1.10.2  snj      *)
    210  1.1.1.1.10.2  snj 	echo "prerelease <$prerelease> unexpected"
    211  1.1.1.1.10.2  snj 	exit 1
    212  1.1.1.1.10.2  snj 	;;
    213  1.1.1.1.10.2  snj     esac
    214  1.1.1.1.10.2  snj     ;;
    215  1.1.1.1.10.2  snj  *) echo "impossible: repo <$repo>!"
    216  1.1.1.1.10.2  snj     exit 1
    217  1.1.1.1.10.2  snj     ;;
    218  1.1.1.1.10.2  snj esac
    219  1.1.1.1.10.2  snj 
    220  1.1.1.1.10.2  snj case "$bp::$point" in
    221  1.1.1.1.10.2  snj  0::*)
    222  1.1.1.1.10.2  snj     newpoint=$point
    223  1.1.1.1.10.2  snj     ;;
    224  1.1.1.1.10.2  snj  1::[1-9]*)
    225  1.1.1.1.10.2  snj     newpoint=`expr $point + 1`
    226  1.1.1.1.10.2  snj     ;;
    227  1.1.1.1.10.2  snj  1::)
    228  1.1.1.1.10.2  snj     newpoint=1
    229  1.1.1.1.10.2  snj     ;;
    230  1.1.1.1.10.2  snj  1::[Nn][Ee][Ww])
    231  1.1.1.1.10.2  snj     newpoint=
    232  1.1.1.1.10.2  snj     ;;
    233  1.1.1.1.10.2  snj  *) echo "Unexpected value for 'point' <$point>!"
    234  1.1.1.1.10.2  snj     exit 1
    235  1.1.1.1.10.2  snj     ;;
    236  1.1.1.1.10.2  snj esac
    237  1.1.1.1.10.2  snj 
    238  1.1.1.1.10.2  snj case "$bbp::$betapoint" in
    239  1.1.1.1.10.2  snj  0::*)
    240  1.1.1.1.10.2  snj     newbetapoint=$betapoint
    241  1.1.1.1.10.2  snj     ;;
    242  1.1.1.1.10.2  snj  1::[0-9]*)
    243  1.1.1.1.10.2  snj     newbetapoint=`expr $betapoint + 1`
    244  1.1.1.1.10.2  snj     ;;
    245  1.1.1.1.10.2  snj  *) echo "Unexpected value for 'betapoint' <$betapoint>!"
    246  1.1.1.1.10.2  snj     exit 1
    247  1.1.1.1.10.2  snj     ;;
    248  1.1.1.1.10.2  snj esac
    249  1.1.1.1.10.2  snj 
    250  1.1.1.1.10.2  snj case "$crcp::$rcpoint" in
    251  1.1.1.1.10.2  snj  n::*)
    252  1.1.1.1.10.2  snj     newrcpoint=$rcpoint
    253  1.1.1.1.10.2  snj     ;;
    254  1.1.1.1.10.2  snj  i::)
    255  1.1.1.1.10.2  snj     newrcpoint=1
    256  1.1.1.1.10.2  snj     ;;
    257  1.1.1.1.10.2  snj  i::[0-9]*)
    258  1.1.1.1.10.2  snj     newrcpoint=`expr $rcpoint + 1`
    259  1.1.1.1.10.2  snj     ;;
    260  1.1.1.1.10.2  snj  z::*)
    261  1.1.1.1.10.2  snj     newrcpoint=
    262  1.1.1.1.10.2  snj     newbetapoint=0
    263  1.1.1.1.10.2  snj     ;;
    264  1.1.1.1.10.2  snj  *) echo "Unexpected value for 'crcp::rcpoint' <$crcp::$rcpoint>!"
    265  1.1.1.1.10.2  snj     exit 1
    266  1.1.1.1.10.2  snj     ;;
    267  1.1.1.1.10.2  snj esac
    268  1.1.1.1.10.2  snj 
    269  1.1.1.1.10.2  snj case "$setpr" in
    270  1.1.1.1.10.2  snj  0)
    271  1.1.1.1.10.2  snj     newpr=$prerelease
    272  1.1.1.1.10.2  snj esac
    273  1.1.1.1.10.2  snj 
    274  1.1.1.1.10.2  snj # display results
    275  1.1.1.1.10.2  snj printf "prerelease		$prerelease"
    276  1.1.1.1.10.2  snj case "$newpr" in
    277  1.1.1.1.10.2  snj  $prerelease)
    278  1.1.1.1.10.2  snj     printf "\n"
    279  1.1.1.1.10.2  snj     ;;
    280  1.1.1.1.10.2  snj  *) printf " -> $newpr\n"
    281  1.1.1.1.10.2  snj     ;;
    282  1.1.1.1.10.2  snj esac
    283  1.1.1.1.10.2  snj printf "point			$point"
    284  1.1.1.1.10.2  snj case "$newpoint" in
    285  1.1.1.1.10.2  snj  $point)
    286  1.1.1.1.10.2  snj     printf "\n"
    287  1.1.1.1.10.2  snj     ;;
    288  1.1.1.1.10.2  snj  *) printf " -> $newpoint\n"
    289  1.1.1.1.10.2  snj     ;;
    290  1.1.1.1.10.2  snj esac
    291  1.1.1.1.10.2  snj printf "betapoint		$betapoint"
    292  1.1.1.1.10.2  snj case "$newbetapoint" in
    293  1.1.1.1.10.2  snj  $betapoint)
    294  1.1.1.1.10.2  snj     printf "\n"
    295  1.1.1.1.10.2  snj     ;;
    296  1.1.1.1.10.2  snj  *) printf " -> $newbetapoint\n"
    297  1.1.1.1.10.2  snj     ;;
    298  1.1.1.1.10.2  snj esac
    299  1.1.1.1.10.2  snj printf "rcpoint			$rcpoint"
    300  1.1.1.1.10.2  snj case "$newrcpoint" in
    301  1.1.1.1.10.2  snj  $rcpoint)
    302  1.1.1.1.10.2  snj     printf "\n"
    303  1.1.1.1.10.2  snj     ;;
    304  1.1.1.1.10.2  snj  *) printf " -> $newrcpoint\n"
    305  1.1.1.1.10.2  snj     ;;
    306  1.1.1.1.10.2  snj esac
    307  1.1.1.1.10.2  snj 
    308  1.1.1.1.10.2  snj printf "Previous version: "
    309  1.1.1.1.10.2  snj scripts/build/VersionName
    310  1.1.1.1.10.2  snj 
    311  1.1.1.1.10.2  snj # apply packageinfo.sh changes
    312  1.1.1.1.10.2  snj 
    313  1.1.1.1.10.2  snj sed -e "s/^point=.*/point=$newpoint/"			\
    314  1.1.1.1.10.2  snj     -e "s/^betapoint=.*/betapoint=$newbetapoint/"	\
    315  1.1.1.1.10.2  snj     -e "s/^rcpoint=.*/rcpoint=$newrcpoint/"		\
    316  1.1.1.1.10.2  snj     -e "s/^prerelease=.*/prerelease=$newpr/"		\
    317  1.1.1.1.10.2  snj 	< packageinfo.sh					\
    318  1.1.1.1.10.2  snj 	> packageinfo.sh+
    319  1.1.1.1.10.2  snj 
    320  1.1.1.1.10.2  snj case "$test" in
    321  1.1.1.1.10.2  snj  0)
    322  1.1.1.1.10.2  snj     mv packageinfo.sh+ packageinfo.sh
    323  1.1.1.1.10.2  snj     printf "Updated version: "
    324  1.1.1.1.10.2  snj     scripts/build/VersionName
    325  1.1.1.1.10.2  snj     ;;
    326  1.1.1.1.10.2  snj  *)
    327  1.1.1.1.10.2  snj     printf "Next version would be: "
    328  1.1.1.1.10.2  snj     scripts/build/VersionName -p ./packageinfo.sh+
    329  1.1.1.1.10.2  snj     rm packageinfo.sh+
    330  1.1.1.1.10.2  snj     ;;
    331  1.1.1.1.10.2  snj esac
    332