]> git.saurik.com Git - apt.git/blob - test/integration/create-test-data
require explicit paths to dsc/control as we do for deb files
[apt.git] / test / integration / create-test-data
1 #!/bin/sh
2 set +e # its okay to fail in these script, most of the time the apt* stuff will generate errors
3
4 if [ -z "$1" -o -z "$2" ]; then
5 echo "Usage: $0 file codename pkg…"
6 exit 1
7 fi
8
9 TESTDIR=$(readlink -f $(dirname $0))
10 . $TESTDIR/framework
11 BUILDDIRECTORY="${TESTDIR}/../../build/bin"
12
13 GENERATE=$1
14 CODENAME=$2
15 shift 2
16
17 WORKDIR=$(mktemp -d)
18 trap "rm -rf $WORKDIR" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
19 touch $WORKDIR/status
20 TMPGEN=$WORKDIR/Packages
21 export LANG=C
22
23 LISTOFPKGS=$(aptget install $* -t $CODENAME -so Dir::state::status=$WORKDIR/status -o Dir::Cache::archives=$WORKDIR -o pkgCacheGen::Essential=none -o APT::Immediate-Configure=0 2> /dev/null | awk '/^Inst/ {print $2}' | sed -e "s#\$#/$CODENAME#")
24 if [ -z "$LISTOFPKGS" ]; then
25 echo "List of packages is empty: run apt-get install command again for you now"
26 aptget install $* -t $CODENAME -so Dir::state::status=$WORKDIR/status -o Dir::Cache::archives=$WORKDIR -o pkgCacheGen::Essential=none -o APT::Immediate-Configure=0
27 exit 1
28 fi
29 aptcache show $LISTOFPKGS --no-all-versions 2> $WORKDIR/error.lst > $TMPGEN
30 sed -i $TMPGEN \
31 -e '/^ / d' \
32 -e '/^SHA1: / d' -e '/^SHA256: / d' \
33 -e '/^Homepage: / d' -e '/^Tag: / d' \
34 -e '/^Xul-Appid: / d' \
35 -e '/^Status: / d'
36
37 if [ "$CODENAME" = "experimental" ]; then
38 aptcache show $(cat $WORKDIR/error.lst | cut -d"'" -f 4 | sed -e 's#$#/sid#') --no-all-versions 2> /dev/null >> $TMPGEN
39 fi
40
41 if echo "$GENERATE" | grep '^status-' > /dev/null; then
42 sed -i $TMPGEN -e '/^Package: / a\
43 Status: install ok installed' \
44 -e '/^Filename: / d' -e '/^Size: / d' -e '/^MD5sum: / d'
45 fi
46
47 apt-sortpkgs $TMPGEN > $GENERATE