On 30/07/15 03:26 PM, Michael Stapelberg wrote: > On Thu, Jul 30, 2015 at 3:02 PM, Alexandre Viau > <alexan...@alexandreviau.net> wrote: >> We can extend the default list of installed extensions, but I'm not > > Can you send a patch for that please? >
Here you go :)! -- Alexandre Viau alexan...@alexandreviau.net
From 7d039c7236171e5e4614f42b02a0aa5a690cd429 Mon Sep 17 00:00:00 2001 From: aviau <alexandre.v...@savoirfairelinux.com> Date: Wed, 29 Jul 2015 14:51:20 -0400 Subject: [PATCH] New DH_GOLANG_INSTALL_EXTRA_EXTENSIONS option By default, only .go, .c, .h and .proto files are installed. DH_GOLANG_INSTALL_EXTRA_EXTENSIONS allows to specify more file extensions to install. It can also be used to specify a file name. For example: export DH_GOLANG_INSTALL_EXTRA_EXTENSIONS:=.py,test.sh Will install all .py files and all files with names ending with 'test.sh' --- lib/Debian/Debhelper/Buildsystem/golang.pm | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/lib/Debian/Debhelper/Buildsystem/golang.pm b/lib/Debian/Debhelper/Buildsystem/golang.pm index 6b33f69..88b323a 100644 --- a/lib/Debian/Debhelper/Buildsystem/golang.pm +++ b/lib/Debian/Debhelper/Buildsystem/golang.pm @@ -51,11 +51,19 @@ sub configure { my $builddir = $this->get_builddir(); ############################################################################ - # Copy all .go files into the build directory $builddir/src/$go_package + # Copy all source files into the build directory $builddir/src/$go_package ############################################################################ my $install_all = (exists($ENV{DH_GOLANG_INSTALL_ALL}) && $ENV{DH_GOLANG_INSTALL_ALL} == 1); + + # By default, only .go, .c, .h and .proto files are installed. + my @installed_file_extensions = ('.go', '.c', '.h', '.proto'); + if (exists($ENV{DH_GOLANG_INSTALL_EXTRA_EXTENSIONS})) { + push(@installed_file_extensions, + split(',', $ENV{DH_GOLANG_INSTALL_EXTRA_EXTENSIONS})); + } + my @sourcefiles; find({ # Ignores ./debian entirely, but not e.g. foo/debian/debian.go @@ -69,8 +77,18 @@ sub configure { my $name = $File::Find::name; if ($install_all) { # All files will be installed - } elsif (substr($name, -3) ne '.go') { - return; + } else { + my $matched_extension = 0; + foreach (@installed_file_extensions) + { + if (substr($name, -length($_)) eq $_){ + $matched_extension = 1; + last; + } + } + if (not $matched_extension) { + return; + } } return unless -f $name; # Store regexp/utf.go instead of ./regexp/utf.go -- 2.4.6
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Pkg-go-maintainers mailing list Pkg-go-maintainers@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-go-maintainers