From 7f9f47e4b6cd389bae73c5b35bbcfc197e145994 Mon Sep 17 00:00:00 2001 From: Thorsten Glaser Date: Fri, 13 May 2011 12:23:18 +0000 Subject: [PATCH] =?utf8?q?prepare=20for=20debian=20package=20repository,?= =?utf8?q?=20as=20discussed=20on=20today=E2=80=99s=20meeting?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit • unmodified mkdebidx.sh from MirBSD CVS (will be changed in later commits) • basic directory structure for both Debian and *buntu packages (we use hardy and lenny as baselines; their packages can be used with newer distros as well) • svn:ignore properties for generated files --- .gitattributes | 3 + .gitignore | 63 +++ htdocs/deb-repo/dists/hardy/distinfo.sh | 10 + htdocs/deb-repo/dists/lenny/distinfo.sh | 10 + htdocs/deb-repo/mkdebidx.sh | 619 ++++++++++++++++++++++++ 5 files changed, 705 insertions(+) create mode 100644 htdocs/deb-repo/dists/hardy/distinfo.sh create mode 100644 htdocs/deb-repo/dists/lenny/distinfo.sh create mode 100755 htdocs/deb-repo/mkdebidx.sh diff --git a/.gitattributes b/.gitattributes index f09322825b..51c5bc411d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -72,6 +72,9 @@ delivery/novaforge/package/config -text /fix_phpunit.xslt -text svneol=unset#text/xml hook/ubuntu/G00ubukey -text htdocs/box-grad2.png -text svneol=unset#image/png +htdocs/deb-repo/dists/hardy/distinfo.sh -text +htdocs/deb-repo/dists/lenny/distinfo.sh -text +htdocs/deb-repo/mkdebidx.sh -text htdocs/favicon.ico -text htdocs/fusionforge-resized-transp.png -text svneol=unset#image/png htdocs/gforge47etch.jpg -text svneol=unset#image/jpeg diff --git a/.gitignore b/.gitignore index 90a1bfe1b6..7a165a869a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,65 @@ +htdocs/deb-repo/debidx.htm +htdocs/deb-repo/dists/hardy/3rd-party/binary-all +htdocs/deb-repo/dists/hardy/3rd-party/binary-alpha +htdocs/deb-repo/dists/hardy/3rd-party/binary-amd64 +htdocs/deb-repo/dists/hardy/3rd-party/binary-arm +htdocs/deb-repo/dists/hardy/3rd-party/binary-armeb +htdocs/deb-repo/dists/hardy/3rd-party/binary-armel +htdocs/deb-repo/dists/hardy/3rd-party/binary-armhf +htdocs/deb-repo/dists/hardy/3rd-party/binary-avr32 +htdocs/deb-repo/dists/hardy/3rd-party/binary-hppa +htdocs/deb-repo/dists/hardy/3rd-party/binary-i386 +htdocs/deb-repo/dists/hardy/3rd-party/binary-ia64 +htdocs/deb-repo/dists/hardy/3rd-party/binary-kfreebsd-amd64 +htdocs/deb-repo/dists/hardy/3rd-party/binary-kfreebsd-i386 +htdocs/deb-repo/dists/hardy/3rd-party/binary-lpia +htdocs/deb-repo/dists/hardy/3rd-party/binary-m32r +htdocs/deb-repo/dists/hardy/3rd-party/binary-m68k +htdocs/deb-repo/dists/hardy/3rd-party/binary-mips +htdocs/deb-repo/dists/hardy/3rd-party/binary-mipsel +htdocs/deb-repo/dists/hardy/3rd-party/binary-powerpc +htdocs/deb-repo/dists/hardy/3rd-party/binary-powerpcspe +htdocs/deb-repo/dists/hardy/3rd-party/binary-ppc64 +htdocs/deb-repo/dists/hardy/3rd-party/binary-s390 +htdocs/deb-repo/dists/hardy/3rd-party/binary-s390x +htdocs/deb-repo/dists/hardy/3rd-party/binary-sh3 +htdocs/deb-repo/dists/hardy/3rd-party/binary-sh3eb +htdocs/deb-repo/dists/hardy/3rd-party/binary-sh4 +htdocs/deb-repo/dists/hardy/3rd-party/binary-sh4eb +htdocs/deb-repo/dists/hardy/3rd-party/binary-sparc +htdocs/deb-repo/dists/hardy/3rd-party/source +htdocs/deb-repo/dists/hardy/Release +htdocs/deb-repo/dists/hardy/Release.gpg +htdocs/deb-repo/dists/lenny/3rd-party/binary-all +htdocs/deb-repo/dists/lenny/3rd-party/binary-alpha +htdocs/deb-repo/dists/lenny/3rd-party/binary-amd64 +htdocs/deb-repo/dists/lenny/3rd-party/binary-arm +htdocs/deb-repo/dists/lenny/3rd-party/binary-armeb +htdocs/deb-repo/dists/lenny/3rd-party/binary-armel +htdocs/deb-repo/dists/lenny/3rd-party/binary-armhf +htdocs/deb-repo/dists/lenny/3rd-party/binary-avr32 +htdocs/deb-repo/dists/lenny/3rd-party/binary-hppa +htdocs/deb-repo/dists/lenny/3rd-party/binary-i386 +htdocs/deb-repo/dists/lenny/3rd-party/binary-ia64 +htdocs/deb-repo/dists/lenny/3rd-party/binary-kfreebsd-amd64 +htdocs/deb-repo/dists/lenny/3rd-party/binary-kfreebsd-i386 +htdocs/deb-repo/dists/lenny/3rd-party/binary-lpia +htdocs/deb-repo/dists/lenny/3rd-party/binary-m32r +htdocs/deb-repo/dists/lenny/3rd-party/binary-m68k +htdocs/deb-repo/dists/lenny/3rd-party/binary-mips +htdocs/deb-repo/dists/lenny/3rd-party/binary-mipsel +htdocs/deb-repo/dists/lenny/3rd-party/binary-powerpc +htdocs/deb-repo/dists/lenny/3rd-party/binary-powerpcspe +htdocs/deb-repo/dists/lenny/3rd-party/binary-ppc64 +htdocs/deb-repo/dists/lenny/3rd-party/binary-s390 +htdocs/deb-repo/dists/lenny/3rd-party/binary-s390x +htdocs/deb-repo/dists/lenny/3rd-party/binary-sh3 +htdocs/deb-repo/dists/lenny/3rd-party/binary-sh3eb +htdocs/deb-repo/dists/lenny/3rd-party/binary-sh4 +htdocs/deb-repo/dists/lenny/3rd-party/binary-sh4eb +htdocs/deb-repo/dists/lenny/3rd-party/binary-sparc +htdocs/deb-repo/dists/lenny/3rd-party/source +htdocs/deb-repo/dists/lenny/Release +htdocs/deb-repo/dists/lenny/Release.gpg src/www/scm/viewvc/viewvc.org/*.tar.gz src/www/scm/viewvc/viewvc.org/*.zip diff --git a/htdocs/deb-repo/dists/hardy/distinfo.sh b/htdocs/deb-repo/dists/hardy/distinfo.sh new file mode 100644 index 0000000000..fade264ef6 --- /dev/null +++ b/htdocs/deb-repo/dists/hardy/distinfo.sh @@ -0,0 +1,10 @@ +# encoding: UTF-8 + +# Plain text (multiple words) +archs='all amd64 i386' + +# Plain text (one word) +nick=Hardy + +# HTML +desc="Kubuntu Hardy Heron (8.04 LTS)" diff --git a/htdocs/deb-repo/dists/lenny/distinfo.sh b/htdocs/deb-repo/dists/lenny/distinfo.sh new file mode 100644 index 0000000000..ed16e1020f --- /dev/null +++ b/htdocs/deb-repo/dists/lenny/distinfo.sh @@ -0,0 +1,10 @@ +# encoding: UTF-8 + +# Plain text (multiple words) +archs='all amd64 i386' + +# Plain text (one word) +nick=Lenny + +# HTML +desc="Debian Lenny (5.0)" diff --git a/htdocs/deb-repo/mkdebidx.sh b/htdocs/deb-repo/mkdebidx.sh new file mode 100755 index 0000000000..e28ef86b87 --- /dev/null +++ b/htdocs/deb-repo/mkdebidx.sh @@ -0,0 +1,619 @@ +#!/bin/mksh +rcsid='$MirOS: contrib/hosted/tg/deb/mkdebidx.sh,v 1.47 2011/04/27 12:59:06 tg Exp $' +#- +# Copyright (c) 2008, 2009, 2010, 2011 +# Thorsten Glaser +# +# Provided that these terms and disclaimer and all copyright notices +# are retained or reproduced in an accompanying document, permission +# is granted to deal in this work without restriction, including un- +# limited rights to use, publicly perform, distribute, sell, modify, +# merge, give away, or sublicence. +# +# This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to +# the utmost extent permitted by applicable law, neither express nor +# implied; without malicious intent or gross negligence. In no event +# may a licensor, author or contributor be held liable for indirect, +# direct, other damage, loss, or other issues arising in any way out +# of dealing in the work, even if advised of the possibility of such +# damage or existence of a defect, except proven that it results out +# of said person's immediate fault when using the work as intended. + +set -A normarchs -- i386 +repo_keyid=0x405422DD +# either '' (locally) or 'remsign user@host.domain.com' (remote ssh) +gpg_remote= +repo_origin='The MirOS Project' +repo_label=wtf +repo_title='MirDebian “WTF” Repository' +function repo_description { + typeset suite_nick=$1 + + print -nr -- "WTF ${suite_nick} Repository" +} + + +set -A dpkgarchs -- alpha amd64 arm armeb armel armhf avr32 hppa \ + i386 ia64 kfreebsd-amd64 kfreebsd-i386 lpia m32r m68k mips mipsel \ + powerpc powerpcspe ppc64 s390 s390x sh3 sh3eb sh4 sh4eb sparc + +function remsign { + target=$1; shift + master=remsign.ctl$$ + tmpfnm=remsign.tmp$$ + ssh -fNM -o ControlPath=$tmpfnm "$target" + ssh -o ControlPath=$tmpfnm "$target" cat \>$tmpfnm + ssh -o ControlPath=$tmpfnm -t "$target" "$* $tmpfnm" 0<&2 1>&2 + rv=$? + ssh -o ControlPath=$tmpfnm "$target" "cat $tmpfnm.sig; rm -f $tmpfnm $tmpfnm.sig" + ssh -o ControlPath=$tmpfnm "$target" -O exit + return $rv +} + +function putfile { + tee $1 | gzip -n9 >$1.gz +} + +function sortlist { + typeset x u=$1 + + if [[ $u = -u ]]; then + shift + else + u= + fi + + for x in "$@"; do + print -r -- "$x" + done | sort $u +} + +# DJB cdb hash (not via stdio, for speed) +typeset -Z11 -Uui16 Lcdbhash_result +function Lcdbhash_add { + typeset s="$*" + typeset -i i=0 n=${#s} + + while (( i < n )); do + ((# Lcdbhash_result = (Lcdbhash_result * 33) ^ 1#${s:(i++):1} )) + done +} + +set +U +export LC_ALL=C +unset LANGUAGE +saveIFS=$IFS +cd "$(dirname "$0")" +rm -f dpkg_578162_workaround + +IFS=: +dpkgarchl=:all:"${dpkgarchs[*]}": +IFS=$saveIFS + +suites=: +for suite in "$@"; do + suites=:dists/$suite$suites +done + +allsuites= +for suite in dists/*; do + allsuites="$allsuites${allsuites:+ }${suite##*/}" + [[ $suites = : || $suites = *:"$suite":* ]] || continue + archs= + . $suite/distinfo.sh + suitearchs=${archs:-${normarchs[*]}} + components=Components: + for dist in $suite/*; do + [[ -d $dist/. ]] || continue + rm -rf $dist/binary-* $dist/source + ovf= oef= osf= + [[ -s $dist/override.file ]] && ovf=$dist/override.file + [[ -s $dist/override.extra ]] && oef="-e $dist/override.extra" + [[ -s $dist/override.src ]] && osf="-s $dist/override.src" + components="$components ${dist##*/}" + archs= + [[ -s $dist/distinfo.sh ]] && . $dist/distinfo.sh + set -A distarchs -- $(sortlist -u all ${archs:-$suitearchs}) + IFS=:; distarchl=:"${distarchs[*]}":; IFS=$saveIFS + for arch in $(sortlist -u ${distarchs[*]} ${dpkgarchs[*]}); do + if [[ $dpkgarchl != *:"$arch":* ]]; then + print -u2 "Invalid arch '$arch' in $dist" + exit 1 + elif [[ $distarchl != *:"$arch":* ]]; then + print "\n===> Linking all =>" \ + "${dist#dists/}/$arch/Packages" + ln -s binary-all $dist/binary-$arch + else + print "\n===> Creating" \ + "${dist#dists/}/$arch/Packages\n" + mkdir -p $dist/binary-$arch + dpkg-scanpackages $oef -m -a $arch \ + $dist $ovf | \ + putfile $dist/binary-$arch/Packages + fi + done + print "\n===> Creating ${dist#dists/}/Sources" + mkdir -p $dist/source + [[ -e dpkg_578162_workaround ]] || (dpkg-scansources $oef $osf \ + $dist $ovf || touch dpkg_578162_workaround) | \ + putfile $dist/source/Sources + [[ -e dpkg_578162_workaround ]] && dpkg-scansources $osf \ + $dist $ovf | \ + putfile $dist/source/Sources + print done. + done + print "\n===> Creating ${suite#dists/}/Release.gpg" + rm -f $suite/Release* + (cat <<-EOF + Origin: ${repo_origin} + Label: ${repo_label} + Suite: ${suite##*/} + Codename: ${suite##*/} + Date: $(date -u) + Architectures: all ${dpkgarchs[*]} source + $components + Description: $(repo_description "$nick") + MD5Sum: + EOF + cd $suite + set -A cache_fn + set -A cache_md5 + set -A cache_size + for n in Contents-* */{binary-*,source}/{Packag,Sourc}es*; do + [[ -f $n ]] || continue + # realpath-ise $n and cache the checksum + nn=$(realpath "$n") + #XXX once mksh can, use associative arrays instead + Lcdbhash_result=5381 + Lcdbhash_add "$nn" + # simple hash collision solver by increment + nc=${cache_fn[Lcdbhash_result]} + while [[ -n $nc && $nc != "$nn" ]]; do + nc=${cache_fn[++Lcdbhash_result]} + done + if [[ $nc = "$nn" ]]; then + nm=${cache_md5[Lcdbhash_result]} + ns=${cache_size[Lcdbhash_result]} + else + set -A x -- $(md5sum "$nn") + nm=${x[0]} + ns=$(stat -c '%s' "$nn") + cache_md5[Lcdbhash_result]=$nm + cache_size[Lcdbhash_result]=$ns + cache_fn[Lcdbhash_result]=$nn + fi + print " $nm $ns $n" + done) >$suite/Release + $gpg_remote gpg -u $repo_keyid -sb <$suite/Release >$suite/Release.gpg +done + +print "\n===> Creating debidx.htm\n" + +set -A preplsrc +set -A prepldst +integer nsrc=0 nbin=0 nrpl=0 +br='
' + +# syntax: ${suitename}/${distname}/${pN}/${pp} +# example: sid/wtf/openntpd/i386 lenny +if [[ -s mkdebidx.lnk ]]; then + while read pn pd; do + [[ $pn = '#'* ]] && continue + if [[ $pn != +([a-z0-9_])/+([a-z0-9_-])/+([!/])/@(%|=|+([a-z0-9])) || \ + $pd != +([a-z0-9_]) ]]; then + print -u2 "Invalid lnk line '$pn' '$pd'" + continue + fi + preplsrc[nrpl]=$pn + prepldst[nrpl++]=$pd + done $pv" + pv="$pp: $pv" + eval x=\${bp_ver_${suitename}[i]} + [[ $br$x$br = *"$br$pv$br"* ]] || x=$x${x:+$br}$pv + eval bp_ver_${suitename}[i]=\$x + bp_desc[i]=$pd + fi + pn=; pv=; pd=; pp=; pN=; pf=; Lf= + ;; + } + done + done +done + +(cat <<'EOF' + + + + + +EOF +print -r -- " ${repo_title} Index" +cat <<'EOF' + + + +EOF +print -r -- "

