#!/bin/bash # Copyright (C) 2005 - 2025 René Rebe, ExactCODE GmbH; Germany. # # Parse the *.desc file. Use the description from PKG-DESC-FORMAT and # save the tag data in $desc_*. # parse_desc() { local tag="`sed -n '/^\[/ { s/][^]]*$//; s/. ./|/g; s/^\[//; p }' \ $base/misc/share/PKG-DESC-FORMAT`" for tag in $tag ; do tagdata="`egrep "^\[($tag)\]" $confdir/$1.desc | \ cut -f2- -d']' | sed 's,^ ,,'`" tag="`echo $tag | cut -f1 -d'|' | tr - _`" eval "desc_$tag=\"\$tagdata\"" done ver="`echo "$desc_V" | tail -n 1 | cut -f1 -d' '`" extraver="`echo "$desc_V" | tail -n 1 | cut -s -f2- -d' '`" [ -z "$extraver" ] && extraver="${rockver//DEV-*/DEV}" } # The usual web e-mail address mangling, ... # mangle_addr() { echo -e "${*/>/>\n}" | sed '/<[^>]*>/{h; s/.*<\([^>]*\)>/\1/; s/\./ [dot] /g; s/@/ [at] /; G; s/\(.*\)\n\(.*<\)[^>]*\(>.*\)/\2\1\3/ }' | tr -d '\n' | sed 's//\>/g' } # Print a single package in HTML. # print_package() { base="$1" pkg="$2" confdir=`echo $base/package/*/$pkg` repo="${confdir%/*}"; repo="${repo##*/}" # does the package exist? if not -> 404 [ -e $confdir/$pkg.desc ] || exit 1 local t2src="//svn.exactcode.de/t2/trunk" parse_desc $pkg # guard against multi-tags desc_I="${desc_I// */}" ( cat <<-EOT
EOT echo -e "\n

$pkg: $desc_I1

\n" echo "

$desc_T

" | sed 's,^$,

,' echo '

... part of T2, get it here

' cat <<-EOT
EOT IFS=" " echo "

" for x in $desc_U ; do url="${x/ */}" comment="${x#$url}" echo "URL: $url$comment
" done echo "

" IFS=" " echo "

" for x in $desc_A ; do echo "Author: `mangle_addr $x`
" done for x in $desc_M ; do echo "Maintainer: `mangle_addr $x`
" done echo "

" echo "

License: $desc_L
" echo "Status: $desc_S
" echo "Version: $desc_V

" IFS=" " echo "

" for x in $desc_F ; do case $x in CROSS) x="Does cross compile (as setup and patched in T2)." ;; NOPARALLEL) x="Does not allow parallel builds." ;; DIETLIBC) x="Dietlibc compatible." ;; JAIL) x="Includes jailing support." ;; BINARY) x="Is binary only (not build from source)!." ;; *) x="" ;; esac [ "$x" ] && echo "Remark: $x
" done echo "

" if [ "$desc_R" ]; then ( set -- $desc_R case $1 in -) echo "

CPU architectures: Does not support:" ;; +) echo "

CPU architectures: Does only support:" ;; esac shift; for x; do echo " $x" done echo "

" ) fi IFS=" " echo "

" for x in $desc_D; do local file="${x/* /}" if [[ "$file" = \!* ]] ; then file="${file/\!/}" elif [[ "$file" = -manual://* ]]; then file="`echo $x | sed 's,[^ ]* *\([^ ]*\) *\(.*\),\2 \1,'`" else file="`echo $x | sed 's,[^ ]* *\([^ ]*\) *\(.*\),\2\1,'`" fi local dir="$(echo $file | sed -f $base/misc/share/CVTranslations)" file="`echo $file | sed -f $base/misc/share/DownloadTranslations`" dir="${dir#git+}" file="${file#git+}" if [[ "$file" == -manual://* ]]; then file="http://${file#-manual://}" echo "Manual download: `echo $file | sed 's,\([^ ]*\) \(.*\),\1 \2,'`
" else dir="${dir%/*}/" echo "Download: $dir ${file##*/}
" fi done echo "

" echo "

" for x in `find $confdir ! -path '*/.*' -type f | sort` ; do echo "T2 source: ${x#$confdir/}
" done echo "

" bt="`grep BUILDTIME $confdir/$pkg.cache 2> /dev/null | cut -d ' ' -f 2`" size="`grep "\[SIZE\]" $confdir/$pkg.cache 2> /dev/null | sed -e 's/\[SIZE\] //'`" deps="`grep "\[DEP\]" $confdir/$pkg.cache 2> /dev/null | sed -e 's/\[DEP\] //' | tr '\n' ' '`" [ "$bt" ] && bt="${bt}% (relative to binutils)2" echo "

Build time (on reference hardware): ${bt:-n.a.}

" echo "

Installed size (on reference hardware): ${size:-n.a.}

" echo "

Dependencies (build time detected): " IFS=" " if [ "$deps" ]; then for x in $deps; do echo "$x" done else echo "n.a." fi echo "

" echo "

Installed files (on reference hardware): " if [ ! -f $base/flists/$pkg ]; then echo "n.a.

" else cat <<-EOT [show]
" fi echo -e "

1) This page was automatically generated from the T2 package source. Corrections, such as dead links, URL changes or typos need to be performed directly on that source.

2) Compatible with Linux From Scratch's \"Standard Build Unit\" (SBU).

