]> git.saurik.com Git - apt.git/blob - test/integration/create-test-data
merged from lp:~donkult/apt/sid
[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 local TESTDIR=$(readlink -f $(dirname $0))
5 . $TESTDIR/framework
6 BUILDDIRECTORY="${TESTDIR}/../../build/bin"
7
8 GENERATE=$1
9 CODENAME=$2
10 shift 2
11
12 WORKDIR=$(mktemp -d)
13 trap "rm -rf $WORKDIR" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
14 touch $WORKDIR/status
15 TMPGEN=$WORKDIR/Packages
16 export LANG=C
17
18 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#")
19 aptcache show $LISTOFPKGS --no-all-versions 2> /dev/null > $TMPGEN
20 sed -i $TMPGEN \
21 -e '/^ / d' \
22 -e '/^SHA1: / d' -e '/^SHA256: / d' \
23 -e '/^Homepage: / d' -e '/^Tag: / d' \
24 -e '/^Xul-Appid: / d' \
25 -e '/^Status: / d'
26
27 if echo "$GENERATE" | grep '^status-' > /dev/null; then
28 sed -i $TMPGEN -e '/^Package: / a\
29 Status: install ok installed' \
30 -e '/^Filename: / d' -e '/^Size: / d' -e '/^MD5sum: / d'
31 fi
32
33 apt-sortpkgs $TMPGEN > $GENERATE