Files
flatpak/tests/make-test-runtime.sh
Alexander Larsson 0fb2f362a8 tests: Move the test repo to a subdirectory (repos/test)
This makes the ostree trivial-httpd --autoexit feature work better,
because it seems to exit whenever the root directory changes (i.e. not
only when its deleted).

This means the root dir can't be the repo (because then we can't
update the repo), or the base testdir (because we create files there
too), so instead we make the repo $testdir/repos/test and
$testdir/repos as the httpd root.
2017-01-12 00:04:36 +01:00

63 lines
2.1 KiB
Bash
Executable File

#!/bin/sh
set -e
DIR=`mktemp -d`
ID=$1
shift
flatpak build-init ${DIR} ${ID} ${ID} ${ID}
sed -i s/Application/Runtime/ ${DIR}/metadata
# Add bash and dependencies
mkdir -p ${DIR}/usr/bin
mkdir -p ${DIR}/usr/lib
ln -s ../lib ${DIR}/usr/lib64
ln -s ../lib ${DIR}/usr/lib32
T=`mktemp`
for i in $@; do
I=`which $i`
cp $I ${DIR}/usr/bin
ldd $I | sed "s/.* => //" | awk '{ print $1}' | grep ^/ | grep ^/ >> $T
if test $i == python2; then
mkdir -p ${DIR}/usr/lib/python2.7/lib-dynload
# This is a hardcoded minimal set of modules we need in the current tests.
# Pretty hacky stuff. Add modules as needed.
PYDIR=/usr/lib/python2.7
if test -d /usr/lib64/python2.7; then PYDIR=/usr/lib64/python2.7; fi
for py in site os stat posixpath genericpath warnings \
linecache types UserDict abc _abcoll \
_weakrefset copy_reg traceback sysconfig \
re sre_compile sre_parse sre_constants \
_sysconfigdata ; do
cp ${PYDIR}/$py.py ${DIR}/usr/lib/python2.7
done
# These might not exist, depending how Python was configured; and the
# part after ${so} might be "module" or ".x86_64-linux-gnu" or
# something else
for so in _locale strop ; do
cp ${PYDIR}/lib-dynload/${so}*.so ${DIR}/usr/lib/python2.7/lib-dynload || :
done
for plat in $( cd ${PYDIR} && echo plat-* ); do
test -e ${PYDIR}/${plat} || continue
mkdir -p ${DIR}/usr/lib/python2.7/${plat}
cp ${PYDIR}/${plat}/*.py ${DIR}/usr/lib/python2.7/${plat}/
done
fi
done
ln -s bash ${DIR}/usr/bin/sh
for i in `sort -u $T`; do
cp "$i" ${DIR}/usr/lib/
done
# We copy the C.UTF8 locale and call it en_US. Its a bit of a lie, but
# the real en_US locale is often not available, because its in the
# local archive.
mkdir -p ${DIR}/usr/lib/locale/
cp -r /usr/lib/locale/C.* ${DIR}/usr/lib/locale/en_US
mkdir -p repos
flatpak build-export --runtime ${GPGARGS-} repos/test ${DIR}
rm -rf ${DIR}