" cat <<-EOT
EOT ) } # AWK program taken from T2 for quick indexing. # main_awk_index() { echo ' END { if (repo) print_package(); } (FNR == 1 && repo) { print_package(); } FNR == 1 { split(FILENAME, a, /\//); repo=a[1]; package=a[2]; defset="X"; pri="999.999"; stages="-----------"; ver="0000"; categories="" ver_dup=0; flags="" license="" title="" } /^\[(P|PRI|PRIORITY)\]/ { split($0, a, /[ \t]+/); defset=a[2]; stages=a[3]; pri=a[4]; } /^\[(V|VER|VERSION)\]/ { split($0, a, /[ \t]+/); if ( ver_dup == 0 ) ver=a[2]; ver_dup = 1; } /^\[(C|CATEGORY)\]/ { split($0, a, /[ \t]+/); for (c=2; a[c]; c++) categories = categories " " a[c]; } /^\[(F|FLAGS)\]/ { split($0, a, /[ \t]+/); for (c=2; a[c]; c++) flags = flags " " a[c]; } /^\[(R|ARCH|ARCHITECTURE)\]/ { n=split($0, a, /[ \t]+/); } /^\[(L|LICENSE)\]/ { split($0, a, /[ \t]+/); for (c=2; a[c]; c++) license = license " " a[c]; } /^\[(I|TITLE)\]/ { split($0, a, /[ \t]+/); for (c=2; a[c]; c++) title = title " " a[c]; } ' } # Pretty print the whole index (in HTML). # print_index() { cat <<-EOT

T2 SDE - packages

T2 comes with an extensive list of package meta data descriptions, defining how to build packages from the source. You can think of them like recipes.

This is an automatically generated list of all packages currently available in T2.

EOT (cd $1; gawk -f - */*/*.desc | sort) <<-EOT function print_package() { print ""; } $(main_awk_index) EOT cat <<-EOT
Package name - TitleVersionRepositoryLicense
" package \ " - " title "" ver "" repo "" license "
EOT } # Just a plain/text list of the whole index (for Distrowatch). # text_print_index() { (cd $1; gawk -f - */*/*.desc) <<-EOT function print_package() { print package " " ver " " repo; } $(main_awk_index) EOT } # The main handler. # repo=${1#packages} repo=${repo%/*} repo=${repo#/} if [[ "$1" = *index.html ]]; then print_index $PWD/${1%/*}/package elif [[ "$1" = *index.txt ]]; then text_print_index $PWD/${1%/*}/package else # .html is "optional" pkg=${1##*/}; pkg=${pkg%.html} print_package $PWD/${1%/*} $pkg fi