openpkg/release.sh

Sat, 24 Mar 2012 21:40:49 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 24 Mar 2012 21:40:49 +0100
changeset 414
fd611cde817f
child 428
f880f219c566
permissions
-rw-r--r--

Introduce many changes to the buildconf and source code including:
(01) clean up, update, and partially update default config files,
(02) seems that Melware is unable to perform release engineering so
update chan_capi to new daily snapshot to solve echo problems,
(03) correct Asterisk inadequate hard coded gmime version check,
(04) force postgresql pthreads linkage to solve build problem,
(05) remove buggy hard coded LibXML configure definitions,
(06) remove local architecture specification to allow GCC
internal logic to determine proper CPU type instead,
(07) remove vendor sound install target causing uncontrolled
downloads and non RPM managed file installation,
(08) solve long outstanding bug in tcptls causing Asterisk
to ignore any intermediate CA certificate signatures,
(09) back out Digium engineering team's bright idea of replacing the
very portable and pervasive POSIX rand(1) with ast_random(), and
then not even implementing it causing all references to fail in
platforms not providing the very new POSIX.1-2008 mkdtemp(3)
function only distributed by BSD and some Linux,
(10) withdraw advanced linker symbol manipulations from SVR5 builds
until either Binutils supports hybrid versioned and anonymous
linker scripts or GCC stops hard coding versioned linker scripts,
(11) correct missing library linkage, some tailored to a specific OS,
(12) remove outdated logic for the no longer distributed gmime-config(1),
(13) remove local gmime buildconf hacks now that Asterisk has corrected
their own build configuration to almost portably support gmime,
(14) solve build problems relating to undetected LibXML paths,
(15) correct erroneous out of tree include definitions,
(16) improve some variable and comment naming,
(17) simplify sound language path hierarchy creation,
and correct australian english installation logic.

     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