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.
 
 
 
 
 
 

67 lines
2.8 KiB

  1. #!/bin/sh
  2. set -e
  3. TESTDIR=$(readlink -f $(dirname $0))
  4. . $TESTDIR/framework
  5. setupenvironment
  6. configarchitecture 'amd64'
  7. testtargets() {
  8. msgtest 'Test acquired targets for' "$1"
  9. shift
  10. while [ -n "$1" ]; do
  11. echo "$1"
  12. shift
  13. done | sort -u > expectedtargets.lst
  14. aptget indextargets --no-release-info --format='$(CREATED_BY)' | sort -u > gottargets.lst
  15. testfileequal --nomsg ./expectedtargets.lst "$(cat ./gottargets.lst)"
  16. }
  17. echo 'deb http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  18. testtargets 'default' 'Packages' 'Translations'
  19. cat > rootdir/etc/apt/apt.conf.d/content-target.conf <<EOF
  20. Acquire::IndexTargets::deb::Contents {
  21. MetaKey "\$(COMPONENT)/Contents-\$(ARCHITECTURE)";
  22. ShortDescription "Contents";
  23. Description "\$(RELEASE)/\$(COMPONENT) \$(ARCHITECTURE) Contents";
  24. };
  25. EOF
  26. testtargets 'default + Contents' 'Packages' 'Translations' 'Contents'
  27. echo 'deb [target=Packages] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  28. testtargets 'force Packages target' 'Packages'
  29. echo 'deb [target=Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  30. testtargets 'force Contents target' 'Contents'
  31. echo 'deb [target=Translations,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  32. testtargets 'force two targets' 'Contents' 'Translations'
  33. echo 'deb [target+=Translations,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  34. testtargets 'add existing' 'Packages' 'Contents' 'Translations'
  35. echo 'deb [target+=AppStream] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  36. testtargets 'add non-existing' 'Packages' 'Contents' 'Translations'
  37. echo 'deb [target-=Translations,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  38. testtargets 'remove existing' 'Packages'
  39. echo 'deb [target-=AppStream] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  40. testtargets 'remove non-existing' 'Packages' 'Contents' 'Translations'
  41. echo 'deb [AppStream=yes] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  42. testtargets 'activate non-existing' 'Packages' 'Contents' 'Translations'
  43. echo 'deb [AppStream=no] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  44. testtargets 'deactivate non-existing' 'Packages' 'Contents' 'Translations'
  45. echo 'deb [Contents=yes] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  46. testtargets 'activate existing' 'Packages' 'Contents' 'Translations'
  47. echo 'deb [Contents=no] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  48. testtargets 'deactivate existing' 'Packages' 'Translations'
  49. echo 'deb [target=Packages Contents=yes] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list
  50. testtargets 'explicit + activate' 'Packages' 'Contents'