X-Git-Url: https://git.stderr.nl/gitweb?p=apt-repository.git;a=blobdiff_plain;f=rebuild;h=97c08acece41b08f3120cfab86f6b21b0ffbc853;hp=5e2528f6293bb277c821fec488ee087e887b6899;hb=HEAD;hpb=8312b4526cc2839f418e28cb526cfb85969a3133 diff --git a/rebuild b/rebuild index 5e2528f..97c08ac 100755 --- a/rebuild +++ b/rebuild @@ -1,13 +1,60 @@ #!/bin/sh -SOURCES=sources -PACKAGES=public/packages -mkdir -p $PACKAGES +# The location of the sources +SOURCES=sources/equivs +# The codename of the archive to import into +CODENAME=stderr -cd $PACKAGES +# Save the root of the repository +cd `dirname $0` +REPO_ROOT=`pwd` -for i in ../../$SOURCES/*; do - equivs-build $i +# Create our output dir +OUT_DIR=`mktemp -d` || exit 1 +cd $OUT_DIR + +for i in $REPO_ROOT/$SOURCES/*; do + BASE=`basename "$i"` + if [ -d "$i" ]; then + echo "Skipping directory '$BASE'" + continue; + fi + if [ ! -f "$i" ]; then + echo "Skipping special file file '$BASE'" + continue; + fi + if [ ! -r "$i" ]; then + echo "Skipping non-readable file '$BASE'" + continue; + fi + + VERSION=`cat $i | grep "^Version:" | sed "s/^Version: //"` + PACKAGE=`cat $i | grep "^Package:" | sed "s/^Package: //"` + + if [ -z "${PACKAGE}" -o -z "${VERSION}" ]; then + echo "Skipping non-equivs file '$BASE'" + continue; + fi + + # Find out what the current repostory version is. We simply take the + # first of the architectures in the output, since these are + # architecture all packages and should have the same version on all + # archs. + REPO_VERSION=`$REPO_ROOT/reprepro list "${CODENAME}" "${PACKAGE}" | head -1 | cut -d' ' -f 3` + if dpkg --compare-versions "${REPO_VERSION}" ge "${VERSION}"; then + echo "Not building version $VERSION of $PACKAGE, version $REPO_VERSION already in repository" + continue + fi + + echo "Building version $VERSION of $PACKAGE" + equivs-build $i || exit 1 + + # Import the produced deb + $REPO_ROOT/reprepro includedeb "${CODENAME}" "${PACKAGE}_${VERSION}_all.deb" || exit 1 done -cd ../.. +# Conservatively delete our temporary directory (To prevent issues when +# $OUT_DIR got set to / for some reason or something like that) +cd / +rm -f $OUT_DIR/*.deb +rmdir $OUT_DIR