Re: [pkg-go] dh-golang : DH_GOLANG_INSTALL_EXTRA_EXTENSIONS option
Thanks! I’ve merged the patch and taken the liberty to make the code a bit faster by using a hash, see http://anonscm.debian.org/cgit/collab-maint/dh-golang.git/ Can you confirm that this works as expected for you? Once I hear back from you, I’ll prepare a new dh-golang release. On Fri, Jul 31, 2015 at 4:02 PM, Alexandre Viau alexan...@alexandreviau.net wrote: Hi, On 31/07/15 03:59 AM, Michael Stapelberg wrote: Your patch still adds an extra option. Can you remove that part please? Also, while you’re at it, install .s files as well? :) This one should work like you wanted! -- Alexandre Viau alexan...@alexandreviau.net -- Best regards, Michael ___ Pkg-go-maintainers mailing list Pkg-go-maintainers@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-go-maintainers
Re: [pkg-go] dh-golang : DH_GOLANG_INSTALL_EXTRA_EXTENSIONS option
Thanks for confirming. I uploaded dh-golang 1.9. On Mon, Aug 3, 2015 at 8:05 PM, Alexandre Viau alexan...@alexandreviau.net wrote: Hello Michael, On Mon, Aug 3, 2015 at 1:45 PM, Michael Stapelberg stapelb...@debian.org wrote: Can you confirm that this works as expected for you? Once I hear back from you, I’ll prepare a new dh-golang release. Works fine for me! -- Alexandre Viau alexan...@alexandreviau.net -- Best regards, Michael ___ Pkg-go-maintainers mailing list Pkg-go-maintainers@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-go-maintainers
Re: [pkg-go] dh-golang : DH_GOLANG_INSTALL_EXTRA_EXTENSIONS option
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
Re: [pkg-go] dh-golang : DH_GOLANG_INSTALL_EXTRA_EXTENSIONS option
Instead of adding this via a new setting, why not make dh-golang install these files by default? I think installing everything one can legitimately call program source code is fair game. The tricky part is identifying files which are necessary for test cases. The reason why dh-golang doesn’t just install all files is because that might generate lintian warnings about extra LICENSE files, extra README files not being marked as docs, random non-executable shell scripts, etc. That said, I’m not very happy with the current need to specify the install_all option in many cases, and any improvements over that (using more introspection? using a blacklist instead of a whitelist?) are very welcome. On Wed, Jul 29, 2015 at 10:53 PM, Alexandre Viau alexan...@alexandreviau.net wrote: Hello, This is new dh-golang feature should allow to include more files to the install in an easier way. It should be useful, for example, with cgo projects. DH_GOLANG_INSTALL_EXTRA_EXTENSIONS := .cgo,.h,.c Will include all files with .cgo, .h and .c extensions. I have had this issue (not just with cgo projects) a couple times last week so I thought this would be useful. I have never done perl before, feel free to comment on the code. -- Alexandre Viau alexan...@alexandreviau.net ___ Pkg-go-maintainers mailing list Pkg-go-maintainers@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-go-maintainers -- Best regards, Michael ___ Pkg-go-maintainers mailing list Pkg-go-maintainers@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-go-maintainers
Re: [pkg-go] dh-golang : DH_GOLANG_INSTALL_EXTRA_EXTENSIONS option
I think the go tools do not cover files that are referenced by test code, e.g.: func TestFoo(t *testing.T) { f, err := os.Open(my_test_resource.txt) if err != nil { t.Fatalf(Could not open file: %v, err) } // … } Did I miss something? On Thu, Jul 30, 2015 at 2:41 AM, Michael Hudson-Doyle michael.hud...@canonical.com wrote: I guess you could ask go by invoking 'go list -json ./...' and looking for the various *Files fields. The imports/deps calculations won't work of course because the point of the copy is to get files to where they _do_ work, but that just means that there are DepsErrors fields in the json -- the command still completes and gives the needed information afaics. Cheers, mwh On 30 July 2015 at 19:10, Michael Stapelberg stapelb...@debian.org wrote: Instead of adding this via a new setting, why not make dh-golang install these files by default? I think installing everything one can legitimately call program source code is fair game. The tricky part is identifying files which are necessary for test cases. The reason why dh-golang doesn’t just install all files is because that might generate lintian warnings about extra LICENSE files, extra README files not being marked as docs, random non-executable shell scripts, etc. That said, I’m not very happy with the current need to specify the install_all option in many cases, and any improvements over that (using more introspection? using a blacklist instead of a whitelist?) are very welcome. On Wed, Jul 29, 2015 at 10:53 PM, Alexandre Viau alexan...@alexandreviau.net wrote: Hello, This is new dh-golang feature should allow to include more files to the install in an easier way. It should be useful, for example, with cgo projects. DH_GOLANG_INSTALL_EXTRA_EXTENSIONS := .cgo,.h,.c Will include all files with .cgo, .h and .c extensions. I have had this issue (not just with cgo projects) a couple times last week so I thought this would be useful. I have never done perl before, feel free to comment on the code. -- Alexandre Viau alexan...@alexandreviau.net ___ Pkg-go-maintainers mailing list Pkg-go-maintainers@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-go-maintainers -- Best regards, Michael ___ Pkg-go-maintainers mailing list Pkg-go-maintainers@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-go-maintainers -- Best regards, Michael ___ Pkg-go-maintainers mailing list Pkg-go-maintainers@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-go-maintainers