You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

create-test-data 1.7 KiB

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