diff options
Diffstat (limited to 'src/at/deb-content.at')
-rw-r--r-- | src/at/deb-content.at | 129 |
1 files changed, 129 insertions, 0 deletions
diff --git a/src/at/deb-content.at b/src/at/deb-content.at new file mode 100644 index 0000000..f475603 --- /dev/null +++ b/src/at/deb-content.at @@ -0,0 +1,129 @@ +AT_SETUP([dpkg-deb .deb conffiles]) +AT_KEYWORDS([dpkg-deb deb conffiles]) + +DPKG_GEN_CONTROL([pkg-conff-duped]) +DPKG_GEN_CTRL_FILE([pkg-conff-duped], [conffiles], [/test-conffile-1 +/test-conffile-2 +/test-conffile-1]) +AT_DATA([pkg-conff-duped/test-conffile-1], [test init +]) +AT_DATA([pkg-conff-duped/test-conffile-2], [test init +]) +AT_CHECK([ +# Duplicate conffile entries should produce a warning. +dpkg-deb -b pkg-conff-duped +], [0], [ignore], [dpkg-deb: warning: conffile name '/test-conffile-1' is duplicated +dpkg-deb: warning: ignoring 1 warning about the control file(s) +]) + +DPKG_GEN_CONTROL([pkg-conff-noeol]) +printf "/test-conffile-1" >"pkg-conff-noeol/DEBIAN/conffiles" +AT_DATA([pkg-conff-noeol/test-conffile-1], [test init +]) +AT_CHECK([ +# Conffiles need a final newline to guarantee there's been no accidental +# file truncation. +dpkg-deb -b pkg-conff-noeol pkg-conff-noeol.deb +], [2], [ignore], [dpkg-deb: error: conffile name '/test-conffile-1' is too long, or missing final newline +]) + +DPKG_GEN_CONTROL([pkg-conff-noabs]) +DPKG_GEN_CTRL_FILE([pkg-conff-noabs], [conffiles], [test-conffile-rel]) +AT_DATA([pkg-conff-noabs/test-conffile-rel], [test init +]) +AT_CHECK([ +# Conffiles must use absolute pathnames. +dpkg-deb -b pkg-conff-noabs pkg-conff-noabs.deb +], [2], [ignore], [dpkg-deb: error: conffile name 'test-conffile-rel' is not an absolute pathname +]) + +DPKG_GEN_CONTROL([pkg-conff-empty]) +printf " \n" >"pkg-conff-empty/DEBIAN/conffiles" +AT_CHECK([ +# Conffiles must not contain empty lines. +dpkg-deb -b pkg-conff-empty pkg-conff-empty.deb +], [2], [ignore], [dpkg-deb: error: empty and whitespace-only lines are not allowed in conffiles +]) + +DPKG_GEN_CONTROL([pkg-conff-space-prefix]) +DPKG_GEN_CTRL_FILE([pkg-conff-space-prefix], [conffiles], [ /test-conffile]) +AT_CHECK([ +# Conffiles must not contain prefixed spaces. +dpkg-deb -b pkg-conff-space-prefix pkg-conff-space-prefix.deb +], [2], [ignore], [dpkg-deb: error: line with conffile filename '/test-conffile' has leading white spaces +]) + +DPKG_GEN_CONTROL([pkg-conff-unknown-flag]) +DPKG_GEN_CTRL_FILE([pkg-conff-unknown-flag], [conffiles], [unknown-flag /test-conffile]) +AT_CHECK([ +# Conffiles marked with an unknown flag. +dpkg-deb -b pkg-conff-unknown-flag pkg-conff-unknown-flag.deb +], [2], [ignore], [dpkg-deb: error: unknown flag 'unknown-flag' for conffile '/test-conffile' +]) + +DPKG_GEN_CONTROL([pkg-conff-missing-pathname]) +printf "unknown-flag \n" >"pkg-conff-missing-pathname/DEBIAN/conffiles" +AT_CHECK([ +# Conffiles need a pathname, in addition to a flag. +dpkg-deb -b pkg-conff-missing-pathname pkg-conff-missing-pathname.deb +], [2], [ignore], [dpkg-deb: error: conffile name missing after flag 'unknown-flag' +]) + +DPKG_GEN_CONTROL([pkg-conff-removed-missing]) +DPKG_GEN_CTRL_FILE([pkg-conff-removed-missing], [conffiles], [remove-on-upgrade /test-conffile-missing]) +AT_CHECK([ +# Conffiles marked for removal must not be present. +dpkg-deb -b pkg-conff-removed-missing pkg-conff-removed-missing.deb +], [0], [ignore], []) + +DPKG_GEN_CONTROL([pkg-conff-removed-duped]) +DPKG_GEN_CTRL_FILE([pkg-conff-removed-duped], [conffiles], [remove-on-upgrade /test-conffile-1 +remove-on-upgrade /test-conffile-2 +remove-on-upgrade /test-conffile-1]) +AT_CHECK([ +# Duplicate conffile entries should produce a warning. +dpkg-deb -b pkg-conff-removed-duped +], [0], [ignore], [dpkg-deb: warning: conffile name '/test-conffile-1' is duplicated +dpkg-deb: warning: ignoring 1 warning about the control file(s) +]) + +DPKG_GEN_CONTROL([pkg-conff-removed-noeol]) +printf "remove-on-upgrade /test-conffile-1" >"pkg-conff-removed-noeol/DEBIAN/conffiles" +AT_CHECK([ +# Conffiles need a final newline to guarantee there has been no accidental +# file truncation. +dpkg-deb -b pkg-conff-removed-noeol pkg-conff-removed-noeol.deb +], [2], [ignore], [dpkg-deb: error: conffile name 'remove-on-upgrade /test-conffile-1' is too long, or missing final newline +]) + +DPKG_GEN_CONTROL([pkg-conff-removed-noabs]) +DPKG_GEN_CTRL_FILE([pkg-conff-removed-noabs], [conffiles], [remove-on-upgrade test-conffile-rel]) +AT_DATA([pkg-conff-removed-noabs/test-conffile-rel], [test init +]) +AT_CHECK([ +# Conffiles must use absolute pathnames. +dpkg-deb -b pkg-conff-removed-noabs pkg-conff-removed-noabs.deb +], [2], [ignore], [dpkg-deb: error: conffile name 'test-conffile-rel' is not an absolute pathname +]) + +DPKG_GEN_CONTROL([pkg-conff-removed-present]) +DPKG_GEN_CTRL_FILE([pkg-conff-removed-present], [conffiles], [remove-on-upgrade /test-conffile-present]) +AT_DATA([pkg-conff-removed-present/test-conffile-present], [test init +]) +AT_CHECK([ +# Conffiles marked for removal must not be present. +dpkg-deb -b pkg-conff-removed-present pkg-conff-removed-present.deb +], [2], [ignore], [dpkg-deb: error: conffile '/test-conffile-present' is present but is requested to be removed +]) + +DPKG_GEN_CONTROL([pkg-deb-newline]) +touch 'pkg-deb-newline/file +newline' +AT_CHECK([ +# Cannot create package with newlines in filenames. +dpkg-deb -b pkg-deb-newline +], [2], [ignore], [dpkg-deb: error: newline not allowed in pathname './file +newline' +]) + +AT_CLEANUP |