hashicorp / terraform

Terraform enables you to safely and predictably create, change, and improve infrastructure. It is a source-available tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.
https://www.terraform.io
Other
42.76k stars 9.56k forks source link

Building on Arch Linux #4735

Closed alfredopalhares closed 8 years ago

alfredopalhares commented 8 years ago

Hello,

I am updating an Arch Linux AUR package to terraform 0.6.9, but the the process is failing during make updatedeps

 mkdir -p "${srcdir}/src/${_gourl}"
 mv -f "${pkgname}" "${srcdir}/src/${_gourl}/${pkgname}"
 cd "${srcdir}/src/${_gourl}/${pkgname}"
  GOPATH="${srcdir}" make updatedeps

On the script $srcdir is a fresh clean directory for me to build the software one., the rest is pretty self explanatory.

During make updatedeps the proccess fails with a not very helpful message, here is the full output:

go get -u github.com/mitchellh/gox
go get -u golang.org/x/tools/cmd/stringer
go list ./... \
    | xargs go list -f '{{join .Deps "\n"}}' \
    | grep -v github.com/hashicorp/terraform \
    | grep -v '/internal/' \
    | sort -u \
    | xargs go get -f -u -v
github.com/apparentlymart/go-cidr (download)
github.com/apparentlymart/go-rundeck-api (download)
github.com/armon/circbuf (download)
github.com/armon/go-radix (download)
github.com/aws/aws-sdk-go (download)
github.com/go-ini/ini (download)
github.com/jmespath/go-jmespath (download)
github.com/Azure/azure-sdk-for-go (download)
package github.com/Azure/azure-sdk-for-go/arm/resources: no buildable Go source files in /home/masterkorp/Public/terraform/src/src/github.com/Azure/azure-sdk-for-go/arm/resources
github.com/bgentry/speakeasy (download)
github.com/coreos/etcd (download)
github.com/cyberdelia/heroku-go (download)
github.com/pborman/uuid (download)
github.com/digitalocean/godo (download)
github.com/google/go-querystring (download)
github.com/tent/http-link-go (download)
github.com/DreamItGetIT/statuscake (download)
github.com/dylanmei/iso8601 (download)
github.com/dylanmei/winrmtest (download)
github.com/masterzen/winrm (download)
github.com/masterzen/simplexml (download)
github.com/masterzen/xmlpath (download)
github.com/satori/go.uuid (download)
github.com/fsouza/go-dockerclient (download)
github.com/go-chef/chef (download)
github.com/hashicorp/atlas-go (download)
github.com/hashicorp/go-version (download)
github.com/hashicorp/go-cleanhttp (download)
github.com/hashicorp/consul (download)
github.com/hashicorp/serf (download)
github.com/hashicorp/errwrap (download)
github.com/hashicorp/go-checkpoint (download)
github.com/hashicorp/go-getter (download)
github.com/hashicorp/go-multierror (download)
github.com/hashicorp/go-retryablehttp (download)
github.com/hashicorp/hcl (download)
github.com/hashicorp/logutils (download)
github.com/hashicorp/yamux (download)
github.com/hmrc/vmware-govcd (download)
github.com/imdario/mergo (download)
github.com/kardianos/osext (download)
github.com/lib/pq (download)
github.com/lusis/go-artifactory (download)
github.com/nu7hatch/gouuid (download)
github.com/mattn/go-isatty (download)
github.com/mitchellh/cli (download)
github.com/mitchellh/colorstring (download)
github.com/mitchellh/copystructure (download)
github.com/mitchellh/reflectwalk (download)
github.com/mitchellh/go-homedir (download)
github.com/mitchellh/go-linereader (download)
github.com/mitchellh/mapstructure (download)
github.com/mitchellh/packer (download)
github.com/mitchellh/panicwrap (download)
github.com/mitchellh/prefixedio (download)
github.com/nesv/go-dynect (download)
github.com/packer-community/winrmcp (download)
github.com/packethost/packngo (download)
github.com/pearkes/cloudflare (download)
github.com/pearkes/dnsimple (download)
github.com/pearkes/mailgun (download)
github.com/rackspace/gophercloud (download)
github.com/soniah/dnsmadeeasy (download)
github.com/sthulb/mime (download)
github.com/vmware/govmomi (download)
golang.org/x/net (download)
github.com/xanzy/go-cloudstack (download)
github.com/xanzy/ssh-agent (download)
golang.org/x/crypto (download)
github.com/ziutek/mymysql (download)
golang.org/x/oauth2 (download)
google.golang.org/cloud (download)
google.golang.org/api (download)
Makefile:51: recipe for target 'updatedeps' failed
make: *** [updatedeps] Error 123

