[Pkg-octave-commit] [octave-pkg-dev] 03/03: check-pkg: Add function for opening a file and adding content to it

Rafael Laboissiere rafael at debian.org
Thu Aug 31 20:33:55 UTC 2017


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

rafael pushed a commit to branch master
in repository octave-pkg-dev.

commit 05c37200e4e0292669ff0955ffa291bb2a3be955
Author: Rafael Laboissiere <rafael at debian.org>
Date:   Thu Aug 31 17:33:21 2017 -0300

    check-pkg: Add function for opening a file and adding content to it
---
 make-octave-forge-debpkg.in | 67 ++++++++++++++++++++++-----------------------
 1 file changed, 33 insertions(+), 34 deletions(-)

diff --git a/make-octave-forge-debpkg.in b/make-octave-forge-debpkg.in
index 56bac4c..3997ec9 100755
--- a/make-octave-forge-debpkg.in
+++ b/make-octave-forge-debpkg.in
@@ -104,6 +104,15 @@ sub makedir ($) {
     -d $dir or mkdir $dir;
 }
 
+### Function for opening a file and adding content to it
+sub writefile ($$) {
+    my $file = shift;
+    my $content = shift;
+    open (FID, $file);
+    print FID $content;
+    close FID;
+}
+
 ### Check whether a given field exists in the DESCRIPTION file and exit the
 ### program with an error message, in the case the field does not exist
 sub check ($) {
@@ -136,16 +145,13 @@ makedir "debian";
 
 ### Create the debian/compat file.
 my $compat = #Compat#;
-open (FID, "> debian/compat");
-print FID $compat;
-close FID;
+writefile ("> debian/compat", $compat);
 
 ### Create the debian/watch file.
-open (FID, "> debian/watch");
-print FID "version=4
+writefile ("> debian/watch",
+           "version=4
 http://sf.net/octave/$name-(.+)\\.tar\\.gz
-";
-close FID;
+");
 
 ### Create the debian/changelog file.
 my $date = qx {date --rfc-2822};
@@ -158,23 +164,21 @@ my $email = exists $ENV{DEBEMAIL} ? $ENV{DEBEMAIL}
                 : "joe\@developer.org";
 my $author = "$developer <$email>";
 
-open (FID, "> debian/changelog");
-print FID "octave-$name ($version-1) UNRELEASED; urgency=low
+writefile ("> debian/changelog",
+           "octave-$name ($version-1) UNRELEASED; urgency=low
 
   * Initial release (closes: #XXXXXX)
 
  -- $author  $date
-";
-close FID;
+");
 
 ### Create the debian/rules file.
-open (FID, "> debian/rules");
-print FID "#!/usr/bin/make -f
+writefile ("> debian/rules",
+           "#!/usr/bin/make -f
 # -*- makefile -*-
 
 include /usr/share/cdbs/1/class/octave-pkg.mk
-";
-close FID;
+");
 system ("chmod +x debian/rules");
 
 ### Create the debian/control file.
@@ -189,8 +193,8 @@ if ($architecture eq "any") {
     $shlibs = ", \${shlibs:Depends}";
 }
 
-open (FID, "> debian/control");
-print FID "Source: octave-$name
+writefile ("> debian/control",
+           "Source: octave-$name
 Section: math
 Priority: optional
 Maintainer: Debian Octave Group <pkg-octave-devel\@lists.alioth.debian.org>
@@ -207,14 +211,11 @@ Description: $title
  \${octave:Upstream-Description}
  .
  This Octave add-on package is part of the Octave-Forge project.
-";
-close FID;
+");
 
 ### Create the debian/source/format file.
 makedir "debian/source";
-open (FID, "> debian/source/format");
-print FID "3.0 (quilt)\n";
-close FID;
+writefile ("> debian/source/format", "3.0 (quilt)\n");
 
 ### Create the debian/copyright file.
 system ("licensecheck -r --copyright -c '\\.m|\\.cc|\\.c|\\.h|\\.f' . "
@@ -224,8 +225,8 @@ my $year = qx {date +%Y};
 chomp $year;
 
 ### Create the Debian specific part to the debian/control file.
-open (FID, ">> debian/copyright");
-print FID "Files: debian/*
+writefile (">> debian/copyright",
+           "Files: debian/*
 Copyright: $year $author
 License: GPL-3+
 
@@ -246,23 +247,21 @@ License: GPL-3+
  On Debian systems, the complete text of the GNU General Public
  License, version 3, can be found in the file
  `/usr/share/common-licenses/GPL-3'.
-";
-close FID;
+");
 
 ### Create the autopkgtest files
 makedir "debian/tests";
-open (FID, "> debian/tests/control");
-print FID "Tests: unit-tests
+writefile ("> debian/tests/control",
+           "Tests: unit-tests
 Depends: @, octave-pkg-dev (>= #Version#)
-";
-close FID;
+");
 system ("chmod +x debian/tests/control");
-open (FID, "> debian/tests/unit-tests");
-print FID "#!/bin/sh
+
+writefile ("> debian/tests/unit-tests",
+           "#!/bin/sh
 
 exec 2>&1
 set -e
 
 debian/rules check-pkg
-";
-close FID;
+");

-- 
Alioth's /home/groups/pkg-octave/bin/git-commit-notice on /srv/git.debian.org/git/pkg-octave/octave-pkg-dev.git



More information about the Pkg-octave-commit mailing list