[pkg-go] Code review: golang-github-danverbraganza-varcaser

Anthony Fok foka at debian.org
Thu Jun 21 13:12:15 BST 2018


Hi Tong,

On Sun, Jun 17, 2018 at 8:15 AM, Tong Sun <pkgoyq.xpt at neverbox.com> wrote:
> Finally! I was able to make my first build successfully!

Congratulations!

> This is my first Go package, and it now builds (kind of). Please
> review it for me before I make my next step.
>
> The project is at
> https://salsa.debian.org/go-team/packages/golang-github-danverbraganza-varcaser
> and my changes are at
> https://salsa.debian.org/go-team/packages/golang-github-danverbraganza-varcaser/commits/debian/sid
>
> Known problem (that I don't know how to fix)
>
>
> - gbp clone it is problematic:
>
> $ gbp clone git at salsa.debian.org:go-team/packages/golang-github-danverbraganza-varcaser.git
> gbp:info: Cloning from
> 'git at salsa.debian.org:go-team/packages/golang-github-danverbraganza-varcaser.git'
> gbp:error: Git command failed: Error running git checkout: error:
> pathspec 'master' did not match any file(s) known to git.

This problem perplexed me too and I spent like two hours reading about
it and experimenting.
It turns out that the culprit is this:

    "upstream", rather than "debian/sid", is^H^H was your default branch

Try running "git branch -a", and you will^H^H^H^H would have seen
something like this:

    $ git branch -a
    * debian/sid
      upstream
      remotes/origin/HEAD -> origin/upstream
      remotes/origin/debian/sid
      remotes/origin/upstream

Notice how remotes/origin/HEAD is pointing to "origin/upstream"
instead of "origin/debian/sid"?

Here is one of somewhat related questions on Stack Overflow:

    https://stackoverflow.com/questions/36190337/git-clone-default-branch

So, what happened?  It is likely because "gbp push" was run
prematurely.  From its man page:

       "gbp push" pushes your local changes to a remote repository.
       It is best run _after_ uploading a Debian package to the
archive to update you[r]
       debian-branch, upstream-branch, pristine-tar branch and
corresponding tags.

The way the current version of "gbp push" works is to first try to
find the latest debian tag, e.g. debian/0.0_git20151108.ce61ec4-1, and
after that, the upstream/0.0_git20151108.ce61ec4.  It would have
worked fine if the package has already been successfully built.
However, since your repository is a work-in-progress with no
debian/0.0_git20151108.ce61ec4-1 tag, "gbp push" skips it and upload
the upstream/0.0_git20151108.ce61ec4 and upstream branch instead.

And, since this was a brand new empty repo, and "upstream" branch was
pushed first, that became the default branch...

If you have access to the bare repository on the Salsa server, you could run

    git symbolic-ref HEAD refs/heads/debian/sid

to fix it.  Unfortunately, none of us has that access.

Fortunately, Salsa running GitLab allows us to change default branch,
but that permission is reserved to the "Owners" of the Salsa go-team
group.  Since you cannot yet change that setting yourself, I have just
done it for you.

So, next time, if you want to show others your progress (for reviews),
perhaps using "git push origin debian/sid" is likely the better first
command for your intiial push to Salsa.


If you think "gbp push" could be improved to prevent this "wrong
default branch" problem from happening again, I invite you to report
this, using reportbug(1), to git-buildpackage's author.

> - debian/docs is failing my build:
>
> . . .
> === RUN   TestCaserLowerCamelInitialCapital
> --- PASS: TestCaserLowerCamelInitialCapital (0.00s)
> === RUN   TestCaserIsATransformer
> --- PASS: TestCaserIsATransformer (0.00s)
> PASS
> ok      github.com/danverbraganza/varcaser/varcaser     0.004s
>    create-stamp debian/debhelper-build-stamp
>  fakeroot debian/rules binary
> dh binary --buildsystem=golang --with=golang
>    dh_testroot -O--buildsystem=golang
>    dh_prep -O--buildsystem=golang
>    dh_auto_install -O--buildsystem=golang
>         cd obj-x86_64-linux-gnu && mkdir -p
> /build/golang-github-danverbraganza-varcaser-0.0\~git20151108.ce61ec4/debian/golang-github-danverbraganza-varcaser-dev/usr/share/gocode/src/github.com/danverbraganza/varcaser
>         cd obj-x86_64-linux-gnu && cp -r -T
> src/github.com/danverbraganza/varcaser
> /build/golang-github-danverbraganza-varcaser-0.0\~git20151108.ce61ec4/debian/golang-github-danverbraganza-varcaser-dev/usr/share/gocode/src/github.com/danverbraganza/varcaser
>    dh_installdocs -O--buildsystem=golang
> dh_installdocs: Cannot find (any matches for) "Varcaser" (tried in .,
> debian/tmp)
>
> make: *** [debian/rules:4: binary] Error 2
> dpkg-buildpackage: error: fakeroot debian/rules binary subprocess
> returned exit status 2
> I: copying local configuration
> E: Failed autobuilding of package
> I: unmounting dev/ptmx filesystem
> . . .
> I: unmounting sys filesystem
> I: Cleaning COW directory
> I: forking: rm -rf /var/cache/pbuilder/build/cow.41098
> gbp:error: 'git-pbuilder' failed: it exited with 1
>
> $ dir debian/docs
> lrwxrwxrwx 1 u u 12 2018-06-16 00:06 debian/docs -> ../README.md

Let's answer your question using the dbab package that you made in 2015:

    $ apt source dbab
    $ cd dbab
    $ ls -l debian/docs

And, last but not least:

    $ man dh_installdocs

Cheers,

Anthony



More information about the Pkg-go-maintainers mailing list