From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa.local.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.1 From: Aleksei Nikiforov To: devel@lists.altlinux.org Date: Tue, 10 Dec 2019 18:23:39 +0300 Message-Id: <20191210152343.33867-35-darktemplar@altlinux.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191210152343.33867-1-darktemplar@altlinux.org> References: <20191210152343.33867-1-darktemplar@altlinux.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Tue, 10 Dec 2019 19:52:38 +0300 Cc: Aleksei Nikiforov Subject: [devel] [PATCH for apt 34/38] Add initial integration tests X-BeenThere: devel@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: ALT Linux Team development discussions List-Id: ALT Linux Team development discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Dec 2019 15:26:03 -0000 Archived-At: List-Archive: List-Post: --- apt/test/integration/framework | 1093 +++-------------- apt/test/integration/run-tests | 8 +- .../conflicting-package-distupgrade.spec | 18 + .../specs/conflicting-package-one.spec | 17 + .../specs/conflicting-package-two.spec | 17 + .../integration/specs/missing-dependency.spec | 17 + .../integration/specs/simple-package-new.spec | 19 + .../specs/simple-package-noarch.spec | 17 + .../specs/simple-package-update-conflict.spec | 17 + .../specs/simple-package-update.spec | 15 + .../integration/specs/simple-package.spec | 15 + .../integration/specs/simple-virtual.spec | 17 + .../integration/test-apt-cache-depends-simple | 38 + apt/test/integration/test-apt-cache-dump | 92 ++ apt/test/integration/test-apt-cache-dumpavail | 115 ++ apt/test/integration/test-apt-cache-pkgnames | 32 + .../integration/test-apt-cache-search-simple | 38 + .../integration/test-apt-cache-show-simple | 67 + .../integration/test-apt-cache-showpkg-simple | 44 + apt/test/integration/test-apt-cache-stats | 36 + apt/test/integration/test-apt-cache-unmet | 31 + .../test-apt-cache-whatdepends-simple | 43 + apt/test/integration/test-apt-check-simple | 26 + apt/test/integration/test-apt-config-dump | 61 + .../integration/test-apt-distupgrade-conflict | 30 + .../test-apt-distupgrade-mutual-conflict | 31 + .../integration/test-apt-distupgrade-obsolete | 26 + .../integration/test-apt-distupgrade-simple | 23 + .../test-apt-install-conflicting-packages | 27 + apt/test/integration/test-apt-install-double | 17 + apt/test/integration/test-apt-install-simple | 13 + apt/test/integration/test-apt-mark-simple | 58 + apt/test/integration/test-apt-remove-double | 22 + apt/test/integration/test-apt-remove-simple | 15 + apt/test/integration/test-apt-update-simple | 19 + apt/test/integration/test-apt-upgrade-simple | 26 + 36 files changed, 1263 insertions(+), 937 deletions(-) create mode 100644 apt/test/integration/specs/conflicting-package-distupgrade.spec create mode 100644 apt/test/integration/specs/conflicting-package-one.spec create mode 100644 apt/test/integration/specs/conflicting-package-two.spec create mode 100644 apt/test/integration/specs/missing-dependency.spec create mode 100644 apt/test/integration/specs/simple-package-new.spec create mode 100644 apt/test/integration/specs/simple-package-noarch.spec create mode 100644 apt/test/integration/specs/simple-package-update-conflict.spec create mode 100644 apt/test/integration/specs/simple-package-update.spec create mode 100644 apt/test/integration/specs/simple-package.spec create mode 100644 apt/test/integration/specs/simple-virtual.spec create mode 100755 apt/test/integration/test-apt-cache-depends-simple create mode 100755 apt/test/integration/test-apt-cache-dump create mode 100755 apt/test/integration/test-apt-cache-dumpavail create mode 100755 apt/test/integration/test-apt-cache-pkgnames create mode 100755 apt/test/integration/test-apt-cache-search-simple create mode 100755 apt/test/integration/test-apt-cache-show-simple create mode 100755 apt/test/integration/test-apt-cache-showpkg-simple create mode 100755 apt/test/integration/test-apt-cache-stats create mode 100755 apt/test/integration/test-apt-cache-unmet create mode 100755 apt/test/integration/test-apt-cache-whatdepends-simple create mode 100755 apt/test/integration/test-apt-check-simple create mode 100755 apt/test/integration/test-apt-config-dump create mode 100755 apt/test/integration/test-apt-distupgrade-conflict create mode 100755 apt/test/integration/test-apt-distupgrade-mutual-conflict create mode 100755 apt/test/integration/test-apt-distupgrade-obsolete create mode 100755 apt/test/integration/test-apt-distupgrade-simple create mode 100755 apt/test/integration/test-apt-install-conflicting-packages create mode 100755 apt/test/integration/test-apt-install-double create mode 100755 apt/test/integration/test-apt-install-simple create mode 100755 apt/test/integration/test-apt-mark-simple create mode 100755 apt/test/integration/test-apt-remove-double create mode 100755 apt/test/integration/test-apt-remove-simple create mode 100755 apt/test/integration/test-apt-update-simple create mode 100755 apt/test/integration/test-apt-upgrade-simple diff --git a/apt/test/integration/framework b/apt/test/integration/framework index bccbb71..326874a 100644 --- a/apt/test/integration/framework +++ b/apt/test/integration/framework @@ -1,4 +1,4 @@ -#!/bin/sh -- # no runable script, just for vi +#!/bin/bash EXIT_CODE=0 @@ -9,7 +9,6 @@ if [ "$MSGCOLOR" != 'NO' ]; then fi fi - if [ "$MSGCOLOR" != 'NO' ]; then CERROR="\033[1;31m" # red CWARNING="\033[1;33m" # yellow @@ -101,47 +100,14 @@ runapt() { msgdebug "Executing: ${CCMD}$*${CDEBUG} " local CMD="$1" shift - case $CMD in - sh|aptitude|*/*|command) ;; - *) CMD="${BUILDDIRECTORY}/$CMD";; - esac - MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH=${BUILDDIRECTORY} $CMD "$@" + APT_CONFIG="$(getaptconfig)" $CMD "$@" } aptconfig() { runapt apt-config "$@"; } aptcache() { runapt apt-cache "$@"; } aptcdrom() { runapt apt-cdrom "$@"; } aptget() { runapt apt-get "$@"; } -aptftparchive() { runapt apt-ftparchive "$@"; } -aptkey() { runapt apt-key "$@"; } aptmark() { runapt apt-mark "$@"; } -aptsortpkgs() { runapt apt-sortpkgs "$@"; } -apt() { runapt apt "$@"; } -apthelper() { runapt "${APTHELPERBINDIR}/apt-helper" "$@"; } -aptwebserver() { runapt "${APTWEBSERVERBINDIR}/aptwebserver" "$@"; } -aptitude() { runapt aptitude "$@"; } -aptextracttemplates() { runapt apt-extracttemplates "$@"; } -aptinternalsolver() { runapt "${APTINTERNALSOLVER}" "$@"; } - -dpkg() { - command dpkg --root=${TMPWORKINGDIRECTORY}/rootdir --force-not-root --force-bad-path --log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log "$@" -} -dpkgcheckbuilddeps() { - command dpkg-checkbuilddeps --admindir=${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg "$@" -} -gdb() { - echo "gdb: run »$*«" - CMD="$1" - shift - APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${LIBRARYPATH} command gdb ${BUILDDIRECTORY}/$CMD --args ${BUILDDIRECTORY}/$CMD "$@" -} -gpg() { - # see apt-key for the whole trickery. Setup is done in setupenvironment - command gpg --ignore-time-conflict --no-options --no-default-keyring \ - --homedir "${TMPWORKINGDIRECTORY}/gnupghome" \ - --no-auto-check-trustdb --trust-model always \ - "$@" -} exitwithstatus() { # error if we about to overflow, but ... @@ -176,87 +142,52 @@ setupenvironment() { TESTDIRECTORY=$(readlink -f $(dirname $0)) msgninfo "Preparing environment for ${CCMD}$(basename $0)${CINFO} in ${TMPWORKINGDIRECTORY}… " - # allow overriding the default BUILDDIR location - BUILDDIRECTORY=${APT_INTEGRATION_TESTS_BUILD_DIR:-"${TESTDIRECTORY}/../../build/bin"} - LIBRARYPATH=${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}"} - METHODSDIR=${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"} - APTHELPERBINDIR=${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}"} - APTWEBSERVERBINDIR=${APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR:-"${BUILDDIRECTORY}"} - APTINTERNALSOLVER=${APT_INTEGRATION_TESTS_INTERNAL_SOLVER:-"${BUILDDIRECTORY}/apt-internal-solver"} - test -x "${BUILDDIRECTORY}/apt-get" || msgdie "You need to build tree first" - # ----- - addtrap "cd /; rm -rf $TMPWORKINGDIRECTORY;" cd $TMPWORKINGDIRECTORY mkdir rootdir aptarchive keys cd rootdir mkdir -p etc/apt/apt.conf.d etc/apt/sources.list.d etc/apt/trusted.gpg.d etc/apt/preferences.d mkdir -p var/cache var/lib/apt var/log tmp - mkdir -p var/lib/dpkg/info var/lib/dpkg/updates var/lib/dpkg/triggers - touch var/lib/dpkg/available - mkdir -p usr/lib/apt - ln -s ${METHODSDIR} usr/lib/apt/methods - if [ "$BUILDDIRECTORY" = "$LIBRARYPATH" ]; then - mkdir -p usr/lib/apt/solvers - ln -s "${BUILDDIRECTORY}/apt-dump-solver" usr/lib/apt/solvers/dump - ln -s "${BUILDDIRECTORY}/apt-internal-solver" usr/lib/apt/solvers/apt - echo "Dir::Bin::Solvers \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/solvers\";" > etc/apt/apt.conf.d/externalsolver.conf - fi - # use the autoremove from the BUILDDIRECTORY if its there, otherwise - # system - if [ -e ${BUILDDIRECTORY}/../../debian/apt.conf.autoremove ]; then - ln -s ${BUILDDIRECTORY}/../../debian/apt.conf.autoremove etc/apt/apt.conf.d/01autoremove - else - ln -s /etc/apt/apt.conf.d/01autoremove etc/apt/apt.conf.d/01autoremove - fi + mkdir -p var/lib/rpm + mkdir -p var/lib/apt/lists/partial var/cache/apt/archives/partial cd .. - local PACKAGESFILE=$(echo "$(basename $0)" | sed -e 's/^test-/Packages-/' -e 's/^skip-/Packages-/') - if [ -f "${TESTDIRECTORY}/${PACKAGESFILE}" ]; then - cp "${TESTDIRECTORY}/${PACKAGESFILE}" aptarchive/Packages - fi - local SOURCESSFILE=$(echo "$(basename $0)" | sed -e 's/^test-/Sources-/' -e 's/^skip-/Sources-/') - if [ -f "${TESTDIRECTORY}/${SOURCESSFILE}" ]; then - cp "${TESTDIRECTORY}/${SOURCESSFILE}" aptarchive/Sources - fi - cp $(find $TESTDIRECTORY -name '*.pub' -o -name '*.sec') keys/ - ln -s ${TMPWORKINGDIRECTORY}/keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg + echo "Dir \"${TMPWORKINGDIRECTORY}/rootdir\";" > aptconfig.conf - echo "Dir::state::status \"${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status\";" >> aptconfig.conf echo "Debug::NoLocking \"true\";" >> aptconfig.conf - echo "APT::Get::Show-User-Simulation-Note \"false\";" >> aptconfig.conf - echo "Dir::Bin::Methods \"${METHODSDIR}\";" >> aptconfig.conf - echo "Dir::Bin::dpkg \"fakeroot\";" >> aptconfig.conf - echo "DPKG::options:: \"dpkg\";" >> aptconfig.conf - echo "DPKG::options:: \"--root=${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf - echo "DPKG::options:: \"--force-not-root\";" >> aptconfig.conf - echo "DPKG::options:: \"--force-bad-path\";" >> aptconfig.conf - if ! command dpkg --assert-multi-arch >/dev/null 2>&1; then - echo "DPKG::options:: \"--force-architecture\";" >> aptconfig.conf # Added to test multiarch before dpkg is ready for it… + echo "Dir::Etc::sourcelist \"${TMPWORKINGDIRECTORY}/rootdir/etc/apt/sources.list\";" >> aptconfig.conf + + if [ -n "$METHODSDIR" ] ; then + echo "Dir::Bin::methods \"$METHODSDIR\";" >> aptconfig.conf fi - echo "DPKG::options:: \"--log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log\";" >> aptconfig.conf - echo 'quiet::NoUpdate "true";' >> aptconfig.conf - echo "Acquire::https::CaInfo \"${TESTDIR}/apt.pem\";" > rootdir/etc/apt/apt.conf.d/99https - echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir/etc/apt/apt.conf.d/apt-binary - configcompression '.' 'gz' #'bz2' 'lzma' 'xz' - - # gpg needs a trustdb to function, but it can't be invalid (not even empty) - # see also apt-key where this trickery comes from: - local TRUSTDBDIR="${TMPWORKINGDIRECTORY}/gnupghome" - mkdir "$TRUSTDBDIR" - chmod 700 "$TRUSTDBDIR" - # We also don't use a secret keyring, of course, but gpg panics and - # implodes if there isn't one available - and writeable for imports - local SECRETKEYRING="${TRUSTDBDIR}/secring.gpg" - touch $SECRETKEYRING - # now create the trustdb with an (empty) dummy keyring - # newer gpg versions are fine without it, but play it safe for now - gpg --quiet --check-trustdb --secret-keyring $SECRETKEYRING --keyring $SECRETKEYRING >/dev/null 2>&1 + + cat > rootdir/etc/apt/pkgpriorities << END +Important: + basesystem +Required: + apt + systemd-sysvinit + sysvinit + openssh-server +Standard: + postfix +END + + cat > rootdir/etc/apt/sources.list << END +rpm file://$TMPWORKINGDIRECTORY/usr/src/RPM/REPO $(getarchitecture) apt-tests +rpm file://$TMPWORKINGDIRECTORY/usr/src/RPM/REPO noarch apt-tests +END # cleanup the environment a bit export PATH="${PATH}:/usr/local/sbin:/usr/sbin:/sbin" export LC_ALL=C.UTF-8 unset LANGUAGE APT_CONFIG - unset GREP_OPTIONS DEB_BUILD_PROFILES + unset GREP_OPTIONS + + # Initialize rpmdb + rpmdb --dbpath="$TMPWORKINGDIRECTORY/var/lib/rpm" --initdb + + # setup rpm dbpath + echo "RPM::DBPath \"$TMPWORKINGDIRECTORY/var/lib/rpm\";" > rootdir/etc/apt/apt.conf.d/99rpmdbpath.conf msgdone "info" } @@ -267,7 +198,7 @@ getarchitecture() { if [ -n "$ARCH" ]; then echo $ARCH else - dpkg --print-architecture + uname -m fi else echo $1 @@ -282,799 +213,31 @@ getarchitecturesfromcommalist() { echo "$1" | sed -e 's#,#\n#g' | sed -e "s/^native\$/$(getarchitecture 'native')/" } -configarchitecture() { - { - echo "APT::Architecture \"$(getarchitecture $1)\";" - while [ -n "$1" ]; do - echo "APT::Architectures:: \"$(getarchitecture $1)\";" - shift - done - } >rootdir/etc/apt/apt.conf.d/01multiarch.conf - configdpkg -} - -configdpkg() { - if [ ! -e rootdir/var/lib/dpkg/status ]; then - local STATUSFILE=$(echo "$(basename $0)" | sed -e 's/^test-/status-/' -e 's/^skip-/status-/') - if [ -f "${TESTDIRECTORY}/${STATUSFILE}" ]; then - cp "${TESTDIRECTORY}/${STATUSFILE}" rootdir/var/lib/dpkg/status - else - echo -n > rootdir/var/lib/dpkg/status - fi - fi - rm -f rootdir/etc/apt/apt.conf.d/00foreigndpkg - if command dpkg --assert-multi-arch >/dev/null 2>&1 ; then - local ARCHS="$(getarchitectures)" - if echo "$ARCHS" | grep -E -q '[^ ]+ [^ ]+'; then - DPKGARCH="$(dpkg --print-architecture)" - for ARCH in ${ARCHS}; do - if [ "${ARCH}" != "${DPKGARCH}" ]; then - if ! dpkg --add-architecture ${ARCH} >/dev/null 2>&1; then - # old-style used e.g. in Ubuntu-P – and as it seems travis - echo "DPKG::options:: \"--foreign-architecture\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg - echo "DPKG::options:: \"${ARCH}\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg - fi - fi - done - if [ "0" = "$(dpkg -l dpkg 2> /dev/null | grep '^i' | wc -l)" ]; then - # dpkg doesn't really check the version as long as it is fully installed, - # but just to be sure we choose one above the required version - insertinstalledpackage 'dpkg' "all" '1.16.2+fake' - fi - fi - fi -} - -configdpkgnoopchroot() { - # create a library to noop chroot() and rewrite maintainer script executions - # via execvp() as used by dpkg as we don't want our rootdir to be a fullblown - # chroot directory dpkg could chroot into to execute the maintainer scripts - msgtest 'Building library to preload to make maintainerscript work in' 'dpkg' - cat << EOF > noopchroot.c -#define _GNU_SOURCE -#include -#include -#include -#include - -static char * chrootdir = NULL; - -int chroot(const char *path) { - printf("WARNING: CHROOTing to %s was ignored!\n", path); - free(chrootdir); - chrootdir = strdup(path); - return 0; -} -int execvp(const char *file, char *const argv[]) { - static int (*func_execvp) (const char *, char * const []) = NULL; - if (func_execvp == NULL) - func_execvp = (int (*) (const char *, char * const [])) dlsym(RTLD_NEXT, "execvp"); - if (chrootdir == NULL || strncmp(file, "/var/lib/dpkg/", strlen("/var/lib/dpkg/")) != 0) - return func_execvp(file, argv); - printf("REWRITE execvp call %s into %s\n", file, chrootdir); - char newfile[strlen(chrootdir) + strlen(file)]; - strcpy(newfile, chrootdir); - strcat(newfile, file); - return func_execvp(newfile, argv); -} -EOF - testsuccess --nomsg gcc -fPIC -shared -o noopchroot.so noopchroot.c -ldl - - mkdir -p "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/" - DPKG="${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" - echo "#!/bin/sh -if [ -n \"\$LD_PRELOAD\" ]; then - export LD_PRELOAD=\"${TMPWORKINGDIRECTORY}/noopchroot.so \${LD_PRELOAD}\" -else - export LD_PRELOAD=\"${TMPWORKINGDIRECTORY}/noopchroot.so\" -fi -dpkg \"\$@\"" > $DPKG - chmod +x $DPKG - sed -ie "s|^DPKG::options:: \"dpkg\";\$|DPKG::options:: \"$DPKG\";|" aptconfig.conf -} - -configallowinsecurerepositories() { - echo "Acquire::AllowInsecureRepositories \"$1\";" > rootdir/etc/apt/apt.conf.d/allow-insecure-repositories.conf - -} - -configcompression() { - while [ -n "$1" ]; do - case "$1" in - '.') printf ".\t.\tcat\n";; - 'gz') printf "gzip\tgz\tgzip\n";; - 'bz2') printf "bzip2\tbz2\tbzip2\n";; - 'lzma') printf "lzma\tlzma\txz --format=lzma\n";; - 'xz') printf "xz\txz\txz\n";; - *) printf "$1\t$1\t$1\n";; - esac - shift - done > ${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf -} - -forcecompressor() { - COMPRESSOR="$1" - COMPRESSOR_CMD="$1" - case $COMPRESSOR in - gzip) COMPRESS='gz';; - bzip2) COMPRESS='bz2';; - lzma) COMPRESS='lzma';; - xz) COMPRESS='xz';; - *) msgdie "Compressor $COMPRESSOR is unknown to framework, so can't be forced by forcecompressor!";; - esac - local CONFFILE="${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/00force-compressor" - echo "Acquire::CompressionTypes::Order { \"${COMPRESS}\"; }; -Dir::Bin::uncompressed \"/does/not/exist\"; -Dir::Bin::gzip \"/does/not/exist\"; -Dir::Bin::bzip2 \"/does/not/exist\"; -Dir::Bin::lzma \"/does/not/exist\"; -Dir::Bin::xz \"/does/not/exist\";" > "$CONFFILE" - if [ -e "/bin/${COMPRESSOR}" ]; then - echo "Dir::Bin::${COMPRESSOR} \"/bin/${COMPRESSOR}\";" >> "$CONFFILE" - elif [ -e "/usr/bin/${COMPRESSOR}" ]; then - echo "Dir::Bin::${COMPRESSOR} \"/usr/bin/${COMPRESSOR}\";" >> "$CONFFILE" - elif [ "${COMPRESSOR}" = 'lzma' ]; then - echo 'Dir::Bin::xz "/usr/bin/xz";' >> "$CONFFILE" - COMPRESSOR_CMD='xz --format=lzma' - else - msgtest 'Test for availability of compressor' "${COMPRESSOR}" - msgfail - fi -} - -setupsimplenativepackage() { +buildpackage() { local NAME="$1" - local ARCH="$2" - local VERSION="$3" - local RELEASE="${4:-unstable}" - local DEPENDENCIES="$5" - local DESCRIPTION="${6:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE} - If you find such a package installed on your system, - something went horribly wrong! They are autogenerated - und used only by testcases and surf no other propose…"}" - - local SECTION="${7:-others}" - local DISTSECTION - if [ "$SECTION" = "$(echo "$SECTION" | cut -d'/' -f 2)" ]; then - DISTSECTION="main" - else - DISTSECTION="$(echo "$SECTION" | cut -d'/' -f 1)" - fi - local BUILDDIR=incoming/${NAME}-${VERSION} - mkdir -p ${BUILDDIR}/debian/source - cd ${BUILDDIR} - echo "* most suckless software product ever" > FEATURES - test -e debian/copyright || echo "Copyleft by Joe Sixpack $(date +%Y)" > debian/copyright - test -e debian/changelog || echo "$NAME ($VERSION) $RELEASE; urgency=low - - * Initial release - - -- Joe Sixpack $(date -R)" > debian/changelog - test -e debian/control || echo "Source: $NAME -Section: $SECTION -Priority: optional -Maintainer: Joe Sixpack -Build-Depends: debhelper (>= 7) -Standards-Version: 3.9.1 - -Package: $NAME" > debian/control - if [ "$ARCH" = 'all' ]; then - echo "Architecture: all" >> debian/control - else - echo "Architecture: any" >> debian/control - fi - test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> debian/control - echo "Description: $DESCRIPTION" >> debian/control - test -e debian/compat || echo "7" > debian/compat - test -e debian/source/format || echo "3.0 (native)" > debian/source/format - test -e debian/rules || cp /usr/share/doc/debhelper/examples/rules.tiny debian/rules - cd - > /dev/null + msgmsg "Building package: ${NAME}" + HOME="$TMPWORKINGDIRECTORY" rpmbuild --target="$(getarchitecture)" --define="_usr $TMPWORKINGDIRECTORY/usr" --root="$TMPWORKINGDIRECTORY" -ba "${TESTDIRECTORY}/specs/${NAME}.spec" 1>/dev/null } -buildsimplenativepackage() { +installpackage() { local NAME="$1" - local ARCH="$2" - local VERSION="$3" - local RELEASE="${4:-unstable}" - local DEPENDENCIES="$5" - local DESCRIPTION="${6:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE} - If you find such a package installed on your system, - something went horribly wrong! They are autogenerated - und used only by testcases and surf no other propose…"}" - - local SECTION="${7:-others}" - local PRIORITY="${8:-optional}" - local FILE_TREE="$9" - local COMPRESS_TYPE="${10:-gzip}" - local DISTSECTION - if [ "$SECTION" = "$(echo "$SECTION" | cut -d'/' -f 2)" ]; then - DISTSECTION="main" - else - DISTSECTION="$(echo "$SECTION" | cut -d'/' -f 1)" - fi - local BUILDDIR=${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION} - - msgtest "Build source package in version ${VERSION} for ${RELEASE} in ${DISTSECTION}" "$NAME" - mkdir -p $BUILDDIR/debian/source - echo "* most suckless software product ever" > ${BUILDDIR}/FEATURES - echo "#!/bin/sh -echo '$NAME says \"Hello!\"'" > ${BUILDDIR}/${NAME} - - echo "Copyleft by Joe Sixpack $(date +%Y)" > ${BUILDDIR}/debian/copyright - echo "$NAME ($VERSION) $RELEASE; urgency=low - - * Initial release - - -- Joe Sixpack $(date -R)" > ${BUILDDIR}/debian/changelog - echo "Source: $NAME -Priority: $PRIORITY -Maintainer: Joe Sixpack -Standards-Version: 3.9.3" > ${BUILDDIR}/debian/control - if [ "$SECTION" != '' ]; then - echo "Section: $SECTION" >> ${BUILDDIR}/debian/control - fi - local BUILDDEPS="$(echo "$DEPENDENCIES" | grep '^Build-')" - test -z "$BUILDDEPS" || echo "$BUILDDEPS" >> ${BUILDDIR}/debian/control - echo " -Package: $NAME" >> ${BUILDDIR}/debian/control + local VERSION="$2" + local RELEASE="$3" + local ARCH="$4" - if [ "$ARCH" = 'all' ]; then - echo "Architecture: all" >> ${BUILDDIR}/debian/control - else - echo "Architecture: any" >> ${BUILDDIR}/debian/control - fi - local DEPS="$(echo "$DEPENDENCIES" | grep -v '^Build-')" - test -z "$DEPS" || echo "$DEPS" >> ${BUILDDIR}/debian/control - echo "Description: $DESCRIPTION" >> ${BUILDDIR}/debian/control - - echo '3.0 (native)' > ${BUILDDIR}/debian/source/format - cd ${BUILDDIR}/.. - testsuccess --nomsg dpkg-source -b ${NAME}-${VERSION} - cd - >/dev/null - sed -n 's#^dpkg-source: info: building [^ ]\+ in ##p' ${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output \ - | while read SRC; do - echo "pool/${SRC}" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist -# if expr match "${SRC}" '.*\.dsc' >/dev/null 2>&1; then -# gpg --yes --secret-keyring ./keys/joesixpack.sec \ -# --keyring ./keys/joesixpack.pub --default-key 'Joe Sixpack' \ -# --clearsign -o "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" -# mv "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" -# fi - done - - for arch in $(getarchitecturesfromcommalist "$ARCH"); do - msgtest "Build binary package for ${RELEASE} in ${SECTION}" "$NAME" - rm -rf ${BUILDDIR}/debian/tmp - mkdir -p ${BUILDDIR}/debian/tmp/DEBIAN ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME} ${BUILDDIR}/debian/tmp/usr/bin - cp ${BUILDDIR}/debian/copyright ${BUILDDIR}/debian/changelog ${BUILDDIR}/FEATURES ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME} - cp ${BUILDDIR}/${NAME} ${BUILDDIR}/debian/tmp/usr/bin/${NAME}-${arch} - if [ -n "$FILE_TREE" ]; then - cp -ar "$FILE_TREE" ${BUILDDIR}/debian/tmp - fi - - (cd ${BUILDDIR}; dpkg-gencontrol -DArchitecture=$arch) - (cd ${BUILDDIR}/debian/tmp; md5sum $(find usr/ -type f) > DEBIAN/md5sums) - local LOG="${BUILDDIR}/../${NAME}_${VERSION}_${arch}.dpkg-deb.log" - # ensure the right permissions as dpkg-deb ensists - chmod 755 ${BUILDDIR}/debian/tmp/DEBIAN - testsuccess --nomsg dpkg-deb -Z${COMPRESS_TYPE} --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. - echo "pool/${NAME}_${VERSION}_${arch}.deb" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist - done - - mkdir -p ${BUILDDIR}/../${NAME}_${VERSION} - cp ${BUILDDIR}/debian/changelog ${BUILDDIR}/../${NAME}_${VERSION}/ - cp ${BUILDDIR}/debian/changelog ${BUILDDIR}/../${NAME}_${VERSION}.changelog - rm -rf "${BUILDDIR}" - msgdone "info" -} - -buildpackage() { - local BUILDDIR=$1 - local RELEASE=$2 - local SECTION=$3 - local ARCH=$(getarchitecture $4) - local PKGNAME="$(echo "$BUILDDIR" | grep -o '[^/]*$')" - local BUILDLOG="$(readlink -f "${BUILDDIR}/../${PKGNAME}_${RELEASE}_${SECTION}.dpkg-bp.log")" - msgtest "Build package for ${RELEASE} in ${SECTION}" "$PKGNAME" - cd $BUILDDIR - if [ "$ARCH" = "all" ]; then - ARCH="$(dpkg-architecture -qDEB_HOST_ARCH 2> /dev/null)" - fi - testsuccess --nomsg dpkg-buildpackage -uc -us -a$ARCH - cp ${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output $BUILDLOG - local PKGS="$(grep '^dpkg-deb: building package' $BUILDLOG | cut -d'/' -f 2 | sed -e "s#'\.##")" - local SRCS="$(grep '^dpkg-source: info: building' $BUILDLOG | grep -o '[a-z0-9._+~-]*$')" - cd - > /dev/null - for PKG in $PKGS; do - echo "pool/${PKG}" >> ${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.pkglist - done - for SRC in $SRCS; do - echo "pool/${SRC}" >> ${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.srclist - done -} - -buildaptarchive() { - if [ -d incoming ]; then - buildaptarchivefromincoming "$@" - else - buildaptarchivefromfiles "$@" - fi -} - -createaptftparchiveconfig() { - local COMPRESSORS="$(cut -d' ' -f 1 ${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf | tr '\n' ' ')" - COMPRESSORS="${COMPRESSORS%* }" - local ARCHS="$(find pool/ -name '*.deb' | grep -oE '_[a-z0-9-]+\.deb$' | sort | uniq | sed -e '/^_all.deb$/ d' -e 's#^_\([a-z0-9-]*\)\.deb$#\1#' | tr '\n' ' ')" - if [ -z "$ARCHS" ]; then - # the pool is empty, so we will operate on faked packages - let us use the configured archs - ARCHS="$(getarchitectures)" - fi - echo -n 'Dir { - ArchiveDir "' >> ftparchive.conf - echo -n $(readlink -f .) >> ftparchive.conf - echo -n '"; - CacheDir "' >> ftparchive.conf - echo -n $(readlink -f ..) >> ftparchive.conf - echo -n '"; - FileListDir "' >> ftparchive.conf - echo -n $(readlink -f pool/) >> ftparchive.conf - echo -n '"; -}; -Default { - Packages::Compress "'"$COMPRESSORS"'"; - Sources::Compress "'"$COMPRESSORS"'"; - Contents::Compress "'"$COMPRESSORS"'"; - Translation::Compress "'"$COMPRESSORS"'"; - LongDescription "false"; -}; -TreeDefault { - Directory "pool/"; - SrcDirectory "pool/"; -}; -APT { - FTPArchive { - Release { - Origin "joesixpack"; - Label "apttestcases"; - Suite "unstable"; - Description "repository with dummy packages"; - Architectures "' >> ftparchive.conf - echo -n "$ARCHS" >> ftparchive.conf - echo 'source"; - }; - }; -};' >> ftparchive.conf - for DIST in $(find ./pool/ -maxdepth 1 -name '*.pkglist' -type f | cut -d'/' -f 3 | cut -d'.' -f 1 | sort | uniq); do - echo -n 'tree "dists/' >> ftparchive.conf - echo -n "$DIST" >> ftparchive.conf - echo -n '" { - Architectures "' >> ftparchive.conf - echo -n "$ARCHS" >> ftparchive.conf - echo -n 'source"; - FileList "' >> ftparchive.conf - echo -n "${DIST}.\$(SECTION).pkglist" >> ftparchive.conf - echo -n '"; - SourceFileList "' >> ftparchive.conf - echo -n "${DIST}.\$(SECTION).srclist" >> ftparchive.conf - echo -n '"; - Sections "' >> ftparchive.conf - echo -n "$(find ./pool/ -maxdepth 1 -name "${DIST}.*.pkglist" -type f | cut -d'/' -f 3 | cut -d'.' -f 2 | sort | uniq | tr '\n' ' ')" >> ftparchive.conf - echo '"; -};' >> ftparchive.conf - done -} - -buildaptftparchivedirectorystructure() { - local DISTS="$(grep -i '^tree ' ftparchive.conf | cut -d'/' -f 2 | sed -e 's#".*##')" - for DIST in $DISTS; do - local SECTIONS="$(grep -i -A 5 "dists/$DIST" ftparchive.conf | grep -i 'Sections' | cut -d'"' -f 2)" - for SECTION in $SECTIONS; do - local ARCHS="$(grep -A 5 "dists/$DIST" ftparchive.conf | grep Architectures | cut -d'"' -f 2 | sed -e 's#source##')" - for ARCH in $ARCHS; do - mkdir -p dists/${DIST}/${SECTION}/binary-${ARCH} - done - mkdir -p dists/${DIST}/${SECTION}/source - mkdir -p dists/${DIST}/${SECTION}/i18n - done - done -} - -insertpackage() { - local RELEASE="$1" - local NAME="$2" - local ARCH="$3" - local VERSION="$4" - local DEPENDENCIES="$5" - local PRIORITY="${6:-optional}" - local DESCRIPTION="${7:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE} - If you find such a package installed on your system, - something went horribly wrong! They are autogenerated - und used only by testcases and surf no other propose…"}" - local ARCHS="" - for arch in $(getarchitecturesfromcommalist "$ARCH"); do - if [ "$arch" = 'all' -o "$arch" = 'none' ]; then - ARCHS="$(getarchitectures)" - else - ARCHS="$arch" - fi - for BUILDARCH in $ARCHS; do - local PPATH="aptarchive/dists/${RELEASE}/main/binary-${BUILDARCH}" - mkdir -p $PPATH aptarchive/dists/${RELEASE}/main/source - touch aptarchive/dists/${RELEASE}/main/source/Sources - local FILE="${PPATH}/Packages" - echo "Package: $NAME -Priority: $PRIORITY -Section: other -Installed-Size: 42 -Maintainer: Joe Sixpack " >> $FILE - test "$arch" = 'none' || echo "Architecture: $arch" >> $FILE - echo "Version: $VERSION -Filename: pool/main/${NAME}/${NAME}_${VERSION}_${arch}.deb" >> $FILE - test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE - echo "Description: $DESCRIPTION" >> $FILE - echo >> $FILE - done - done -} - -insertsource() { - local RELEASE="$1" - local NAME="$2" - local ARCH="$3" - local VERSION="$4" - local DEPENDENCIES="$5" - local ARCHS="" - local SPATH="aptarchive/dists/${RELEASE}/main/source" - mkdir -p $SPATH - local FILE="${SPATH}/Sources" - echo "Package: $NAME -Binary: $NAME -Version: $VERSION -Maintainer: Joe Sixpack -Architecture: $ARCH" >> $FILE - test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE - echo "Files: - d41d8cd98f00b204e9800998ecf8427e 0 ${NAME}_${VERSION}.dsc - d41d8cd98f00b204e9800998ecf8427e 0 ${NAME}_${VERSION}.tar.gz -" >> $FILE + msgmsg "Installing package via rpm: ${NAME}-${VERSION}-${RELEASE}.${ARCH}.rpm" + rpm --dbpath="$TMPWORKINGDIRECTORY/var/lib/rpm" --nodeps -i "$TMPWORKINGDIRECTORY/usr/src/RPM/RPMS/${ARCH}/${NAME}-${VERSION}-${RELEASE}.${ARCH}.rpm" 1>/dev/null } -insertinstalledpackage() { +aptgetinstallpackage() { local NAME="$1" - local ARCH="$2" - local VERSION="$3" - local DEPENDENCIES="$4" - local PRIORITY="${5:-optional}" - local STATUS="${6:-install ok installed}" - local DESCRIPTION="${7:-"an autogenerated dummy ${NAME}=${VERSION}/installed - If you find such a package installed on your system, - something went horribly wrong! They are autogenerated - und used only by testcases and surf no other propose…"}" - - local FILE='rootdir/var/lib/dpkg/status' - local INFO='rootdir/var/lib/dpkg/info' - for arch in $(getarchitecturesfromcommalist "$ARCH"); do - echo "Package: $NAME -Status: $STATUS -Priority: $PRIORITY -Section: other -Installed-Size: 42 -Maintainer: Joe Sixpack -Version: $VERSION" >> $FILE - test "$arch" = 'none' || echo "Architecture: $arch" >> $FILE - test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE - echo "Description: $DESCRIPTION" >> $FILE - echo >> $FILE - if [ "$(dpkg-query -W --showformat='${Multi-Arch}')" = 'same' ]; then - echo -n > ${INFO}/${NAME}:${arch}.list - else - echo -n > ${INFO}/${NAME}.list - fi - done -} - - -buildaptarchivefromincoming() { - msginfo "Build APT archive for ${CCMD}$(basename $0)${CINFO} based on incoming packages…" - cd aptarchive - [ -e pool ] || ln -s ../incoming pool - [ -e ftparchive.conf ] || createaptftparchiveconfig - [ -e dists ] || buildaptftparchivedirectorystructure - msgninfo "\tGenerate Packages, Sources and Contents files… " - testsuccess aptftparchive generate ftparchive.conf - cd - > /dev/null - msgdone "info" - generatereleasefiles -} - -buildaptarchivefromfiles() { - msginfo "Build APT archive for ${CCMD}$(basename $0)${CINFO} based on prebuild files…" - find aptarchive -name 'Packages' -o -name 'Sources' | while read line; do - msgninfo "\t${line} file… " - compressfile "$line" "$1" - msgdone "info" - done - generatereleasefiles "$@" -} - -compressfile() { - cat ${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf | while read compressor extension command; do - if [ "$compressor" = '.' ]; then - if [ -n "$2" ]; then - touch -d "$2" "$1" - fi - continue - fi - cat "$1" | $command > "${1}.${extension}" - if [ -n "$2" ]; then - touch -d "$2" "${1}.${extension}" - fi - done -} - -# can be overridden by testcases for their pleasure -getcodenamefromsuite() { - case "$1" in - unstable) echo 'sid';; - *) echo -n "$1";; - esac -} -getreleaseversionfromsuite() { true; } -getlabelfromsuite() { true; } - -generatereleasefiles() { - # $1 is the Date header and $2 is the ValidUntil header to be set - # both should be given in notation date/touch can understand - msgninfo "\tGenerate Release files… " - if [ -e aptarchive/dists ]; then - for dir in $(find ./aptarchive/dists -mindepth 1 -maxdepth 1 -type d); do - local SUITE="$(echo "$dir" | cut -d'/' -f 4)" - local CODENAME="$(getcodenamefromsuite $SUITE)" - local VERSION="$(getreleaseversionfromsuite $SUITE)" - local LABEL="$(getlabelfromsuite $SUITE)" - if [ -n "$VERSION" ]; then - VERSION="-o APT::FTPArchive::Release::Version=${VERSION}" - fi - if [ -n "$LABEL" ]; then - LABEL="-o APT::FTPArchive::Release::Label=${LABEL}" - fi - aptftparchive -qq release $dir \ - -o APT::FTPArchive::Release::Suite="${SUITE}" \ - -o APT::FTPArchive::Release::Codename="${CODENAME}" \ - ${LABEL} \ - ${VERSION} \ - | sed -e '/0 Release$/ d' > $dir/Release # remove the self reference - if [ "$SUITE" = "experimental" -o "$SUITE" = "experimental2" ]; then - sed -i '/^Date: / a\ -NotAutomatic: yes' $dir/Release - fi - if [ -n "$1" -a "$1" != "now" ]; then - sed -i "s/^Date: .*$/Date: $(date -d "$1" '+%a, %d %b %Y %H:%M:%S %Z')/" $dir/Release - fi - if [ -n "$2" ]; then - sed -i "/^Date: / a\ -Valid-Until: $(date -d "$2" '+%a, %d %b %Y %H:%M:%S %Z')" $dir/Release - fi - done - else - aptftparchive -qq release ./aptarchive | sed -e '/0 Release$/ d' > aptarchive/Release # remove the self reference - fi - if [ -n "$1" -a "$1" != "now" ]; then - for release in $(find ./aptarchive -name 'Release'); do - touch -d "$1" $release - done - fi - msgdone "info" -} + local VERSION="$2" + local RELEASE="$3" + local ARCH="$4" -setupdistsaptarchive() { - local APTARCHIVE=$(readlink -f ./aptarchive) - rm -f root/etc/apt/sources.list.d/apt-test-*-deb.list - rm -f root/etc/apt/sources.list.d/apt-test-*-deb-src.list - for DISTS in $(find ./aptarchive/dists/ -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 4); do - SECTIONS=$(find ./aptarchive/dists/${DISTS}/ -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 5 | tr '\n' ' ') - msgninfo "\tadd deb and deb-src sources.list lines for ${CCMD}${DISTS} ${SECTIONS}${CINFO}… " - echo "deb file://$APTARCHIVE $DISTS $SECTIONS" > rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb.list - echo "deb-src file://$APTARCHIVE $DISTS $SECTIONS" > rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb-src.list - msgdone "info" - done -} - -setupflataptarchive() { - local APTARCHIVE=$(readlink -f ./aptarchive) - if [ -f ${APTARCHIVE}/Packages ]; then - msgninfo "\tadd deb sources.list line… " - echo "deb file://$APTARCHIVE /" > rootdir/etc/apt/sources.list.d/apt-test-archive-deb.list - msgdone "info" - else - rm -f rootdir/etc/apt/sources.list.d/apt-test-archive-deb.list - fi - if [ -f ${APTARCHIVE}/Sources ]; then - msgninfo "\tadd deb-src sources.list line… " - echo "deb-src file://$APTARCHIVE /" > rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list - msgdone "info" - else - rm -f rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list - fi -} - -setupaptarchive() { - buildaptarchive - if [ -e aptarchive/dists ]; then - setupdistsaptarchive - else - setupflataptarchive - fi - signreleasefiles - if [ "$1" != '--no-update' ]; then - msgninfo "\tSync APT's cache with the archive… " - aptget update -qq - msgdone "info" - fi -} - -signreleasefiles() { - local SIGNER="${1:-Joe Sixpack}" - local GPG="gpg --batch --yes" - msgninfo "\tSign archive with $SIGNER key… " - local REXKEY='keys/rexexpired' - local SECEXPIREBAK="${REXKEY}.sec.bak" - local PUBEXPIREBAK="${REXKEY}.pub.bak" - if [ "${SIGNER}" = 'Rex Expired' ]; then - # the key is expired, so gpg doesn't allow to sign with and the --faked-system-time - # option doesn't exist anymore (and using faketime would add a new obscure dependency) - # therefore we 'temporary' make the key not expired and restore a backup after signing - cp ${REXKEY}.sec $SECEXPIREBAK - cp ${REXKEY}.pub $PUBEXPIREBAK - local SECUNEXPIRED="${REXKEY}.sec.unexpired" - local PUBUNEXPIRED="${REXKEY}.pub.unexpired" - if [ -f "$SECUNEXPIRED" ] && [ -f "$PUBUNEXPIRED" ]; then - cp $SECUNEXPIRED ${REXKEY}.sec - cp $PUBUNEXPIRED ${REXKEY}.pub - else - printf "expire\n1w\nsave\n" | $GPG --keyring ${REXKEY}.pub --secret-keyring ${REXKEY}.sec --command-fd 0 --edit-key "${SIGNER}" >/dev/null 2>&1 || true - cp ${REXKEY}.sec $SECUNEXPIRED - cp ${REXKEY}.pub $PUBUNEXPIRED - fi - fi - for KEY in $(find keys/ -name '*.sec'); do - GPG="$GPG --secret-keyring $KEY" - done - for KEY in $(find keys/ -name '*.pub'); do - GPG="$GPG --keyring $KEY" - done - for RELEASE in $(find aptarchive/ -name Release); do - $GPG --default-key "$SIGNER" --armor --detach-sign --sign --output ${RELEASE}.gpg ${RELEASE} - local INRELEASE="$(echo "${RELEASE}" | sed 's#/Release$#/InRelease#')" - $GPG --default-key "$SIGNER" --clearsign --output $INRELEASE $RELEASE - # we might have set a specific date for the Release file, so copy it - touch -d "$(stat --format "%y" ${RELEASE})" ${RELEASE}.gpg ${INRELEASE} - done - if [ -f "$SECEXPIREBAK" ] && [ -f "$PUBEXPIREBAK" ]; then - mv -f $SECEXPIREBAK ${REXKEY}.sec - mv -f $PUBEXPIREBAK ${REXKEY}.pub - fi - msgdone "info" -} - -webserverconfig() { - msgtest "Set webserver config option '${1}' to" "$2" - local DOWNLOG='rootdir/tmp/download-testfile.log' - local STATUS='rootdir/tmp/webserverconfig.status' - rm -f "$STATUS" "$DOWNLOG" - if downloadfile "http://localhost:8080/_config/set/${1}/${2}" "$STATUS" > "$DOWNLOG"; then - msgpass - else - cat "$DOWNLOG" "$STATUS" - msgfail - fi - testwebserverlaststatuscode '200' -} - -rewritesourceslist() { - local APTARCHIVE="file://$(readlink -f "${TMPWORKINGDIRECTORY}/aptarchive")" - for LIST in $(find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list'); do - sed -i $LIST -e "s#$APTARCHIVE#${1}#" -e "s#http://localhost:8080/#${1}#" -e "s#http://localhost:4433/#${1}#" - done -} - -# wait for up to 10s for a pid file to appear to avoid possible race -# when a helper is started and dosn't write the PID quick enough -waitforpidfile() { - local PIDFILE="$1" - for i in $(seq 10); do - if test -s "$PIDFILE"; then - return 0 - fi - sleep 1 - done - msgdie "waiting for $PIDFILE failed" - return 1 -} - -changetowebserver() { - if [ "$1" != '--no-rewrite' ]; then - rewritesourceslist 'http://localhost:8080/' - else - shift - fi - if test -x ${APTWEBSERVERBINDIR}/aptwebserver; then - cd aptarchive - local LOG="webserver.log" - if ! aptwebserver -o aptwebserver::fork=1 "$@" >$LOG 2>&1 ; then - cat $LOG - false - fi - waitforpidfile aptwebserver.pid - local PID="$(cat aptwebserver.pid)" - if [ -z "$PID" ]; then - msgdie 'Could not fork aptwebserver successfully' - fi - addtrap "kill $PID;" - cd - > /dev/null - else - msgdie 'You have to build aptwerbserver or install a webserver' - fi -} - -changetohttpswebserver() { - if ! which stunnel4 >/dev/null; then - msgdie 'You need to install stunnel4 for https testcases' - fi - if [ ! -e "${TMPWORKINGDIRECTORY}/aptarchive/aptwebserver.pid" ]; then - changetowebserver --no-rewrite "$@" - fi - echo "pid = ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid -cert = ${TESTDIRECTORY}/apt.pem -output = /dev/null - -[https] -accept = 4433 -connect = 8080 -" > ${TMPWORKINGDIRECTORY}/stunnel.conf - stunnel4 "${TMPWORKINGDIRECTORY}/stunnel.conf" - waitforpidfile "${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid" - local PID="$(cat ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid)" - if [ -z "$PID" ]; then - msgdie 'Could not fork stunnel4 successfully' - fi - addtrap 'prefix' "kill ${PID};" - rewritesourceslist 'https://localhost:4433/' -} - -changetocdrom() { - mkdir -p rootdir/media/cdrom/.disk - local CD="$(readlink -f rootdir/media/cdrom)" - echo "acquire::cdrom::mount \"${CD}\"; -acquire::cdrom::${CD}/::mount \"mv ${CD}-unmounted ${CD}\"; -acquire::cdrom::${CD}/::umount \"mv ${CD} ${CD}-unmounted\"; -acquire::cdrom::autodetect 0;" > rootdir/etc/apt/apt.conf.d/00cdrom - echo -n "$1" > ${CD}/.disk/info - if [ ! -d aptarchive/dists ]; then - msgdie 'Flat file archive cdroms can not be created currently' - return 1 - fi - mv aptarchive/dists "$CD" - ln -s "$(readlink -f ./incoming)" $CD/pool - find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list' -delete - # start with an unmounted disk - mv "${CD}" "${CD}-unmounted" - # we don't want the disk to be modifiable - addtrap 'prefix' "chmod -f -R +w $PWD/rootdir/media/cdrom/dists/ $PWD/rootdir/media/cdrom-unmounted/dists/ || true;" - chmod -R -w rootdir/media/cdrom-unmounted/dists -} - -downloadfile() { - local PROTO="${1%%:*}" - apthelper -o Debug::Acquire::${PROTO}=1 -o Debug::pkgAcquire::Worker=1 \ - download-file "$1" "$2" 2>&1 || true - # only if the file exists the download was successful - if [ -e "$2" ]; then - return 0 - else - return 1 - fi + msgmsg "Installing package via apt-get: ${NAME}-${VERSION}-${RELEASE}.${ARCH}.rpm" + aptget install "$TMPWORKINGDIRECTORY/usr/src/RPM/RPMS/${ARCH}/${NAME}-${VERSION}-${RELEASE}.${ARCH}.rpm" 1>/dev/null } checkdiff() { @@ -1127,6 +290,43 @@ testequal() { "$@" 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail } +testregexmatch() { + local MSG='Test of regex match of' + if [ "$1" = '--nomsg' ]; then + MSG='' + shift + fi + + local COMPAREMSG="$1" + shift + + if [ -n "$MSG" ]; then + msgtest "$MSG" "$*" + fi + + local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testregexmatch.comparefile" + local RESULTFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testregexmatch.resultfile" + + echo "^$COMPAREMSG\$" > $COMPAREFILE + set +e + "$@" &> $RESULTFILE + set -e + + if [[ "$(cat $RESULTFILE)" =~ $(cat $COMPAREFILE) ]] ; then + msgpass + else + checkdiff $COMPAREFILE $RESULTFILE + msgfail + fi +} + +skiplines() { + local count="$1" + shift + + "$@" 2>&1 | tail +"$count" +} + testequalor2() { local COMPAREFILE1="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile1" local COMPAREFILE2="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile2" @@ -1180,39 +380,48 @@ testnopackage() { fi } -testdpkgstatus() { - local STATE="$1" - local NR="$2" - shift 2 - msgtest "Test that $NR package(s) are in state $STATE with" "dpkg -l $*" - local PKGS="$(dpkg -l "$@" 2>/dev/null | grep "^${STATE}" | wc -l)" - if [ "$PKGS" != $NR ]; then - echo >&2 $PKGS - dpkg -l "$@" | grep '^[a-z]' >&2 - msgfail - else +testpkginstalled() { + msgtest "Test that package(s) are installed with" "rpm -q $*" + + local result=0 + + set +e + rpm --dbpath="$TMPWORKINGDIRECTORY/var/lib/rpm" -q "$@" &>/dev/null + result=$? + set -e + + if [ $result -eq 0 ] ; then msgpass + else + msgfail fi } -testdpkginstalled() { - testdpkgstatus 'ii' "$#" "$@" -} +getpackageversion() { + local result= + + set +e + result=$(rpm --dbpath="$TMPWORKINGDIRECTORY/var/lib/rpm" -q --qf '%{EVR}\n' "$@" 2>/dev/null) + set -e -testdpkgnotinstalled() { - testdpkgstatus 'ii' '0' "$@" + echo $result } -testmarkedauto() { - local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedauto.comparefile" - if [ -n "$1" ]; then - msgtest 'Test for correctly marked as auto-installed' "$*" - while [ -n "$1" ]; do echo "$1"; shift; done | sort > $COMPAREFILE +testpkgnotinstalled() { + msgtest "Test that package(s) are not installed with" "rpm -q $*" + + local result=0 + + set +e + rpm --dbpath="$TMPWORKINGDIRECTORY/var/lib/rpm" -q "$@" &>/dev/null + result=$? + set -e + + if [ $result -ne 0 ] ; then + msgpass else - msgtest 'Test for correctly marked as auto-installed' 'no package' - echo -n > $COMPAREFILE + msgfail fi - aptmark showauto 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail } testsuccess() { @@ -1247,29 +456,47 @@ testfailure() { fi } -testwebserverlaststatuscode() { - local DOWNLOG='rootdir/tmp/webserverstatus-testfile.log' - local STATUS='rootdir/tmp/webserverstatus-statusfile.log' - rm -f "$DOWNLOG" "$STATUS" - msgtest 'Test last status code from the webserver was' "$1" - downloadfile "http://localhost:8080/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG" - if [ "$(cat "$STATUS")" = "$1" ]; then - msgpass - else - echo >&2 - if [ -n "$2" ]; then - shift - echo >&2 '#### Additionally provided output files contain:' - cat >&2 "$@" - fi - echo >&2 '#### Download log of the status code:' - cat >&2 "$DOWNLOG" - msgfail "Status was $(cat "$STATUS")" +generaterepository() { + local ORIG_DIR="$1" + local REPO_DIR="$2" + local REPO_DATE="$3" + + local label="${GB_REPO_LABEL:-apt-tests}" + local description="${GB_REPO_DESCRIPTION:-ALT Linux $label}" + local date_s="$(date +%s)" + local arch="$(getarchitecture)" + local comps="${label}" + + if [ -n "$REPO_DATE" ] ; then + date_s="$REPO_DATE" fi -} -pause() { - echo "STOPPED execution. Press enter to continue" - local IGNORE - read IGNORE + for dir in ${arch} noarch ; do + mkdir -p "${REPO_DIR}/${dir}/RPMS.${label}" + mkdir -p "${REPO_DIR}/${dir}/base" + stat "${ORIG_DIR}/${dir}/"*.rpm &>/dev/null && cp "${ORIG_DIR}/${dir}/"*.rpm "${REPO_DIR}/${dir}/RPMS.${label}"/ + done + + mkdir -p "${TMPWORKINGDIRECTORY}/cache" + + for dir in ${arch} noarch ; do + genbasedir \ + --cachedir="${TMPWORKINGDIRECTORY}/cache" \ + --architecture="$dir" \ + --architectures="$dir" \ + --archive="${GB_REPO_ARCHIVE:-$description}" \ + --codename="${GB_REPO_CODENAME:-$date_s}" \ + --description="${GB_REPO_DESCRIPTION:-$description}" \ + --label="$label" \ + --origin="${GB_REPO_ORIGIN:-ALT Linux Team}" \ + --suite="${GB_REPO_SUITE:-$label}" \ + --version="${GB_REPO_VERSION:-$date_s}" \ + --topdir="$REPO_DIR" \ + --flat --no-oldhashfile --no-bz2 --no-xz --mapi \ + $dir $comps + + if [ -n "$REPO_DATE" ] ; then + touch -t $(date --date=@${REPO_DATE} '+%Y%m%d%H%M.%S') "${REPO_DIR}/${dir}/base/"* + fi + done } diff --git a/apt/test/integration/run-tests b/apt/test/integration/run-tests index c39a2ac..8d51ebd 100755 --- a/apt/test/integration/run-tests +++ b/apt/test/integration/run-tests @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -e FAIL=0 @@ -36,14 +36,14 @@ else CRESET='' fi -TOTAL="$(run-parts --list $DIR | grep '/test-' | wc -l)" -for testcase in $(run-parts --list $DIR | grep '/test-'); do +TOTAL="$(ls $DIR | egrep '^test-' | wc -l)" +for testcase in $(ls $DIR | egrep '^test-'); do if [ "$MSGLEVEL" -le 2 ]; then printf "($(($ALL+1))/${TOTAL}) ${CTEST}Testcase ${CHIGH}$(basename ${testcase})${CRESET}: " else printf "${CTEST}Run Testcase ($(($ALL+1))/${TOTAL}) ${CHIGH}$(basename ${testcase})${CRESET}\n" fi - if ! ${testcase}; then + if ! ./${testcase}; then FAIL=$((FAIL+1)) FAILED_TESTS="$FAILED_TESTS $(basename $testcase)" echo >&2 "$(basename $testcase) ... FAIL" diff --git a/apt/test/integration/specs/conflicting-package-distupgrade.spec b/apt/test/integration/specs/conflicting-package-distupgrade.spec new file mode 100644 index 0000000..7f59ae6 --- /dev/null +++ b/apt/test/integration/specs/conflicting-package-distupgrade.spec @@ -0,0 +1,18 @@ +Name: conflicting-package-one +Version: 2 +Release: alt1 +Summary: Test package +License: LGPLv2+ +Group: Other + +Conflicts: conflicting-package-two +Conflicts: simple-package + +%description +Dummy description + +%files + +%changelog +* Mon Sep 30 2019 Nobody 2-alt1 +- Test package created diff --git a/apt/test/integration/specs/conflicting-package-one.spec b/apt/test/integration/specs/conflicting-package-one.spec new file mode 100644 index 0000000..b0ae93f --- /dev/null +++ b/apt/test/integration/specs/conflicting-package-one.spec @@ -0,0 +1,17 @@ +Name: conflicting-package-one +Version: 1 +Release: alt1 +Summary: Test package +License: LGPLv2+ +Group: Other + +Conflicts: conflicting-package-two + +%description +Dummy description + +%files + +%changelog +* Mon Sep 30 2019 Nobody 1-alt1 +- Test package created diff --git a/apt/test/integration/specs/conflicting-package-two.spec b/apt/test/integration/specs/conflicting-package-two.spec new file mode 100644 index 0000000..363bc77 --- /dev/null +++ b/apt/test/integration/specs/conflicting-package-two.spec @@ -0,0 +1,17 @@ +Name: conflicting-package-two +Version: 1 +Release: alt1 +Summary: Test package +License: LGPLv2+ +Group: Other + +Conflicts: conflicting-package-one + +%description +Dummy description + +%files + +%changelog +* Mon Sep 30 2019 Nobody 1-alt1 +- Test package created diff --git a/apt/test/integration/specs/missing-dependency.spec b/apt/test/integration/specs/missing-dependency.spec new file mode 100644 index 0000000..c53fdfc --- /dev/null +++ b/apt/test/integration/specs/missing-dependency.spec @@ -0,0 +1,17 @@ +Name: missing-dependency +Version: 1 +Release: alt1 +Summary: Test package +License: LGPLv2+ +Group: Other + +Requires: no-such-package + +%description +Dummy description + +%files + +%changelog +* Mon Sep 30 2019 Nobody 1-alt1 +- Test package created diff --git a/apt/test/integration/specs/simple-package-new.spec b/apt/test/integration/specs/simple-package-new.spec new file mode 100644 index 0000000..caefd34 --- /dev/null +++ b/apt/test/integration/specs/simple-package-new.spec @@ -0,0 +1,19 @@ +Name: simple-package-new +Version: 3 +Release: alt1 +Summary: Test package +License: LGPLv2+ +Group: Other + +Provides: simple-package = %EVR +Obsoletes: simple-package < %EVR +Conflicts: simple-package < %EVR + +%description +Dummy description + +%files + +%changelog +* Mon Sep 30 2019 Nobody 3-alt1 +- Test package created diff --git a/apt/test/integration/specs/simple-package-noarch.spec b/apt/test/integration/specs/simple-package-noarch.spec new file mode 100644 index 0000000..5a4e724 --- /dev/null +++ b/apt/test/integration/specs/simple-package-noarch.spec @@ -0,0 +1,17 @@ +Name: simple-package-noarch +Version: 1 +Release: alt1 +Summary: Test package +License: LGPLv2+ +Group: Other + +BuildArch: noarch + +%description +Dummy description + +%files + +%changelog +* Mon Sep 30 2019 Nobody 1-alt1 +- Test package created diff --git a/apt/test/integration/specs/simple-package-update-conflict.spec b/apt/test/integration/specs/simple-package-update-conflict.spec new file mode 100644 index 0000000..debbf3e --- /dev/null +++ b/apt/test/integration/specs/simple-package-update-conflict.spec @@ -0,0 +1,17 @@ +Name: simple-package +Version: 2 +Release: alt1 +Summary: Test package +License: LGPLv2+ +Group: Other + +Conflicts: conflicting-package-one + +%description +Dummy description + +%files + +%changelog +* Mon Sep 30 2019 Nobody 2-alt1 +- Test package created diff --git a/apt/test/integration/specs/simple-package-update.spec b/apt/test/integration/specs/simple-package-update.spec new file mode 100644 index 0000000..5cd1200 --- /dev/null +++ b/apt/test/integration/specs/simple-package-update.spec @@ -0,0 +1,15 @@ +Name: simple-package +Version: 2 +Release: alt1 +Summary: Test package +License: LGPLv2+ +Group: Other + +%description +Dummy description + +%files + +%changelog +* Mon Sep 30 2019 Nobody 2-alt1 +- Test package created diff --git a/apt/test/integration/specs/simple-package.spec b/apt/test/integration/specs/simple-package.spec new file mode 100644 index 0000000..ff10b63 --- /dev/null +++ b/apt/test/integration/specs/simple-package.spec @@ -0,0 +1,15 @@ +Name: simple-package +Version: 1 +Release: alt1 +Summary: Test package +License: LGPLv2+ +Group: Other + +%description +Dummy description + +%files + +%changelog +* Mon Sep 30 2019 Nobody 1-alt1 +- Test package created diff --git a/apt/test/integration/specs/simple-virtual.spec b/apt/test/integration/specs/simple-virtual.spec new file mode 100644 index 0000000..b915145 --- /dev/null +++ b/apt/test/integration/specs/simple-virtual.spec @@ -0,0 +1,17 @@ +Name: simple-virtual +Version: 1 +Release: alt1 +Summary: Test package +License: LGPLv2+ +Group: Other + +Provides: virtual(dummy) + +%description +Dummy description + +%files + +%changelog +* Mon Sep 30 2019 Nobody 1-alt1 +- Test package created diff --git a/apt/test/integration/test-apt-cache-depends-simple b/apt/test/integration/test-apt-cache-depends-simple new file mode 100755 index 0000000..b07bd79 --- /dev/null +++ b/apt/test/integration/test-apt-cache-depends-simple @@ -0,0 +1,38 @@ +#!/bin/bash +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment + +buildpackage "conflicting-package-distupgrade" +buildpackage "conflicting-package-one" +buildpackage "conflicting-package-two" +buildpackage "missing-dependency" +buildpackage "simple-package-new" +buildpackage "simple-package-noarch" +buildpackage "simple-package" +buildpackage "simple-package-update-conflict" +buildpackage "simple-package-update" + +generaterepository "$TMPWORKINGDIRECTORY/usr/src/RPM/RPMS" "$TMPWORKINGDIRECTORY/usr/src/RPM/REPO" + +testsuccess aptget update + +testregexmatch "simple-package-2-alt1@[0-9]+" aptcache depends "simple-package" + +testregexmatch "missing-dependency-1-alt1@[0-9]+ + Depends: " aptcache depends "missing-dependency" + +testregexmatch "conflicting-package-one-2-alt1@[0-9]+ + Conflicts: conflicting-package-two + Conflicts: simple-package + simple-package-new-3-alt1@[0-9]+" aptcache depends "conflicting-package-one" + +testregexmatch "missing-dependency-1-alt1@[0-9]+ + Depends: " aptcache depends "missing-dependency" + +testregexmatch "" aptcache depends "no-such-package" + +testregexmatch "W: Unable to locate package definitely-no-such-package" aptcache depends "definitely-no-such-package" diff --git a/apt/test/integration/test-apt-cache-dump b/apt/test/integration/test-apt-cache-dump new file mode 100755 index 0000000..6cc0bb5 --- /dev/null +++ b/apt/test/integration/test-apt-cache-dump @@ -0,0 +1,92 @@ +#!/bin/bash +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment + +buildpackage "conflicting-package-distupgrade" +buildpackage "conflicting-package-one" +buildpackage "conflicting-package-two" +buildpackage "missing-dependency" +buildpackage "simple-package-new" +buildpackage "simple-package-noarch" +buildpackage "simple-package" +buildpackage "simple-package-update-conflict" +buildpackage "simple-package-update" + +generaterepository "$TMPWORKINGDIRECTORY/usr/src/RPM/RPMS" "$TMPWORKINGDIRECTORY/usr/src/RPM/REPO" + +testsuccess aptget update + +testregexmatch "Using Versioning System: Standard \.rpm +Package: conflicting-package-two + Version: 1-alt1@[0-9]+ + File: /.*/rootdir/var/lib/apt/lists/.*_usr_src_RPM_REPO_.*_base_pkglist\.apt-tests + Depends: conflicting-package-one \(null\) +Package: no-such-package +Package: simple-package-noarch + Version: 1-alt1@[0-9]+ + File: /.*/rootdir/var/lib/apt/lists/.*_usr_src_RPM_REPO_noarch_base_pkglist\.apt-tests +Package: simple-package-new + Version: 3-alt1@[0-9]+ + File: /.*/rootdir/var/lib/apt/lists/.*_usr_src_RPM_REPO_.*_base_pkglist\.apt-tests + Depends: simple-package 3-alt1 + Depends: simple-package 3-alt1 +Package: missing-dependency + Version: 1-alt1@[0-9]+ + File: /.*/rootdir/var/lib/apt/lists/.*_usr_src_RPM_REPO_.*_base_pkglist\.apt-tests + Depends: no-such-package \(null\) +Package: simple-package + Version: 2-alt1@[0-9]+ + File: /.*/rootdir/var/lib/apt/lists/.*_usr_src_RPM_REPO_.*_base_pkglist\.apt-tests + Version: 1-alt1@[0-9]+ + File: /.*/rootdir/var/lib/apt/lists/.*_usr_src_RPM_REPO_.*_base_pkglist\.apt-tests +Package: conflicting-package-one + Version: 2-alt1@[0-9]+ + File: /.*/rootdir/var/lib/apt/lists/.*_usr_src_RPM_REPO_.*_base_pkglist\.apt-tests + Depends: conflicting-package-two \(null\) + Depends: simple-package \(null\) + Version: 1-alt1@[0-9]+ + File: /.*/rootdir/var/lib/apt/lists/.*_usr_src_RPM_REPO_.*_base_pkglist\.apt-tests + Depends: conflicting-package-two \(null\) +File: /.*/var/lib/rpm/Packages + Type: RPM Database + Size: [0-9]+ + ID: 2 + Flags: 1 + Time: .* + Archive: \(null\) + Component: \(null\) + Version: \(null\) + Origin: \(null\) + Site:[ ]* + Label: \(null\) + Architecture: \(null\) +File: /.*/rootdir/var/lib/apt/lists/.*_usr_src_RPM_REPO_noarch_base_pkglist\.apt-tests + Type: RPM Package Index + Size: [0-9]+ + ID: 1 + Flags: 0 + Time: .* + Archive: ALT Linux apt-tests + Component: apt-tests + Version: [0-9]+ + Origin: ALT Linux Team + Site:[ ]* + Label: apt-tests + Architecture: noarch +File: /.*/rootdir/var/lib/apt/lists/.*_usr_src_RPM_REPO_.*_base_pkglist\.apt-tests + Type: RPM Package Index + Size: [0-9]+ + ID: 0 + Flags: 0 + Time: .* + Archive: ALT Linux apt-tests + Component: apt-tests + Version: [0-9]+ + Origin: ALT Linux Team + Site:[ ]* + Label: apt-tests + Architecture: $(getarchitecture)" aptcache dump diff --git a/apt/test/integration/test-apt-cache-dumpavail b/apt/test/integration/test-apt-cache-dumpavail new file mode 100755 index 0000000..2c56300 --- /dev/null +++ b/apt/test/integration/test-apt-cache-dumpavail @@ -0,0 +1,115 @@ +#!/bin/bash +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment + +buildpackage "conflicting-package-distupgrade" +buildpackage "conflicting-package-one" +buildpackage "conflicting-package-two" +buildpackage "missing-dependency" +buildpackage "simple-package-new" +buildpackage "simple-package-noarch" +buildpackage "simple-package" +buildpackage "simple-package-update-conflict" +buildpackage "simple-package-update" + +generaterepository "$TMPWORKINGDIRECTORY/usr/src/RPM/RPMS" "$TMPWORKINGDIRECTORY/usr/src/RPM/REPO" + +testsuccess aptget update + +testregexmatch "Package: conflicting-package-two +Section: Other +Installed Size: 0 +Maintainer: +Version: 1-alt1@[0-9]+ +Pre-Depends: rpmlib\(PayloadIsLzma\) +Conflicts: conflicting-package-one +Provides: conflicting-package-two \(= 1-alt1\) +Architecture: $(getarchitecture) +Size: [0-9]+ +MD5Sum: [0-9a-fA-F]+ +Filename: conflicting-package-two-1-alt1\.$(getarchitecture)\.rpm +Description: Test package + Dummy description + + +Package: simple-package-noarch +Section: Other +Installed Size: 0 +Maintainer: +Version: 1-alt1@[0-9]+ +Pre-Depends: rpmlib\(PayloadIsLzma\) +Provides: simple-package-noarch \(= 1-alt1\) +Architecture: noarch +Size: [0-9]+ +MD5Sum: [0-9a-fA-F]+ +Filename: simple-package-noarch-1-alt1\.noarch\.rpm +Description: Test package + Dummy description + + +Package: simple-package-new +Section: Other +Installed Size: 0 +Maintainer: +Version: 3-alt1@[0-9]+ +Pre-Depends: rpmlib\(PayloadIsLzma\) +Conflicts: simple-package \(< 3-alt1\) +Provides: simple-package \(= 3-alt1\), simple-package-new \(= 3-alt1\) +Obsoletes: simple-package \(< 3-alt1\) +Architecture: $(getarchitecture) +Size: [0-9]+ +MD5Sum: [0-9a-fA-F]+ +Filename: simple-package-new-3-alt1\.$(getarchitecture)\.rpm +Description: Test package + Dummy description + + +Package: missing-dependency +Section: Other +Installed Size: 0 +Maintainer: +Version: 1-alt1@[0-9]+ +Pre-Depends: rpmlib\(PayloadIsLzma\) +Depends: no-such-package +Provides: missing-dependency \(= 1-alt1\) +Architecture: $(getarchitecture) +Size: [0-9]+ +MD5Sum: [0-9a-fA-F]+ +Filename: missing-dependency-1-alt1\.$(getarchitecture)\.rpm +Description: Test package + Dummy description + + +Package: simple-package +Section: Other +Installed Size: 0 +Maintainer: +Version: 2-alt1@[0-9]+ +Pre-Depends: rpmlib\(PayloadIsLzma\) +Provides: simple-package \(= 2-alt1\) +Architecture: $(getarchitecture) +Size: [0-9]+ +MD5Sum: [0-9a-fA-F]+ +Filename: simple-package-2-alt1\.$(getarchitecture)\.rpm +Description: Test package + Dummy description + + +Package: conflicting-package-one +Section: Other +Installed Size: 0 +Maintainer: +Version: 2-alt1@[0-9]+ +Pre-Depends: rpmlib\(PayloadIsLzma\) +Conflicts: conflicting-package-two, simple-package +Provides: conflicting-package-one \(= 2-alt1\) +Architecture: $(getarchitecture) +Size: [0-9]+ +MD5Sum: [0-9a-fA-F]+ +Filename: conflicting-package-one-2-alt1\.$(getarchitecture)\.rpm +Description: Test package + Dummy description" aptcache dumpavail diff --git a/apt/test/integration/test-apt-cache-pkgnames b/apt/test/integration/test-apt-cache-pkgnames new file mode 100755 index 0000000..2de38a7 --- /dev/null +++ b/apt/test/integration/test-apt-cache-pkgnames @@ -0,0 +1,32 @@ +#!/bin/bash +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment + +buildpackage "conflicting-package-distupgrade" +buildpackage "conflicting-package-one" +buildpackage "conflicting-package-two" +buildpackage "missing-dependency" +buildpackage "simple-package-new" +buildpackage "simple-package-noarch" +buildpackage "simple-package" +buildpackage "simple-package-update-conflict" +buildpackage "simple-package-update" +buildpackage "simple-virtual" + +generaterepository "$TMPWORKINGDIRECTORY/usr/src/RPM/RPMS" "$TMPWORKINGDIRECTORY/usr/src/RPM/REPO" + +testsuccess aptget update + +testequal "conflicting-package-two +no-such-package +simple-virtual +simple-package-noarch +virtual(dummy) +simple-package-new +missing-dependency +simple-package +conflicting-package-one" aptcache pkgnames diff --git a/apt/test/integration/test-apt-cache-search-simple b/apt/test/integration/test-apt-cache-search-simple new file mode 100755 index 0000000..bb8f023 --- /dev/null +++ b/apt/test/integration/test-apt-cache-search-simple @@ -0,0 +1,38 @@ +#!/bin/bash +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment + +buildpackage "conflicting-package-distupgrade" +buildpackage "conflicting-package-one" +buildpackage "conflicting-package-two" +buildpackage "missing-dependency" +buildpackage "simple-package-new" +buildpackage "simple-package-noarch" +buildpackage "simple-package" +buildpackage "simple-package-update-conflict" +buildpackage "simple-package-update" + +generaterepository "$TMPWORKINGDIRECTORY/usr/src/RPM/RPMS" "$TMPWORKINGDIRECTORY/usr/src/RPM/REPO" + +testsuccess aptget update + +testequal "simple-package - Test package +simple-package-new - Test package +simple-package-noarch - Test package" aptcache search "simple-package" + +testequal "simple-package - Test package +simple-package-new - Test package +simple-package-noarch - Test package" aptcache search "simple-package-*" + +testequal "simple-package - Test package +simple-package-new - Test package +simple-package-noarch - Test package" aptcache search "simple-package*" + +testequal "simple-package-new - Test package +simple-package-noarch - Test package" aptcache search "simple-package-n*" + +testempty aptcache search "no-such-package" diff --git a/apt/test/integration/test-apt-cache-show-simple b/apt/test/integration/test-apt-cache-show-simple new file mode 100755 index 0000000..b188714 --- /dev/null +++ b/apt/test/integration/test-apt-cache-show-simple @@ -0,0 +1,67 @@ +#!/bin/bash +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment + +buildpackage "conflicting-package-distupgrade" +buildpackage "conflicting-package-one" +buildpackage "conflicting-package-two" +buildpackage "missing-dependency" +buildpackage "simple-package-new" +buildpackage "simple-package-noarch" +buildpackage "simple-package" +buildpackage "simple-package-update-conflict" +buildpackage "simple-package-update" + +generaterepository "$TMPWORKINGDIRECTORY/usr/src/RPM/RPMS" "$TMPWORKINGDIRECTORY/usr/src/RPM/REPO" + +testsuccess aptget update + +testregexmatch "Package: simple-package +Section: Other +Installed Size: 0 +Maintainer: +Version: 2-alt1@[0-9]+ +Pre-Depends: rpmlib\(PayloadIsLzma\) +Provides: simple-package \(= 2-alt1\) +Architecture: $(getarchitecture) +Size: [0-9]+ +MD5Sum: [0-9a-fA-F]+ +Filename: simple-package-2-alt1\.$(getarchitecture)\.rpm +Description: Test package + Dummy description + + +Package: simple-package +Section: Other +Installed Size: 0 +Maintainer: +Version: 1-alt1@[0-9]+ +Pre-Depends: rpmlib\(PayloadIsLzma\) +Provides: simple-package \(= 1-alt1\) +Architecture: $(getarchitecture) +Size: [0-9]+ +MD5Sum: [0-9a-fA-F]+ +Filename: simple-package-1-alt1\.$(getarchitecture)\.rpm +Description: Test package + Dummy description" aptcache show "simple-package" + +testregexmatch "Package: missing-dependency +Section: Other +Installed Size: 0 +Maintainer: +Version: 1-alt1@[0-9]+ +Pre-Depends: rpmlib\(PayloadIsLzma\) +Depends: no-such-package +Provides: missing-dependency \(= 1-alt1\) +Architecture: $(getarchitecture) +Size: [0-9]+ +MD5Sum: [0-9a-fA-F]+ +Filename: missing-dependency-1-alt1\.$(getarchitecture)\.rpm +Description: Test package + Dummy description" aptcache show "missing-dependency" + +testempty aptcache show "no-such-package" diff --git a/apt/test/integration/test-apt-cache-showpkg-simple b/apt/test/integration/test-apt-cache-showpkg-simple new file mode 100755 index 0000000..3df1232 --- /dev/null +++ b/apt/test/integration/test-apt-cache-showpkg-simple @@ -0,0 +1,44 @@ +#!/bin/bash +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment + +buildpackage "simple-package" + +testpkgnotinstalled "simple-package" +testequal 'W: Unable to locate package simple-package' aptcache showpkg "simple-package" + +generaterepository "$TMPWORKINGDIRECTORY/usr/src/RPM/RPMS" "$TMPWORKINGDIRECTORY/usr/src/RPM/REPO" + +testsuccess aptget update + +testpkgnotinstalled "simple-package" +testregexmatch "Package: simple-package[ ]* +Versions:[ ]* +1-alt1@[0-9]+\(.*\)[ ]* +[ ]* +Reverse Depends:[ ]* +Dependencies:[ ]* +1-alt1@[0-9]+ -[ ]* +Provides:[ ]* +1-alt1@[0-9]+ - simple-package[ ]* +Reverse Provides:[ ]* +simple-package 1-alt1@[0-9]+[ ]*" aptcache showpkg "simple-package" + +aptgetinstallpackage "simple-package" "1" "alt1" "$(getarchitecture)" + +testpkginstalled "simple-package" +testregexmatch "Package: simple-package[ ]* +Versions:[ ]* +1-alt1@[0-9]+\(.*\)[ ]* +[ ]* +Reverse Depends:[ ]* +Dependencies:[ ]* +1-alt1@[0-9]+ -[ ]* +Provides:[ ]* +1-alt1@[0-9]+ - simple-package[ ]* +Reverse Provides:[ ]* +simple-package 1-alt1@[0-9]+[ ]*" aptcache showpkg "simple-package" diff --git a/apt/test/integration/test-apt-cache-stats b/apt/test/integration/test-apt-cache-stats new file mode 100755 index 0000000..3b540c6 --- /dev/null +++ b/apt/test/integration/test-apt-cache-stats @@ -0,0 +1,36 @@ +#!/bin/bash +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment + +buildpackage "conflicting-package-distupgrade" +buildpackage "conflicting-package-one" +buildpackage "conflicting-package-two" +buildpackage "missing-dependency" +buildpackage "simple-package-new" +buildpackage "simple-package-noarch" +buildpackage "simple-package" +buildpackage "simple-package-update-conflict" +buildpackage "simple-package-update" + +generaterepository "$TMPWORKINGDIRECTORY/usr/src/RPM/RPMS" "$TMPWORKINGDIRECTORY/usr/src/RPM/REPO" + +testsuccess aptget update + +testregexmatch "Total Package Names : 7 \([^\)]*\) + Normal Packages: 0 + Pure Virtual Packages: 0 + Single Virtual Packages: 0 + Mixed Virtual Packages: 6 + Missing: 1 +Total Distinct Versions: 8 \([^\)]*\) +Total Dependencies: 7 \([^\)]*\) +Total Ver/File relations: 8 \([^\)]*\) +Total Provides Mappings: 9 \([^\)]*\) +Total Globbed Strings: 10 \([^\)]*\) +Total Dependency Version space: 14 +Total Slack space: .* +Total Space Accounted for: .*" aptcache stats diff --git a/apt/test/integration/test-apt-cache-unmet b/apt/test/integration/test-apt-cache-unmet new file mode 100755 index 0000000..e4f9950 --- /dev/null +++ b/apt/test/integration/test-apt-cache-unmet @@ -0,0 +1,31 @@ +#!/bin/bash +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment + +buildpackage "conflicting-package-distupgrade" +buildpackage "conflicting-package-one" +buildpackage "conflicting-package-two" +buildpackage "simple-package-new" +buildpackage "simple-package-noarch" +buildpackage "simple-package" +buildpackage "simple-package-update-conflict" +buildpackage "simple-package-update" + +generaterepository "$TMPWORKINGDIRECTORY/usr/src/RPM/RPMS" "$TMPWORKINGDIRECTORY/usr/src/RPM/REPO" + +testsuccess aptget update + +testempty aptcache unmet + +buildpackage "missing-dependency" + +generaterepository "$TMPWORKINGDIRECTORY/usr/src/RPM/RPMS" "$TMPWORKINGDIRECTORY/usr/src/RPM/REPO" "$(date +%s --date='now +1 day')" + +testsuccess aptget update + +testregexmatch "Package missing-dependency version 1-alt1@[0-9]+ has an unmet dep: + Depends: no-such-package" aptcache unmet diff --git a/apt/test/integration/test-apt-cache-whatdepends-simple b/apt/test/integration/test-apt-cache-whatdepends-simple new file mode 100755 index 0000000..16684a4 --- /dev/null +++ b/apt/test/integration/test-apt-cache-whatdepends-simple @@ -0,0 +1,43 @@ +#!/bin/bash +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment + +buildpackage "conflicting-package-distupgrade" +buildpackage "conflicting-package-one" +buildpackage "conflicting-package-two" +buildpackage "missing-dependency" +buildpackage "simple-package-new" +buildpackage "simple-package-noarch" +buildpackage "simple-package" +buildpackage "simple-package-update-conflict" +buildpackage "simple-package-update" + +generaterepository "$TMPWORKINGDIRECTORY/usr/src/RPM/RPMS" "$TMPWORKINGDIRECTORY/usr/src/RPM/REPO" + +testsuccess aptget update + +testregexmatch "simple-package-2-alt1@[0-9]+ + simple-package-new-3-alt1@[0-9]+ + Conflicts: simple-package < 3-alt1 + Obsoletes: simple-package < 3-alt1 + conflicting-package-one-2-alt1@[0-9]+ + Conflicts: simple-package + simple-package-new-3-alt1@[0-9]+" aptcache whatdepends "simple-package" + +testregexmatch "missing-dependency-1-alt1@[0-9]+" aptcache whatdepends "missing-dependency" + +testregexmatch "conflicting-package-one-2-alt1@[0-9]+ + conflicting-package-two-1-alt1@[0-9]+ + Conflicts: conflicting-package-one" aptcache whatdepends "conflicting-package-one" + +testregexmatch "missing-dependency-1-alt1@[0-9]+" aptcache whatdepends "missing-dependency" + +testregexmatch " + missing-dependency-1-alt1@[0-9]+ + Depends: " aptcache whatdepends "no-such-package" + +testregexmatch "W: Unable to locate package definitely-no-such-package" aptcache whatdepends "definitely-no-such-package" diff --git a/apt/test/integration/test-apt-check-simple b/apt/test/integration/test-apt-check-simple new file mode 100755 index 0000000..bd56d1c --- /dev/null +++ b/apt/test/integration/test-apt-check-simple @@ -0,0 +1,26 @@ +#!/bin/bash +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment + +buildpackage "missing-dependency" +buildpackage "simple-package" + +testpkgnotinstalled "missing-dependency" +testpkgnotinstalled "simple-package" +testsuccess aptget check + +installpackage "simple-package" "1" "alt1" "$(getarchitecture)" + +testpkgnotinstalled "missing-dependency" +testpkginstalled "simple-package" +testsuccess aptget check + +installpackage "missing-dependency" "1" "alt1" "$(getarchitecture)" + +testpkginstalled "missing-dependency" +testpkginstalled "simple-package" +testfailure aptget check diff --git a/apt/test/integration/test-apt-config-dump b/apt/test/integration/test-apt-config-dump new file mode 100755 index 0000000..134242f --- /dev/null +++ b/apt/test/integration/test-apt-config-dump @@ -0,0 +1,61 @@ +#!/bin/bash +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment + +testregexmatch "APT \"\"; +APT::Architecture \"$(getarchitecture)\"; +APT::DistroVersion \"\"; +APT::Get \"\"; +APT::Get::ReInstall \"\"; +APT::Get::ReInstall::MarkManual \"1\"; +APT::Get::Obsoletes \"\"; +APT::Get::Obsoletes::AptMarkInheritanceAuto \"all\"; +Dir \"[^\"]*\"; +Dir::State \"var/lib/apt/\"; +Dir::State::lists \"lists/\"; +Dir::State::cdroms \"cdroms\.list\"; +Dir::State::prefetch \"prefetch\"; +Dir::Cache \"var/cache/apt/\"; +Dir::Cache::archives \"archives/\"; +Dir::Cache::srcpkgcache \"srcpkgcache\.bin\"; +Dir::Cache::pkgcache \"pkgcache\.bin\"; +Dir::Etc \"etc/apt/\"; +Dir::Etc::sourcelist \"[^\"]*\"; +Dir::Etc::sourceparts \"sources\.list\.d\"; +Dir::Etc::vendorlist \"vendors\.list\"; +Dir::Etc::vendorparts \"vendors\.list\.d\"; +Dir::Etc::main \"apt\.conf\"; +Dir::Etc::parts \"apt\.conf\.d\"; +Dir::Etc::preferences \"preferences\"; +Dir::Etc::preferencesparts \"preferences\.d\"; +Dir::Etc::pkgpriorities \"pkgpriorities\"; +Dir::Etc::translatelist \"translate\.list\"; +Dir::Etc::translateparts \"translate\.list\.d\"; +Dir::Bin \"\"; +Dir::Bin::methods \"[^\"]*\"; +Dir::Bin::rpm \"/bin/rpm\"; +Dir::Bin::scripts \"/usr/share/apt/scripts\"; +Dir::Ignore-Files-Silently \"\"; +Dir::Ignore-Files-Silently:: \"~\\$\"; +Dir::Ignore-Files-Silently:: \"\\\.disabled\\$\"; +Dir::Ignore-Files-Silently:: \"\\\.bak\\$\"; +Dir::Ignore-Files-Silently:: \"\\\.dpkg-\[a-z\]\+\\$\"; +Dir::Ignore-Files-Silently:: \"\\\.ucf-\[a-z\]\+\\$\"; +Dir::Ignore-Files-Silently:: \"\\\.save\\$\"; +Dir::Ignore-Files-Silently:: \"\\\.orig\\$\"; +Dir::Ignore-Files-Silently:: \"[^\"]*\\$\"; +Dir::Locale \"/usr/share/locale\"; +Acquire \"\"; +Acquire::ComprExtension \"\.bz2\"; +Acquire::DistroID \"ALT Linux\"; +Acquire::CDROM \"\"; +Acquire::CDROM::Mount \"/media/ALTLinux\"; +Acquire::CDROM::Copy-All \"true\"; +Debug \"\"; +Debug::NoLocking \"true\"; +RPM \"\"; +RPM::DBPath \"[^\"]*\";" aptconfig dump diff --git a/apt/test/integration/test-apt-distupgrade-conflict b/apt/test/integration/test-apt-distupgrade-conflict new file mode 100755 index 0000000..d03413c --- /dev/null +++ b/apt/test/integration/test-apt-distupgrade-conflict @@ -0,0 +1,30 @@ +#!/bin/bash +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment + +buildpackage "simple-package" +buildpackage "simple-package-update" +buildpackage "conflicting-package-one" +buildpackage "conflicting-package-distupgrade" + +testpkgnotinstalled "simple-package" +testpkgnotinstalled "conflicting-package-one" +aptgetinstallpackage "simple-package" "1" "alt1" "$(getarchitecture)" +aptgetinstallpackage "conflicting-package-one" "1" "alt1" "$(getarchitecture)" +testpkginstalled "simple-package" +testpkginstalled "conflicting-package-one" + +testequal '1-alt1' getpackageversion "simple-package" +testequal '1-alt1' getpackageversion "conflicting-package-one" + +generaterepository "$TMPWORKINGDIRECTORY/usr/src/RPM/RPMS" "$TMPWORKINGDIRECTORY/usr/src/RPM/REPO" + +testsuccess aptget update + +testsuccess aptget dist-upgrade -y +testequal '2-alt1' getpackageversion "simple-package" +testequal '1-alt1' getpackageversion "conflicting-package-one" diff --git a/apt/test/integration/test-apt-distupgrade-mutual-conflict b/apt/test/integration/test-apt-distupgrade-mutual-conflict new file mode 100755 index 0000000..6e1262c --- /dev/null +++ b/apt/test/integration/test-apt-distupgrade-mutual-conflict @@ -0,0 +1,31 @@ +#!/bin/bash +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment + +buildpackage "simple-package" +buildpackage "simple-package-update-conflict" +buildpackage "conflicting-package-one" +buildpackage "conflicting-package-distupgrade" + +testpkgnotinstalled "simple-package" +testpkgnotinstalled "conflicting-package-one" +aptgetinstallpackage "simple-package" "1" "alt1" "$(getarchitecture)" +aptgetinstallpackage "conflicting-package-one" "1" "alt1" "$(getarchitecture)" +testpkginstalled "simple-package" +testpkginstalled "conflicting-package-one" + +testequal '1-alt1' getpackageversion "simple-package" +testequal '1-alt1' getpackageversion "conflicting-package-one" + +generaterepository "$TMPWORKINGDIRECTORY/usr/src/RPM/RPMS" "$TMPWORKINGDIRECTORY/usr/src/RPM/REPO" + +testsuccess aptget update + +testsuccess aptget dist-upgrade -y + +testequal '1-alt1' getpackageversion "simple-package" +testequal '1-alt1' getpackageversion "conflicting-package-one" diff --git a/apt/test/integration/test-apt-distupgrade-obsolete b/apt/test/integration/test-apt-distupgrade-obsolete new file mode 100755 index 0000000..44110d0 --- /dev/null +++ b/apt/test/integration/test-apt-distupgrade-obsolete @@ -0,0 +1,26 @@ +#!/bin/bash +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment + +buildpackage "simple-package" +buildpackage "simple-package-new" + +testpkgnotinstalled "simple-package" +testpkgnotinstalled "simple-package-new" + +aptgetinstallpackage "simple-package" "1" "alt1" "$(getarchitecture)" +testpkginstalled "simple-package" +testpkgnotinstalled "simple-package-new" + +generaterepository "$TMPWORKINGDIRECTORY/usr/src/RPM/RPMS" "$TMPWORKINGDIRECTORY/usr/src/RPM/REPO" + +testsuccess aptget update + +testsuccess aptget dist-upgrade -y + +testpkgnotinstalled "simple-package" +testpkginstalled "simple-package-new" diff --git a/apt/test/integration/test-apt-distupgrade-simple b/apt/test/integration/test-apt-distupgrade-simple new file mode 100755 index 0000000..c330ecf --- /dev/null +++ b/apt/test/integration/test-apt-distupgrade-simple @@ -0,0 +1,23 @@ +#!/bin/bash +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment + +buildpackage "simple-package" +buildpackage "simple-package-update" + +testpkgnotinstalled "simple-package" +aptgetinstallpackage "simple-package" "1" "alt1" "$(getarchitecture)" +testpkginstalled "simple-package" + +testequal '1-alt1' getpackageversion "simple-package" + +generaterepository "$TMPWORKINGDIRECTORY/usr/src/RPM/RPMS" "$TMPWORKINGDIRECTORY/usr/src/RPM/REPO" + +testsuccess aptget update + +testsuccess aptget dist-upgrade -y +testequal '2-alt1' getpackageversion "simple-package" diff --git a/apt/test/integration/test-apt-install-conflicting-packages b/apt/test/integration/test-apt-install-conflicting-packages new file mode 100755 index 0000000..9fc8f19 --- /dev/null +++ b/apt/test/integration/test-apt-install-conflicting-packages @@ -0,0 +1,27 @@ +#!/bin/bash +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment + +buildpackage "conflicting-package-one" +buildpackage "conflicting-package-two" + +testpkgnotinstalled "conflicting-package-one" "conflicting-package-two" + +testregexmatch "Reading Package Lists\.\.\. +Building Dependency Tree\.\.\. +Selecting conflicting-package-one for '[^']+' +Selecting conflicting-package-two for '[^']+' +Some packages could not be installed\. This may mean that you have +requested an impossible situation or if you are using the unstable +distribution that some required packages have not yet been created +or been moved out of Incoming\. +The following information may help to resolve the situation: + +The following packages have unmet dependencies: + conflicting-package-one: Conflicts: conflicting-package-two + conflicting-package-two: Conflicts: conflicting-package-one +E: Broken packages" aptget install "$TMPWORKINGDIRECTORY/usr/src/RPM/RPMS/$(getarchitecture)/conflicting-package-one-1-alt1.$(getarchitecture).rpm" "$TMPWORKINGDIRECTORY/usr/src/RPM/RPMS/$(getarchitecture)/conflicting-package-two-1-alt1.$(getarchitecture).rpm" diff --git a/apt/test/integration/test-apt-install-double b/apt/test/integration/test-apt-install-double new file mode 100755 index 0000000..4728b08 --- /dev/null +++ b/apt/test/integration/test-apt-install-double @@ -0,0 +1,17 @@ +#!/bin/bash +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment + +buildpackage "simple-package" +buildpackage "conflicting-package-one" + +testpkgnotinstalled "simple-package" "conflicting-package-one" +aptgetinstallpackage "simple-package" "1" "alt1" "$(getarchitecture)" +testpkginstalled "simple-package" +testpkgnotinstalled "conflicting-package-one" +aptgetinstallpackage "conflicting-package-one" "1" "alt1" "$(getarchitecture)" +testpkginstalled "simple-package" "conflicting-package-one" diff --git a/apt/test/integration/test-apt-install-simple b/apt/test/integration/test-apt-install-simple new file mode 100755 index 0000000..b765b19 --- /dev/null +++ b/apt/test/integration/test-apt-install-simple @@ -0,0 +1,13 @@ +#!/bin/bash +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment + +buildpackage "simple-package" + +testpkgnotinstalled "simple-package" +aptgetinstallpackage "simple-package" "1" "alt1" "$(getarchitecture)" +testpkginstalled "simple-package" diff --git a/apt/test/integration/test-apt-mark-simple b/apt/test/integration/test-apt-mark-simple new file mode 100755 index 0000000..0a6fe65 --- /dev/null +++ b/apt/test/integration/test-apt-mark-simple @@ -0,0 +1,58 @@ +#!/bin/bash +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment + +buildpackage "simple-package" +buildpackage "conflicting-package-one" + +aptgetinstallpackage "simple-package" "1" "alt1" "$(getarchitecture)" +aptgetinstallpackage "conflicting-package-one" "1" "alt1" "$(getarchitecture)" + +testpkginstalled "simple-package" +testpkginstalled "conflicting-package-one" + +testequal "Reading Package Lists... +Building Dependency Tree... +conflicting-package-one manual +simple-package manual" aptmark showstate simple-package conflicting-package-one + +testequal "Reading Package Lists... +Building Dependency Tree... +conflicting-package-one manual +simple-package manual" aptmark showstate + +testequal "Reading Package Lists... +Building Dependency Tree..." aptmark showauto + +testequal "Reading Package Lists... +Building Dependency Tree... +conflicting-package-one +simple-package" aptmark showmanual + +testsuccess aptmark auto simple-package + +testequal "Reading Package Lists... +Building Dependency Tree... +conflicting-package-one manual +simple-package auto" aptmark showstate simple-package conflicting-package-one + +testequal "Reading Package Lists... +Building Dependency Tree... +conflicting-package-one manual" aptmark showstate conflicting-package-one + +testequal "Reading Package Lists... +Building Dependency Tree... +conflicting-package-one manual +simple-package auto" aptmark showstate + +testequal "Reading Package Lists... +Building Dependency Tree... +simple-package" aptmark showauto + +testequal "Reading Package Lists... +Building Dependency Tree... +conflicting-package-one" aptmark showmanual diff --git a/apt/test/integration/test-apt-remove-double b/apt/test/integration/test-apt-remove-double new file mode 100755 index 0000000..87aa0d0 --- /dev/null +++ b/apt/test/integration/test-apt-remove-double @@ -0,0 +1,22 @@ +#!/bin/bash +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment + +buildpackage "simple-package" +buildpackage "conflicting-package-one" + +testpkgnotinstalled "simple-package" "conflicting-package-one" +aptgetinstallpackage "simple-package" "1" "alt1" "$(getarchitecture)" +msgmsg "Installed package \"simple-package\"" +aptgetinstallpackage "conflicting-package-one" "1" "alt1" "$(getarchitecture)" +msgmsg "Installed package \"conflicting-package-one\"" +testpkginstalled "simple-package" "conflicting-package-one" +testsuccess aptget -y remove "simple-package" +testpkgnotinstalled "simple-package" +testpkginstalled "conflicting-package-one" +testsuccess aptget -y remove "conflicting-package-one" +testpkgnotinstalled "simple-package" "conflicting-package-one" diff --git a/apt/test/integration/test-apt-remove-simple b/apt/test/integration/test-apt-remove-simple new file mode 100755 index 0000000..1b28e71 --- /dev/null +++ b/apt/test/integration/test-apt-remove-simple @@ -0,0 +1,15 @@ +#!/bin/bash +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment + +buildpackage "simple-package" +testpkgnotinstalled "simple-package" +aptgetinstallpackage "simple-package" "1" "alt1" "$(getarchitecture)" +msgmsg "Installed package \"simple-package\"" +testpkginstalled "simple-package" +testsuccess aptget -y remove "simple-package" +testpkgnotinstalled "simple-package" diff --git a/apt/test/integration/test-apt-update-simple b/apt/test/integration/test-apt-update-simple new file mode 100755 index 0000000..7ada61c --- /dev/null +++ b/apt/test/integration/test-apt-update-simple @@ -0,0 +1,19 @@ +#!/bin/bash +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment + +buildpackage "simple-package" +buildpackage "simple-package-noarch" +buildpackage "conflicting-package-one" +buildpackage "conflicting-package-two" + +generaterepository "$TMPWORKINGDIRECTORY/usr/src/RPM/RPMS" "$TMPWORKINGDIRECTORY/usr/src/RPM/REPO" + +testsuccess aptget update +testsuccess aptcache show simple-package +testsuccess aptcache show simple-package-noarch +testfailure aptcache show nosuchpkg diff --git a/apt/test/integration/test-apt-upgrade-simple b/apt/test/integration/test-apt-upgrade-simple new file mode 100755 index 0000000..0fc9d54 --- /dev/null +++ b/apt/test/integration/test-apt-upgrade-simple @@ -0,0 +1,26 @@ +#!/bin/bash +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment + +buildpackage "simple-package" +buildpackage "simple-package-update" + +testpkgnotinstalled "simple-package" +aptgetinstallpackage "simple-package" "1" "alt1" "$(getarchitecture)" +testpkginstalled "simple-package" + +testequal '1-alt1' getpackageversion "simple-package" + +generaterepository "$TMPWORKINGDIRECTORY/usr/src/RPM/RPMS" "$TMPWORKINGDIRECTORY/usr/src/RPM/REPO" + +testsuccess aptget update + +testfailure aptget upgrade -y +testequal '1-alt1' getpackageversion "simple-package" + +testsuccess aptget upgrade -y -o APT::Get::EnableUpgrade=true +testequal '2-alt1' getpackageversion "simple-package" -- 2.24.0