[Pkg-voip-commits] [asterisk] 01/05: Initial work on debhelpers for asterisk modules

tzafrir at debian.org tzafrir at debian.org
Fri Jan 30 10:13:57 UTC 2015


This is an automated email from the git hooks/post-receive script.

tzafrir pushed a commit to branch master
in repository asterisk.

commit 3876f32734b3c6795990f2d9ed01776bd82a73d8
Author: Tzafrir Cohen <tzafrir at debian.org>
Date:   Thu Jan 29 20:42:02 2015 +0200

    Initial work on debhelpers for asterisk modules
    
    Initial versions (not installed yet as not to postponse the security
    fix) of debhelpers for building Debian packages:
    
    * dh_asterisk: adds substvar Asterisk:ABI for any package with an
      asterisk module.
    * A debhelper sequese, so you could use 'dh --with asterisk'
---
 debian/debhelper/asterisk.pm |  8 +++++
 debian/debhelper/dh_asterisk | 82 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 90 insertions(+)

diff --git a/debian/debhelper/asterisk.pm b/debian/debhelper/asterisk.pm
new file mode 100644
index 0000000..935b326
--- /dev/null
+++ b/debian/debhelper/asterisk.pm
@@ -0,0 +1,8 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+use Debian::Debhelper::Dh_Lib;
+
+insert_after("dh_installman", "dh_asterisk");
+
+1;
diff --git a/debian/debhelper/dh_asterisk b/debian/debhelper/dh_asterisk
new file mode 100755
index 0000000..0f76c36
--- /dev/null
+++ b/debian/debhelper/dh_asterisk
@@ -0,0 +1,82 @@
+#!/usr/bin/perl -w
+
+=head1 NAME
+
+dh_asterisk - Add dependency on the ABI version of Asterisk
+
+When writing a package that builds an Asterisk module and is not built
+with Astersk itself (and hence depends on the exact binary version),
+add ${Asterisk:ABI} to the package's Depends: field in debian control
+and run dh_asterisk.
+
+If you use dh, you can run dh_asterisk using:
+
+  dh --with asterisk
+
+Otherwise run it in debian/rules after installing the modules.
+
+=cut
+
+use strict;
+use Debian::Debhelper::Dh_Lib;
+
+=head1 SYNOPSIS
+
+B<dh_asterisk> [S<I<debhelper options>>] [S<B<-V>[I<version>]>] [S<B<--> I<file>>]
+
+=head1 DESCRIPTION
+
+dh_asterisk is a debhelper program that is responsible for correctly
+setting the dependency on asterisk-I<asterisk-ABI-version> for a package.
+
+=head1 OPTIONS
+
+No special options of its own. Use standard debhelper options.
+
+=head1 NOTES
+
+Note that this command is not idempotent. L<dh_prep(1)> should be called
+between invocations of this command. Otherwise, it may cause multiple
+instances of the same text to be added to maintainer scripts.
+
+=cut
+
+init();
+
+my $BUILD_OPTS_FILE = '/usr/include/asterisk/buildopts.h'
+
+sub get_abi_name() {
+	# FIXME: replace the "die" with a nicer handling once this is tested
+	open(OPTS, $BUILD_OPTS_FILE) || 
+		die ("failed to open opts file $BUILD_OPTS_FILE. asterisk-dev not installed?");
+	while(<OPTS>) {
+		if (/AST_BUILDOPT_SUM/) {
+			my ($ig, $nored, $checksum) = split
+			$checksum =~ s/"//g;
+			return $checksum;
+		}
+	}
+	return "";
+}
+
+foreach my $package (@{$dh{DOPACKAGES}}) {
+	#next if is_udeb($package);
+	my $ast_dir = tmpdir()."/usr/lib/asterisk/modules";
+	return unless glob("$ast_dir/*");
+	my $ast_ver = get_abi_name();
+	addsubstvar($package, "asterisk:ABI", $abi);
+}
+
+=head1 SEE ALSO
+
+L<debhelper(1)>
+
+This program is part of the Debian Asterisk package.
+
+L<asterisk(8)>
+
+=head1 AUTHOR
+
+Tzafrir Cohen <tzafrir at debian.org>
+
+=cut

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-voip/asterisk.git



More information about the Pkg-voip-commits mailing list