recipes: python/libxml2_python2: Bump version number against recent libxml2 update
[dragora.git] / packages / makeTags
blob1eec91e00d7a25eb45b4fb828f586a16f693d084
1 #! /bin/sh -
3 # Gets information from packages to create a checklist for
4 # the installer of Dragora (also know as "tagfiles")
6 # Copyright (c) 2019 Matias Fonzo, <selk@dragora.org>.
8 # Licensed under the Apache License, Version 2.0 (the "License");
9 # you may not use this file except in compliance with the License.
10 # You may obtain a copy of the License at
12 # http://www.apache.org/licenses/LICENSE-2.0
14 # Unless required by applicable law or agreed to in writing, software
15 # distributed under the License is distributed on an "AS IS" BASIS,
16 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 # See the License for the specific language governing permissions and
18 # limitations under the License.
20 # USAGE: makeTags [directory]
21 # e.g: makeTags i586/tools
23 set -e
25 getSize()
27 lzip_output="$(plzip -tvvv "$1" 2>&1)"
29 # To obtain the uncompressed, compressed size
30 echo $lzip_output | awk '{ print $8 $10 }' | \
31 while IFS=, read -r decompressed compressed
33 echo "Decompressed size $(( $decompressed / 1024 ))K, Compressed size $(( ${compressed%.} / 1024 ))K"
34 done
36 unset lzip_output
39 searchpath="$1"
40 searchpath="${searchpath:-.}"
42 echo "Deleting any previous (.tmp) tagfile ..."
43 find $searchpath -type f -name 'tagfile*' -exec rm -f '{}' +
45 umask 022
47 # Search all .tlz packages
48 for meta in $(find $searchpath -type f -name '*.tlz')
50 # Ignore some package names
51 case $meta in
52 *_pass?*)
53 echo " ${meta}: Ignored."
54 continue;
56 esac
57 if test ! -e "${meta}.txt"
58 then
59 echo "Error ${meta##*/} does not have a meta tag file." 1>&2
60 exit 99;
63 meta="${meta}.txt"
64 directory=$(dirname -- "$meta")
65 category="${directory##*/}"
67 # Determine output level for those series with sub-directories
68 case $directory in
69 */modules/* | */xorg/*)
70 output_level=../
71 parent_level="$(dirname -- $directory)"
72 parent_level="$(basename -- $parent_level)"
73 parent_level=${parent_level}_
75 esac
77 echo "Extracting information from $meta ..."
78 . $meta
80 cd -- "$directory"
81 echo " Adding information to ${output_level}tagfile-${parent_level}${category}.tmp"
82 echo "${pkgname}:${blurb}:ON:Version ${pkgversion} - $(getSize $(basename -- "${meta%.txt}"))" \
83 >> "${output_level}tagfile-${parent_level}${category}.tmp"
85 unset output_level parent_level
86 done
88 echo "Removing temporal tagfile(s) and sorting the final ones ..."
89 for tagfile in ./*/*/tagfile*.tmp
91 LC_COLLATE=C sort -- "$tagfile" > "${tagfile%.tmp}"
92 rm -f -- "$tagfile"; # Delete temporary tagfile.
93 done
95 echo "All done."