[pkg-go] Sponsor needed for NEW package pt-websocket

Ximin Luo infinity0 at pwned.gg
Sat May 24 15:54:06 UTC 2014


Hey, thanks for the review. I did already try dh_golang, but it requires further changes on top of the ones you mention below:

- override dh_auto_install to remove the installed source code
- override dh_auto_build and dh_auto_test to exclude pt-websocket-client. This is because it depends on code not yet in Debian (go.net/websocket). I agree it's nice to build it, but I don't think we should block the release of this package to do so.

If you prefer this approach (sample below) I can do it though; otherwise I can stick with the current Makefile approach.

~~~~
export DH_GOPKG := git.torproject.org/pluggable-transports/websocket
export DH_GOPKG_SUBDIRS := websocket pt-websocket-server
DH_BUILDDIR = obj-$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)

override_dh_auto_build:
	cd $(DH_BUILDDIR) && GOPATH=$$PWD go install -v $(DH_GOPKG_SUBDIRS:%=$(DH_GOPKG)/%)
	make doc/pt-websocket-server.1

override_dh_auto_test:
	cd $(DH_BUILDDIR) && GOPATH=$$PWD go test -v $(DH_GOPKG_SUBDIRS:%=$(DH_GOPKG)/%)

override_dh_auto_install:
	dh_auto_install
	rm -rf debian/pt-websocket/usr/share/gocode
~~~~

This also suggests some extensions to dh_golang:

- an option to not install the source code (DH_GOLANG_INSTALL_EXCLUDE_SOURCE?), instead of me having to override dh_auto_install with a rm. I imagine this would be a fairly common use-case for binaries that don't need to distribute a -dev package.
- use a separate DH_GOPKG_CHILDREN to explicitly list child modules you want to act on, used separately from DH_GOPKG, similar to my use above.

X

On 23/05/14 10:48, Michael Stapelberg wrote:
> Hi Ximin,
> 
> Ximin Luo <infinity0 at pwned.gg> writes:
>> git: https://anonscm.debian.org/gitweb/?p=pkg-go/packages/pt-websocket.git;a=summary
> Thanks for your mail.
> 
> The Makefile in pt-websocket is calling “go build” directly and you’re
> setting GOPATH in debian/rules. While it works by chance in this case,
> it’s not robust. See this comment:
> 
> http://anonscm.debian.org/gitweb/?p=collab-maint/dh-golang.git;a=blob;f=lib/Debian/Debhelper/Buildsystem/golang.pm;h=b34a5f2f14256de84d6477080667d2d98c75f6e5;hb=HEAD#l91
> 
> Therefore, I think it’d be better if you could use dh-golang for
> building the package. The following three changes need to be done for
> that:
> 
> --- i/debian/rules
> +++ w/debian/rules
> @@ -4,17 +4,14 @@
>  # Uncomment this to turn on verbose mode.
>  #export DH_VERBOSE=1
>  
> -export GOPATH=/usr/share/gocode
> +export DH_GOPKG := git.torproject.org/pluggable-transports/websocket
>  
>  %:
> -       dh $@
> +       dh $@ --buildsystem=golang --with=golang
>  
>  override_dh_auto_build:
>         dh_auto_build
>         make doc/pt-websocket-server.1
>  
> -override_dh_auto_install:
> -       dh_auto_install -S makefile -- PREFIX=/usr
> -
>  override_dh_compress:
>         dh_compress -X /examples/
> 
> 
> The following hunk strucks me as odd. Why was that a local import
> before, if the line below imports goptlib “properly”? Also, why are
> those imports separate from the import block just above?
> 
> 
> --- i/pt-websocket-server/pt-websocket-server.go
> +++ w/pt-websocket-server/pt-websocket-server.go
> @@ -20,7 +20,7 @@ import (
>         "time"
>  )
> 
> -import "../websocket"
> +import "git.torproject.org/pluggable-transports/websocket/websocket"
>  
>  import "git.torproject.org/pluggable-transports/goptlib.git"
> 
> 
> 
> 
> 
> --- i/Makefile
> +++ w/Makefile
> @@ -17,8 +17,8 @@ pt-websocket-server/pt-websocket-server:
> pt-websocket-server/*.go websocket/*.go
>  pt-websocket-client/pt-websocket-client: pt-websocket-client/*.go
>         cd pt-websocket-client && go build $(GOBUILDFLAGS)
>  
> -doc/pt-websocket-server.1: pt-websocket-server/pt-websocket-server
> -       help2man --no-info --name "WebSocket server pluggable transport"
> -       --version-string "$(VERSION)" -o "$@" "$<"
> +doc/pt-websocket-server.1:
> +       help2man --no-info --name "WebSocket server pluggable transport"
> -       --version-string "$(VERSION)" -o "$@"
> -       obj-*/bin/pt-websocket-server
>  
>  install: pt-websocket-server/pt-websocket-server
>         mkdir -p "$(DESTDIR)$(BINDIR)"
> 
> 
> Note that in the resulting package, the source code will be installed by
> default. You should probably remove that, or split it into a separate
> package if the source code could be used as a library by other packages
> (from a quick glance, I don’t think it could).
> 
> Also, the websocket-client is compiled and installed by default. The
> same applies here, if you don’t want it, remove it before the package is
> generated. Compiling it seems useful though, just to ensure that the
> shipped example actually works :).
> 
> HTH.
> 


-- 
GPG: 4096R/1318EFAC5FBBDBCE
git://github.com/infinity0/pubkeys.git

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 880 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-go-maintainers/attachments/20140524/2a8e8964/attachment.sig>


More information about the Pkg-go-maintainers mailing list