Swapspace: update to 1.18.1
[void-pkg.git] / common / build-style / texmf.sh
blob76f8a871e85bfe1cebc9fe39a31b79c9e849ea4a
1 do_build() {
2 local f p
3 # Extract the source files
4 mkdir -p "build/usr/share/texmf-dist"
5 find . -maxdepth 1 -print -name "*.tar.xz" \
6 -exec bsdtar \
7 -s '|^texmf-dist/||' \
8 -C "build/usr/share/texmf-dist" \
9 -xf {} \;
10 cd "build/usr/share/texmf-dist/"
11 # LICENSEs are unneeded
12 rm -f LICENSE*
14 # We have some conflicting files between different packages. To work
15 # around this, we use an ownership file that maps which conflicting
16 # files should be in which packages. Here, each file in the map list is
17 # checked whether it is in the package, and if it shouldn't be it is
18 # removed.
19 while IFS=' ' read -r f p ; do
20 if [ "$p" = "$pkgname" ] && ! [ -e "$f" ]; then
21 # Error out if the ownership map expects this package to have a
22 # file but it dosen't
23 msg_error "$pkgver: missing file $f\n"
24 elif [ "$p" != "$pkgname" ] && [ -e "$f" ]; then
25 # Remove a file that according to the ownership map belongs to
26 # another file
27 echo "removed $f"
28 # Install a file that lists the removed packages
29 mkdir -p ../texlive/removed
30 echo "$f" >> ../texlive/removed/$pkgname.txt
31 rm -f "$f"
33 done < "${XBPS_COMMONDIR}/environment/build-style/texmf/ownership.txt"
36 do_check() {
37 # This is essentially a helper for generating the ownership map. It checks
38 # to see if there are any conflicts between all of the different packages.
39 local f p current_ver current_rev exitcode=0
40 cd build
42 while read p; do
43 # Don't check against the texlive-bin* packages, ourselves, -dbg or -32bit pkgs
44 if [[ ${p%-*} =~ .*-bin$ ]] || [ "${p%-*}" = "$pkgname" ] || [[ ${p%-*} =~ .*-dbg$ ]] || [[ ${p%-*} =~ .*-32bit$ ]]; then
45 continue
47 # Don't check against any version other than the version in the source tree
48 current_ver="$(grep -m 1 version= ${XBPS_SRCPKGDIR}/${p%-*}/template | cut -d= -f2)"
49 current_rev="$(grep -m 1 revision= ${XBPS_SRCPKGDIR}/${p%-*}/template | cut -d= -f2)"
50 if [ "${p%-*}-${current_ver}_${current_rev}" != "${p}" ]; then
51 # They are not the same version
52 continue
54 echo checking conflicts with ${p}...
55 while IFS= read -r f; do
56 if [ -e ".$f" ]; then
57 msg_red "both contain file $f\n"
58 exitcode=1
60 done < <(xbps-query -Rf $p | sed 's/ -> .*//')
61 done < <(xbps-query -Rs texlive -p pkgver | cut -d : -f 1)
62 return $exitcode
65 do_install() {
66 vcopy build/usr .