gofed / symbols-extractor

Extractor of symbols from Go based projects
BSD 3-Clause "New" or "Revised" License
7 stars 3 forks source link

[Bug] unexpected directory layout (whatever that means) #147

Closed nim-nim closed 5 years ago

nim-nim commented 6 years ago

golist fails to output project go files on github.com/rubiojr/go-vhd (works fine on hundreds of other Go projects)

Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.NZHyXq
+ umask 022
+ cd /builddir/build/BUILD
+ '[' /builddir/build/BUILDROOT/golang-github-rubiojr-vhd-0-0.1.4.20180320git0bfd3b3.el7.llt.x86_64 '!=' / ']'
+ rm -rf /builddir/build/BUILDROOT/golang-github-rubiojr-vhd-0-0.1.4.20180320git0bfd3b3.el7.llt.x86_64
++ dirname /builddir/build/BUILDROOT/golang-github-rubiojr-vhd-0-0.1.4.20180320git0bfd3b3.el7.llt.x86_64
+ mkdir -p /builddir/build/BUILDROOT
+ mkdir /builddir/build/BUILDROOT/golang-github-rubiojr-vhd-0-0.1.4.20180320git0bfd3b3.el7.llt.x86_64
+ cd go-vhd-0bfd3b39853cdde5762efda92289f14b0ac0491b
+ go-rpm-integration install -i github.com/rubiojr/go-vhd -s /builddir/build/BUILD/go-vhd-0bfd3b39853cdde5762efda92289f14b0ac0491b -b /builddir/build/BUILD/go-vhd-0bfd3b39853cdde5762efda92289f14b0ac0491b/_build -o devel.file-list -p /builddir/build/BUILDROOT/golang-github-rubiojr-vhd-0-0.1.4.20180320git0bfd3b3.el7.llt.x86_64 -g /usr/share/gocode -r '.*example.*'
install: creating directory '/builddir/build/BUILDROOT/golang-github-rubiojr-vhd-0-0.1.4.20180320git0bfd3b3.el7.llt.x86_64/usr'
install: creating directory '/builddir/build/BUILDROOT/golang-github-rubiojr-vhd-0-0.1.4.20180320git0bfd3b3.el7.llt.x86_64/usr/share'
install: creating directory '/builddir/build/BUILDROOT/golang-github-rubiojr-vhd-0-0.1.4.20180320git0bfd3b3.el7.llt.x86_64/usr/share/gocode'
install: creating directory '/builddir/build/BUILDROOT/golang-github-rubiojr-vhd-0-0.1.4.20180320git0bfd3b3.el7.llt.x86_64/usr/share/gocode/src'
Installing: github.com/rubiojr/go-vhd
install: creating directory '/builddir/build/BUILD/go-vhd-0bfd3b39853cdde5762efda92289f14b0ac0491b/_build'
install: creating directory '/builddir/build/BUILD/go-vhd-0bfd3b39853cdde5762efda92289f14b0ac0491b/_build/src'
install: creating directory '/builddir/build/BUILD/go-vhd-0bfd3b39853cdde5762efda92289f14b0ac0491b/_build/src/github.com'
install: creating directory '/builddir/build/BUILD/go-vhd-0bfd3b39853cdde5762efda92289f14b0ac0491b/_build/src/github.com/rubiojr'
2018/03/23 16:49:12 unexpected directory layout:
        import path: _/builddir/build/BUILD/go-vhd-0bfd3b39853cdde5762efda92289f14b0ac0491b/_build/src/github.com/rubiojr/go-vhd/vhd
        root: /builddir/build/BUILD/go-vhd-0bfd3b39853cdde5762efda92289f14b0ac0491b/_build/src
        dir: /builddir/build/BUILD/go-vhd-0bfd3b39853cdde5762efda92289f14b0ac0491b/_build/src/github.com/rubiojr/go-vhd/vhd
        expand root: /builddir/build/BUILD/go-vhd-0bfd3b39853cdde5762efda92289f14b0ac0491b/_build/src
        expand dir: /builddir/build/BUILD/go-vhd-0bfd3b39853cdde5762efda92289f14b0ac0491b/vhd
        separator: /
