X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=update-archive%2Fupdate-archive.sh;h=126e72760659c59aaa347483e8b54cb761509a42;hb=46340c8a878d4a45eb3296c9a47f8d43110d7d78;hp=e60a9a11ac5e0091320555e2b2f612219cd7ee98;hpb=5125f59faed8167697bf69f9d9cbad27e3126980;p=git-tools-moved-to-github.git diff --git a/update-archive/update-archive.sh b/update-archive/update-archive.sh index e60a9a1..126e727 100755 --- a/update-archive/update-archive.sh +++ b/update-archive/update-archive.sh @@ -1,7 +1,13 @@ #!/bin/sh -# $Id: update-archive.sh,v 1.13 2008-10-20 10:24:15 adam Exp $ -if test ! -f apt-ftparchive.conf.in; then - echo "$0: apt-ftparchive.conf.in must be located in current directory" +D0=`dirname $0` +confdir=`cd $D0; pwd` + +if test ! -f ${confdir}/apt-ftparchive.conf.in; then + echo "$0: ${condir}/apt-ftparchive.conf.in not found" + exit 1 +fi +if test ! -f ${confdir}/apt-release.conf.in; then + echo "$0: ${condir}/apt-release.conf.in not found" exit 1 fi @@ -12,11 +18,16 @@ fi # gpg -a -d -o Release.gpg Release -confdir=`pwd` architectures="i386 amd64" -for vdist in ubuntu/gutsy ubuntu/hardy ubuntu/intrepid ubuntu/jaunty debian/squeeze debian/lenny debian/etch debian/sarge debian/woody; do +if [ "$1" == "" ]; then + DISTRIBUTIONS="ubuntu/lucid ubuntu/natty ubuntu/oneiric ubuntu/precise ubuntu/quantal debian/wheezy debian/squeeze debian/lenny" +else + DISTRIBUTIONS=$1 +fi + +for vdist in $DISTRIBUTIONS ; do dist=`basename $vdist` vendor=`dirname $vdist` ftpdir=/home/ftp/pub/$vendor @@ -29,63 +40,92 @@ for vdist in ubuntu/gutsy ubuntu/hardy ubuntu/intrepid ubuntu/jaunty debian/sque # Uncomment to clean the .db (cache) # rm tmp/* - # Make symlinks from the regular FTP archive - d=pool/dists/$dist - if test ! -d $d; then mkdir -p $d; fi - # Remove invalid symlinks - for l in $d/*; do - if test -L $l; then - if test ! -f $l; then - rm $l + sections="" + for section in main restricted; do + # Prepare pool + d=pool/dists/$dist/$section + if test ! -d $d; then mkdir -p $d; fi + mkdir -p $d/source + # Remove invalid symlinks (source, i386, amd64,..) + for l in $d/*/*; do + if test -L "$l"; then + if test ! -f "$l"; then + rm $l + fi fi - fi - done - mkdir -p $d/source - ln -sf /home/ftp/pub/*/$vendor/$dist/* $d/source - rm $d/source/*.deb - for arch in $architectures; do - mkdir -p $d/${arch} - for f in /home/ftp/pub/*/$vendor/$dist/*_${arch}.* \ - /home/ftp/pub/*/$vendor/$dist/*_all.*; do - if test -f $f; then - ln -sf $f $d/${arch} + done + # Make symlinks from the regular FTP archive + has_packages=false + for pdir in /home/ftp/pub/*; do + use=false + if test -f $pdir/.htaccess -a $section != "main"; then + use=true + fi + if test ! -f $pdir/.htaccess -a $section = "main"; then + use=true + fi + if $use; then + distdir=$pdir/$vendor/$dist + if test -d $distdir; then + for f in $distdir/*.dsc $distdir/*.gz; do + test -f $f && ln -sf $f $d/source + done + for arch in $architectures; do + mkdir -p $d/${arch} + for f in $pdir/.htaccess \ + $distdir/*_${arch}.* \ + $distdir/*_all.*; do + if test -f $f; then + ln -sf $f $d/${arch} + has_packages=true + fi + done + done + fi fi done - #ln -sf /home/ftp/pub/*/$vendor/$dist/*_${arch}.* $d/${arch} - #ln -sf /home/ftp/pub/*/$vendor/$dist/*_all.* $d/${arch} - done + # ${confdir}/symclean.sh $d - # ${confdir}/symclean.sh $d - - for arch in $architectures; do - d=dists/$dist/main/binary-$arch - if test ! -d $d; then mkdir -p $d; fi - echo "Archive: $dist" >$d/Release - echo 'Component: main' >>$d/Release - echo 'Origin: Indexdata' >>$d/Release - echo "Architecture: $arch" >>$d/Release + rm -f $d/Release + if $has_packages; then + if test -z "$sections"; then + sections="$section" + else + sections="$sections $section" + fi + for arch in $architectures; do + d=dists/$dist/$section/binary-$arch + if test ! -d $d; then mkdir -p $d; fi + echo "Archive: $dist" >$d/Release + echo "Component: $section" >>$d/Release + echo 'Origin: Indexdata' >>$d/Release + echo "Architecture: $arch" >>$d/Release + done + d=dists/$dist/$section/source + if test ! -d $d; then mkdir -p $d; fi + echo "Archive: $dist" >$d/Release + echo "Component: $section" >>$d/Release + echo 'Origin: Indexdata' >>$d/Release + echo 'Architecture: source' >>$d/Release + fi done - - d=dists/$dist/main/source - if test ! -d $d; then mkdir -p $d; fi - echo "Archive: $dist" >$d/Release - echo 'Component: main' >>$d/Release - echo 'Origin: Indexdata' >>$d/Release - echo 'Architecture: source' >>$d/Release - # generate - echo "Begin Generate $dist" + echo "Begin Generate $dist: $sections" F=apt-ftparchive.conf - sed "s/@dist@/$dist/g" <${confdir}/${F}.in |sed "s/@architectures@/${architectures}/g" > $F + sed "s/@dist@/$dist/g" <${confdir}/${F}.in | \ + sed "s/@architectures@/${architectures}/g" | \ + sed "s/@sections@/${sections}/g" > $F # Don't know if clean is needed! # apt-ftparchive clean apt-ftparchive.conf - apt-ftparchive generate apt-ftparchive.conf - echo "Done generate $dist" + apt-ftparchive generate apt-ftparchive.conf 2>&1 + echo "Done generate $dist: $sections" # release r=dists/$dist/Release F=apt-release.conf - sed "s/@dist@/$dist/g" <${confdir}/${F}.in | sed "s/@architectures@/${architectures}/g" >$F + sed "s/@dist@/$dist/g" <${confdir}/${F}.in | \ + sed "s/@architectures@/${architectures}/g" | \ + sed "s/@sections@/${sections}/g" > $F # Move Release file away while calling using release rm $r apt-ftparchive -c $F release dists/$dist >tmp_Release