Ticket #18014: createSubpackageInfos.pl.mhtml

File createSubpackageInfos.pl.mhtml, 5.0 KB (added by jmairboeck, 19 months ago)

the saved file

Line 
1From: <Saved by WebKit>
2Subject:
3Date: Mon, 23 Oct 2022 19:42:56 +0200
4MIME-Version: 1.0
5Content-Type: multipart/related;
6 type="text/html";
7 boundary="----=_NextPart_000_5219_3F9F082D.D6A94958"
8
9------=_NextPart_000_5219_3F9F082D.D6A94958
10Content-Type: text/html
11Content-Transfer-Encoding: quoted-printable
12Content-Location: https://gist.githubusercontent.com/jmairboeck/ceb5e9d51a7716c07b4e22936d56e087/raw/abd0c3e262970bfdbb323a119e8d72949bce8558/createSubpackageInfos_provides.pl
13
14<html><head><meta charset=3D"UTF-8"></head><body><pre style=3D"word-wrap: b=
15reak-word; white-space: pre-wrap;">#!/bin/perl
16# Copyright 2021, Joachim Mairb=C3=B6ck &lt;j.mairboeck@gmail.com&gt;
17# Distributed under the terms of the MIT license.
18
19# Helper script to generate the package metadata definitions for the texliv=
20e subpackages
21# usage:
22# perl -I $sourceDir/tlpkg createSubpackageInfos.pl &lt;tlpdbroot&gt; &gt;=
23 subpackageInfos.recipe
24#
25# &lt;tlpdbroot&gt; is the root of the TeXLive package database, containing=
26 tlpkg/texlive.tlpdb.
27# It also needs the texmf-dist directory to work.
28# After these have been symlinked to $sourceDir (by the BUILD function in =
29the recipe),
30# $sourceDir can be used inside the haikuporter chroot.
31# Alternatively, after the installation of the texlive package,
32# /boot/system/data/texlive can be used.
33#
34# This script uses the TeXLive perl modules, therefore it needs $sourceDir/=
35tlpkg in @INC.
36
37use strict;
38use warnings;
39
40use TeXLive::TLPDB;
41
42print "# This file has been generated by createSubpackageInfos.pl\n\n";
43
44my $tlpdb =3D TeXLive::TLPDB-&gt;new(root =3D&gt; $ARGV[0]);
45my @collections =3D $tlpdb-&gt;collections();
46
47for my $collectionPkgName (@collections) {
48 my $collection =3D substr $collectionPkgName, 11;
49 my $collectionPkg =3D $tlpdb-&gt;get_package($collectionPkgName);
50 my $shortdesc =3D $collectionPkg-&gt;shortdesc();
51 my $longdesc =3D $collectionPkg-&gt;longdesc();
52 if (length $shortdesc &gt;=3D 44) { # SUMMARY must not exceed 80 character=
53s in total
54 $shortdesc =3D substr($shortdesc, 0, 42) . "=E2=80=A6";
55 }
56 if ($shortdesc =3D~ /\.$/) { # SUMMARY must not end in a '.'
57 $shortdesc =3D substr($shortdesc, 0, -1);
58 }
59 $shortdesc =3D~ s'`'\`'g; # escape '`' characters
60 $longdesc =3D~ s'`'\`'g if $longdesc;
61 my @depends =3D $collectionPkg-&gt;depends();
62 my @runfiles;
63 my @docfiles;
64 my @srcfiles;
65 for my $depName (@depends) {
66 my $depPkg =3D $tlpdb-&gt;get_package($depName);
67 push @runfiles, $depPkg-&gt;runfiles();
68 push @docfiles, $depPkg-&gt;docfiles();
69 push @srcfiles, $depPkg-&gt;srcfiles();
70 }
71 if (@runfiles) {
72 print "SUMMARY_$collection=3D\"TeXLive Collection: $shortdesc\"\n";
73 print "DESCRIPTION_$collection=3D\"$longdesc\"\n" if $longdesc;
74 print "PROVIDES_$collection=3D\"\n";
75 print "\ttexlive_texmf_$collection =3D \$portVersion\n";
76 for my $dep (@depends) {
77 if ($dep !~ /^collection-/) {
78 my $version =3D $tlpdb-&gt;get_package($dep)-&gt;cataloguedata()-&gt;{'=
79version'};
80 $dep =3D~ s/-/_/g;
81 print "\ttex:", $dep;
82 # ignore version for now, they would need some transformation to be usa=
83ble
84 # print " =3D $version" if $version;
85 print "\n";
86 }
87 }
88 print "\t\"\n";
89 print "REQUIRES_$collection=3D\"\n";
90 print "\thaiku\n";
91 print "\ttexlive_texmf =3D=3D \$portVersion base\n";
92 for my $dep (@depends) {
93 print "\ttexlive_texmf_", substr($dep, 11), "\n" if $dep =3D~ /^collecti=
94on-/;
95 }
96 print "\t\"\n";
97 print "REQUIRES_full+=3D\"\n";
98 print "\ttexlive_texmf_$collection\n";
99 print "\t\"\n";
100 print "POST_INSTALL_SCRIPTS_$collection=3D\"\$relativePostInstallDir/texl=
101ive_postinstall.sh\"\n";
102 print "subpackages+=3D($collection)\n";
103 }
104 if (@docfiles) {
105 print "SUMMARY_${collection}_doc=3D\"TeXLive Collection: $shortdesc (docu=
106mentation)\"\n";
107 print "DESCRIPTION_${collection}_doc=3D\"$longdesc\"\n" if $longdesc;
108 print "PROVIDES_${collection}_doc=3D\"\n";
109 print "\ttexlive_texmf_${collection}_doc =3D \$portVersion\n";
110 print "\t\"\n";
111 print "REQUIRES_${collection}_doc=3D\"\n";
112 print "\thaiku\n";
113 print "\ttexlive_texmf =3D=3D \$portVersion base\n";
114 print "\t\"\n";
115 print "REQUIRES_full_doc+=3D\"\n";
116 print "\ttexlive_texmf_${collection}_doc\n";
117 print "\t\"\n";
118 print "subpackages+=3D(${collection}_doc)\n";
119 }
120 if (@srcfiles) {
121 print "SUMMARY_${collection}_source=3D\"TeXLive Collection: $shortdesc (s=
122ource files)\"\n";
123 print "DESCRIPTION_${collection}_source=3D\"$longdesc\"\n" if $longdesc;
124 print "PROVIDES_${collection}_source=3D\"\n";
125 print "\ttexlive_texmf_${collection}_source =3D \$portVersion\n";
126 print "\t\"\n";
127 print "REQUIRES_${collection}_source=3D\"\n";
128 print "\thaiku\n";
129 print "\ttexlive_texmf =3D=3D \$portVersion base\n";
130 print "\t\"\n";
131 print "REQUIRES_full_source+=3D\"\n";
132 print "\ttexlive_texmf_${collection}_source\n";
133 print "\t\"\n";
134 print "subpackages+=3D(${collection}_source)\n";
135 }
136}
137
138</pre></body></html>
139------=_NextPart_000_5219_3F9F082D.D6A94958--