install: creating directory '/builddir/build/BUILDROOT/golang-github-rubiojr-vhd-0-0.1.4.20180320git0bfd3b3.el7.llt.x86_64/usr/share/gocode/src/github.com'
install: creating directory '/builddir/build/BUILDROOT/golang-github-rubiojr-vhd-0-0.1.4.20180320git0bfd3b3.el7.llt.x86_64/usr/share/gocode/src/github.com/rubiojr'
install: creating directory '/builddir/build/BUILDROOT/golang-github-rubiojr-vhd-0-0.1.4.20180320git0bfd3b3.el7.llt.x86_64/usr/share/gocode/src/github.com/rubiojr/go-vhd'
'/builddir/build/BUILD/go-vhd-0bfd3b39853cdde5762efda92289f14b0ac0491b/notes.md' -> '/builddir/build/BUILDROOT/golang-github-rubiojr-vhd-0-0.1.4.20180320git0bfd3b3.el7.llt.x86_64/usr/share/gocode/src/github.com/rubiojr/go-vhd/notes.md'
'/builddir/build/BUILD/go-vhd-0bfd3b39853cdde5762efda92289f14b0ac0491b/README.md' -> '/builddir/build/BUILDROOT/golang-github-rubiojr-vhd-0-0.1.4.20180320git0bfd3b3.el7.llt.x86_64/usr/share/gocode/src/github.com/rubiojr/go-vhd/README.md'
'/builddir/build/BUILD/go-vhd-0bfd3b39853cdde5762efda92289f14b0ac0491b/.goipath' -> '/builddir/build/BUILDROOT/golang-github-rubiojr-vhd-0-0.1.4.20180320git0bfd3b3.el7.llt.x86_64/usr/share/gocode/src/github.com/rubiojr/go-vhd/.goipath'
'/builddir/build/BUILD/go-vhd-0bfd3b39853cdde5762efda92289f14b0ac0491b/.goflags' -> '/builddir/build/BUILDROOT/golang-github-rubiojr-vhd-0-0.1.4.20180320git0bfd3b3.el7.llt.x86_64/usr/share/gocode/src/github.com/rubiojr/go-vhd/.goflags'
ingvagabund commented 6 years ago

What golist binary did you use? From the go-compilers package or from the one pushed in this repo?

ingvagabund commented 6 years ago

Tested with golist from the go-compilers-golang-compiler-1-29.fc29.x86_64 over 0bfd3b39853cdde5762efda92289f14b0ac0491b hexsha of github.com/rubiojr/go-vhd:

$ golist --package-path github.com/rubiojr/go-vhd --to-install
/home/jchaloup/Packages/upstream/src/github.com/rubiojr/go-vhd
/home/jchaloup/Packages/upstream/src/github.com/rubiojr/go-vhd/cli.go
/home/jchaloup/Packages/upstream/src/github.com/rubiojr/go-vhd/version.go
/home/jchaloup/Packages/upstream/src/github.com/rubiojr/go-vhd/vhd
/home/jchaloup/Packages/upstream/src/github.com/rubiojr/go-vhd/vhd/util.go
/home/jchaloup/Packages/upstream/src/github.com/rubiojr/go-vhd/vhd/vhd.go
ingvagabund commented 6 years ago

Though, I am able to reproduce it during the rpmbuild.

nim-nim commented 6 years ago

I'm mostly using a golist rebuilt from sources in its own rpm except for very early builds where it has not been bootstrapped yet. (Will probably post a fist set of specs for inclusion in devel in the next days. The set passes mock I need to pt it through copr too. They will depend on some of the PRs you've not accepter yet, as bootstraping google-cloud is tricky without them)

ingvagabund commented 6 years ago
2018/03/23 16:49:12 unexpected directory layout:
        import path: _/builddir/build/BUILD/go-vhd-0bfd3b39853cdde5762efda92289f14b0ac0491b/_build/src/github.com/rubiojr/go-vhd/vhd
        root: /builddir/build/BUILD/go-vhd-0bfd3b39853cdde5762efda92289f14b0ac0491b/_build/src
        dir: /builddir/build/BUILD/go-vhd-0bfd3b39853cdde5762efda92289f14b0ac0491b/_build/src/github.com/rubiojr/go-vhd/vhd
        expand root: /builddir/build/BUILD/go-vhd-0bfd3b39853cdde5762efda92289f14b0ac0491b/_build/src
        expand dir: /builddir/build/BUILD/go-vhd-0bfd3b39853cdde5762efda92289f14b0ac0491b/vhd
        separator: /

Why is the import path prefixed with _?

nim-nim commented 6 years ago

no idea :)

It's nowhere in the spec or shell code, that's something golists constructs itself

(the log traces the arguments given to the shell wrapper, nothing to see there)

ingvagabund commented 6 years ago

Because https://github.com/rubiojr/go-vhd/blob/master/cli.go#L4:

package main

import (
    "./vhd"
    "fmt"
        ...
)

The "./vhd" is the culprit.

nim-nim commented 6 years ago

so, what is the correct solution? Have golist learn to parse it? Patch the code?

ingvagabund commented 6 years ago

This has nothing to do with the golist as the affected code is inside the golang stdlib. The problem is the GOPATH and symlinks. Not sure if we can fix it on our side.

nim-nim commented 6 years ago

Ok, I'll workaround then. Nothing that can be fixed in the shell wrapper either, it's already setting all the correct env variable and even cd-ing to the fake gopath directory.

Thanksfully it seems Google is fed up with GOPATH directory tricks too and is starting to talk about adding a manifest and a zip envelope for Go 11.

nim-nim commented 5 years ago

Migrated to https://pagure.io/golist/issue/10