[dh-fortran-mod] 01/01: Initial commit.

Sébastien Villemot sebastien at debian.org
Mon Mar 24 17:35:22 UTC 2014


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

sebastien pushed a commit to branch master
in repository dh-fortran-mod.

commit 35604144b613b2daf73b2ddaf2d3b06f9212fafd
Author: Sébastien Villemot <sebastien at debian.org>
Date:   Mon Mar 24 18:33:39 2014 +0100

    Initial commit.
---
 debian/changelog     |  5 ++++
 debian/compat        |  1 +
 debian/control       | 33 ++++++++++++++++++++++
 debian/copyright     | 20 ++++++++++++++
 debian/install       |  2 ++
 debian/manpages      |  1 +
 debian/rules         | 12 ++++++++
 debian/source/format |  1 +
 dh_fortran_mod       | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 fortran_mod.pm       |  8 ++++++
 10 files changed, 160 insertions(+)

diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..fb2bb67
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
+dh-fortran-mod (1) UNRELEASED; urgency=low
+
+  * Initial release. (Closes: #XXXXXX)
+
+ -- Sébastien Villemot <sebastien at debian.org>  Sat, 15 Mar 2014 10:36:15 +0100
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..ec63514
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+9
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..8fabc04
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,33 @@
+Source: dh-fortran-mod
+Section: devel
+Priority: optional
+Maintainer: Debian Science Team <debian-science-maintainers at lists.alioth.debian.org>
+Uploaders: Sébastien Villemot <sebastien at debian.org>
+Build-Depends: debhelper (>= 9)
+Standards-Version: 3.9.5
+Vcs-Git: git://anonscm.debian.org/debian-science/packages/dh-fortran-mod.git
+Vcs-Browser: http://anonscm.debian.org/gitweb/?p=debian-science/packages/dh-fortran-mod.git
+
+Package: dh-fortran-mod
+Architecture: all
+Multi-Arch: foreign
+Depends: ${perl:Depends}, ${misc:Depends}, debhelper (>= 9),
+         libio-compress-perl, libfile-libmagic-perl
+Enhances: debhelper
+Description: debhelper add-on to handle Fortran '.mod' files
+ Modules were introduced in the 1990 revision of the Fortran standard. When the
+ Fortran compiler processes a source file containing a module, it produces both
+ an object file and a '.mod' file. The latter plays a role similar to header
+ files in C, since it is needed when compiling other source files which make
+ use of the module.
+ .
+ The '.mod' files are however platform dependent, and their format changes with
+ the gfortran version.
+ .
+ This package provides the dh_fortran_mod command, which simplifies the
+ inclusion of '.mod' files in binary packages. First, it places the '.mod'
+ files in the correct platform- and gfortran-dependent location. Second, it
+ adds the right dependency information on gfortran version(s).
+ .
+ Inclusion of dh_fortran_mod in dh sequence is also provided under the name
+ 'fortran_mod'.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..36f7542
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,20 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+
+Files: *
+Copyright: 2014 Sébastien Villemot <sebastien at debian.org>
+License: GPL-3+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+ .
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ .
+ You should have received a copy of the GNU General Public License
+ along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
+ .
+ On Debian systems, the full text of the GNU General Public License
+ version 3 can be found in the file `/usr/share/common-licenses/GPL-3'.
diff --git a/debian/install b/debian/install
new file mode 100644
index 0000000..8ab5524
--- /dev/null
+++ b/debian/install
@@ -0,0 +1,2 @@
+dh_fortran_mod  /usr/bin/
+fortran_mod.pm  /usr/share/perl5/Debian/Debhelper/Sequence/
diff --git a/debian/manpages b/debian/manpages
new file mode 100644
index 0000000..f31d7f0
--- /dev/null
+++ b/debian/manpages
@@ -0,0 +1 @@
+dh_fortran_mod.1
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..e6031f2
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,12 @@
+#!/usr/bin/make -f
+version := $(shell dpkg-parsechangelog | sed -nr 's/^Version: (.*)/\1/p')
+pod2man := pod2man -r "dh-fortran-mod v$(version)" -c dh-fortran-mod
+
+%:
+	dh $@
+
+override_dh_auto_build:
+	$(pod2man) --section=1 dh_fortran_mod dh_fortran_mod.1
+
+override_dh_clean:
+	dh_clean dh_fortran_mod.1
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..89ae9db
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (native)
diff --git a/dh_fortran_mod b/dh_fortran_mod
new file mode 100755
index 0000000..cb73093
--- /dev/null
+++ b/dh_fortran_mod
@@ -0,0 +1,77 @@
+#!/usr/bin/perl -w
+
+=encoding utf8
+
+=head1 NAME
+
+dh_fortran_mod - Install Fortran 90 .mod files and add dependency information.
+
+=cut
+
+use strict;
+use Debian::Debhelper::Dh_Lib;
+use IO::Uncompress::Gunzip qw( $GunzipError );
+use File::LibMagic;
+
+init();
+
+my $multiarch = dpkg_architecture_value("DEB_HOST_MULTIARCH");
+
+my $magic = File::LibMagic->new();
+
+sub determine_mod_version {
+    my $modfile = shift;
+    (-r $modfile) or error("Can't open $modfile.");
+    my ($mime) = split(/;/, $magic->checktype_filename($modfile));
+
+    if ($mime eq "text/plain") {
+        open(MODFILE, "<", $modfile) or error($!);
+        $_ = <MODFILE>;
+        close(MODFILE);
+    } elsif ($mime eq "application/gzip") {
+        my $z = new IO::Uncompress::Gunzip $modfile or error("gunzip failed: $GunzipError\n");
+        $_ = <$z>;
+        $z->close();
+    } else {
+        error("wrong MIME type $mime for $modfile");
+    }
+
+    if (/^GFORTRAN module version '([0-9]+)'/) {
+        return $1;
+    } else {
+        error("$modfile is not a gfortran mod file.");
+    }
+}
+
+foreach my $package (@{$dh{DOPACKAGES}}) {
+    my %modversions = ();
+
+    my $tmp = tmpdir($package);
+    my $config = pkgfile($package, "fortran-mod");
+    if ($config) {
+        open(FILE, "<", $config) or error($!);
+        while (<FILE>) {
+            chomp;
+            my ($modfile) = split;
+            my $modversion = determine_mod_version($modfile);
+            my $moddir = "$tmp/usr/include/fortran/gcc-$modversion/$multiarch/";
+            if (!exists($modversions{$modversion})) {
+                $modversions{$modversion} = 1;
+                addsubstvar($package, "misc:Depends", "gfortran-mod-$modversion");
+                doit("install","-d",$moddir);
+            }
+            doit("install",$modfile,$moddir);
+        }
+        close(FILE);
+    }
+}
+
+=head1 SEE ALSO
+
+L<debhelper(7)>
+
+=head1 AUTHOR
+
+Sébastien Villemot <sebastien at debian.org>
+
+=cut
diff --git a/fortran_mod.pm b/fortran_mod.pm
new file mode 100644
index 0000000..5d8d55a
--- /dev/null
+++ b/fortran_mod.pm
@@ -0,0 +1,8 @@
+#!/usr/bin/perl -w
+
+use strict;
+use Debian::Debhelper::Dh_Lib;
+
+insert_after("dh_install", "dh_fortran_mod");
+
+1;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/dh-fortran-mod.git



More information about the debian-science-commits mailing list