Currently using go 1.5.3 linux/amd64

Any suggestions would be welcome.

Regards,

jen20 commented 8 years ago

Hi @masterkorp! I can confirm that that package indeed has no go files in it. Could you paste the output of running this command in the root directory of your Terraform checkout?

go list ./... \
    | xargs go list -f '{{join .Deps "\n"}}' \
    | grep -v github.com/hashicorp/terraform \
    | grep -v '/internal/' \
    | sort -u

More interestingly, does it include github.com/Azure/azure-sdk-for-go/arm/resources? The output running on my box and on Travis shows github.com/Azure/azure-sdk-for-go/arm/resources/resources - which does have buildable go files.

jen20 commented 8 years ago

Ah, actually the issue might be that you're not building master - regrettably Microsoft reorganised the packages in the Azure/azure-sdk-for-go repo and nested them more deeply. The actual dependency versions as of the release of 0.6.9 are captured in the Godeps.json file here - you could restore the actual versions which went into that release using the Godeps tool if necessary.

Sorry there isn't a better answer here - sadly Go dependency management is a tale of woe for the most part. We have discussed internally switching over to vending dependencies, but they change upstream at a fairly breakneck speed so this would probably add a decent amount of overhead to development. @phinze, we could reopen that discussion at some point? I'll close this issue for now - if you need further assistance here please feel free to reopen it!

alfredopalhares commented 8 years ago

Thanks for your quick reply @jen20 but there are some things I do not understand.

How do I build terraform 0.6.9?

Can I checkout to 0.6.9 tag, then copy `deps/v0-6-9.json' toGodeps/Godeps.json, rungodep restoreand only then runmake updatedeps? Would that work?

grubernaut commented 8 years ago

@masterkorp does it need to be built from source? We host the binaries at https://releases.hashicorp.com, and would make for a much simpler PKGBUILD if you were to go the curl; mv route. The hosted binary is already natively compiled so you wouldn't be losing any performance gains by using the hosted binary.

I've been using the hosted binary while waiting for the AUR build to be updated, and has worked fine thus far :)

alfredopalhares commented 8 years ago

@grubernaut It does not really need to be, currently I am too using the precompiled binary.

But I would like to do things the right way, unless i have a very strong reason not to, and packages should fetch the source unless the source its not available or Its not possible to build from source.

grubernaut commented 8 years ago

@masterkorp Completely understand, as there's another package in the AUR, that simply moves the binary into place, terraform-bin. It looks like godep was able to solve your woes, however, as the PKGBUILD is now updated and no longer flagged.

For future reference, and documentation should anyone else encounter this issue (removing the Arch specific commands):

mkdir -p "${srcdir}/src/${_gourl}"
rm -rf "${srcdir}/src/${_gourl}/${pkgname}"
mv -f "${pkgname}" "${srcdir}/src/${_gourl}/${pkgname}"
cd "${srcdir}/src/${_gourl}/${pkgname}"
GOPATH="${srcdir}" go get -u github.com/mitchellh/gox
GOPATH="${srcdir}" go get -u golang.org/x/tools/cmd/stringer
mkdir Godeps
cp deps/v$(echo ${pkgver} | sed 's/\./-/g').json Godeps/Godeps.json
GOPATH="${srcdir}" godep get

GOPATH="${srcdir}" PATH="${srcdir}/bin:${PATH}" TF_DEV=1 TF_QUICKDEV=1 make bin
ghost commented 4 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.