68560b
#! /bin/bash -ex
68560b
68560b
# You can set the version as an argument to the script,
68560b
# default is taken from the specfile
68560b
if [ "$1" = "" ]; then
68560b
    VERSION=$(
68560b
        rpm -q --qf "%{VERSION}\n" --specfile python-pygments.spec | head -n1
68560b
    )
68560b
else
68560b
    VERSION=$1
68560b
fi
68560b
68560b
SRCURL=https://files.pythonhosted.org/packages/source/P/Pygments/Pygments-$VERSION.tar.gz
68560b
BADFILE=Pygments-$VERSION/tests/examplefiles/Intro.java
68560b
OUT=Pygments-$VERSION-clean.tar.xz
68560b
68560b
curl -L $SRCURL |
68560b
    gunzip |
68560b
    tar --delete $BADFILE --delete $BADFILE.output |
68560b
    xz > $OUT
68560b
68560b
if tar tJf $OUT | grep 'Intro.java'; then
68560b
    >&2 echo "Intro.java left in!"
68560b
    mv $OUT $OUT.bad
68560b
    exit 1
68560b
fi