]>
git.saurik.com Git - apt.git/blob - test/integration/test-apt-tagfile-fields-order
4 TESTDIR
="$(readlink -f "$(dirname "$0")")"
8 dpkg_field_ordered_list() {
9 local FIELDS="$
(perl
-e "
11 use Dpkg::Control::Fields;
12 foreach \$f (field_ordered_list(${1})) {
15 if [ -z "$FIELDS" ]; then
16 msgfail 'Could not get fields via libdpkg-perl'
22 local DIFFOUTPUT="$(diff -u apt.lst dpkg.lst || true)"
23 if echo "$DIFFOUTPUT" | grep -q '^+[^+]'; then
25 echo "$DIFFOUTPUT" | grep '^[+-][^+-]'
32 msgtest 'Check that apt knows all fields dpkg orders in' 'Packages'
33 dpkg_field_ordered_list 'CTRL_INDEX_PKG' > dpkg.lst
34 sed -ne 's#^ "\
(.
*\
)",.*$#\1#p' "${SOURCEDIRECTORY}/apt
-pkg/tagfile
-order.c
" | sed -n '/^Package$/,/^Package$/ p' | head -n -1 | sort -u > apt.lst
37 msgtest 'Check that apt knows all fields dpkg orders in' 'status'
38 dpkg_field_ordered_list 'CTRL_FILE_STATUS' > dpkg.lst
41 msgtest 'Check that apt knows all fields dpkg orders in' 'DEBIAN/control'
42 dpkg_field_ordered_list 'CTRL_PKG_DEB' > dpkg.lst
45 msgtest 'Check that apt knows all fields dpkg orders in' 'Sources'
46 dpkg_field_ordered_list 'CTRL_INDEX_SRC' > dpkg.lst
47 echo 'Package' > apt.tmp
48 sed -ne 's#^ "\
(.
*\
)",.*$#\1#p' "${SOURCEDIRECTORY}/apt
-pkg/tagfile
-order.c
" | sed '/^Package$/,/^Package$/ d' >> apt.tmp
49 sort -u apt.tmp > apt.lst
52 msgtest 'Check that apt knows all fields dpkg orders in' 'dsc'
53 dpkg_field_ordered_list 'CTRL_PKG_SRC' > dpkg.lst
56 # HACK, but there is no good way to acquire sources in tests and/or to remember to run this regular manually
57 if [ "$USER" = 'david' ]; then
58 msgtest 'Check if we have somewhere the sources of' 'dpkg'
59 DPKGSOURCE="$(locate dpkg/lib/dpkg/parse.c | head -n 1 || true)"
60 if [ -z "$DPKGSOURCE" ]; then
64 msgtest 'Check that apt knows about all fields' 'dpkg parses'
65 sed -n 's#^.*FIELD("\
(.
*\
)").*$#\1#p' "${DPKGSOURCE}" | sort -u > dpkg.lst
66 sed -ne 's#^ "\
(.
*\
)",.*$#\1#p' "${SOURCEDIRECTORY}/apt
-pkg/tagfile
-order.c
" | sed -n '/^Package$/,/^Package$/ p' | head -n -1 | sort -u > apt.lst
70 msgtest 'Check if we have somewhere the sources of' 'dak'
71 DAKSOURCE="$(locate dak/setup/core-init.d/080_metadatakeys | head -n 1 || true)"
72 if [ -z "$DAKSOURCE" ]; then
76 msgtest 'Check that apt knows about all fields' 'dak knows'
77 # dak mixes both, so we can only check with the mixed one as well
78 sed -ne "s
#^.* VALUES ('\(.*\)', \(.*\)).*\$#\1 \2#p" "${DAKSOURCE}" | cut -d ' ' -f 1 | sort -u > dpkg.lst
79 sed -ne 's#^ "\(.*\)",.*$#\1#p' "${SOURCEDIRECTORY}/apt-pkg/tagfile-order.c" | sort -u > apt.lst