X-Git-Url: https://git.stderr.nl/gitweb?p=apt-repository.git;a=blobdiff_plain;f=rebuild;h=97c08acece41b08f3120cfab86f6b21b0ffbc853;hp=95f7699d2c031de0123269b3bc5a759fbd6a1a9a;hb=HEAD;hpb=b04eb9d625d594481f2940a4e4c97bf6b4667430 diff --git a/rebuild b/rebuild index 95f7699..97c08ac 100755 --- a/rebuild +++ b/rebuild @@ -1,12 +1,19 @@ #!/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 +# 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'" @@ -28,13 +35,26 @@ for i in ../../$SOURCES/*; do echo "Skipping non-equivs file '$BASE'" continue; fi - if [ -f "${PACKAGE}_${VERSION}_all.deb" ]; then - echo "Skipping $PACKAGE, version $VERSION already built" - continue; + + # 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 + 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