| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
# Copyright © 2018, 2019, 2022, 2023, 2025 Rafael Laboissière <[email protected]> |
| 4 |
# |
| 5 |
# This program is free software; you can redistribute it and/or modify |
| 6 |
# it under the terms of the GNU General Public License as published by |
| 7 |
# the Free Software Foundation; either version 3 of the License, or |
| 8 |
# (at your option) any later version. |
| 9 |
# |
| 10 |
# This program is distributed in the hope that it will be useful, |
| 11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
# GNU General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License along |
| 16 |
# with this program; if not, see <https://www.gnu.org/licenses/>. |
| 17 |
|
| 18 |
: <<=cut |
| 19 |
|
| 20 |
=encoding utf8 |
| 21 |
|
| 22 |
=head1 NAME |
| 23 |
|
| 24 |
dh_octave_version - check Octave version dependency for an Octave add-on package |
| 25 |
|
| 26 |
=head1 SYNOPSIS |
| 27 |
|
| 28 |
B<dh_octave_version> |
| 29 |
|
| 30 |
=head1 DESCRIPTION |
| 31 |
|
| 32 |
B<dh_octave_version> is intended to be run from the top-level source |
| 33 |
directory of an Octave add-on package. It checks whether the version |
| 34 |
of the Octave program installed in the system satisfies the dependency |
| 35 |
specified in the package's F<DESCRIPTION> file. |
| 36 |
|
| 37 |
=head1 SEE ALSO |
| 38 |
|
| 39 |
L<debhelper(7)>, L<dh(1)>, L<dh_octave_substvar(1)>, L<dh_octave_clean(1)>, |
| 40 |
L<dh_octave_check(1)>, L<dh_octave_changelogs(1)>, L<dh_octave_examples(1)> |
| 41 |
|
| 42 |
This program is meant to be used together with debhelper for Debian |
| 43 |
packages derived from Octave add-on packages. |
| 44 |
It is recommended to enable it by adding the dh-sequence-octave |
| 45 |
virtual package to Build-Depends, Build-Depends-Arch or |
| 46 |
Build-Depends-Indep. |
| 47 |
This is equivalent to adding dh-octave to the same field and adding |
| 48 |
--with=octave to the dh sequencer in debian/rules, except that only |
| 49 |
-arch/-indep/profiled builds are affected. |
| 50 |
This is also slightly more simple in the most common case. |
| 51 |
|
| 52 |
=head1 AUTHOR |
| 53 |
|
| 54 |
Rafael Laboissière <[email protected]> |
| 55 |
|
| 56 |
=cut |
| 57 |
|
| 58 |
# Exit immediately on error |
| 59 |
set -e |
| 60 |
|
| 61 |
echo -n "Checking the Octave version... " |
| 62 |
|
| 63 |
version=$(octave-config -p VERSION | sed 's/-rc/~rc/') |
| 64 |
|
| 65 |
dep=$(grep Depends DESCRIPTION \ |
| 66 |
| perl -ne 'if (/octave\s+\(>=\s*([.\d]+)\)/i) {print $1}') |
| 67 |
|
| 68 |
if [ "$dep" != "" ] ; then |
| 69 |
if dpkg --compare-versions "$version" lt "$dep" ; then |
| 70 |
echo ; |
| 71 |
echo "Octave version mismatch: " \ |
| 72 |
"Needs >= $dep, but version " \ |
| 73 |
"$version is installed" 1>&2 ; |
| 74 |
exit 1 |
| 75 |
fi |
| 76 |
fi |
| 77 |
|
| 78 |
echo ok |
| 79 |
|
| 80 |
# Local Variables: |
| 81 |
# indent-tabs-mode: nil |
| 82 |
# tab-width: 4 |
| 83 |
# End: |