summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Shachnev <mitya57@gmail.com>2017-10-11 13:30:47 +0300
committerDmitry Shachnev <mitya57@gmail.com>2017-10-11 13:41:46 +0300
commit564e86deed4cfd58d224896a121059063eaac3ec (patch)
treec5a48da238ecd307314b4a78fbc3b5d8c5d05ace
parentb2d289a8b6b7313f3a40bb14532aa1799c31c129 (diff)
downloadpkg-kde-tools-564e86deed4cfd58d224896a121059063eaac3ec.tar.gz
dh_qmlcdeps: New script for generating dependencies for *.qmlc files.
Closes: #872325.
-rw-r--r--CMakeLists.txt3
-rw-r--r--debian/changelog3
-rw-r--r--debian/pkg-kde-tools.install2
-rwxr-xr-xdh_qmlcdeps96
-rw-r--r--perllib/Debian/Debhelper/Sequence/qmlcdeps.pm8
5 files changed, 111 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0dabc71..697c050 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -62,12 +62,13 @@ install(DIRECTORY perllib/
# Install debhelper helpers programs
install(PROGRAMS
dh_movelibkdeinit
+ dh_qmlcdeps
dh_sameversiondep
dh_sodeps
DESTINATION ${BIN_INSTALL_DIR}
COMPONENT Programs
)
-install_pod_manpages(1 dh_movelibkdeinit dh_sameversiondep dh_sodeps)
+install_pod_manpages(1 dh_movelibkdeinit dh_qmlcdeps dh_sameversiondep dh_sodeps)
# Install pkgkde binaries
install(PROGRAMS
diff --git a/debian/changelog b/debian/changelog
index cfdd4f8..e9859cb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,8 @@
pkg-kde-tools (0.15.26) UNRELEASED; urgency=medium
+ [ Dmitry Shachnev ]
+ * Add a new script, dh_qmlcdeps, for generating proper Qt dependencies
+ for QML compiled data files (Closes: #872325).
-- Debian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org> Wed, 11 Oct 2017 13:24:10 +0300
diff --git a/debian/pkg-kde-tools.install b/debian/pkg-kde-tools.install
index 2042096..489d61d 100644
--- a/debian/pkg-kde-tools.install
+++ b/debian/pkg-kde-tools.install
@@ -1,4 +1,5 @@
usr/bin/dh_movelibkdeinit
+usr/bin/dh_qmlcdeps
usr/bin/dh_sameversiondep
usr/bin/dh_sodeps
usr/bin/pkgkde-debs2symbols
@@ -11,6 +12,7 @@ usr/bin/pkgkde-override-sc-dev-latest
usr/bin/pkgkde-symbolshelper
usr/bin/pkgkde-vcs
usr/share/man/man1/dh_movelibkdeinit.1
+usr/share/man/man1/dh_qmlcdeps.1
usr/share/man/man1/dh_sameversiondep.1
usr/share/man/man1/dh_sodeps.1
usr/share/man/man1/pkgkde-gensymbols.1
diff --git a/dh_qmlcdeps b/dh_qmlcdeps
new file mode 100755
index 0000000..0b86df4
--- /dev/null
+++ b/dh_qmlcdeps
@@ -0,0 +1,96 @@
+#!/usr/bin/perl -w
+
+# Copyright: 2017 Dmitry Shachnev <mitya57@debian.org>
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+=head1 NAME
+
+dh_qmlcdeps - generate proper dependencies for QML cache files
+
+=head1 SYNOPSIS
+
+B<dh_qmlcdeps> [S<I<debhelper options>>]
+
+=head1 DESCRIPTION
+
+B<dh_qmlcdeps> is a debhelper program that looks for F<*.qmlc> files
+(generated by B<qmlcachegen>) in the package temporary locations, performs
+sanity check on them, and adds a dependency on B<libqt5qml5> package to
+B<${qmlc:Depends}> substitution variable to make sure its version matches
+the Qt version in these files.
+
+You can pass B<--with qmlcdeps> to L<dh(1)> to make it automatically call
+B<dh_qmlcdeps> after B<dh_install>.
+
+=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;
+ my $qt_version_bin;
+
+ find({
+ wanted => sub {
+ my $filename = $_;
+ return unless ($filename =~ m/\.qmlc$/);
+ open (my $fh, "<", $filename);
+ binmode $fh;
+ read ($fh, my $magic, 8);
+ if ($magic ne "qv4cdata") {
+ close $fh;
+ error("Unknown .qmlc file: $File::Find::name");
+ }
+ read ($fh, my $struct_version, 4);
+ read ($fh, my $file_qt_version_bin, 4);
+ close $fh;
+ if ($qt_version_bin and $file_qt_version_bin ne $qt_version_bin) {
+ error("Package $package contains .qmlc files built for different Qt versions");
+ }
+ $qt_version_bin = $file_qt_version_bin;
+ }
+ }, $tmpdir);
+
+ $qt_version_bin or exit(0);
+ my @qt_version = unpack("C4", $qt_version_bin);
+ my $qt_version_str = "$qt_version[2].$qt_version[1].$qt_version[0]";
+ $qt_version[2] == 5 or error("Qt version $qt_version_str is not supported");
+ my $qt_next_version_str = "$qt_version[2].$qt_version[1]." . ($qt_version[0] + 1);
+
+ addsubstvar($package, "qmlc:Depends", "libqt5qml5 (>= $qt_version_str)");
+ addsubstvar($package, "qmlc:Depends", "libqt5qml5 (<< $qt_next_version_str)");
+}
+
+=head1 SEE ALSO
+
+L<debhelper(7)>
+
+=head1 AUTHOR
+
+Dmitry Shachnev <mitya57@debian.org>
+
+=cut
diff --git a/perllib/Debian/Debhelper/Sequence/qmlcdeps.pm b/perllib/Debian/Debhelper/Sequence/qmlcdeps.pm
new file mode 100644
index 0000000..07449d7
--- /dev/null
+++ b/perllib/Debian/Debhelper/Sequence/qmlcdeps.pm
@@ -0,0 +1,8 @@
+use warnings;
+use strict;
+
+use Debian::Debhelper::Dh_Lib;
+
+insert_after("dh_install", "dh_qmlcdeps");
+
+1;