echo "DPKG::options:: \"--log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log\";" >> aptconfig.conf
echo 'quiet::NoUpdate "true";' >> aptconfig.conf
export LC_ALL=C
+ export PATH="${PATH}:/usr/local/sbin:/usr/sbin:/sbin"
msgdone "info"
}
local DEPENDENCIES="$5"
local DESCRIPTION="$6"
local SECTION="${7:-others}"
+ local PRIORITY="${8:-optional}"
local DISTSECTION
if [ "$SECTION" = "$(echo "$SECTION" | cut -d'/' -f 2)" ]; then
DISTSECTION="main"
-- Joe Sixpack <joe@example.org> $(date -R)" > ${BUILDDIR}/debian/changelog
echo "Source: $NAME
Section: $SECTION
-Priority: optional
+Priority: $PRIORITY
Maintainer: Joe Sixpack <joe@example.org>
Standards-Version: 3.9.1
fi
echo '3.0 (native)' > ${BUILDDIR}/debian/source/format
local SRCS="$( (cd ${BUILDDIR}/..; dpkg-source -b ${NAME}-${VERSION} 2>&1) | grep '^dpkg-source: info: building' | grep -o '[a-z0-9._+~-]*$')"
-
- 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
- (cd ${BUILDDIR}; dpkg-gencontrol -DArchitecture=$ARCH)
- (cd ${BUILDDIR}/debian/tmp; md5sum $(find usr/ -type f) > DEBIAN/md5sums)
-
- dpkg-deb --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. 2> /dev/null > /dev/null
- echo "pool/${NAME}_${VERSION}_${ARCH}.deb" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist
for SRC in $SRCS; do
echo "pool/${SRC}" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist
done
+
+ for arch in $(echo "$ARCH" | sed -e 's#,#\n#g'); do
+ 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}
+ (cd ${BUILDDIR}; dpkg-gencontrol -DArchitecture=$arch)
+ (cd ${BUILDDIR}/debian/tmp; md5sum $(find usr/ -type f) > DEBIAN/md5sums)
+
+ dpkg-deb --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. 2> /dev/null > /dev/null
+ 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
local ARCH="$3"
local VERSION="$4"
local DEPENDENCIES="$5"
- local ARCHS="$ARCH"
- if [ "$ARCHS" = "all" ]; then
- ARCHS="$(aptconfig dump | grep APT::Architecture | cut -d'"' -f 2 | sed '/^$/ d' | sort | uniq | tr '\n' ' ')"
- 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: optional
+ local PRIORITY="${6:-optional}"
+ local ARCHS=""
+ for arch in $(echo "$ARCH" | sed -e 's#,#\n#g'); do
+ if [ "$arch" = "all" ]; then
+ ARCHS="$(aptconfig dump | grep APT::Architecture | cut -d'"' -f 2 | sed '/^$/ d' | sort | uniq | tr '\n' ' ')"
+ 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 <joe@example.org>
-Architecture: $ARCH
+Architecture: $arch
Version: $VERSION
-Filename: pool/main/${NAME}/${NAME}_${VERSION}_${ARCH}.deb" >> $FILE
+Filename: pool/main/${NAME}/${NAME}_${VERSION}_${arch}.deb" >> $FILE
+ test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
+ echo "Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
+ If you find such a package installed on your system,
+ YOU did something horribly wrong! They are autogenerated
+ und used only by testcases for APT and surf no other propose…
+" >> $FILE
+ done
+ done
+}
+
+insertinstalledpackage() {
+ local NAME="$1"
+ local ARCH="$2"
+ local VERSION="$3"
+ local DEPENDENCIES="$4"
+ local PRIORITY="${5:-optional}"
+ local FILE="rootdir/var/lib/dpkg/status"
+ for arch in $(echo "$ARCH" | sed -e 's#,#\n#g'); do
+ echo "Package: $NAME
+Status: install ok installed
+Priority: $PRIORITY
+Section: other
+Installed-Size: 42
+Maintainer: Joe Sixpack <joe@example.org>
+Architecture: $arch
+Version: $VERSION" >> $FILE
test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
- echo "Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
+ echo "Description: an autogenerated dummy ${NAME}=${VERSION}/installed
If you find such a package installed on your system,
YOU did something horribly wrong! They are autogenerated
und used only by testcases for APT and surf no other propose…
done
}
+
buildaptarchivefromincoming() {
msginfo "Build APT archive for ${CCMD}$(basename $0)${CINFO} based on incoming packages…"
cd aptarchive
if which weborf > /dev/null; then
weborf -xb aptarchive/ 2>&1 > /dev/null &
addtrap "kill $!;"
- local APTARCHIVE="file://$(readlink -f ./aptarchive)"
- for LIST in $(find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list'); do
- sed -i $LIST -e "s#$APTARCHIVE#http://localhost:8080/#"
- done
- return 0
+ elif which lighttpd > /dev/null; then
+ echo "server.document-root = \"$(readlink -f ./aptarchive)\"
+server.port = 8080
+server.stat-cache-engine = \"disable\"" > lighttpd.conf
+ lighttpd -t -f lighttpd.conf >/dev/null || msgdie 'Can not change to webserver: our lighttpd config is invalid'
+ lighttpd -D -f lighttpd.conf 2>/dev/null >/dev/null &
+ addtrap "kill $!;"
+ else
+ msgdie 'You have to install weborf or lighttpd first'
+ return 1
fi
- return 1
+ local APTARCHIVE="file://$(readlink -f ./aptarchive)"
+ for LIST in $(find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list'); do
+ sed -i $LIST -e "s#$APTARCHIVE#http://localhost:8080/#"
+ done
+ return 0
}
checkdiff() {
while [ -n "$1" ]; do echo "$1"; shift; done | sort > $COMPAREFILE
else
msgtest 'Test for correctly marked as auto-installed' 'no package'
- echo > $COMPAREFILE
+ echo -n > $COMPAREFILE
fi
aptmark showauto 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail
}