Add bindep support
Adds make targets bindep and .bindep (install bindep into a venv) Change-Id: Ie497d917e9149e56d8a1ed2570896b8b812da283
This commit is contained in:
parent
d38d3def62
commit
9b52de086d
37
Makefile
37
Makefile
@ -7,19 +7,24 @@
|
|||||||
GIT_HOST = git.openstack.org
|
GIT_HOST = git.openstack.org
|
||||||
|
|
||||||
PWD := $(shell pwd)
|
PWD := $(shell pwd)
|
||||||
TOP_DIR := $(shell basename $(PWD))
|
BASE_DIR := $(shell basename $(PWD))
|
||||||
export GOPATH := $(PWD)-gopath
|
# Keep an existing GOPATH, make a private one if it is undefined
|
||||||
DEST := $(GOPATH)/src/$(GIT_HOST)/openstack/$(TOP_DIR).git
|
GOPATH_DEFAULT := $(PWD)/.go
|
||||||
|
export GOPATH ?= $(GOPATH_DEFAULT)
|
||||||
|
DEST := $(GOPATH)/src/$(GIT_HOST)/openstack/$(BASE_DIR).git
|
||||||
|
|
||||||
env:
|
env:
|
||||||
@echo "PWD: $(PWD)"
|
@echo "PWD: $(PWD)"
|
||||||
@echo "TOP_DIR: $(TOP_DIR)"
|
@echo "BASE_DIR: $(BASE_DIR)"
|
||||||
@echo "GOPATH: $(GOPATH)"
|
@echo "GOPATH: $(GOPATH)"
|
||||||
@echo "DEST: $(DEST)"
|
@echo "DEST: $(DEST)"
|
||||||
|
|
||||||
work: $(GOPATH)
|
work: $(GOPATH) $(DEST)
|
||||||
|
|
||||||
$(GOPATH):
|
$(GOPATH):
|
||||||
|
mkdir -p $(GOPATH)
|
||||||
|
|
||||||
|
$(DEST): $(GOPATH)
|
||||||
mkdir -p $(shell dirname $(DEST))
|
mkdir -p $(shell dirname $(DEST))
|
||||||
ln -s $(PWD) $(DEST)
|
ln -s $(PWD) $(DEST)
|
||||||
|
|
||||||
@ -29,8 +34,8 @@ get: work
|
|||||||
test: get
|
test: get
|
||||||
cd $(DEST); go test -tags=unit ./...
|
cd $(DEST); go test -tags=unit ./...
|
||||||
|
|
||||||
fmt:
|
fmt: work
|
||||||
cd $(DEST); go fmt ./...
|
cd $(DEST) && go fmt ./...
|
||||||
|
|
||||||
cover:
|
cover:
|
||||||
@echo "$@ not yet implemented"
|
@echo "$@ not yet implemented"
|
||||||
@ -43,3 +48,21 @@ relnotes:
|
|||||||
|
|
||||||
translation:
|
translation:
|
||||||
@echo "$@ not yet implemented"
|
@echo "$@ not yet implemented"
|
||||||
|
|
||||||
|
.bindep:
|
||||||
|
virtualenv .bindep
|
||||||
|
.bindep/bin/pip install bindep
|
||||||
|
|
||||||
|
bindep: .bindep
|
||||||
|
@.bindep/bin/bindep -b -f bindep.txt || true
|
||||||
|
|
||||||
|
install-distro-packages:
|
||||||
|
tools/install-distro-packages.sh
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf .bindep
|
||||||
|
if [ "$(GOPATH)" = "$(GOPATH_DEFAULT)" ]; then \
|
||||||
|
rm -rf $(GOPATH); \
|
||||||
|
fi
|
||||||
|
|
||||||
|
.PHONY: bindep clean
|
||||||
|
5
bindep.txt
Normal file
5
bindep.txt
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
pkg-config
|
||||||
|
build-essential
|
||||||
|
golang-go
|
||||||
|
golint
|
||||||
|
make
|
24
tools/install-distro-packages.sh
Executable file
24
tools/install-distro-packages.sh
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash -xe
|
||||||
|
|
||||||
|
# Local version to install bindep packages
|
||||||
|
# Suitable for use for development
|
||||||
|
|
||||||
|
function is_fedora {
|
||||||
|
[ -f /usr/bin/yum ] && cat /etc/*release | grep -q -e "Fedora"
|
||||||
|
}
|
||||||
|
|
||||||
|
PACKAGES=$(make bindep || true)
|
||||||
|
|
||||||
|
# inspired from project-config install-distro-packages.sh
|
||||||
|
if apt-get -v >/dev/null 2>&1 ; then
|
||||||
|
sudo apt-get -qq update
|
||||||
|
sudo PATH=/usr/sbin:/sbin:$PATH DEBIAN_FRONTEND=noninteractive \
|
||||||
|
apt-get -q --option "Dpkg::Options::=--force-confold" \
|
||||||
|
--assume-yes install $PACKAGES
|
||||||
|
elif emerge --version >/dev/null 2>&1 ; then
|
||||||
|
sudo emerge -uDNq --jobs=4 @world
|
||||||
|
sudo PATH=/usr/sbin:/sbin:$PATH emerge -q --jobs=4 $PACKAGES
|
||||||
|
else
|
||||||
|
is_fedora && YUM=dnf || YUM=yum
|
||||||
|
sudo PATH=/usr/sbin:/sbin:$PATH $YUM install -y $PACKAGES
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user