Commit 47cb2a0d authored by Christoph Berg's avatar Christoph Berg

pg_buildext: Replace multiple occurrences of PGVERSION on the same line, and...

pg_buildext: Replace multiple occurrences of PGVERSION on the same line, and implement replacing for debian/tests/control.in.
parent 54a5a05c
......@@ -11,6 +11,8 @@ postgresql-common (171) UNRELEASED; urgency=medium
devel/alpha versions, save a minimal copy of the old version binaries in
the preinst to enable using pg_upgrade. Use debconf in the postinst to
instruct the user how to proceed with the upgrade.
* pg_buildext: Replace multiple occurrences of PGVERSION on the same line,
and implement replacing for debian/tests/control.in.
[ Martin Pitt ]
* pg_upgradecluster: Fix "ANALZYE" typo.
......
......@@ -164,11 +164,38 @@ versions() {
gencontrol() {
tmpcontrol=$(mktemp debian/control.XXXXXX)
trap "rm -f $tmpcontrol" 0 2 3 15
if [ -f debian/tests/control.in ]; then
tmptestscontrol=$(mktemp debian/tests/control.XXXXXX)
fi
trap "rm -f $tmpcontrol ${tmptestscontrol:-}" 0 2 3 15
grep-dctrl -vP PGVERSION debian/control.in > $tmpcontrol
for v in $(versions); do
grep-dctrl -P PGVERSION debian/control.in | sed -e "s:PGVERSION:$v:" >> $tmpcontrol
grep-dctrl -P PGVERSION debian/control.in | sed -e "s:PGVERSION:$v:g" >> $tmpcontrol
done
if [ -f debian/tests/control.in ]; then
cp debian/tests/control.in $tmptestscontrol
# find words (package names) containing PGVERSION
REGEXP='[[:alnum:]-]*PGVERSION[[:alnum:]-]*'
for pkgpattern in $(egrep -wo "$REGEXP" debian/tests/control.in); do
repl=""
# build an array of replacements separated by ,
for v in $(versions); do
repl="${repl:+$repl, }$(echo $pkgpattern | sed -e "s/PGVERSION/$v/g")"
done
# put array into control file
sed -i -e "s/$pkgpattern/$repl/g" $tmptestscontrol
done
fi
}
updatecontrol() {
cat $tmpcontrol > debian/control
if [ -f debian/tests/control.in ]; then
cat $tmptestscontrol > debian/tests/control
fi
}
# when a version is included in the action, just act on this one (this is
......@@ -189,19 +216,24 @@ case $action in
if ! diff -u debian/control $tmpcontrol; then
if [ "${PG_UPDATECONTROL:-no}" != "no" ] || head -1 debian/changelog | egrep -q -- '-backports|-pgdg|-pgapt'; then
echo "Notice: Updating debian/control from debian/control.in."
mv $tmpcontrol debian/control
exit
need_update=1
else
echo "Error: debian/control needs updating from debian/control.in. Run 'pg_buildext updatecontrol'."
echo "If you are seeing this message in a buildd log, a sourceful upload is required."
exit 1
fi
echo "Error: debian/control needs updating from debian/control.in. Run 'pg_buildext updatecontrol'."
echo "If you are seeing this message in a buildd log, a sourceful upload is required."
exit 1
fi
exit
if ! diff -u debian/tests/control $tmptestscontrol; then
echo "Notice: Updating debian/tests/control from debian/tests/control.in."
need_update=1
fi
[ "$need_update" ] && updatecontrol
exit 0
;;
updatecontrol)
gencontrol
mv $tmpcontrol debian/control
updatecontrol
exit
;;
esac
......
......@@ -38,6 +38,11 @@ Many extensions support B<make installcheck> testing using B<pg_regress>. As
this needs the package to be installed, it cannot be run at build time.
Instead, the tests should be run using B<autopkgtest> from C<debian/tests/*>.
If C<debian/tests/control.in> exists, occurrences of package names containing
B<PGVERSION> are replaced by lists of package names with the target PostgreSQL
versions filled in. (If no replacing is needed in C<debian/tests/control>, it
is fine to provide the tests control file directly.)
=head1 OPTIONS
=over 4
......@@ -74,7 +79,8 @@ B<updatecontrol> needs to be run manually.
=item B<updatecontrol>
Update C<debian/control> from C<debian/control.in>.
Update C<debian/control> from C<debian/control.in>, and C<debian/tests/control>
from C<debian/tests/control.in> if the latter exists.
=item B<configure> I<build-dir> [I<extra-configure-options>]
......@@ -166,6 +172,8 @@ configure the list of supported versions on your system.
=item B<debian/rules:>
#!/usr/bin/make -f
include /usr/share/postgresql-common/pgxs_debian_control.mk
# omit this if the package does not use autoconf
......@@ -196,6 +204,12 @@ configure the list of supported versions on your system.
Tests: installcheck
Restrictions: allow-stderr
=item B<debian/tests/control.in:> (optional)
Depends: @, postgresql-contrib-PGVERSION, postgresql-PGVERSION-bar
Tests: installcheck
Restrictions: allow-stderr
=item B<debian/tests/installcheck:>
#!/bin/sh
......@@ -233,6 +247,9 @@ B<pg_buildext installcheck> was introduced in postgresql-server-dev-all (>=
B<PG_VIRTUALENV_UNSHARE=-n> was introduced in postgresql-common (>= 170~).
Handling of C<debian/tests/control.in> with B<PGVERSION> replacement was
introduced in postgresql-common (>= 171~).
=head1 SEE ALSO
C</usr/share/postgresql-common/supported-versions>, autopkgtest(1),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment