source: pkgmngt/packInstall.sh.porg@ 0d1c9f0

ablfs-more legacy trunk
Last change on this file since 0d1c9f0 was 0d1c9f0, checked in by Pierre Labastie <pierre@…>, 6 years ago

Now libuv has a version string starting with"v"

  • Property mode set to 100644
File size: 4.4 KB
Line 
1# $Id:$
2# functions for recording installation of a package and make a tarball,
3# or using fakeroot type commands for install, then packing and installing
4# the package.
5# We only have access to variables PKGDIR and PKG_DEST. Other variables could
6# be set in the environment
7
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 # JH_PACK_INSTALL contains the path to this script, which is in the
26 # parent dir of the book.
27 local PACKENT=$(dirname $JH_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 exiv*)
33 local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
34 VERSION=$(sed -n 's/.*exiv2[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
35 ;;
36 flashplayer*)
37 local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
38 VERSION=$(sed -n 's/.*flashplayer[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
39 ;;
40 psutils*)
41 local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
42 VERSION=$(sed -n 's/.*psutils[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
43 ;;
44 soundtouch*)
45 local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
46 VERSION=$(sed -n 's/.*soundtouch[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
47 ;;
48 unrar*)
49 local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
50 VERSION=$(sed -n 's/.*unrar[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
51 ;;
52 xvid*)
53 local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
54 VERSION=$(sed -n 's/.*xvid[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
55 ;;
56 xf86-video-intel)
57 local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/x/installing/x7driver-intel.xml
58 VERSION=$(sed -n '/<!--/!s/.*-version[^;][^0-9]*\([^"]*\).*/\1/p' $PACKENT)
59 ;;
60 jdk8*)
61 VERSION=1.8.0.$(echo $1 | sed 's/.*u\([0-9]\+\).*/\1/')
62 ;;
63 docbook-xml)
64 VERSION=4.5
65 ;;
66 cacerts*)
67 VERSION=0.1
68 ;;
69 btrfs*|node*)
70 VERSION=$(echo $1 | sed 's/^.*v//')
71 ;;
72 x265*) # can contain vd.d or just d.d: thanks to packagers
73 VERSION=$(echo $1 | sed 's/^.*[v_]//')
74 ;;
75 libuv*) # can contain -vd.d or just -d.d
76 VERSION=$(echo $1 | sed 's/^.*[v-]//')
77 ;;
78 *)
79 VERSION=$(echo $1 | sed 's/^.*[-_]\([0-9]\)/\1/' | sed 's/_/./g')
80 ;;
81# the last sed above is because some package managers do not want a '_'
82# in version.
83esac
84echo ${VERSION,,} # convert to lowercase, in case there is a capital letter
85 # in version
86}
87
88# Export the previous function, since it is used by the others
89export -f extract_version
90# The other "official" functions, wrapInstall and packInstall, are exported
91# by "envars" (in LFS), and the scripts (in BLFS).
92
93wrapInstall() {
94# a bash command is passed as an argument (that may be a compound command).
95# It is executed by this function, after various set-ups...
96
97# Note that PKGDIR is changed to UNPACKDIR
98# and PKG_DEST is changed to PKG_DIR in BLFS tools.
99# The sed for PACKAGE is therefore not needed in BLFS,
100# but it does not hurt, either.
101local PCKGVRS=$(basename $PKGDIR)
102local TGTPKG=$(basename $PKG_DEST)
103local PACKAGE=$(echo ${TGTPKG} | sed 's/^[0-9]\{3\}-//' |
104 sed 's/^[0-9]\{1\}-//')
105# Porg converts package names to lowercase anyway, so do the conversion
106# ourselves
107PACKAGE=${PACKAGE,,}
108# version is only accessible from PKGDIR name. Since the format of the
109# name is not normalized, several hacks are necessary (now in function
110# extract_version)...
111VERSION=$(extract_version $PCKGVRS)
112porg -lp ${PACKAGE}-${VERSION} sh << PORG_EOF
113$*
114PORG_EOF
115}
116
117#----------------
118packInstall() {
119
120# With porg, we need only the package name to make the tarball
121local TGTPKG=$(basename $PKG_DEST)
122local PACKAGE=$(echo ${TGTPKG} | sed 's/^[0-9]\{3\}-//' |
123 sed 's/^[0-9]\{1\}-//')
124local PCKGVRS=$(basename $PKGDIR)
125# Porg converts package names to lowercase anyway, so do the conversion
126# ourselves
127PACKAGE=${PACKAGE,,}
128# Building the binary package
129porgball ${PACKAGE}
130# The package is in the current directory
131VERSION=$(extract_version $PCKGVRS)
132mv -v ${PACKAGE}-${VERSION}.porg* /var/lib/packages
133}
Note: See TracBrowser for help on using the repository browser.