Code Monkey home page Code Monkey logo

dh-make-golang's Introduction

CI Test

dh-make-golang is a tool to automatically create Debian packaging for Go packages. Its goal is to automate away as much of the work as possible when creating a Debian package for a Go library package or Go program.

Overview

All you need to specify is a Go package name. In your current working directory, a new directory will be created containing a git repository. Inside that repository, you’ll find the Go package’s source code plus the necessary Debian packaging files to build a Debian package. The packaging adheres to the pkg-go packaging guidelines and hence can be placed alongside the other team-maintained packages in pkg-go, hosted on Debian’s salsa.

Usage/example

For an introductory example, see this annotated demonstration of how to use dh-make-golang.

dh-make-golang’s usage of the internet

dh-make-golang makes heavy use of online resources to improve the resulting package. In no particular order and depending on where your package is hosted, dh-make-golang may query:

  • By virtue of using go get, the specified Go package and all of its dependencies will be downloaded. This step can quickly cause dozens of megabytes to be transferred, so be careful if you are on a metered internet connection.
  • The output of filter-packages.sh, hosted on https://people.debian.org/~stapelberg/dh-make-golang/. This is used to figure out whether dependencies are already packaged in Debian, and whether you are about to duplicate somebody else’s work.
  • GitHub’s API, to get the license, repository creator, description and README for Go packages hosted on GitHub.

dh-make-golang's People

Contributors

anthonyfok avatar aviau avatar creekorful avatar ctrochalakis avatar dawidd6 avatar dependabot[bot] avatar dhowett avatar donfede avatar elboulangero avatar felixonmars avatar guillemj avatar jacksgt avatar kataras avatar lucaskanashiro avatar maytha8 avatar montj2 avatar olasd avatar paultag avatar pityonline avatar pymnh avatar rajudev avatar stapelberg avatar supertassu avatar sysbot avatar threefx avatar tianon avatar toddy15 avatar tuxofil avatar zhsj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dh-make-golang's Issues

gbp buildpackage error

I got a error when I run gbp buildpackage --git-pbuilder

root@cvm:/home/yutao/deb-labs/clown# gbp buildpackage --git-pbuilder
gbp:info: Building with (cowbuilder) for sid
Building with cowbuilder for distribution sid
W: /root/.pbuilderrc does not exist
I: using cowbuilder as pbuilder
dpkg-buildpackage: warning: using a gain-root-command while being root
dpkg-buildpackage: source package clown
dpkg-buildpackage: source version 0.0~git20160926.0.6cf7c23-1
dpkg-buildpackage: source distribution UNRELEASED
dpkg-buildpackage: source changed by root <root@cvm>
 dpkg-source --before-build clown
 fakeroot debian/rules clean
dh clean --buildsystem=golang --with=golang
   dh_testdir -O--buildsystem=golang
   dh_auto_clean -O--buildsystem=golang
   dh_clean -O--buildsystem=golang
 dpkg-source -b clown
dpkg-source: info: using source format '3.0 (quilt)'
dpkg-source: info: building clown using existing ./clown_0.0~git20160926.0.6cf7c23.orig.tar.xz
dpkg-source: info: building clown in clown_0.0~git20160926.0.6cf7c23-1.debian.tar.xz
dpkg-source: info: building clown in clown_0.0~git20160926.0.6cf7c23-1.dsc
 dpkg-genchanges -S >../clown_0.0~git20160926.0.6cf7c23-1_source.changes
dpkg-genchanges: including full source code in upload
 dpkg-source --after-build clown
dpkg-buildpackage: full upload (original source is included)
 -> Copying COW directory
  forking: rm -rf /var/cache/pbuilder/build/cow.19179 
  forking: cp -al /var/cache/pbuilder/base.cow /var/cache/pbuilder/build/cow.19179 
I: unlink for ilistfile /var/cache/pbuilder/build/cow.19179/.ilist failed, it didn't exist?
  forking: chroot /var/cache/pbuilder/build/cow.19179 cowdancer-ilistcreate /.ilist find . -xdev -path ./home -prune -o \( \( -type l -o -type f \) -a -links +1 -print0 \) | xargs -0 stat --format '%d %i ' 
chroot: failed to run command 'cowdancer-ilistcreate': No such file or directory
W: cowdancer-ilistcreate failed to run within chroot, falling back to old method
stat: missing operand
Try 'stat --help' for more information.
E: cowbuilder: pclose returned non-zero, probably the directory contains no hardlinked file, don't bother using cow-shell here.
 -> Invoking pbuilder
  forking: pbuilder build --debbuildopts  --debbuildopts  --buildplace /var/cache/pbuilder/build/cow.19179 --buildresult /home/yutao/deb-labs --debbuildopts  --no-targz --internal-chrootexec chroot /var/cache/pbuilder/build/cow.19179 cow-shell /home/yutao/deb-labs/clown_0.0~git20160926.0.6cf7c23-1.dsc 
W: /root/.pbuilderrc does not exist
I: Running in no-targz mode
I: using fakeroot in build.
I: pbuilder: network access will be disabled during build
I: Current time: Tue Sep 27 09:50:38 CST 2016
I: pbuilder-time-stamp: 1474941038
I: copying local configuration
cp: cannot create regular file '/var/cache/pbuilder/build/cow.19179/etc/hosts': No such file or directory
 -> Cleaning COW directory
  forking: rm -rf /var/cache/pbuilder/build/cow.19179 
