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

Michael Stapelberg stapelberg at debian.org
Fri May 23 09:48:42 UTC 2014


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.

-- 
Best regards,
Michael



More information about the Pkg-go-maintainers mailing list