Basically what happens is that the patch 'ostree-stub.patch' produces an empty file 'ostree_src.go' and the compiler doesn't accept an empty Go file.
My affirmation WRT the path can be confirmed by reading the patch itself [2] or just applying it. [2] https://salsa.debian.org/go-team/packages/golang-github-containers-image/blob/master/debian/patches/ostree-stub.patch#L1104 The error reported by the compiler is (see full buildlog below): can't load package: package github.com/containers/image/ostree: obj-x86_64-linux-gnu/src/github.com/containers/image/ostree/ostree_src.go:1:1: expected 'package', found 'EOF' On Mon, 2019-04-29 at 07:29 -0400, Reinhard Tartler wrote: > I'm having a hard time understanding what issue you are facing with and what > you mean fix "fix manually". How are you building the package? Are you using > git-buildpackage, sbuild or pbuilder? I'd > strongly recommend to do so, because if you were, I cannot see how you > possibly could run into such issues. I'm using none of them, I'm building "the hard way": in a container (from Docker base image debian:sid-slim) with a script that runs the individual steps and builds with 'dpkg-buildpackage'. It should be possible to build these packages this way, right? It usually works. I prefer not to use too much magic (although using containers involves per-se some magic) to better understand what's going on. What I meant with "fix manually" is executing "rm ostree/ostree_src.go" right after patching and before building. I don't know if the 'magic' of any of the mentioned tools is just silently fixing the issue for you and that's why you are not facing it... > In any case, a full buildlog, similar to what I attached, could be helpful. > If English is a language barrier, try explaining in German. I don't think that it's a language barrier. But possibly an expertise barrier: my expertise on building Debian packages (specially for Go) is not as extensive as yours :-) --- dpkg-buildpackage: info: source package golang-github-containers-image dpkg-buildpackage: info: source version 1.5-1 dpkg-buildpackage: info: source distribution UNRELEASED dpkg-buildpackage: info: source changed by Reinhard Tartler <siret...@tauware.de> dpkg-buildpackage: info: host architecture amd64 dpkg-source --before-build . debian/rules clean dh clean --buildsystem=golang --with=golang dh_auto_clean -O--buildsystem=golang dh_autoreconf_clean -O--buildsystem=golang dh_clean -O--buildsystem=golang debian/rules build dh build --buildsystem=golang --with=golang dh_update_autotools_config -O--buildsystem=golang dh_autoreconf -O--buildsystem=golang dh_auto_configure -O--buildsystem=golang debian/rules override_dh_auto_build make[1]: Entering directory '/debian-packages/golang-github-containers-image' dh_auto_build -O--buildsystem=golang -- -tags "containers_image_ostree_stub" can't load package: package github.com/containers/image/ostree: obj-x86_64-linux-gnu/src/github.com/containers/image/ostree/ostree_src.go:1:1: expected 'package', found 'EOF' cd obj-x86_64-linux-gnu && go install -gcflags=all=\"-trimpath=/debian-packages/golang-github-containers-image/obj-x86_64-linux-gnu/src\" -asmflags=all=\"-trimpath=/debian-packages/golang-github-containers-image/obj-x86_64-linux-gnu/src\" -v -p 4 -tags containers_image_ostree_stub github.com/containers/image github.com/containers/image/copy github.com/containers/image/directory github.com/containers/image/directory/explicitfilepath github.com/containers/image/docker github.com/containers/image/docker/archive github.com/containers/image/docker/daemon github.com/containers/image/docker/policyconfiguration github.com/containers/image/docker/reference github.com/containers/image/docker/tarfile github.com/containers/image/image github.com/containers/image/internal/testing/explicitfilepath-tmpdir github.com/containers/image/internal/testing/mocks github.com/containers/image/internal/tmpdir github.com/containers/image/manifest github.com/containers/image/oci github.com/containers/image/oci/archive github.com/containers/image/oci/internal github.com/containers/image/oci/layout github.com/containers/image/pkg/blobinfocache github.com/containers/image/pkg/compression github.com/containers/image/pkg/docker/config github.com/containers/image/pkg/strslice github.com/containers/image/pkg/sysregistries github.com/containers/image/pkg/sysregistriesv2 github.com/containers/image/pkg/tlsclientconfig github.com/containers/image/signature github.com/containers/image/storage github.com/containers/image/tarball github.com/containers/image/transports github.com/containers/image/transports/alltransports github.com/containers/image/types github.com/containers/image/version github.com/containers/image errors internal/race internal/cpu runtime/internal/sys runtime/internal/atomic sync/atomic unicode unicode/utf8 internal/testlog internal/bytealg math math/bits encoding unicode/utf16 crypto/internal/subtle runtime crypto/subtle container/list vendor/golang_org/x/crypto/cryptobyte/asn1 vendor/golang_org/x/net/dns/dnsmessage internal/nettrace runtime/cgo strconv vendor/golang_org/x/crypto/curve25519 crypto/rc4 github.com/ulikunitz/xz/internal/hash golang.org/x/crypto/openpgp/errors golang.org/x/crypto/cast5 image/color github.com/VividCortex/ewma github.com/vbauerster/mpb/internal github.com/docker/docker/api github.com/docker/docker/api/types/events github.com/docker/docker/api/types/image github.com/containers/image/oci github.com/containers/storage/pkg/promise github.com/pquerna/ffjson/fflib/v1/internal github.com/opencontainers/selinux/go-selinux/label github.com/containers/storage/pkg/ostree github.com/containers/storage/pkg/config sync math/rand reflect syscall io internal/singleflight bytes hash crypto strings crypto/sha256 path github.com/docker/docker/api/types/versions crypto/cipher crypto/internal/randutil crypto/sha512 time internal/syscall/unix crypto/aes bufio crypto/hmac crypto/md5 crypto/sha1 encoding/base32 hash/fnv github.com/klauspost/cpuid internal/poll github.com/klauspost/crc32 hash/crc32 hash/crc64 os golang.org/x/crypto/openpgp/s2k hash/adler32 image vendor/golang_org/x/text/transform sort regexp/syntax encoding/binary fmt path/filepath encoding/base64 crypto/des encoding/pem io/ioutil vendor/golang_org/x/crypto/internal/chacha20 vendor/golang_org/x/crypto/poly1305 runtime/debug vendor/golang_org/x/crypto/chacha20poly1305 compress/bzip2 regexp golang.org/x/crypto/openpgp/armor context encoding/hex encoding/json github.com/opencontainers/image-spec/specs-go math/big net github.com/opencontainers/go-digest github.com/containers/image/docker/reference github.com/opencontainers/image-spec/specs-go/v1 github.com/containers/image/types net/url github.com/containers/image/pkg/strslice github.com/pkg/errors log github.com/klauspost/compress/flate github.com/boltdb/bolt crypto/elliptic encoding/asn1 crypto/rand crypto/dsa github.com/klauspost/pgzip crypto/rsa github.com/ulikunitz/xz/internal/xlog github.com/containers/image/transports github.com/containers/image/version github.com/ulikunitz/xz/lzma crypto/ecdsa crypto/x509/pkix vendor/golang_org/x/crypto/cryptobyte github.com/proglottis/gpgme compress/flate github.com/ulikunitz/xz compress/zlib golang.org/x/crypto/openpgp/elgamal image/internal/imageutil image/jpeg container/heap github.com/vbauerster/mpb/decor crypto/x509 golang.org/x/sys/unix golang.org/x/crypto/openpgp/packet crypto/tls golang.org/x/crypto/openpgp golang.org/x/crypto/ssh/terminal github.com/mattn/go-isatty os/signal github.com/sirupsen/logrus github.com/vbauerster/mpb/cwriter github.com/vbauerster/mpb golang.org/x/net/context golang.org/x/sync/semaphore github.com/containers/image/pkg/blobinfocache github.com/containers/image/pkg/compression github.com/containers/image/directory/explicitfilepath github.com/containers/image/docker/policyconfiguration github.com/docker/docker-credential-helpers/credentials os/exec github.com/docker/libtrust github.com/docker/docker/vendor/github.com/containerd/continuity/pathdriver github.com/docker/docker/pkg/mount github.com/docker/docker-credential-helpers/client github.com/docker/go-units os/user github.com/docker/docker/pkg/system github.com/BurntSushi/toml github.com/containers/image/manifest github.com/containers/image/image github.com/containers/image/pkg/sysregistriesv2 golang.org/x/net/internal/socks github.com/containers/image/signature github.com/containers/image/directory github.com/opencontainers/runc/libcontainer/user golang.org/x/net/proxy compress/gzip github.com/docker/docker/pkg/idtools vendor/golang_org/x/text/unicode/bidi vendor/golang_org/x/text/unicode/norm github.com/docker/docker/pkg/homedir github.com/containers/image/pkg/docker/config net/textproto github.com/containers/image/copy vendor/golang_org/x/net/http2/hpack vendor/golang_org/x/text/secure/bidirule mime mime/quotedprintable net/http/httptrace vendor/golang_org/x/net/idna net/http/internal github.com/docker/go-connections/tlsconfig github.com/docker/distribution/digest github.com/docker/distribution/uuid gopkg.in/yaml.v2 mime/multipart github.com/docker/distribution/reference archive/tar vendor/golang_org/x/net/http/httpguts vendor/golang_org/x/net/http/httpproxy github.com/containers/image/internal/tmpdir github.com/docker/docker/vendor/github.com/docker/distribution/digestset net/http github.com/docker/docker/vendor/github.com/docker/distribution/reference github.com/docker/docker/api/types/blkiodev github.com/docker/docker/api/types/mount github.com/docker/docker/api/types/strslice github.com/docker/go-connections/nat github.com/docker/docker/api/types/container github.com/containers/image/docker/tarfile github.com/docker/docker/api/types/filters github.com/docker/docker/errdefs github.com/containers/image/docker/archive github.com/docker/docker/api/types/network github.com/docker/docker/api/types/registry github.com/docker/docker/api/types/time github.com/gogo/protobuf/proto github.com/containers/image/internal/testing/explicitfilepath-tmpdir github.com/containers/image/internal/testing/mocks github.com/containers/image/oci/internal text/scanner github.com/containers/storage/pkg/fileutils github.com/containers/storage/pkg/mount github.com/ghodss/yaml github.com/containers/storage/pkg/system github.com/containers/storage/pkg/ioutils github.com/containers/storage/pkg/idtools github.com/containers/storage/pkg/pools github.com/opencontainers/runc/libcontainer/system github.com/pquerna/ffjson/fflib/v1 github.com/containers/image/pkg/sysregistries flag github.com/containers/storage/pkg/archive github.com/containers/storage/pkg/reexec github.com/syndtr/gocapability/capability github.com/vbatts/tar-split/tar/storage github.com/containers/storage/pkg/directory github.com/containers/storage/pkg/locker github.com/docker/docker/api/types/swarm/runtime github.com/containers/storage/pkg/parsers github.com/containers/storage/pkg/devicemapper github.com/docker/docker/api/types/swarm github.com/docker/docker/api/types github.com/docker/docker/api/types/volume github.com/containers/storage/pkg/dmesg github.com/containers/storage/pkg/loopback github.com/containers/storage/pkg/chrootarchive github.com/containers/storage/drivers github.com/containers/storage/pkg/parsers/kernel github.com/containers/storage/drivers/quota github.com/docker/go-connections/sockets github.com/docker/distribution/registry/api/errcode github.com/containers/image/pkg/tlsclientconfig github.com/gorilla/context github.com/docker/distribution/registry/client/auth/challenge github.com/gorilla/mux github.com/docker/distribution/registry/client/transport golang.org/x/net/context/ctxhttp net/http/httputil github.com/docker/distribution/registry/api/v2 github.com/docker/distribution/context github.com/docker/docker/client github.com/containers/image/oci/layout github.com/docker/distribution github.com/containers/image/oci/archive github.com/docker/distribution/registry/storage/cache github.com/containers/storage/drivers/aufs github.com/docker/distribution/registry/storage/cache/memory github.com/containers/storage/drivers/btrfs github.com/docker/distribution/registry/client github.com/containers/storage/drivers/devmapper github.com/containers/image/docker github.com/containers/image/docker/daemon github.com/containers/storage/drivers/overlayutils github.com/containers/storage/pkg/fsutils github.com/containers/storage/drivers/overlay github.com/containers/storage/drivers/copy github.com/mistifyio/go-zfs github.com/containers/storage/pkg/stringid github.com/containers/storage/pkg/stringutils github.com/tchap/go-patricia/patricia github.com/containers/storage/drivers/zfs github.com/containers/storage/pkg/truncindex github.com/vbatts/tar-split/archive/tar github.com/containers/storage/drivers/vfs github.com/containers/image/tarball github.com/containers/storage/drivers/register github.com/vbatts/tar-split/tar/asm github.com/containers/storage github.com/containers/image/storage github.com/containers/image/transports/alltransports make[1]: Leaving directory '/debian-packages/golang-github-containers-image' debian/rules override_dh_auto_test make[1]: Entering directory '/debian-packages/golang-github-containers-image' # TODO: investiate failures make[1]: Leaving directory '/debian-packages/golang-github-containers-image' create-stamp debian/debhelper-build-stamp 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 dh_installdocs -O--buildsystem=golang dh_installchangelogs -O--buildsystem=golang dh_installinit -O--buildsystem=golang dh_perl -O--buildsystem=golang dh_link -O--buildsystem=golang dh_strip_nondeterminism -O--buildsystem=golang dh_compress -O--buildsystem=golang dh_fixperms -O--buildsystem=golang dh_missing -O--buildsystem=golang dh_installdeb -O--buildsystem=golang dh_golang -O--buildsystem=golang can't load package: package github.com/containers/image/ostree: obj-x86_64-linux-gnu/src/github.com/containers/image/ostree/ostree_src.go:1:1: expected 'package', found 'EOF' can't load package: package github.com/containers/image/ostree: obj-x86_64-linux-gnu/src/github.com/containers/image/ostree/ostree_src.go:1:1: expected 'package', found 'EOF' dh_golang: go list -f '\ {{ .Dir }}/{{ index (or .GoFiles .CgoFiles .TestGoFiles .XTestGoFiles .IgnoredGoFiles) 0 }}' returned exit code 1 make: *** [debian/rules:8: binary] Error 1 dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2