gbp:error: 'git-pbuilder' failed: it exited with 1

I missing somthing need to do ?

Have an option to determine recursive package dependencies.

While running dh-make-golang <package-name> , we get a list of dependencies which are still not in Debian.
Then we have to do the same thing for all the dependencies and there sub-dependencies on multiple hierarchies manually.

It would be great if dh-make-golang has an optional flag, may be -r or something like --recursive-dependencies so that it can generate the whole dependency tree.

A simple text hierarchical output of the dependency tree is fine as well. The functionality can be further enhanced to provide an image file of the dependency tree, some thing like this

select non-transitional build dep when Go-Import-Path has two or more corresponding -dev packages

For example,

$ dh-make-golang search golang.org/x/text
golang-x-text-dev: golang.org/x/text

It should be golang-golang-x-text-dev instead.

Go through the meta source, following import paths have two or more -dev packages,

github.com/spf13/cobra ['golang-github-dnephin-cobra-dev', 'golang-github-spf13-cobra-dev']
github.com/docker/containerd ['golang-github-containerd-docker-containerd-dev', 'golang-github-docker-containerd-dev']
github.com/docker/docker ['golang-docker-dev', 'golang-github-docker-docker-dev']
github.com/opencontainers/runc ['golang-github-opencontainers-docker-runc-dev', 'golang-github-opencontainers-runc-dev']
github.com/gogo/protobuf ['golang-github-gogo-protobuf-dev', 'golang-gogoprotobuf-dev']
gopkg.in/check.v1 ['golang-check.v1-dev', 'golang-gopkg-check.v1-dev']
gopkg.in/check.v1,
                   launchpad.net/gocheck,
                   github.com/go-check/check ['golang-check.v1-dev', 'golang-gopkg-check.v1-dev']
github.com/jonboulle/clockwork ['golang-clockwork-dev', 'golang-github-jonboulle-clockwork-dev']
github.com/codegangsta/cli ['golang-codegangsta-cli-dev', 'golang-github-codegangsta-cli-dev']
github.com/gorilla/context ['golang-context-dev', 'golang-github-gorilla-context-dev']
github.com/miekg/dns ['golang-dns-dev', 'golang-github-miekg-dns-dev']
github.com/coreos/go-etcd ['golang-etcd-dev', 'golang-github-coreos-go-etcd-dev']
github.com/fsnotify/fsnotify ['golang-fsnotify-dev', 'golang-github-fsnotify-fsnotify-dev', 'golang-github-go-fsnotify-fsnotify-dev']
github.com/BurntSushi/toml ['golang-github-burntsushi-toml-dev', 'golang-toml-dev']
github.com/coreos/go-semver ['golang-github-coreos-go-semver-dev', 'golang-go-semver-dev']
github.com/docker/go ['golang-github-docker-go-dev', 'golang-github-jfrazelle-go-dev']
github.com/golang/snappy ['golang-github-golang-snappy-dev', 'golang-snappy-go-dev']
github.com/gorilla/websocket ['golang-github-gorilla-websocket-dev', 'golang-websocket-dev']
github.com/gucumber/gucumber ['golang-github-gucumber-gucumber-dev', 'golang-github-lsegal-gucumber-dev']
github.com/influxdata/influxdb ['golang-github-influxdb-influxdb-dev', 'influxdb-dev']
github.com/kardianos/osext ['golang-github-kardianos-osext-dev', 'golang-github-kardianos-osext-dev']
github.com/kr/pretty ['golang-github-kr-pretty-dev', 'golang-pretty-dev']
github.com/kr/pty ['golang-github-kr-pty-dev', 'golang-pty-dev']
github.com/kr/text ['golang-github-kr-text-dev', 'golang-text-dev']
github.com/lib/pq ['golang-github-lib-pq-dev', 'golang-pq-dev']
github.com/mreiferson/go-httpclient ['golang-github-mreiferson-go-httpclient-dev', 'golang-mreiferson-httpclient-dev']
github.com/pborman/uuid ['golang-github-pborman-uuid-dev', 'golang-uuid-dev']
github.com/prometheus/client_golang ['golang-github-prometheus-client-golang-dev', 'golang-prometheus-client-dev']
github.com/rcrowley/go-metrics ['golang-github-rcrowley-go-metrics-dev', 'golang-metrics-dev']
github.com/Sirupsen/logrus ['golang-github-sirupsen-logrus-dev', 'golang-logrus-dev']
github.com/sirupsen/logrus ['golang-github-sirupsen-logrus-dev', 'golang-logrus-dev']
github.com/snapcore/snapd ['golang-github-snapcore-snapd-dev', 'golang-github-ubuntu-core-snappy-dev']
github.com/stretchr/objx ['golang-github-stretchr-objx-dev', 'golang-objx-dev']
github.com/syndtr/goleveldb ['golang-github-syndtr-goleveldb-dev', 'golang-goleveldb-dev']
github.com/tchap/go-patricia ['golang-github-tchap-go-patricia-dev', 'golang-go-patricia-dev']
github.com/xi2/xz, xi2.org/x/xz ['golang-github-xi2-xz-dev', 'golang-xi2-x-xz-dev']
golang.org/x/crypto ['golang-go.crypto-dev', 'golang-golang-x-crypto-dev']
golang.org/x/net ['golang-go.net-dev', 'golang-golang-x-net-dev']
golang.org/x/tools ['golang-go.tools-dev', 'golang-golang-x-tools-dev']
golang.org/x/oauth2 ['golang-golang-x-oauth2-dev', 'golang-golang-x-oauth2-google-dev']
golang.org/x/text ['golang-golang-x-text-dev', 'golang-x-text-dev']
cloud.google.com/go ['golang-google-cloud-compute-metadata-dev', 'golang-google-cloud-dev']
gopkg.in/alecthomas/kingpin.v3,
                   gopkg.in/alecthomas/kingpin.v3-unstable,
                   github.com/alecthomas/kingpin, ['golang-gopkg-alecthomas-kingpin.v3-dev', 'golang-gopkg-alecthomas-kingpin.v3-unstable-dev']
