Ignore:
Timestamp:
02/27/2017 01:55:30 PM (8 years ago)
Author:
Pierre Labastie <pierre@…>
Branches:
new_features
Children:
1cf1ad6
Parents:
dc315ea
Message:

Add several cases to the special cases in packInstall.sh.porg:

  • put the version extraction in a function
  • use packages.xml if needed
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pkgmngt/packInstall.sh.porg

    rdc315ea r0c5dfcc  
    66# be set in the environment
    77
     8extract_version() {
     9local VERSION
     10
     11case $1 in
     12  expect*|tcl*|tk*|mozjs*)
     13    VERSION=$(echo $1 | sed 's/^[^0-9]*//')
     14    ;;
     15  vim*|unzip*|zip*)
     16    VERSION=$(echo $1 | sed 's/^[^0-9]*\([0-9]\)\([0-9]\)/\1.\2/')
     17    ;;
     18  wireless_tools*|LVM2*)
     19    VERSION=$(echo $1 | sed 's/^[^.]*\.//')
     20    ;;
     21  x264*)
     22    VERSION=$(echo $1 | sed 's/.*shot-//')
     23    ;;
     24  icu*) # No version in PCKGVRS! Use version directly from xml book.
     25        # PACK_INSTALL # contains the path to this script, which is in the
     26        # parent dir of the book.
     27    local PACKENT=$(dirname $PACK_INSTALL)/blfs-xml/packages.ent
     28    local VERSION1=$(sed -n 's/.*icu-major[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
     29    local VERSION2=$(sed -n 's/.*icu-minor[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
     30    VERSION=$VERSION1.$VERSION2
     31    ;;
     32  xf86-video-intel)
     33    local PACKENT=$(dirname $PACK_INSTALL)/blfs-xml/x/installing/x7driver-intel.xml
     34    VERSION=$(sed -n '/<!--/!s/.*-version[^;][^0-9]*\([^"]*\).*/\1/p' $PACKENT)
     35    ;;
     36  jdk8*)
     37    VERSION=1.8.0.$(echo $1 | sed 's/.*u\([0-9]\+\).*/\1/')
     38    ;;
     39  docbook-xml)
     40    VERSION=4.5
     41    ;;
     42  cacerts*)
     43    VERSION=0.1
     44    ;;
     45  *)
     46    VERSION=$(echo $1 | sed 's/^.*[-_]\([0-9]\)/\1/' | sed 's/_/./g')
     47    ;;
     48# the last sed above is because some package managers do not want a '_'
     49# in version.
     50esac
     51echo $VERSION
     52}
     53
     54# Export the previous function, since it is used by the others
     55export -f extract_version
     56# The other "official" functions, wrapInstall and packInstall, are exported
     57# by "envars" (in LFS), and the scripts (in BLFS).
     58
    859wrapInstall() {
    960# a bash command is passed as an argument (that may be a compound command).
    1061# It is executed by this function, after various set-ups...
    1162
     63# Note that PKGDIR is changed to UNPACKDIR
     64# and PKG_DEST is changed to PKG_DIR in BLFS tools.
     65# The sed for PACKAGE is therefore not needed in BLFS,
     66# but it does not hurt, either.
    1267local PCKGVRS=$(basename $PKGDIR)
    1368local TGTPKG=$(basename $PKG_DEST)
     
    1873PACKAGE=${PACKAGE,,}
    1974# version is only accessible from PKGDIR name. Since the format of the
    20 # name is not normalized, several hacks are necessary...
    21 case $PCKGVRS in
    22   expect*|tcl*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*//') ;;
    23   vim*|unzip*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*\([0-9]\)\([0-9]\)/\1.\2/') ;;
    24   tidy*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*\([0-9]*\)/\1cvs/') ;;
    25   docbook-xml) local VERSION=4.5 ;;
    26   cacerts*) local VERSION=0.1 ;;
    27   *) local VERSION=$(echo ${PCKGVRS} | sed 's/^.*[-_]\([0-9]\)/\1/' |
    28                    sed 's/_/./g');;
    29 # the last sed above is because some package managers do not want a '_'
    30 # in version.
    31 esac
    32 
     75# name is not normalized, several hacks are necessary (now in function
     76# extract_version)...
     77VERSION=$(extract_version $PCKGVRS)
    3378porg -lp ${PACKAGE}-${VERSION} sh << PORG_EOF
    3479$*
     
    4792# ourselves
    4893PACKAGE=${PACKAGE,,}
    49 case $PCKGVRS in
    50   expect*|tcl*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*//') ;;
    51   vim*|unzip*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*\([0-9]\)\([0-9]\)/\1.\2/') ;;
    52   tidy*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*\([0-9]*\)/\1cvs/') ;;
    53   docbook-xml) local VERSION=4.5 ;;
    54   cacerts*) local VERSION=0.1 ;;
    55   *) local VERSION=$(echo ${PCKGVRS} | sed 's/^.*[-_]\([0-9]\)/\1/' |
    56                    sed 's/_/./g');;
    57 # the last sed above is because some package managers do not want a '_'
    58 # in version.
    59 esac
    6094# Building the binary package
    6195porgball ${PACKAGE}
    6296# The package is in the current directory
     97VERSION=$(extract_version $PCKGVRS)
    6398mv -v ${PACKAGE}-${VERSION}.porg* /var/lib/packages
    6499}
Note: See TracChangeset for help on using the changeset viewer.