[neon/extras/grantlee/Neon/release] debian: add dh_grantlee
Pino Toscano
null at kde.org
Mon Sep 2 17:01:22 BST 2024
Git commit d8545f2ad7a91c51cde80cbd767c3b897b4c0a40 by Pino Toscano.
Committed on 05/08/2023 at 08:55.
Pushed by jriddell into branch 'Neon/release'.
add dh_grantlee
M +6 -0 debian/changelog
A +1 -0 debian/clean
M +2 -0 debian/control
A +79 -0 debian/dh/dh_grantlee
A +11 -0 debian/dh/grantlee.pm
M +2 -0 debian/libgrantlee5-dev.install
A +1 -0 debian/libgrantlee5-dev.manpages
M +3 -0 debian/rules
https://invent.kde.org/neon/extras/grantlee/-/commit/d8545f2ad7a91c51cde80cbd767c3b897b4c0a40
diff --git a/debian/changelog b/debian/changelog
index da4b43e..19c3247 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,12 @@ grantlee5 (5.2.0-5) UNRELEASED; urgency=medium
* Set upstream metadata fields: Bug-Database, Bug-Submit, Repository,
Repository-Browse.
* Update standards version to 4.6.2, no changes needed.
+ * Ship a new dh_grantlee tool in libgrantlee5-dev to help ensuring packages
+ that install grantlee plugins depend on the right version of
+ libgrantlee-templates5:
+ - add the grantlee5-templates-5-2 provides to libgrantlee-templates5,
+ - add the dh-sequence-grantlee provides to libgrantlee5-dev
+ - create the manpages for it at build time using pod2man
-- Debian Krap Maintainers <debian-qt-kde at lists.debian.org> Sat, 05 Aug 2023 10:12:07 +0200
diff --git a/debian/clean b/debian/clean
new file mode 100644
index 0000000..aa4b926
--- /dev/null
+++ b/debian/clean
@@ -0,0 +1 @@
+dh_grantlee.1
diff --git a/debian/control b/debian/control
index e670176..4f3a4a1 100644
--- a/debian/control
+++ b/debian/control
@@ -32,6 +32,7 @@ Package: libgrantlee-templates5
Architecture: any
Multi-Arch: same
Depends: ${misc:Depends}, ${shlibs:Depends}
+Provides: grantlee5-templates-5-2
Description: Grantlee templating library for Qt - Templates
Grantlee is a string template engine based on the Django template system
and written in Qt.
@@ -48,6 +49,7 @@ Depends: libgrantlee-templates5 (= ${binary:Version}),
${misc:Depends}
Breaks: libgrantlee-dev (<= 5~)
Replaces: libgrantlee-dev (<= 5~)
+Provides: dh-sequence-grantlee
Description: Grantlee templating library development files
Grantlee is a string template engine based on the Django template system
and written in Qt.
diff --git a/debian/dh/dh_grantlee b/debian/dh/dh_grantlee
new file mode 100755
index 0000000..fc15c2f
--- /dev/null
+++ b/debian/dh/dh_grantlee
@@ -0,0 +1,79 @@
+#!/usr/bin/perl -w
+
+# SPDX-FileCopyrightText: 2023 Pino Toscano <pino at debian.org>
+# SPDX-License-Identifier: GPL-2.0
+
+=head1 NAME
+
+dh_grantlee - generate proper dependencies for grantlee plugins
+
+=head1 SYNOPSIS
+
+B<dh_qmlcdeps> [S<I<debhelper options>>]
+
+=head1 DESCRIPTION
+
+B<dh_grantlee> is a debhelper program that looks for F<*.so> files of
+grantlee plugins, installed in F</usr/lib/$DEB_HOST_MULTIARCH/grantlee>
+or F</usr/lib/$DEB_HOST_MULTIARCH/qt5/plugins/grantlee>, under a subdirectory
+named C<MAJOR.MINOR> (e.g. C<5.2>): in case any is found, a proper dependency
+C<grantlee5-templates-MAJOR-MINOR> dependency is added to the
+B<${grantlee:Depends}> substitution variable.
+
+This is needed because Grantlee loads plugins for templates only in
+subdirectories named after its C<MAJOR.MINOR> version.
+
+You can pass B<--with grantlee> to L<dh(1)> to make it automatically call
+B<dh_grantlee> after B<dh_install>, or add the C<dh-sequence-grantlee>
+build dependency.
+
+=cut
+
+use strict;
+use warnings;
+use File::Find;
+use Debian::Debhelper::Dh_Lib;
+
+init(options => {});
+
+foreach my $package (@{$dh{DOPACKAGES}}) {
+ my $tmpdir = tmpdir($package);
+ next unless -d "$tmpdir/usr/lib";
+ my $multiarch = dpkg_architecture_value("DEB_HOST_MULTIARCH");
+ my @candidate_paths = (
+ "$tmpdir/usr/lib/$multiarch/grantlee",
+ "$tmpdir/usr/lib/$multiarch/qt5/plugins/grantlee",
+ );
+ my @paths = grep { -d $_ } @candidate_paths;
+ next unless @paths;
+
+ my $grantlee_version;
+
+ find({
+ wanted => sub {
+ return unless $_ =~ /\.so$/;
+ return unless $File::Find::dir =~ m,/grantlee/(\d\.\d)/?$,;
+ my $file_version = $1;
+ if ($grantlee_version and $file_version ne $grantlee_version) {
+ error("Package $package contains plugins for different grantlee versions");
+ }
+ $grantlee_version = $file_version;
+ }
+ }, @paths);
+
+ $grantlee_version or next;
+ my $grantlee_version_str = "grantlee5-templates-$grantlee_version";
+ $grantlee_version_str =~ tr/./-/;
+
+ addsubstvar($package, "grantlee:Depends", $grantlee_version_str);
+}
+
+=head1 SEE ALSO
+
+L<debhelper(7)>
+
+=head1 AUTHOR
+
+Pino Toscano <pino at debian.org>
+
+=cut
diff --git a/debian/dh/grantlee.pm b/debian/dh/grantlee.pm
new file mode 100644
index 0000000..c13d70d
--- /dev/null
+++ b/debian/dh/grantlee.pm
@@ -0,0 +1,11 @@
+# SPDX-FileCopyrightText: 2023 Pino Toscano <pino at debian.org>
+# SPDX-License-Identifier: GPL-2.0
+
+use warnings;
+use strict;
+
+use Debian::Debhelper::Dh_Lib;
+
+insert_after("dh_install", "dh_grantlee");
+
+1;
diff --git a/debian/libgrantlee5-dev.install b/debian/libgrantlee5-dev.install
index 67a96b8..719a0b3 100644
--- a/debian/libgrantlee5-dev.install
+++ b/debian/libgrantlee5-dev.install
@@ -1,3 +1,5 @@
+debian/dh/dh_grantlee /usr/bin/
+debian/dh/grantlee.pm /usr/share/perl5/Debian/Debhelper/Sequence/
usr/include/grantlee/
usr/include/grantlee_templates.h
usr/include/grantlee_textdocument.h
diff --git a/debian/libgrantlee5-dev.manpages b/debian/libgrantlee5-dev.manpages
new file mode 100644
index 0000000..aa4b926
--- /dev/null
+++ b/debian/libgrantlee5-dev.manpages
@@ -0,0 +1 @@
+dh_grantlee.1
diff --git a/debian/rules b/debian/rules
index 72e57c2..674fc9b 100755
--- a/debian/rules
+++ b/debian/rules
@@ -16,5 +16,8 @@ endif
override_dh_auto_configure:
dh_auto_configure -- -DBUILD_TESTS=ON -DLIB_SUFFIX="/$(DEB_HOST_MULTIARCH)"
+execute_after_dh_auto_build-arch:
+ pod2man debian/dh/dh_grantlee > dh_grantlee.1
+
override_dh_auto_test:
xvfb-run dh_auto_test $(fail_param)
More information about the Neon-commits
mailing list