gopkg.in/yaml.v2 ['golang-gopkg-yaml.v2-dev', 'golang-yaml.v2-dev']

Most are caused by transitional package, but golang.org/x/oauth2 is caused by package splits.

$ dh-make-golang search golang.org/x/oauth2
golang-golang-x-oauth2-google-dev: golang.org/x/oauth

It should be golang-golang-x-oauth2-dev.

Runtime error

I have a standalone golang application, that uses github.com/golang/glog

My directory structure is something like,

$GOPATH/godebian

  • pkg/
  • bin/
  • src/
    github.com/
    goDebian.go

upon running dh-make-golang, I see the following error.

$ dh-make-golang -allow_unknown_hoster /home/godebian
panic: runtime error: slice bounds out of range

goroutine 1 [running]:
panic(0x7ec2c0, 0xc82000e0e0)
/usr/lib/go-1.6/src/runtime/panic.go:464 +0x3e6
main.debianNameFromGopkg(0x7ffc63901209, 0x18, 0x868190, 0x7, 0x0, 0x0)
/build/dh-make-golang-OhS4Fp/dh-make-golang-0.0git20150913.0.1221041/
obj-x86_64-linux-gnu/src/github.com/Debian/dh-make-golang/make.go:307 +0x829
main.main()
/build/dh-make-golang-OhS4Fp/dh-make-golang-0.0
git20150913.0.1221041/
obj-x86_64-linux-gnu/src/github.com/Debian/dh-make-golang/make.go:575 +0x65e

crash against package with relative import

Hey!

dh-make-golang crashes when making a package that has a relative import.

For example:

reazem@cranberry:~/git/dh-make-golang$ dh-make-golang github.com/hpcloud/tail 
2015/12/14 16:58:50 Downloading "github.com/hpcloud/tail/..."
2015/12/14 16:58:52 Determining upstream version number
2015/12/14 16:58:52 Package version is "0+git20151102.34.157f8ef"
2015/12/14 16:58:52 Determining package type
2015/12/14 16:58:52 Assuming you are packaging a program (because "github.com/hpcloud/tail/cmd/gotail" defines a main package), use -type to override
2015/12/14 16:58:52 Determining dependencies
can't load package: package ./watch: open /home/reazem/git/dh-make-golang/watch: no such file or directory
2015/12/14 16:58:53 Could not create a tarball of the upstream source: exit status 1

This is due to the following import:

"./watch"

I added logging and here is a part of the go list command ran by dh-make-golang:

time
./watch
fmt

I tried debugging, but I couldn't reproduce the go list output including the ./watch dependency. I must be doing something wrong.

several import paths for one package

Hello!

Sometimes, people import the same package with gopkg or github.

We create symlinks to support this.

Could Go-Import-Path reflect this?

Go-Import-Path could be a comma-separated list of import paths.

Allow for searching packages

Hello,

Would you merge a feature that allows for searching existing packages by gopath?

For example:

$ dh-make-golang search tomb
golang-gopkg-tomb.v1-dev: gopkg.in/tomb.v1
golang-gopkg-tomb.v2-dev: gopkg.in/tomb.v2

I know that dh-make-golang warns when packaging stuff that is already packaged but I would find this very useful for searching what is already available in Debian.

Example use case: I imported a new upstream version for my existing package and it won't build anymore because of a new dependency. I run dh-make-golang search <keyword> to quickly find the debian binary package name and add it to build-dependencies.

Error: 'can't load package: package .: no buildable Go source files in'

$ cd $(mktemp -d)
$ dh-make-golang github.com/agl/ed25519
$ cd golang-github-agl-ed25519/
$ git add -A
$ git commit -m "Initial packaging"
$ gbp buildpackage
...
dh build --buildsystem=golang --with=golang
   dh_testdir -O--buildsystem=golang
   dh_auto_configure -O--buildsystem=golang
   dh_auto_build -O--buildsystem=golang
warning: "/..." matched no packages
can't load package: package .: no buildable Go source files in /tmp/rnd-dir/golang-github-agl-ed25519/obj-x86_64-linux-gnu
dh_auto_build: go install -v returned exit code 1
debian/rules:4: recipe for target 'build' failed
make: *** [build] Error 1
dpkg-buildpackage: error: debian/rules build gave error exit status 2
debuild: fatal error at line 1376:
dpkg-buildpackage -rfakeroot -D -us -uc -i -I failed
gbp:error: 'debuild -i -I' failed: it exited with 29

It tries to match /... instead of ./... (leading period sign)

Warning about package type even if -type is specified

The check for the existence of a main program on lines 147-151 is not conditional on the existence of a -type command-line argument. So if a user runs dh-make-golang -type=program or -type=library on a package which contains a main.go file, they will still get a message telling them "Assuming you are packaging...", which is annoying but harmless.

