]> git.saurik.com Git - apt.git/blame - test/integration/create-test-data
eipp: add Allow-Temporary-Remove-of-Essentials
[apt.git] / test / integration / create-test-data
CommitLineData
7d0627b6
DK
1#!/bin/sh
2set +e # its okay to fail in these script, most of the time the apt* stuff will generate errors
3
ceabaaa1
DK
4if [ -z "$1" -o -z "$2" ]; then
5 echo "Usage: $0 file codename pkg…"
6 exit 1
7fi
8
3abb6a6a
DK
9TESTDIR="$(readlink -f "$(dirname "$0")")"
10. "$TESTDIR/framework"
7d0627b6
DK
11BUILDDIRECTORY="${TESTDIR}/../../build/bin"
12
13GENERATE=$1
14CODENAME=$2
15shift 2
16
17WORKDIR=$(mktemp -d)
18trap "rm -rf $WORKDIR" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
19touch $WORKDIR/status
20TMPGEN=$WORKDIR/Packages
21export LANG=C
22
23LISTOFPKGS=$(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#")
ceabaaa1
DK
24if [ -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
28fi
b99d5aef 29aptcache show $LISTOFPKGS --no-all-versions 2> $WORKDIR/error.lst > $TMPGEN
7d0627b6
DK
30sed -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
b99d5aef
DK
37if [ "$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
39fi
40
7d0627b6
DK
41if echo "$GENERATE" | grep '^status-' > /dev/null; then
42 sed -i $TMPGEN -e '/^Package: / a\
43Status: install ok installed' \
44 -e '/^Filename: / d' -e '/^Size: / d' -e '/^MD5sum: / d'
45fi
46
47apt-sortpkgs $TMPGEN > $GENERATE