${repo_title}

" +cat <<'EOF' +

Browse the repository or read about how to amend /etc/apt/sources.list in order to use it. +EOF +[[ -s 0-NOTE.txt ]] && print ' Also read my notes.' +cat <${repo_keyid} + as signing key. +

+

Suites

+
    +EOF + +allsuites=$(for suitename in $allsuites; do + print $suitename +done | sort -u) + +for suitename in $allsuites; do + suite=dists/$suitename + . $suite/distinfo.sh + print -n "
  • ${suite##*/}: $desc (dists:" + for dist in $suite/*; do + [[ -d $dist/. ]] || continue + distname=${dist##*/} + print -n " $distname" + done + print ")
  • " +done +print "
" +print "

Packages

" +print "" +print "" +print " " +print " " +for suitename in $allsuites; do + print " " +done +print "" +print " " +print "" + +set -A bp_sort +i=0 +while (( i < nbin )); do + print $i ${bp_disp[i++]} #${bp_suites[i]} +done | sort -k2 |& +while read -p num rest; do + bp_sort[${#bp_sort[*]}]=$num +done + +i=0 +while (( i < nsrc )); do + print $i ${sp_name[i++]} +done | sort -k2 |& +while read -p num rest; do + print "\n" + print "" + print " " + pd= + for x in $(tr ', ' '\n' <<<"${sp_desc[num]}" | sort -u); do + [[ -n $x ]] && pd="$pd, $x" + done + print " " + for suitename in $allsuites; do + eval pvo=\${sp_ver_${suitename}[num]} + eval ppo=\${sp_dir_${suitename}[num]} + IFS=, + set -A pva -- $pvo + set -A ppa -- $ppo + IFS=$saveIFS + (( ${#pva[*]} )) || pva[0]= + y= + i=0 + while (( i < ${#pva[*]} )); do + pv=${pva[i]} + pp=${ppa[i]} + if [[ $pv = *""* ]]; then + pvdsc=${pv%%""*} + pv=${pv##*""} + else + pvdsc=$pv + fi + if [[ -z $pv ]]; then + pv=- + if (( nrpl )); then + x=${suitename}/${sp_dist[num]}/${sp_name[num]}/% + j=0 + while (( j < nrpl )); do + [[ ${preplsrc[j]} = "$x" ]] && break + let j++ + done + (( j < nrpl )) && pv=${prepldst[j]} + fi + elif [[ $pp != ?(/) ]]; then + pv="$pv" + fi + [[ $pp != ?(/) ]] && pv="[dir] $pv" + y=${y:+"$y
"}$pv + let i++ + done + print " " + done + print "" + print " " + print "" + k=0 + while (( k < nbin )); do + (( (i = bp_sort[k++]) < 0 )) && continue + [[ ${bp_name[i]} = "${sp_name[num]}" && \ + ${bp_dist[i]} = "${sp_dist[num]}" ]] || continue + bp_sort[k - 1]=-1 + #print "" + print "" + print "" + print " " + print " " + for suitename in $allsuites; do + eval pv=\${bp_ver_${suitename}[i]} + if [[ -z $pv ]]; then + pv=- + if (( nrpl )); then + x=${suitename}/${sp_dist[num]}/${sp_name[num]}/% + j=0 + while (( j < nrpl )); do + [[ ${preplsrc[j]} = "$x" ]] && break + let j++ + done + (( j < nrpl )) && pv=${prepldst[j]} + fi + fi + print " " + done + print "" + done +done + +num=0 +for i in ${bp_sort[*]}; do + (( i < 0 )) && continue + if (( !num )); then + print "\n" + print "" + print " " + print " " + for suitename in $allsuites; do + print " " + done + print "" + num=1 + fi + #print "" + print "" + print "" + print " " + print " " + for suitename in $allsuites; do + eval pv=\${bp_ver_${suitename}[i]} + if [[ -z $pv ]]; then + pv=- + if (( nrpl )); then + x=${suitename}/${bp_dist[num]}/${bp_disp[num]}/= + j=0 + while (( j < nrpl )); do + [[ ${preplsrc[j]} = "$x" ]] && break + let j++ + done + (( j < nrpl )) && pv=${prepldst[j]} + fi + fi + print " " + done + print "" + print " " + print "" +done + +cat <
distBinary / Description$suitename
package name
${sp_dist[num]}${pd#, }$y
${sp_name[num]}
${bp_disp[i]}${bp_desc[i]}$pv
~ENOENT~binary" \ + "packages without a matching source package-
${bp_dist[i]}${bp_desc[i]}$pv
${bp_disp[i]}
+ +

• Valid XHTML/1.1! + • Generated on $(date -u +'%F %T') by $rcsid •

+ +EOF + +:) >debidx.htm +print done. -- 2.30.2