Perhaps this could be fixed by parsing pkgType first, and passing this into the makeUpstreamSourceTarball function. Then the logic could be:
if pkgType unset, do as now
if pkgType == 'library', then if a main.go is found, give an appropriate warning
if pkgType == 'program', then if no main.go is found, give an appropriate warning

Switch from "tar --exclude-vcs" to "git archive" to keep .gitignore

After running into trouble on several occasions trying to upgrade golang-*-dev packages that predate dh-make-golang, especially error merging with deleted .gitignore in dh-make-golang-generated tarball, I become convinced that the use of tar --exclude-vcs, which indiscriminately delete files like .gitignore, is not the best solution.

Would git archive be a better solution? Perhaps something like the following?

git archive --format=tar --prefix=golang-github-author-package/ upstream/0.0_git20160429.0.9abcdef \
    | xz -9 >golang-github-author-pacakage_0.0~git20160429.0.9abcdef.orig.tar.xz

Cheers,
Anthony

"use of internal package not allowed" running dh-make-golang

I'm running dh-make-golang to grab the source for a new snapshot
of containerd, and get the following error:

# dh-make-golang -git_revision 0366d7e github.com/docker/containerd
2016/11/16 14:02:29 Downloading "github.com/docker/containerd/..."
go get: 202.79 MiB
package github.com/docker/containerd/vendor/src/golang.org/x/net/trace
	imports golang.org/x/net/internal/timeseries: use of internal package not allowed
package github.com/docker/containerd/vendor/src/google.golang.org/grpc
	imports google.golang.org/grpc/internal: use of internal package not allowed
2016/11/16 14:12:26 Could not create a tarball of the upstream source: exit status 1

It looks like the vendored dependencies that have internal packages, x-net and golang-grpc,
here are trying to be imported while being built using a longer package name: github.com/docker/containerd/vendor/src/google.golang.org/grpc vs google.golang.org/grpc
but I don't understand why.

My guess is that this was always happening but only now produces an error as upstreams
are only just starting to add internal packages to their code.

pkgVersionFromGit indiscriminately say "latest tag" even if -git_revision is used

(Note-to-self to fix a minor bug that I introduced myself.)

Since around dh-make-golang v0.2.0, pkgVersionFromGit() would print log messages like the following:

    log.Printf("Found latest tag %q", latestTag)
    log.Printf("WARNING: Latest tag %q is not a valid SemVer version\n", latestTag)
    log.Printf("Latest tag %q matches master", latestTag)

saying it is the "latest tag" even if the user had specify an older tag -git_revision.

For example, even if the actual latest release is v1.1.9, the log message claims v1.1.2 is the latest:

$ dh-make-golang make -git_revision v1.1.2 github.com/yuin/goldmark
2019/11/29 14:02:38 Downloading "github.com/yuin/goldmark/..."
2019/11/29 14:02:39 Determining upstream version number
2019/11/29 14:02:39 Found latest tag "v1.1.2"
2019/11/29 14:02:39 Latest tag "v1.1.2" matches master
2019/11/29 14:02:39 Package version is "1.1.2"

The Description field in debian/control has whitespace-only lines

Looks like trailing whitespace is treated as text rather than blank lines. The build process then fails
because it treats these lines as blank.

The regexp for parsing description needs to be equivalent to: s/^[[:space:]]*$/ ./ when parsing the description field.

I am using: dh-make-golang 0.0~git20150803.0.bd09cd9-1 amd64 in Ubuntu 15.10

(Thanks for an excellent program)

don't try building packages with only test files

This is happening during a package build:

go build github.com/syncthing/syncthing/meta: no buildable Go source files in /home/aviau/git/debian-pkg/build-area/syncthing-0.14.33+dfsg1/_build/src/github.com/syncthing/syncthing/meta

the meta package is not empty:

aviau@cranberry:~/git/debian-pkg/build-area/syncthing-0.14.33+dfsg1/_build/src/github.com/syncthing/syncthing/meta$ ls -l
total 16
-rw-r--r-- 1 aviau aviau 3719 Jul 26 22:02 authors_test.go
-rw-r--r-- 1 aviau aviau 1533 Jul 26 22:02 copyright_test.go
-rw-r--r-- 1 aviau aviau 1055 Jul 26 22:02 gofmt_test.go
-rw-r--r-- 1 aviau aviau 2642 Jul 26 22:02 metalint_test.go

Its just that it contains only tests.

It would be great if whatever command is used to determine what packages are build could exclude packages that are "empty" because they contain only tests.

Output directive will cause invalid initial push to salsa-project

