openpkg/release.sh

Fri, 15 Oct 2010 18:46:25 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 15 Oct 2010 18:46:25 +0200
changeset 261
4f973c756446
child 428
f880f219c566
permissions
-rw-r--r--

Update copyright, file server URL, modify doc and link logic.
Now documentation is installed by default to the correct path,
and QtCreator links against Qt shared libraries instead of Qt
static libraries. This unfortunate change supports Nokia's
unfortunate decision to poorly support static linking in Qt.

     1 #!@l_prefix@/lib/openpkg/bash
     2 ##
     3 ##  release -- OpenPKG Release Determination Utility
     4 ##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
     5 ##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
     6 ##
     7 ##  Permission to use, copy, modify, and distribute this software for
     8 ##  any purpose with or without fee is hereby granted, provided that
     9 ##  the above copyright notice and this permission notice appear in all
    10 ##  copies.
    11 ##
    12 ##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    13 ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    14 ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    15 ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    16 ##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    17 ##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    18 ##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    19 ##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    20 ##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    21 ##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    22 ##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    23 ##  SUCH DAMAGE.
    24 ##
    26 #   configuration
    27 prefix="@l_prefix@"
    29 #   minimum command line parsing
    30 opt_F="OpenPKG-%t %u"
    31 opt_r=""
    32 while [ $# -gt 0 ]; do
    33     case "$1" in
    34         -F          ) opt_F="$2"; shift;                      shift ;;
    35         --fmt       ) opt_F="$2"; shift;                      shift ;;
    36         -F*         ) opt_F="`expr ".$1" : '.-F\(.*\)'`";     shift ;;
    37         --fmt=*     ) opt_F="`expr ".$1" : '.--fmt=\(.*\)'`"; shift ;;
    38         -r          ) opt_r="$2"; shift;                      shift ;;
    39         --release   ) opt_r="$2"; shift;                      shift ;;
    40         -r*         ) opt_r="`expr ".$1" : '.-r\(.*\)'`";     shift ;;
    41         --release=* ) opt_r="`expr ".$1" : '.--release=\(.*\)'`"; shift ;;
    42         *       ) break ;;
    43     esac
    44 done
    46 #   translate a release number to a release tag
    47 number_to_tag () {
    48     sed -e 's;^;X;' \
    49         -e 's;^X\([^.-][^.-]*\.[^.-][^.-]*\)\.[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].*$;\1-SOLID;' \
    50         -e 's;^X\([^.-][^.-]*\.[^.-][^.-]*\)\.[^.-][^.-]*.*$;\1-RELEASE;' \
    51         -e 's;^X\([^.-][^.-]*\)\.[^.-][^.-]*.*$;\1-STABLE;' \
    52         -e 's;^X[^.-][^.-]*.*$;CURRENT;' \
    53         -e 's;^X.*$;UNKNOWN;'
    54 }
    56 #   sanity check a release tag
    57 tag_sanity () {
    58     sed -e 's;^;X;' \
    59         -e 's;^X[^.-][^.-]*\.[^.-][^.-]*-RELEASE$;OK;' \
    60         -e 's;^X[^.-][^.-]*\.[^.-][^.-]*-SOLID-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$;OK;' \
    61         -e 's;^X[^.-][^.-]*\.[^.-][^.-]*-SOLID$;OK;' \
    62         -e 's;^X[^.-][^.-]*-STABLE-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$;OK;' \
    63         -e 's;^X[^.-][^.-]*-STABLE$;OK;' \
    64         -e 's;^XCURRENT-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$;OK;' \
    65         -e 's;^XCURRENT$;OK;' \
    66         -e 's;^X.*$;ERROR;'
    67 }
    69 #   determine release
    70 tag=""
    71 if [ ".$opt_r" != . ]; then
    72     tag=`echo ".$opt_r" | sed -e 's;^\.;;' | number_to_tag`
    73 elif [ -f "$prefix/etc/openpkg/release" ]; then
    74     tag=`(cat $prefix/etc/openpkg/release; echo "") | sed \
    75         -e 's;^;X;' \
    76         -e 's;^X *TAG *= *\([^ ][^ ]*\).*;\1;' \
    77         -e '/^X/d' | \
    78         sed -n -e '$p'`
    79 else
    80     tag=`$prefix/bin/openpkg rpm \
    81         -q --qf '%{VERSION}\n' openpkg | number_to_tag`
    82 fi
    83 if [ .`echo ".$tag" | sed -e 's;^\.;;' | tag_sanity` = .ERROR ]; then
    84     echo "openpkg:release: WARNING: unable to determine OpenPKG release tag" 1>&2
    85     tag="UNKNOWN"
    86 fi
    88 #   determine distribution URL
    89 url=""
    90 if [ -f "$prefix/etc/openpkg/release" ]; then
    91     url=`(cat $prefix/etc/openpkg/release; echo "") | sed \
    92         -e 's;^;X;' \
    93         -e 's;^X *URL *= *\([^ ][^ ]*\).*;\1;' \
    94         -e '/^X/d' | \
    95         sed -n -e '$p'`
    96 fi
    97 if [ ".$url" = . ]; then
    98     url="ftp://ftp.openpkg.org/*"
    99 fi
   100 case ".$url" in
   101     */\* )
   102         url=`echo ".$url" | sed -e 's;^\.;;' -e 's;/\*$;;'`
   103         case "$tag" in
   104             CURRENT )
   105                 url="$url/current/SRC/"
   106                 ;;
   107             CURRENT-* )
   108                 version=`echo "$tag" | sed -e 's;^CURRENT-;;'`
   109                 url="$url/current/$version/"
   110                 ;;
   111             *-STABLE )
   112                 version=`echo "$tag" | sed -e 's;^\(.*\)-STABLE$;\1;'`
   113                 url="$url/stable/$version/"
   114                 ;;
   115             *-STABLE-* )
   116                 version=`echo "$tag" | sed -e 's;^\(.*\)-STABLE-\(.*\)$;\1.\2;'`
   117                 url="$url/stable/$version/"
   118                 ;;
   119             *-SOLID )
   120                 version=`echo "$tag" | sed -e 's;^\(.*\)-SOLID$;\1;'`
   121                 url="$url/solid/$version/"
   122                 ;;
   123             *-SOLID-* )
   124                 version=`echo "$tag" | sed -e 's;^\(.*\)-SOLID-\(.*\)$;\1.\2;'`
   125                 url="$url/solid/$version/"
   126                 ;;
   127             *-RELEASE )
   128                 version=`echo "$tag" | sed -e 's;^\(.*\)-RELEASE$;\1;'`
   129                 url="$url/release/$version/"
   130                 ;;
   131         esac
   132         ;;
   133 esac
   135 #   read uuid
   136 [ -f "$prefix/etc/openpkg/uuid" ] && . "$prefix/etc/openpkg/uuid"
   138 #   generate output
   139 echo "X$opt_F" |\
   140 sed -e 's/^X//' \
   141     -e "s;%t;${tag};g" \
   142     -e "s;%u;${url};g" \
   143     -e "s;%r;${UUID_REGISTRY};g" \
   144     -e "s;%i;${UUID_INSTANCE};g" \
   145     -e "s;%p;${UUID_PLATFORM};g" \
   146     -e 's/\\n/^/g' | tr '^' '\012'

mercurial