Last active
August 22, 2021 20:27
-
-
Save jmairboeck/df92d13e7179cd22ff15c4d7e809a955 to your computer and use it in GitHub Desktop.
Haiku texlive packaging scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/perl | |
# Helper script to generate the package metadata definitions for the texlive_texmf subpackages | |
# usage: | |
# perl -I $sourceDir3 getpackageinfos.pl <tlpdbroot> | |
# | |
# <tlpdbroot> is the root of the TeXLive package database, containing tlpkg/texlive.tlpdb. | |
# It also needs the texmf-dist directory to work. | |
# After these have been symlinked to $sourceDir (by the fetchTeXLiveInstaller function in the recipe), | |
# $sourceDir can be used. | |
# | |
# This script uses the TeXLive perl modules, therefore it needs $sourceDir3 (the texlive-extra tarball) in @INC. | |
use strict; | |
use warnings; | |
use TeXLive::TLPDB; | |
my $tlpdb = TeXLive::TLPDB->new(root => $ARGV[0]); | |
my @collections = $tlpdb->collections(); | |
for my $collectionPkgName (@collections) { | |
my $collection = substr $collectionPkgName, 11; | |
my $collectionPkg = $tlpdb->get_package($collectionPkgName); | |
my $shortdesc = $collectionPkg->shortdesc(); | |
my $longdesc = $collectionPkg->longdesc(); | |
my @depends = $collectionPkg->depends(); | |
my @runfiles; | |
my @docfiles; | |
my @srcfiles; | |
for my $depName (@depends) { | |
my $depPkg = $tlpdb->get_package($depName); | |
push @runfiles, $depPkg->runfiles(); | |
push @docfiles, $depPkg->docfiles(); | |
push @srcfiles, $depPkg->srcfiles(); | |
} | |
if (@runfiles) { | |
print "SUMMARY_$collection=\"TeXLive Collection: $shortdesc\"\n"; | |
print "DESCRIPTION_$collection=\"$longdesc\"\n" if $longdesc; | |
print "PROVIDES_$collection=\"\n"; | |
print "\ttexlive_texmf_$collection = \$portVersion\n"; | |
print "\t\"\n"; | |
print "REQUIRES_$collection=\"\n"; | |
print "\thaiku\n"; | |
print "\ttexlive_texmf = \$portVersion base\n"; | |
for my $dep (@depends) { | |
print "\ttexlive_texmf_", substr($dep, 11), "\n" if rindex($dep, "collection-", 0) == 0; | |
} | |
print "\t\"\n"; | |
print "REQUIRES_full+=\"\n"; | |
print "\ttexlive_texmf_$collection\n"; | |
print "\t\"\n"; | |
print "subpackages+=($collection)\n"; | |
} | |
if (@docfiles) { | |
print "SUMMARY_${collection}_doc=\"TeXLive Collection: $shortdesc (documentation)\"\n"; | |
print "DESCRIPTION_${collection}_doc=\"$longdesc\"\n" if $longdesc; | |
print "PROVIDES_${collection}_doc=\"\n"; | |
print "\ttexlive_texmf_${collection}_doc = \$portVersion\n"; | |
print "\t\"\n"; | |
print "REQUIRES_${collection}_doc=\"\n"; | |
print "\thaiku\n"; | |
print "\ttexlive_texmf = \$portVersion base\n"; | |
print "\t\"\n"; | |
print "REQUIRES_full_doc+=\"\n"; | |
print "\ttexlive_texmf_${collection}_doc\n"; | |
print "\t\"\n"; | |
print "subpackages+=(${collection}_doc)\n"; | |
} | |
if (@srcfiles) { | |
print "SUMMARY_${collection}_source=\"TeXLive Collection: $shortdesc (source files)\"\n"; | |
print "DESCRIPTION_${collection}_source=\"$longdesc\"\n" if $longdesc; | |
print "PROVIDES_${collection}_source=\"\n"; | |
print "\ttexlive_texmf_${collection}_source = \$portVersion\n"; | |
print "\t\"\n"; | |
print "REQUIRES_${collection}_source=\"\n"; | |
print "\thaiku\n"; | |
print "\ttexlive_texmf = \$portVersion base\n"; | |
print "\t\"\n"; | |
print "REQUIRES_full_source+=\"\n"; | |
print "\ttexlive_texmf_${collection}_source\n"; | |
print "\t\"\n"; | |
print "subpackages+=(${collection}_source)\n"; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/perl | |
# Helper script to get the packageEntries for texlive_texmf subpackages | |
# usage: | |
# perl -I $sourceDir3 printfiles.pl <prefix> <collectionname> | |
# | |
# <prefix> is the root of the installation, containing tlpkg/texlive.tlpdb, i.e. $dataDir/texlive | |
# <collectionname> is the base name of the subpackage without prefix | |
# | |
# This script uses the TeXLive perl modules, therefore it needs $sourceDir3 (the texlive-extra tarball) in @INC. | |
use strict; | |
use warnings; | |
use TeXLive::TLPDB; | |
my $tlpdb = TeXLive::TLPDB->new(root => $ARGV[0]); | |
my ($collection, $suffix) = split "_", $ARGV[1]; | |
my $tlpkg = $tlpdb->get_package("collection-$collection"); | |
my @depnames = $tlpkg->depends(); | |
foreach my $depname (@depnames) { | |
my $deppkg = $tlpdb->get_package($depname); | |
my $filesfield = do { | |
unless (defined $suffix) { "runfiles" } | |
elsif ($suffix eq "doc") { "docfiles" } | |
elsif ($suffix eq "source") { "srcfiles" } | |
}; | |
my @files = @{$deppkg->{$filesfield}}; | |
foreach my $filename (@files) { | |
print $ARGV[0], $filename, "\n"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment