[SCM] kodi/master: Provide virtual packages for addon APIs and install a debhelper addon to enable KODI addon packages to depend on these virtual packages.

tiber-guest at users.alioth.debian.org tiber-guest at users.alioth.debian.org
Sun Nov 13 19:50:39 UTC 2016


The following commit has been merged in the master branch:
commit d6a30eb58cf4c92662ac6d1d81543676281f514e
Author: Tobias Grimm <etobi at debian.org>
Date:   Sat Nov 12 20:06:01 2016 +0100

    Provide virtual packages for addon APIs and install a debhelper addon to
    enable KODI addon packages to depend on these virtual packages.

diff --git a/debian/control b/debian/control
index dfc2d13..2d0f12f 100644
--- a/debian/control
+++ b/debian/control
@@ -113,6 +113,7 @@ Depends: kodi-bin (>= ${source:Version}),
 Recommends: kodi-visualization-spectrum
 Replaces: xbmc (<< 2:13.2+dfsg1-5~)
 Breaks: xbmc (<< 2:13.2+dfsg1-5~)
+Provides: ${kodi:PVRAPI}, ${kodi:GUILIBAPI}
 Description: Open Source Home Theatre (executable binaries)
  Kodi, formerly known as XBMC is an award winning free and
  open source software media-player and entertainment hub for all your digital
diff --git a/debian/dh-addon/dh_kodiaddon_depends b/debian/dh-addon/dh_kodiaddon_depends
new file mode 100755
index 0000000..b2b3fab
--- /dev/null
+++ b/debian/dh-addon/dh_kodiaddon_depends
@@ -0,0 +1,96 @@
+#! /usr/bin/perl -w
+
+=head1 NAME
+
+dh_kodiaddon_depends - Provides substvars for Kodi addons
+
+=cut
+
+use strict;
+use Debian::Debhelper::Dh_Lib;
+
+=head1 SYNOPSIS
+
+B<dh_kodiaddon_depends> [S<I<debhelper options>>]
+
+=head1 DESCRIPTION
+
+dh_kodiaddon_depends is a debhelper program, that is responsible for setting substvars
+providing the Kodi addon-API dependencies. Kodi provides a virtual package for each API
+which might be used by an addon. The following substvars will be set to a dependency
+clause which can be used directly in the "Depends"-line of the addons debian/control:
+
+${kodi:PVRAPI}    (XBMC_PVR_API_VERSION)
+${kodi:GUILIBAPI} (KODI_GUILIB_API_VERSION)
+
+=head1 EXAMPLES
+
+dh_kodiaddon_depends is usually called indirectly in a rules file via the dh command.
+
+	%:
+		dh $@ --with kodiaddon
+
+It can also be called directly, prior to calling dh_gencontrol.
+
+=head1 CONFORMS TO
+
+Debian policy, version 3.8.1
+
+=cut
+
+init ();
+
+no locale;
+
+sub get_api_version {
+  my $headerFileName = $_[0];
+  my $defineName = $_[1];
+  my $apiVersion;
+
+  open(HEADERFILE, "<$headerFileName") or die "$!";
+  while (<HEADERFILE>) {
+    if ($_ =~ /^#define $defineName "(.*)"/) {
+      $apiVersion = $1;
+      last;
+    }
+  }
+  close(HEADERFILE);
+  $apiVersion or die "Could not find '$defineName' in $headerFileName";
+}
+
+sub create_substvar {
+  my $substvarName = $_[0];
+  my $substvarValue = $_[1];
+  foreach my $package (@{$dh{DOPACKAGES}}) {
+    delsubstvar($package, $substvarName);
+    addsubstvar($package, $substvarName, $substvarValue);
+  }
+}
+
+my $baseDir = "debian/kodi-addons-dev";
+if (! -d $baseDir) {
+  $baseDir = ""
+}
+
+my @apis = (
+  ["kodi-api-pvr", "kodi:PVRAPI", "$baseDir/usr/include/kodi/xbmc_pvr_types.h", "XBMC_PVR_API_VERSION"],
+  ["kodi-api-guilib", "kodi:GUILIBAPI", "$baseDir/usr/include/kodi/libKODI_guilib.h", "KODI_GUILIB_API_VERSION"]
+);
+
+foreach my $api (@apis) {
+  my ($apiName, $apiSubstvar, $apiHeader, $apiDefine) = @$api;
+  my $apiVersion = get_api_version($apiHeader, $apiDefine);
+  create_substvar($apiSubstvar, "$apiName (= $apiVersion)");
+}
+
+=head1 SEE ALSO
+
+L<debhelper(7)>
+
+This program is not a part of debhelper.
+
+=head1 AUTHOR
+
+Tobias Grimm <tobias.grimm at e-tobi.net>
+
+=cut
diff --git a/debian/dh-addon/kodiaddon.pm b/debian/dh-addon/kodiaddon.pm
new file mode 100644
index 0000000..019793c
--- /dev/null
+++ b/debian/dh-addon/kodiaddon.pm
@@ -0,0 +1,7 @@
+use warnings;
+use strict;
+use Debian::Debhelper::Dh_Lib;
+
+insert_before("dh_gencontrol", "dh_kodiaddon_depends");
+
+1
diff --git a/debian/kodi-addons-dev.install b/debian/kodi-addons-dev.install
index 2b3480f..fa2416b 100644
--- a/debian/kodi-addons-dev.install
+++ b/debian/kodi-addons-dev.install
@@ -8,3 +8,6 @@ usr/lib/*/kodi/*.cmake
 xbmc/cores/AudioEngine/Utils/AEChannelInfo.h usr/include/kodi/AudioEngine/
 xbmc/cores/AudioEngine/Utils/AEChannelData.h usr/include/kodi/AudioEngine/
 xbmc/cores/AudioEngine/Utils/AEStreamData.h usr/include/kodi/AudioEngine/
+
+debian/dh-addon/kodiaddon.pm         usr/share/perl5/Debian/Debhelper/Sequence/
+debian/dh-addon/dh_kodiaddon_depends usr/bin/
diff --git a/debian/kodi-addons-dev.manpages b/debian/kodi-addons-dev.manpages
new file mode 100644
index 0000000..f83eeca
--- /dev/null
+++ b/debian/kodi-addons-dev.manpages
@@ -0,0 +1 @@
+debian/dh-addon/*.1
diff --git a/debian/rules b/debian/rules
index 68caaab..31e4469 100755
--- a/debian/rules
+++ b/debian/rules
@@ -87,6 +87,7 @@ override_dh_clean:
 		-d $(DVDNAV_COMPONENT) || true
 	ls $(CURDIR)/debian/patches/libdvdread-* | tac | xargs cat | patch -R --no-backup-if-mismatch -r - -s -p1 \
 		-d $(DVDREAD_COMPONENT) || true
+	rm -f debian/dh-addon/*.1
 
 override_dh_auto_clean:
 	dh_auto_clean
@@ -127,6 +128,12 @@ override_dh_auto_configure: configure
 		--prefix=$(CURDIR)/tools/depends/target/libdvdnav/dvdnav-install --disable-shared --enable-static --with-pic && \
 		$(MAKE) install)
 
+override_dh_auto_build:
+	dh_auto_build
+	for file in $$(ls debian/dh-addon/dh_*); do \
+		pod2man --section=1 --utf8 $$file $$file.1; \
+	done
+
 override_dh_auto_test-arch:
 	dh_auto_test -a
 
@@ -189,6 +196,7 @@ override_dh_installinit:
 	@echo "Shipping systemd kodi.service file as an example only"
 
 override_dh_gencontrol:
+	debian/dh-addon/dh_kodiaddon_depends
 	dh_gencontrol -pxbmc -pxbmc-bin -pxbmc-eventclients-common \
 		-pxbmc-eventclients-dev -pxbmc-eventclients-wiiremote \
 		-pxbmc-eventclients-ps3 \

-- 
kodi packaging



More information about the pkg-multimedia-commits mailing list