(Converted to issue from https://lists.debian.org/debian-go/2018/12/msg00001.html)

Summary: the output of dh-make-golang that gives instructions on what do next will cause invalid initial push to salsa-project.

Here is what I'm trying to follow (The whole log is at http://paste.debian.net/1053985/)

$ dh-make-golang github.com/danverbraganza/varcaser
2018/11/25 09:07:42 To create the packaging git repository on salsa, use:
2018/11/25 09:07:42     dh-make-golang create-salsa-project
golang-github-danverbraganza-varcaser
2018/11/25 09:07:42
2018/11/25 09:07:42 Once you are happy with your packaging, push it to
salsa using:
2018/11/25 09:07:42     git remote set-url origin
[email protected]:go-team/packages/golang-github-danverbraganza-varcaser.git
2018/11/25 09:07:42     gbp push
                        ^^^^^^^^

Here is my work log:

$ git branch -v
* master       9078e4c - [+] Initial packaging
  pristine-tar fbba72a pristine-tar data for
golang-github-danverbraganza-varcaser_0.0~git20151108.ce61ec4.orig.tar.xz
  upstream     88a5d5c New upstream version 0.0~git20151108.ce61ec4

$ gbp push --dry-run --verbose
gbp:debug: ['git', 'rev-parse', '--show-cdup']
gbp:debug: ['git', 'rev-parse', '--is-bare-repository']
gbp:debug: ['git', 'rev-parse', '--git-dir']
gbp:debug: ['git', 'symbolic-ref', 'HEAD']
gbp:debug: ['git', 'show-ref', 'refs/heads/master']
gbp:debug: ['git', 'config', 'branch.master.remote']
gbp:debug: ['git', 'tag', '-l', 'debian/0.0_git20151108.ce61ec4-1']
gbp:debug: ['git', 'tag', '-l', 'upstream/0.0_git20151108.ce61ec4']
gbp:debug: ['git', 'rev-parse', '--quiet', '--verify',
'upstream/0.0_git20151108.ce61ec4^{commit}']
gbp:debug: ['git', 'rev-parse', '--quiet', '--verify', 'refs/heads/upstream']
gbp:debug: ['git', 'show-ref', '--verify', 'refs/heads/pristine-tar']
gbp:debug: ['git', 'log', '--pretty=format:%H', '--no-merges',
'--grep=pristine-tar .*
golang-github-danverbraganza-varcaser_0.0~git20151108.ce61ec4.orig.tar.*',
'pristine-tar', '--']
gbp:debug: Found pristine-tar commit at
'31cf4b66f3eb7b7391cd90ddba762acb37ee6ea9'
gbp:debug: ['git', 'rev-parse', '--quiet', '--verify',
'31cf4b66f3eb7b7391cd90ddba762acb37ee6ea9^{commit}']
gbp:debug: ['git', 'rev-parse', '--quiet', '--verify',
'refs/heads/pristine-tar']
gbp:info: Dry-run: Pushing upstream/0.0_git20151108.ce61ec4 to origin
gbp:debug: ['git', 'push', 'origin', 'tag',
'upstream/0.0_git20151108.ce61ec4', '--dry-run']
gbp:info: Dry-run: Pushing refs/heads/pristine-tar to
origin:refs/heads/pristine-tar
gbp:debug: ['git', 'push', 'origin', '--dry-run',
'refs/heads/pristine-tar:refs/heads/pristine-tar']
gbp:info: Dry-run: Pushing refs/heads/upstream to origin:refs/heads/upstream
gbp:debug: ['git', 'push', 'origin', '--dry-run',
'refs/heads/upstream:refs/heads/upstream']

I.e., when it is actually run, the first branch being pushed is upstream, making golang-github-danverbraganza-varcaser's default branch to be upstream. Moreover, my default master branch is not being pushed at all.

This is incorrect.

Either gbp push behavior is changed or the above instructional comment should be changed, so the next newcomers will not fall into the same pitiful again.

Thx

$ apt-cache policy git-buildpackage
git-buildpackage:
  Installed: 0.9.10+nmu1
  Candidate: 0.9.10+nmu1
  Version table:
 *** 0.9.10+nmu1 100
         50 http://cdn-fastly.deb.debian.org/debian unstable/main amd64 Packages
        100 /var/lib/dpkg/status
     0.8.12.2 500
        500 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 Packages

gbp:error: Couldn't commit to 'pristine-tar' with upstream

Hi,

What could go wrong with this simple command?

dh-make-golang github.com/suntong/ffcvt

These are the errors I'm getting for that:

$ dh-make-golang github.com/suntong/ffcvt
2018/06/22 23:45:53 Downloading "github.com/suntong/ffcvt/..."
2018/06/22 23:45:53 Determining upstream version number
2018/06/22 23:45:53 Package version is "1.1.0+git20170914.a6d80b5"
2018/06/22 23:45:53 Determining dependencies
2018/06/22 23:45:53 Assuming you are packaging a program (because
"github.com/suntong/ffcvt" defines a main package), use -type to
override
gbp:error: Couldn't commit to 'pristine-tar' with upstream
'27899a6f2bdbe757b832450b123699d935e2f5c8': execution failed: [Errno
2] No such file or directory
gbp:error: Import of
/path/to/ffcvt/ffcvt_1.1.0+git20170914.a6d80b5.orig.tar.xz failed:
Couldn't commit to 'pristine-tar' with upstream
'27899a6f2bdbe757b832450b123699d935e2f5c8': execution failed: [Errno
2] No such file or directory
gbp:error: Error detected, Will roll back changes.
gbp:error: Rolled back changes after import error.
2018/06/22 23:45:54 Could not create git repository: exit status 1

$ dir /path/to/ffcvt/ffcvt_1.1.0+git20170914.a6d80b5.orig.tar.xz
-rw-rw---- 1 73576 2018-06-22 23:45
/path/to/ffcvt/ffcvt_1.1.0+git20170914.a6d80b5.orig.tar.xz

I.e., the file is right there, but why gbp gives the error of import failed?

My dh-make-golang is the latest from git.

Please help. Thx.

Error while estimating gitlab-org/gitlab-workhorse

I'm trying to estimate gitlab-org/gitlab-workhorse, but it is failing with the following error:

➜  ~ dh-make-golang estimate gitlab.com/gitlab-org/gitlab-workhorse
go get: 73.69 MiBpackage gitlab.com/gitlab-org/gitaly-proto/go: no Go files in /tmp/dh-make-golang422696571/src/gitlab.com/gitlab-org/gitaly-proto/go
2018/12/23 17:55:10 exit status 1

dh-make-golang not including vendor dependencies in debian/control ?

When I run dh-make-golang github.com/quilt/quilt, it seems to not include the dependencies I have imported into my project using govendor in my debian/control file. I'm new to packaging golang into debian applications, especially those that have dependencies, so I'm not sure what this is supposed to do.

From reading #46, it seems that these dependencies should be listed in debian/control, but currently they aren't for me. So when I do try to use gbp to build my package I get an error for all of my dependencies saying it can't find them in my $GOROOT or $GOPATH.

I am running version 0.0~git20161120.0.71f5e23-1 (2016-11-20), and the commands I have done are the following:

dh-make-golang github.com/quilt/quilt

Creates the debian folder and associated files with TODOs, which I correct. But I noticed here the relevant parts of my debian/control look like:

Source: quilt
Section: devel
Priority: extra
Maintainer: Brian Sang <[email protected]>
Uploaders: Brian Sang <[email protected]>
Build-Depends: debhelper (>= 10),
               dh-golang,
               golang-any
Standards-Version: 3.9.8
Homepage: https://github.com/quilt/quilt
Vcs-Browser: https://github.com/quilt/quilt.git
Vcs-Git: https://github.com/quilt/quilt.git
XS-Go-Import-Path: github.com/quilt/quilt

Package: quilt
Architecture: any
Built-Using: ${misc:Built-Using}
Depends: ${shlibs:Depends},
         ${misc:Depends}
Description: Quilt

and then when I try to build using gbp buildpackage, it goes until it hits the golang dependencies:

src/github.com/quilt/quilt/quilt.go:17:2: cannot find package "github.com/Sirupsen/logrus" in any of:
	/usr/lib/go-1.7/src/github.com/Sirupsen/logrus (from $GOROOT)
	/build/quilt-0.0+git20170328.741.b2136f2/obj-x86_64-linux-gnu/src/github.com/Sirupsen/logrus (from $GOPATH)
 .............

And this happens for each dependency. So I'm not sure if dh-make-golang is supposed to sort all of this out for me, or if I have to manually do this somehow. Any help would be appreciated!

Command to create new upstream tarball

Correct me if this is outside the scope of the project, but I would like a command to create a new tarball. That would mean running only the makeUpstreamSourceTarball function.

So that I can do something like this:

dh-make-golang <make-tarball-command>
gbp import-orig ../<tarball>

Invalid version number error

here is the start of the log:

2015/11/30 03:23:39 Downloading "github.com/cihub/seelog/..."
2015/11/30 03:23:42 Determining upstream version number
2015/11/30 03:23:42 Package version is "go1.1+git20151102.84.0f89bb7"

Further investigation shows that the author is tagging the "go compiler version" along with "vX.y" tags.
This library has two tags: go1.1 and v2.5 both on the same commit.
Any Idea if it would be possible to pick the 2.5 from the other tag, though it might be easier to be able to specify a version as a command line argument.

Generated watch file is broken

Hi,

the debian/watch file generated by dh-make-golang is broken.
(This example was created by running dh-make-golang github.com/gchaincl/httplab)

version=3
opts=filenamemangle=s/.+\/v?(\d\S*)\.tar\.gz/httplab-\$1\.tar\.gz/,\\
uversionmangle=s/(\d)[_\.\-\+]?(RC|rc|pre|dev|beta|alpha)[.]?(\d*)$/\$1~\$2\$3/ \\
  https://github.com/gchaincl/httplab/tags .*/v?(\d\S*)\.tar\.gz

Which results in:

$ uscan --report
uscan warn: unrecognised option \\
uscan warn: Filename pattern missing version delimiters () without filenamemangle
  in debian/watch, skipping:
  uversionmangle=s/(\d)[_\.\-\+]?(RC|rc|pre|dev|beta|alpha)[.]?(\d*)$/\$1~\$2\$3/ \\

The escaped backslashes at the end of the line should actually be single backslashes:

version=3
opts=filenamemangle=s/.+\/v?(\d\S*)\.tar\.gz/httplab-\$1\.tar\.gz/,\
uversionmangle=s/(\d)[_\.\-\+]?(RC|rc|pre|dev|beta|alpha)[.]?(\d*)$/\$1~\$2\$3/ \
  https://github.com/gchaincl/httplab/tags .*/v?(\d\S*)\.tar\.gz
$ uscan --report
$

Bug: dependencies for vendored repo

I have an app vendored with the official golang's dep (https://github.com/golang/dep) utility. I should not require any external dependencies.
However, when I use dh-make-golang it adds golang-golang-x-crypto-dev as a Build-Depends. I suppose something's wrong.
Should I just manually remove golang-golang-x-crypto-dev for now?

sendmail suggested command not quite correct

In make.go, it suggests running the command sendmail -t -f. With sendmail installed as exim, the -f option expects a From envelope name as a parameter, and this requires an authorised user. I don't know whether other sendmail programs are different in this respect; sendmail -t was fine on its own with exim.

Wrong format of version when git_revision is given

When I ran

dh-make-golang -type program -git_revision 0.9 github.com/elves/elvish

I got the version string like 0.9+git20170703.0.8b7445d. I hope it could be just 0.9.

PS, the upstream doesn't use annotated tag. Is it related?

Why set email and user.name for every repository?

Hi, should user.name and email really be added to every repository? I have both in my ~/.gitconfig? An alternative could be to warn if neither is available, and maybe add them (preferably globally) fromDEB_FULLNAME and DEB_EMAIL.

I stumbled on the issue because of a bug in golang-github-tcnksm-go-gitconfig, where tests were not properly isolated. (That merge request is here.) While this issue is not necessarily a bug, it may make it more difficult to change an email. Please let me know your favorite way to resolve, and I will submit a merge request. Thank you!

dh-make-golang/make.go

Lines 296 to 306 in f0afc0f

if debianName := getDebianName(); debianName != "TODO" {
if err := runGitCommandIn(dir, "config", "user.name", debianName); err != nil {
return dir, err
}
}
if debianEmail := getDebianEmail(); debianEmail != "TODO" {
if err := runGitCommandIn(dir, "config", "user.email", debianEmail); err != nil {
return dir, err
}
}

gbp:error: Failed to commit tree: *** Please tell me who you are.

$ dh-make-golang -allow_unknown_hoster github.com/zyedidia/micro 
...
gbp:error: Failed to commit tree: 
*** Please tell me who you are.

Run

  git config --global user.email "[email protected]"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

Is it possible to run it without writing global config? Thanks.

Reorganize project and expose internals

This project has solved a lot of problems other linux distribution would need to solve to properly package golang. I'm curious if its beneficial to reorganize the project and expose the internals so it's easier to reuse the code.

Any thoughts on this?

-insecure flag

Some repositorys dont use https, they only works for http so if we have a -insecure flag that will be nice

underscores in package names

Some Go packages have underscores in their import path (github.com/prometheus/client_golang and friends, for example), which is not valid according to 5.6.1 (Package names (both source and binary) must consist only of lower case letters (a-z), digits (0-9), plus (+) and minus (-) signs, and periods (.).). This ought to be handled in dh-make-golang, and I'd propose it be done by replacing the _ with - like we do for / (and perhaps anything else that matches [^a-z0-9+.-] and is thus invalid).

Here's some example output that demonstrates the problem:

$ dh-make-golang -type library github.com/prometheus/client_golang
2015/09/08 21:35:18 Downloading "github.com/prometheus/client_golang/..."
2015/09/08 21:35:30 Determining upstream version number
2015/09/08 21:35:30 Package version is "0.0~git20150828.32.29939ec"
2015/09/08 21:35:30 Determining package type
2015/09/08 21:35:30 Assuming you are packaging a program (because "github.com/prometheus/client_golang/examples/random" defines a main package), use -type to override
2015/09/08 21:35:30 Determining dependencies
2015/09/08 21:35:34 Build-Dependency "golang-github-golang-protobuf-dev" is not yet available in Debian
2015/09/08 21:35:34 Build-Dependency "golang-github-prometheus-procfs-dev" is not yet available in Debian
2015/09/08 21:35:34 Build-Dependency "golang-github-prometheus-common-dev" is not yet available in Debian
2015/09/08 21:35:34 Build-Dependency "golang-github-matttproud-golang_protobuf_extensions-dev" is not yet available in Debian
2015/09/08 21:35:34 Build-Dependency "golang-github-prometheus-client_model-dev" is not yet available in Debian
2015/09/08 21:35:34 Build-Dependency "golang-bitbucket-ww-goautoneg-dev" is not yet available in Debian
2015/09/08 21:35:34 Build-Dependency "golang-github-beorn7-perks-dev" is not yet available in Debian
2015/09/08 21:35:38 
2015/09/08 21:35:38 Packaging successfully created in /host/home/tianon/temp/golang-github-prometheus-client_golang
2015/09/08 21:35:38 
2015/09/08 21:35:38 Resolve all TODOs in itp-golang-github-prometheus-client_golang.txt, then email it out:
2015/09/08 21:35:38     sendmail -t -f < itp-golang-github-prometheus-client_golang.txt
2015/09/08 21:35:38 
2015/09/08 21:35:38 Resolve all the TODOs in debian/, find them using:
2015/09/08 21:35:38     grep -r TODO debian
2015/09/08 21:35:38 
2015/09/08 21:35:38 To build the package, commit the packaging and use gbp buildpackage:
2015/09/08 21:35:38     git add debian && git commit -a -m 'Initial packaging'
2015/09/08 21:35:38     gbp buildpackage --git-pbuilder
2015/09/08 21:35:38 
2015/09/08 21:35:38 To create the packaging git repository on alioth, use:
2015/09/08 21:35:38     ssh git.debian.org "/git/pkg-go/setup-repository golang-github-prometheus-client_golang 'Packaging for golang-github-prometheus-client_golang'"
2015/09/08 21:35:38 
2015/09/08 21:35:38 Once you are happy with your packaging, push it to alioth using:
2015/09/08 21:35:38     git push git+ssh://git.debian.org/git/pkg-go/packages/golang-github-prometheus-client_golang.git --tags master pristine-tar upstream

Add --type=combined for programs accompanied by libraries

Filed from https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=814690:

(1) -type=library Behaviour as at present: creates a -dev package
including the Go source code and doesn't compile anything.

(2) -type=program Behaviour different from present: creates a binary
package only, with the compiled Go program, excluding all Go source
code.

(3) -type=combined (or some other appropriate name) Compiles a Go
program to produce a binary package containing only the compiled Go
program; also creates a corresponding -dev package providing the Go
source code.

Working with dep

I am trying to build a package for a program that uses dep. The repository does not contain the vendor directory but requires the user to run dep ensure before building. Where would be the right place to add support for this in dh-make-golang? (checking for Godep lock file, running dep ensure).

dh-make-golang no longer able to calculate dependencies of package with vendoring (as of golang-1.6.2?)

I discovered yesterday that the command:

dh-make-golang github.com/kardianos/govendor

is no longer able to calculate the necessary dependent Go packages in debian/control. The govender repository contains vendoring in the vendor/ directory.

But I remember that it worked back on 2016-05-01 (a little more than a month ago) when I created the initial package for govendor, and dh-make-golang has not changed since. Could it have anything to do with recent changes in golang-go packaging, especially the new go1.6.2?

(I have yet to investigate in depth, but filing an issue so I don't forget.)

Allow the use of a forked repository

The use case: I want to create debian packaging for a project that is not compliant (which has imports not from github).

I forked this project to change the imports to be github-based, commited that in my fork and instructed dh-make-golang to use my fork.

Still got imports .../...: unrecognized import path ".../..." (import path does not begin with hostname) error messages.

Used strace to see that it downloaded from the upstream project.

I'm a total newcomer to go and its ecosystem, but this behavior looks strange...

break out version.go into a package

It'd be great to break out version.go into a package, so other debian go tooling can use it.

This would be helpful for the following 2 things (at least) that I want:

  • gbp import-orig update workflow (based on XS-Golang-Import-Path and version.go to create a new tarball, import-orig and dch)
  • uscan-alike (or uscan patch?) to check when we're out of date (not a huge deal, but good to know)

I'm cool with importing dh-make-golang, or if you want a new common repo for this stuff, that would be great as well

Switch dependency/duplicate check to newly-added api.ftp-master.debian.org/binary/by_metadata/Go-Import-Path

The current heuristic is not precise. For example, when packaging github.com/coreos/dex, I got:

2017/10/21 18:19:49 Build-Dependency "golang-github-gtank-cryptopasta-dev" is not yet available in Debian
2017/10/21 18:19:49 Build-Dependency "golang-github-golang-protobuf-dev" is not yet available in Debian
2017/10/21 18:19:49 Build-Dependency "golang-gopkg-ldap.v2-dev" is not yet available in Debian
2017/10/21 18:19:49 Build-Dependency "golang-github-cockroachdb-cockroach-go-dev" is not yet available in Debian
2017/10/21 18:19:49 Build-Dependency "golang-gopkg-square-go-jose.v2-dev" is not yet available in Debian
2017/10/21 18:19:49 Build-Dependency "golang-github-beevik-etree-dev" is not yet available in Debian
2017/10/21 18:19:49 Build-Dependency "golang-github-russellhaering-goxmldsig-dev" is not yet available in Debian

But, github.com/golang/protobuf and gopkg.in/ldap.v2 are in fact packaged (in golang-goprotobuf-dev and golang-github-go-ldap-ldap-dev, respectively).

@paultag suggested using the XS-Go-Import-Path field in debian/control instead of setting DH_GOPKG (see also https://manpages.debian.org/unstable/dh-golang/Debian::Debhelper::Buildsystem::golang.3pm.en.html), which allows us to precisely list all binary packages by their Go import path.

I recently implemented a query for this in dakweb, see https://lists.debian.org/debian-dak/2017/10/msg00012.html for the patch.

We should switch dh-make-golang to make use of that, and convert all of our remaining packages to set XS-Go-Import-Path (I’ll analyze which these are in a bit).

Cannot derive Debian package name: unknown hoster "cloud.google.com"

While I was trying to update the golang-google-cloud Debian package, I noticed that Google has recently changed the import path from google.golang.org/cloud to cloud.google.com/go.

I then attempted to fetch the latest version as a tarball using dh-make-golang cloud.google.com/go, but was greeted with this error:

Cannot derive Debian package name: unknown hoster "cloud.google.com".
See -help output for -allow_unknown_hoster

Thanks!

Godeps or vendoring?

Is there a method to use import versioning like godeps with this or must all dependencies be available as packages too?

Overaggressive pruning (and no configurability)

I'm trying to use dh-make-golang to package https://getgb.io, but I'm running into trouble right off because https://github.com/constabulary/gb/tree/933576cf5c8367145d3bae615558bac89fda415a/vendor is github.com/constabulary/gb/vendor, but it gets --exclude in the tar invocation, so the orig tarball doesn't have this package.

My thought for solving this is if the vendor directory exists, let's check if there are *.go files directly inside. If there aren't, we add --exclude, otherwise we leave it in (because it must be a legitimate package). Another way to check for this could be to just do something like go list <gopkg>/vendor and see if it comes back with itself or if it says that's not a valid package.

For example:

$ go list github.com/docker/docker/vendor
can't load package: package github.com/docker/docker/vendor: no buildable Go source files in GOPATH/src/github.com/docker/docker/vendor

Versus:

$ go list github.com/constabulary/gb/vendor
github.com/constabulary/gb/vendor

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.