Changeset 3833

Show
Ignore:
Timestamp:
07/31/08 13:33:59 (4 years ago)
Author:
mrenzmann
Message:

Merge 3829:3832 from trunk.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • madwifi/branches/madwifi-0.9.4/scripts/make-release.bash

    r3340 r3833  
    44# for it. 
    55 
     6# check_dir_prereq: 
     7# ensures that a given directory name exist and is writeable 
     8# note: $1 is expected to be set to the name of the variable that contains 
     9#       the name of the directory that is to be tested (indirect reference) 
     10function check_dir_prereq { 
     11        eval d="\$$1" 
     12        n="$1" 
     13         
     14        if [[ ! -d "$d" || ! -w "$d" ]]; then 
     15                echo 
     16                echo "ERROR:" 
     17                echo -n "$n, currently set to $d, " 
     18                [[ ! -d "$d" ]] && echo "does not exist" || echo "is not writable" 
     19                echo 
     20                exit 1 
     21        fi 
     22} 
     23 
     24 
     25 
     26 
    627# check if the script has been called directly 
    728if [[ "$(basename $(pwd))" == "scripts" ]]; then 
    8     echo 
    9     echo "ERROR:" 
    10     echo "Call this script via \"make release\" in the top-level directory of your" 
    11     echo "working copy." 
    12     echo 
    13     exit 1 
     29       echo 
     30       echo "ERROR:" 
     31       echo "Call this script via \"make release\" in the top-level directory of your" 
     32       echo "working copy." 
     33       echo 
     34       exit 1 
    1435fi 
    1536 
     
    1738# Makefile.inc) 
    1839if [[ "$RELEASE_TMP" == "" || "$RELEASE_STORE" == "" ]]; then 
    19     echo 
    20     echo "ERROR:" 
    21     echo "RELEASE_TMP and/or RELEASE_STORE are not set. Check Makefile.inc and try again." 
    22     echo 
    23     exit 1 
    24 fi 
     40        echo 
     41        echo "ERROR:" 
     42        echo "RELEASE_TMP and/or RELEASE_STORE are not set. Check Makefile.inc and try again." 
     43        echo 
     44        exit 1 
     45fi 
     46 
     47# make sure that the directories passed in RELEASE_TMP and RELEASE_STORE 
     48# actually exist and are writable for the caller 
     49check_dir_prereq "RELEASE_TMP" 
     50check_dir_prereq "RELEASE_STORE" 
    2551 
    2652# caller must have write access to the madwifi.org repository 
     
    2854repos=$(svn info | grep "Repository Root" | cut -d" " -f3) 
    2955for f in ~/.subversion/auth/svn.simple/*; do 
    30     if [[ "$(grep -c "$repos" $f)" != "0" ]]; then 
    31         valid=1 
    32         break 
    33     fi 
     56        [ -f $f ] || continue 
     57         
     58        if [[ "$(grep -c "$repos" $f)" != "0" ]]; then 
     59                valid=1 
     60                break 
     61        fi 
    3462done 
    3563 
    3664if [[ "$valid" != "1" ]]; then 
    37     echo 
    38     echo "WARNING:" 
    39     echo "Write access to the repository is needed in order to successfully run this" 
    40     echo "script." 
    41  
    42     read -n1 -p "Do you want to continue? [yN] " choice 
    43     if [[ "$choice" != "y" && "$choice" != "Y" ]]; then 
    44         echo 
    45         echo "Aborted." 
    46         exit 1 
    47     fi 
    48 fi 
    49  
    50  
    51 if [[ ! -d "$RELEASE_TMP" ]]; then 
    52     echo 
    53     echo "ERROR:" 
    54     echo "RELEASE_TMP seems to be wrong. $RELEASE_TMP: no such directory" 
    55     echo 
    56     exit 1 
    57 fi 
     65        echo 
     66        echo "WARNING:" 
     67        echo "Write access to the repository is needed in order to successfully run this" 
     68        echo "script." 
     69 
     70        read -n1 -p "Do you want to continue? [yN] " choice 
     71        if [[ "$choice" != "y" && "$choice" != "Y" ]]; then 
     72                echo 
     73                echo "Aborted." 
     74                exit 1 
     75        fi 
     76fi 
     77 
    5878 
    5979# check if we're in the top-level directory of the snapshot 
    6080if [[ ! -f ./release.h ]]; then 
    61     echo 
    62     echo "ERROR:" 
    63     echo "It seems that the script has not been called with the top-level directory" 
    64     echo "of the working copy as current working directory. This should not happen" 
    65     echo "if you run \"make release\" in the top-level directory of the working" 
    66     echo "copy." 
    67     echo 
    68     exit 1 
     81       echo 
     82       echo "ERROR:" 
     83       echo "It seems that the script has not been called with the top-level directory" 
     84       echo "of the working copy as current working directory. This should not happen" 
     85       echo "if you run \"make release\" in the top-level directory of the working" 
     86       echo "copy." 
     87       echo 
     88       exit 1 
    6989fi 
    7090 
    7191# this script does not work for tarball snapshots 
    7292svn info > /dev/null 2>&1 || { 
    73     echo 
    74     echo "ERROR:" 
    75     echo "It seems this is no Subversion working copy of MadWifi. This script does" 
    76     echo "not work in such cases." 
    77     echo 
    78     exit 1 
     93       echo 
     94       echo "ERROR:" 
     95       echo "It seems this is no Subversion working copy of MadWifi. This script does" 
     96       echo "not work in such cases." 
     97       echo 
     98       exit 1 
    7999} 
    80100 
    81101# check if local working copy has uncommitted changes 
    82 if [[ ! -z "$(svn status)" ]]; then 
    83     echo 
    84     echo "ERROR:" 
    85     echo "Your working copy has changes which are not yet committed." 
    86     echo "Either commit or revert them before you continue to make a release." 
    87     echo "Aborting for now." 
    88     echo 
    89     exit 1 
     102changes="$(svn status | sed -e "/^X/d" -e "/^$/d" -e "/external item/d")" 
     103if [[ ! -z "$changes" ]]; then 
     104        echo 
     105        echo "ERROR:" 
     106        echo "Your working copy has changes which are not yet committed." 
     107        echo "Either commit or revert them before you continue to make a release." 
     108        echo "Aborting for now." 
     109        echo 
     110        exit 1 
    90111fi 
    91112 
     
    96117 
    97118if [[ "$localrev" != "$remoterev" ]]; then 
    98     echo 
    99     echo "ERROR:" 
    100     echo "Your working copy is not in sync with the repository. Please update your" 
    101     echo "working copy, then restart the release process." 
    102     echo 
    103     exit 1 
     119       echo 
     120       echo "ERROR:" 
     121       echo "Your working copy is not in sync with the repository. Please update your" 
     122       echo "working copy, then restart the release process." 
     123       echo 
     124       exit 1 
    104125fi 
    105126 
     
    113134echo 
    114135if [[ ! -z "$latest" ]]; then 
    115     major=$(echo $latest | cut -d"." -f1) 
    116     minor=$(echo $latest | cut -d"." -f2) 
    117     point=$(echo $latest | cut -d"." -f3) 
    118     micro=$(echo $latest | cut -d"." -f4) 
    119  
    120     if [ -n "$micro" ]; then 
    121         echo "The latest release is: $major.$minor.$point.$micro" 
    122     else 
    123         micro="0" 
    124         echo "The latest release is: $major.$minor.$point" 
    125     fi 
     136       major=$(echo $latest | cut -d"." -f1) 
     137       minor=$(echo $latest | cut -d"." -f2) 
     138       point=$(echo $latest | cut -d"." -f3) 
     139       micro=$(echo $latest | cut -d"." -f4) 
     140 
     141       if [ -n "$micro" ]; then 
     142               echo "The latest release is: $major.$minor.$point.$micro" 
     143       else 
     144               micro="0" 
     145               echo "The latest release is: $major.$minor.$point" 
     146       fi 
    126147else 
    127     latest="0.0.0" 
    128     major="0"; minor="0"; point="0"; micro="0" 
    129      
    130     echo "No releases yet." 
     148       latest="0.0.0" 
     149       major="0"; minor="0"; point="0"; micro="0" 
     150         
     151       echo "No releases yet." 
    131152fi 
    132153 
    133154valid=0 
    134155while ! ((valid)); do 
    135     echo 
    136     echo "Please choose the release type:" 
    137     echo " 1: major release (new version will be $((major+1)).0.0)" 
    138     echo " 2: minor release (new version will be $major.$((minor+1)).0)" 
    139     echo " 3: point release (new version will be $major.$minor.$((point+1)))" 
    140     echo " 4: micro release (new version will be $major.$minor.$point.$((micro+1))" 
    141     echo " 5: other (enter new version manually)" 
    142     echo " 0: abort" 
    143     echo 
    144  
    145     read -n1 -p "Your choice: " choice 
    146     case "$choice" in 
    147     1) newmajor=$((major+1)); newminor=0; newpoint=0; newmicro=0; valid=1 ;; 
    148     2) newmajor=$major; newminor=$((minor+1)); newpoint=0; newmicro=0; valid=1 ;; 
    149     3) newmajor=$major; newminor=$minor; newpoint=$((point+1)); newmicro=0; valid=1 ;; 
    150     4) newmajor=$major; newminor=$minor; newpoint=$point; newmicro=$((micro+1)); valid=1 ;; 
    151     5) 
    152         echo 
    153         read -p "Enter release number (a.b.c.d): " newrelease 
    154         if [[ "$(echo $newrelease | grep -c '^[0-9]*\.[0-9]*\.[0-9]*\(\.[0-9]\)\?$')" == "1" ]]; then 
    155             newmajor=$(echo $newrelease | cut -d"." -f1) 
    156             newminor=$(echo $newrelease | cut -d"." -f2) 
    157             newpoint=$(echo $newrelease | cut -d"." -f3) 
    158             newmicro=$(echo $newrelease | cut -d"." -f4) 
     156        echo 
     157        echo "Please choose the release type:" 
     158        echo " 1: major release (new version will be $((major+1)).0.0)" 
     159        echo " 2: minor release (new version will be $major.$((minor+1)).0)" 
     160        echo " 3: point release (new version will be $major.$minor.$((point+1)))" 
     161        echo " 4: micro release (new version will be $major.$minor.$point.$((micro+1))" 
     162        echo " 5: other (enter new version manually)" 
     163        echo " 0: abort" 
     164        echo 
    159165             
    160             if [ -n "$newmicro" ]; then 
    161                 newversion="$newmajor.$newminor.$newpoint.$newmicro" 
    162             else 
    163                 newversion="$newmajor.$newminor.$newpoint" 
    164                 newmicro="0" 
    165             fi 
    166              
    167             if [[ "$(svn list $reproot/tags | grep -c ^release-$newversion)" != "0" ]]; then 
    168                 echo "Release $newversion already exists. Try again." 
    169             else 
    170                 valid=1 
    171             fi 
    172         else 
    173             echo "Invalid release number." 
    174         fi 
    175         ;; 
    176     0) 
    177         echo 
    178         echo "Aborted." 
    179         exit 0 
    180         ;; 
    181          
    182     *) 
    183         echo "Invalid." 
    184         ;; 
    185     esac 
     166        read -n1 -p "Your choice: " choice 
     167        case "$choice" in 
     168        1) newmajor=$((major+1)); newminor=0; newpoint=0; newmicro=0; valid=1 ;; 
     169        2) newmajor=$major; newminor=$((minor+1)); newpoint=0; newmicro=0; valid=1 ;; 
     170        3) newmajor=$major; newminor=$minor; newpoint=$((point+1)); newmicro=0; valid=1 ;; 
     171        4) newmajor=$major; newminor=$minor; newpoint=$point; newmicro=$((micro+1)); valid=1 ;; 
     172        5) 
     173                echo 
     174                read -p "Enter release number (a.b.c.d): " newrelease 
     175                if [[ "$(echo $newrelease | grep -c '^[0-9]*\.[0-9]*\.[0-9]*\(\.[0-9]\)\?$')" == "1" ]]; then 
     176                        newmajor=$(echo $newrelease | cut -d"." -f1) 
     177                        newminor=$(echo $newrelease | cut -d"." -f2) 
     178                        newpoint=$(echo $newrelease | cut -d"." -f3) 
     179                        newmicro=$(echo $newrelease | cut -d"." -f4) 
     180                     
     181                        if [ -n "$newmicro" ]; then 
     182                                newversion="$newmajor.$newminor.$newpoint.$newmicro" 
     183                        else 
     184                                newversion="$newmajor.$newminor.$newpoint" 
     185                                newmicro="0" 
     186                        fi 
     187 
     188                        if [[ "$(svn list $reproot/tags | grep -c ^release-$newversion)" != "0" ]]; then 
     189                                echo "Release $newversion already exists. Try again." 
     190                        else 
     191                                valid=1 
     192                        fi 
     193                else 
     194                        echo "Invalid release number." 
     195                fi 
     196                ;; 
     197        0) 
     198                echo 
     199                echo "Aborted." 
     200                exit 0 
     201                ;; 
     202                 
     203        *) 
     204                echo "Invalid." 
     205                ;; 
     206        esac 
    186207done 
    187208 
    188209# reassure that everything is correct 
    189210if [[ "$micro" != "0" ]]; then 
    190     oldrelease="$major.$minor.$point.$micro" 
     211       oldrelease="$major.$minor.$point.$micro" 
    191212else 
    192     oldrelease="$major.$minor.$point" 
     213       oldrelease="$major.$minor.$point" 
    193214fi 
    194215 
    195216if [[ "$newmicro" != "0" ]]; then 
    196     newrelease="$newmajor.$newminor.$newpoint.$newmicro" 
     217       newrelease="$newmajor.$newminor.$newpoint.$newmicro" 
    197218else 
    198     newrelease="$newmajor.$newminor.$newpoint" 
     219       newrelease="$newmajor.$newminor.$newpoint" 
    199220fi 
    200221 
     
    206227read -n1 -p "Is this correct? [yN] " choice 
    207228if [[ "$choice" != "y" && "$choice" != "Y" ]]; then 
    208     echo 
    209     echo "Aborted." 
    210     exit 0 
     229       echo 
     230       echo "Aborted." 
     231       exit 0 
    211232fi 
    212233 
     
    221242mv release.h release.h.old 
    222243sed -e "/svnversion.h/d" \ 
    223     -e "/RELEASE_TYPE/ s/\".*\"/\"RELEASE\"/" \ 
    224     -e "/RELEASE_VERSION/ s/\".*\"/\"$newrelease\"/" release.h.old > release.h 
     244       -e "/RELEASE_TYPE/ s/\".*\"/\"RELEASE\"/" \ 
     245       -e "/RELEASE_VERSION/ s/\".*\"/\"$newrelease\"/" release.h.old > release.h 
    225246rm -f release.h.old  
    226247 
     
    254275 
    255276[[ -d $tmp/madwifi-release ]] || { 
    256     echo "creating packaging directory..." 
    257     mkdir $tmp/madwifi-release || exit 1 
     277       echo "creating packaging directory..." 
     278       mkdir $tmp/madwifi-release || exit 1 
    258279} 
    259280