debian/tests/skeleton-packaging
author Philippe Pepiot <philippe.pepiot@logilab.fr>
Thu, 09 Jan 2020 17:51:16 +0100
changeset 12843 000cd62eda32
parent 12709 280c9db41038
permissions -rw-r--r--
[sobjects/notification] fix broken email notifications In https://hg.logilab.org/review/cubicweb/rev/8caa109dfe945592a34904bb56971cc57d1c6084 EntityView.w become a method using EntityView._w In notifications we reset "self.w" for every notifications since we handle multiple streams. We should set "self._w" to None instead, otherwise subsequent calls to "self.w()" will fail with TypeError: 'NoneType' object is not callable.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12690
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
     1
#!/bin/sh
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
     2
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
     3
set -e
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
     4
set -x
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
     5
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
     6
if [ -z "$AUTOPKGTEST_TMP" ]; then
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
     7
	echo "Not running as part as autopkgtest" >&2
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
     8
	exit 250
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
     9
fi
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    10
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    11
# Switch to unprivileged user if needed
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    12
if [ "$(id -u)" = 0 ]; then
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    13
	apt-get install -q -y sudo
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    14
	echo 'Defaults !fqdn' > /etc/sudoers.d/fqdn
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    15
	echo 'nobody ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/nobody
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    16
	chown nobody:nogroup "$AUTOPKGTEST_TMP"
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    17
	exec su nobody -s /bin/sh -c "$0"
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    18
fi
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    19
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    20
cd "$AUTOPKGTEST_TMP"
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    21
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    22
# Create a cube
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    23
PACKAGE="cubicweb-mytest"
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    24
cubicweb-ctl newcube -s 'Just a test cube' ${PACKAGE#cubicweb-}
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    25
cd "$PACKAGE"
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    26
12686
74b8bceddee7 [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    27
UPSTREAM_VERSION=$(python3 setup.py --version)
12690
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    28
DEBIAN_VERSION=$(dpkg-parsechangelog -S Version)
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    29
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    30
# Create source tarball
12686
74b8bceddee7 [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    31
python3 setup.py sdist
12690
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    32
mv "dist/${PACKAGE}-${UPSTREAM_VERSION}.tar.gz" "../${PACKAGE}_${UPSTREAM_VERSION}.orig.tar.gz"
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    33
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    34
# Install build-dependencies
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    35
mk-build-deps --install --root-cmd sudo --remove \
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    36
	--tool 'apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --quiet --assume-yes'
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    37
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    38
# Build!
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    39
dpkg-buildpackage
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    40
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    41
# Output .buildinfo for posterity
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    42
cat ../*.buildinfo
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    43
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    44
# Output package content, again for posterity
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    45
debc
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    46
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    47
# Install the package
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    48
sudo debi --with-depends
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    49
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    50
lintian -i ../*.dsc ../*.changes
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    51
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    52
# Test if Python module is usable
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    53
python3 -c 'import cubicweb_mytest; print(dir(cubicweb_mytest))'
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    54
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    55
# Run autopkgtest (uh… inception, anyone?)
d1b5fd6129bd [pkg] Add new autopkgtest for skeleton packaging
Jérémy Bobbio <jeremy.bobbio@irq7.fr>
parents:
diff changeset
    56
sudo autopkgtest ../*.changes -- null