Packages: making unit-go architecture independent.

To support Go modules, the unit-go module should be platform independent.
All platform-dependent logic is moved to libunit, so the unit-dev package
should be installed before building unit-go.
This commit is contained in:
Max Romanov 2019-12-24 17:59:44 +03:00
parent 823f658c77
commit 3d712a7078
19 changed files with 17 additions and 457 deletions

View file

@ -22,8 +22,7 @@ include Makefile.php
include Makefile.python27
include Makefile.python37
include Makefile.python38
include Makefile.go112
include Makefile.go113
include Makefile.go
include Makefile.perl
include Makefile.ruby
include Makefile.jsc-common
@ -36,8 +35,7 @@ include Makefile.php
include Makefile.python27
include Makefile.python37
include Makefile.python38
include Makefile.go110
include Makefile.go111
include Makefile.go
include Makefile.perl
include Makefile.ruby
include Makefile.jsc-common
@ -50,8 +48,7 @@ include Makefile.php
include Makefile.python27
include Makefile.python36
include Makefile.python37
include Makefile.go19
include Makefile.go110
include Makefile.go
include Makefile.perl
include Makefile.ruby
include Makefile.jsc-common
@ -66,8 +63,7 @@ include Makefile.python27
include Makefile.python36
include Makefile.python37
include Makefile.python38
include Makefile.go19
include Makefile.go110
include Makefile.go
include Makefile.perl
include Makefile.ruby
include Makefile.jsc-common
@ -99,7 +95,7 @@ ifeq ($(CODENAME),buster)
include Makefile.php
include Makefile.python27
include Makefile.python37
include Makefile.go111
include Makefile.go
include Makefile.perl
include Makefile.ruby
include Makefile.jsc-common
@ -111,8 +107,7 @@ ifeq ($(CODENAME),stretch)
include Makefile.php
include Makefile.python27
include Makefile.python35
include Makefile.go17
include Makefile.go18
include Makefile.go
include Makefile.perl
include Makefile.ruby
include Makefile.jsc-common

View file

@ -8,7 +8,7 @@ MODULE_RELEASE_go= 1
MODULE_CONFARGS_go= go --go-path=/usr/share/gocode
MODULE_MAKEARGS_go= go
MODULE_INSTARGS_go= go-install
MODULE_INSTARGS_go= go-install-src
MODULE_SOURCES_go= unit.example-go-app \
unit.example-go-config
@ -17,7 +17,9 @@ BUILD_DEPENDS_go= golang
BUILD_DEPENDS+= $(BUILD_DEPENDS_go)
MODULE_BUILD_DEPENDS_go=,golang
MODULE_DEPENDS_go=,golang
MODULE_DEPENDS_go=,golang,unit-dev (= $(VERSION)-$(RELEASE)~$(CODENAME))
MODULE_NOARCH_go= true
define MODULE_PREINSTALL_go
mkdir -p debian/unit-go/usr/share/doc/unit-go/examples/go-app

View file

@ -1,48 +0,0 @@
MODULES+= go110
MODULE_SUFFIX_go110= go1.10
MODULE_SUMMARY_go110= Go 1.10 module for NGINX Unit
MODULE_VERSION_go110= $(VERSION)
MODULE_RELEASE_go110= 1
MODULE_CONFARGS_go110= go --go=/usr/lib/go-1.10/bin/go --go-path=/usr/share/gocode
MODULE_MAKEARGS_go110= /usr/lib/go-1.10/bin/go
MODULE_INSTARGS_go110= /usr/lib/go-1.10/bin/go-install
MODULE_SOURCES_go110= unit.example-go-app \
unit.example-go1.10-config
BUILD_DEPENDS_go110= golang-1.10
BUILD_DEPENDS+= $(BUILD_DEPENDS_go110)
MODULE_BUILD_DEPENDS_go110=,golang-1.10
MODULE_DEPENDS_go110=,golang-1.10
define MODULE_PREINSTALL_go110
mkdir -p debian/unit-go1.10/usr/share/doc/unit-go1.10/examples/go-app
install -m 644 -p debian/unit.example-go-app debian/unit-go1.10/usr/share/doc/unit-go1.10/examples/go-app/let-my-people.go
install -m 644 -p debian/unit.example-go1.10-config debian/unit-go1.10/usr/share/doc/unit-go1.10/examples/unit.config
endef
export MODULE_PREINSTALL_go110
define MODULE_POST_go110
cat <<BANNER
----------------------------------------------------------------------
The $(MODULE_SUMMARY_go110) has been installed.
To check out the sample app, run these commands:
GOPATH=/usr/share/gocode /usr/lib/go-1.10/bin/go build -o /tmp/go1.10-app /usr/share/doc/unit-$(MODULE_SUFFIX_go110)/examples/go-app/let-my-people.go
sudo service unit restart
cd /usr/share/doc/unit-$(MODULE_SUFFIX_go110)/examples
sudo curl -X PUT --data-binary @unit.config --unix-socket /var/run/control.unit.sock http://localhost/config
curl http://localhost:8500/
Online documentation is available at https://unit.nginx.org
----------------------------------------------------------------------
BANNER
endef
export MODULE_POST_go110

View file

@ -1,48 +0,0 @@
MODULES+= go111
MODULE_SUFFIX_go111= go1.11
MODULE_SUMMARY_go111= Go 1.11 module for NGINX Unit
MODULE_VERSION_go111= $(VERSION)
MODULE_RELEASE_go111= 1
MODULE_CONFARGS_go111= go --go=/usr/lib/go-1.11/bin/go --go-path=/usr/share/gocode
MODULE_MAKEARGS_go111= /usr/lib/go-1.11/bin/go
MODULE_INSTARGS_go111= /usr/lib/go-1.11/bin/go-install
MODULE_SOURCES_go111= unit.example-go-app \
unit.example-go1.11-config
BUILD_DEPENDS_go111= golang-1.11
BUILD_DEPENDS+= $(BUILD_DEPENDS_go111)
MODULE_BUILD_DEPENDS_go111=,golang-1.11
MODULE_DEPENDS_go111=,golang-1.11
define MODULE_PREINSTALL_go111
mkdir -p debian/unit-go1.11/usr/share/doc/unit-go1.11/examples/go-app
install -m 644 -p debian/unit.example-go-app debian/unit-go1.11/usr/share/doc/unit-go1.11/examples/go-app/let-my-people.go
install -m 644 -p debian/unit.example-go1.11-config debian/unit-go1.11/usr/share/doc/unit-go1.11/examples/unit.config
endef
export MODULE_PREINSTALL_go111
define MODULE_POST_go111
cat <<BANNER
----------------------------------------------------------------------
The $(MODULE_SUMMARY_go111) has been installed.
To check out the sample app, run these commands:
GOPATH=/usr/share/gocode /usr/lib/go-1.11/bin/go build -o /tmp/go1.11-app /usr/share/doc/unit-$(MODULE_SUFFIX_go111)/examples/go-app/let-my-people.go
sudo service unit restart
cd /usr/share/doc/unit-$(MODULE_SUFFIX_go111)/examples
sudo curl -X PUT --data-binary @unit.config --unix-socket /var/run/control.unit.sock http://localhost/config
curl http://localhost:8500/
Online documentation is available at https://unit.nginx.org
----------------------------------------------------------------------
BANNER
endef
export MODULE_POST_go111

View file

@ -1,48 +0,0 @@
MODULES+= go112
MODULE_SUFFIX_go112= go1.12
MODULE_SUMMARY_go112= Go 1.12 module for NGINX Unit
MODULE_VERSION_go112= $(VERSION)
MODULE_RELEASE_go112= 1
MODULE_CONFARGS_go112= go --go=/usr/lib/go-1.12/bin/go --go-path=/usr/share/gocode
MODULE_MAKEARGS_go112= /usr/lib/go-1.12/bin/go
MODULE_INSTARGS_go112= /usr/lib/go-1.12/bin/go-install
MODULE_SOURCES_go112= unit.example-go-app \
unit.example-go1.12-config
BUILD_DEPENDS_go112= golang-1.12
BUILD_DEPENDS+= $(BUILD_DEPENDS_go112)
MODULE_BUILD_DEPENDS_go112=,golang-1.12
MODULE_DEPENDS_go112=,golang-1.12
define MODULE_PREINSTALL_go112
mkdir -p debian/unit-go1.12/usr/share/doc/unit-go1.12/examples/go-app
install -m 644 -p debian/unit.example-go-app debian/unit-go1.12/usr/share/doc/unit-go1.12/examples/go-app/let-my-people.go
install -m 644 -p debian/unit.example-go1.12-config debian/unit-go1.12/usr/share/doc/unit-go1.12/examples/unit.config
endef
export MODULE_PREINSTALL_go112
define MODULE_POST_go112
cat <<BANNER
----------------------------------------------------------------------
The $(MODULE_SUMMARY_go112) has been installed.
To check out the sample app, run these commands:
GOPATH=/usr/share/gocode /usr/lib/go-1.12/bin/go build -o /tmp/go1.12-app /usr/share/doc/unit-$(MODULE_SUFFIX_go112)/examples/go-app/let-my-people.go
sudo service unit restart
cd /usr/share/doc/unit-$(MODULE_SUFFIX_go112)/examples
sudo curl -X PUT --data-binary @unit.config --unix-socket /var/run/control.unit.sock http://localhost/config
curl http://localhost:8500/
Online documentation is available at https://unit.nginx.org
----------------------------------------------------------------------
BANNER
endef
export MODULE_POST_go112

View file

@ -1,48 +0,0 @@
MODULES+= go113
MODULE_SUFFIX_go113= go1.13
MODULE_SUMMARY_go113= Go 1.13 module for NGINX Unit
MODULE_VERSION_go113= $(VERSION)
MODULE_RELEASE_go113= 1
MODULE_CONFARGS_go113= go --go=/usr/lib/go-1.13/bin/go --go-path=/usr/share/gocode
MODULE_MAKEARGS_go113= /usr/lib/go-1.13/bin/go
MODULE_INSTARGS_go113= /usr/lib/go-1.13/bin/go-install
MODULE_SOURCES_go113= unit.example-go-app \
unit.example-go1.13-config
BUILD_DEPENDS_go113= golang-1.13
BUILD_DEPENDS+= $(BUILD_DEPENDS_go113)
MODULE_BUILD_DEPENDS_go113=,golang-1.13
MODULE_DEPENDS_go113=,golang-1.13
define MODULE_PREINSTALL_go113
mkdir -p debian/unit-go1.13/usr/share/doc/unit-go1.13/examples/go-app
install -m 644 -p debian/unit.example-go-app debian/unit-go1.13/usr/share/doc/unit-go1.13/examples/go-app/let-my-people.go
install -m 644 -p debian/unit.example-go1.13-config debian/unit-go1.13/usr/share/doc/unit-go1.13/examples/unit.config
endef
export MODULE_PREINSTALL_go113
define MODULE_POST_go113
cat <<BANNER
----------------------------------------------------------------------
The $(MODULE_SUMMARY_go113) has been installed.
To check out the sample app, run these commands:
GOPATH=/usr/share/gocode /usr/lib/go-1.13/bin/go build -o /tmp/go1.13-app /usr/share/doc/unit-$(MODULE_SUFFIX_go113)/examples/go-app/let-my-people.go
sudo service unit restart
cd /usr/share/doc/unit-$(MODULE_SUFFIX_go113)/examples
sudo curl -X PUT --data-binary @unit.config --unix-socket /var/run/control.unit.sock http://localhost/config
curl http://localhost:8500/
Online documentation is available at https://unit.nginx.org
----------------------------------------------------------------------
BANNER
endef
export MODULE_POST_go113

View file

@ -1,48 +0,0 @@
MODULES+= go17
MODULE_SUFFIX_go17= go1.7
MODULE_SUMMARY_go17= Go 1.7 module for NGINX Unit
MODULE_VERSION_go17= $(VERSION)
MODULE_RELEASE_go17= 1
MODULE_CONFARGS_go17= go --go=/usr/lib/go-1.7/bin/go --go-path=/usr/share/gocode
MODULE_MAKEARGS_go17= /usr/lib/go-1.7/bin/go
MODULE_INSTARGS_go17= /usr/lib/go-1.7/bin/go-install
MODULE_SOURCES_go17= unit.example-go-app \
unit.example-go1.7-config
BUILD_DEPENDS_go17= golang-1.7
BUILD_DEPENDS+= $(BUILD_DEPENDS_go17)
MODULE_BUILD_DEPENDS_go17=,golang-1.7
MODULE_DEPENDS_go17=,golang-1.7
define MODULE_PREINSTALL_go17
mkdir -p debian/unit-go1.7/usr/share/doc/unit-go1.7/examples/go-app
install -m 644 -p debian/unit.example-go-app debian/unit-go1.7/usr/share/doc/unit-go1.7/examples/go-app/let-my-people.go
install -m 644 -p debian/unit.example-go1.7-config debian/unit-go1.7/usr/share/doc/unit-go1.7/examples/unit.config
endef
export MODULE_PREINSTALL_go17
define MODULE_POST_go17
cat <<BANNER
----------------------------------------------------------------------
The $(MODULE_SUMMARY_go17) has been installed.
To check out the sample app, run these commands:
GOPATH=/usr/share/gocode /usr/lib/go-1.7/bin/go build -o /tmp/go1.7-app /usr/share/doc/unit-$(MODULE_SUFFIX_go17)/examples/go-app/let-my-people.go
sudo service unit restart
cd /usr/share/doc/unit-$(MODULE_SUFFIX_go17)/examples
sudo curl -X PUT --data-binary @unit.config --unix-socket /var/run/control.unit.sock http://localhost/config
curl http://localhost:8500/
Online documentation is available at https://unit.nginx.org
----------------------------------------------------------------------
BANNER
endef
export MODULE_POST_go17

View file

@ -1,48 +0,0 @@
MODULES+= go18
MODULE_SUFFIX_go18= go1.8
MODULE_SUMMARY_go18= Go 1.8 module for NGINX Unit
MODULE_VERSION_go18= $(VERSION)
MODULE_RELEASE_go18= 1
MODULE_CONFARGS_go18= go --go=/usr/lib/go-1.8/bin/go --go-path=/usr/share/gocode
MODULE_MAKEARGS_go18= /usr/lib/go-1.8/bin/go
MODULE_INSTARGS_go18= /usr/lib/go-1.8/bin/go-install
MODULE_SOURCES_go18= unit.example-go-app \
unit.example-go1.8-config
BUILD_DEPENDS_go18= golang-1.8
BUILD_DEPENDS+= $(BUILD_DEPENDS_go18)
MODULE_BUILD_DEPENDS_go18=,golang-1.8
MODULE_DEPENDS_go18=,golang-1.8
define MODULE_PREINSTALL_go18
mkdir -p debian/unit-go1.8/usr/share/doc/unit-go1.8/examples/go-app
install -m 644 -p debian/unit.example-go-app debian/unit-go1.8/usr/share/doc/unit-go1.8/examples/go-app/let-my-people.go
install -m 644 -p debian/unit.example-go1.8-config debian/unit-go1.8/usr/share/doc/unit-go1.8/examples/unit.config
endef
export MODULE_PREINSTALL_go18
define MODULE_POST_go18
cat <<BANNER
----------------------------------------------------------------------
The $(MODULE_SUMMARY_go18) has been installed.
To check out the sample app, run these commands:
GOPATH=/usr/share/gocode /usr/lib/go-1.8/bin/go build -o /tmp/go1.8-app /usr/share/doc/unit-$(MODULE_SUFFIX_go18)/examples/go-app/let-my-people.go
sudo service unit restart
cd /usr/share/doc/unit-$(MODULE_SUFFIX_go18)/examples
sudo curl -X PUT --data-binary @unit.config --unix-socket /var/run/control.unit.sock http://localhost/config
curl http://localhost:8500/
Online documentation is available at https://unit.nginx.org
----------------------------------------------------------------------
BANNER
endef
export MODULE_POST_go18

View file

@ -1,48 +0,0 @@
MODULES+= go19
MODULE_SUFFIX_go19= go1.9
MODULE_SUMMARY_go19= Go 1.9 module for NGINX Unit
MODULE_VERSION_go19= $(VERSION)
MODULE_RELEASE_go19= 1
MODULE_CONFARGS_go19= go --go=/usr/lib/go-1.9/bin/go --go-path=/usr/share/gocode
MODULE_MAKEARGS_go19= /usr/lib/go-1.9/bin/go
MODULE_INSTARGS_go19= /usr/lib/go-1.9/bin/go-install
MODULE_SOURCES_go19= unit.example-go-app \
unit.example-go1.9-config
BUILD_DEPENDS_go19= golang-1.9
BUILD_DEPENDS+= $(BUILD_DEPENDS_go19)
MODULE_BUILD_DEPENDS_go19=,golang-1.9
MODULE_DEPENDS_go19=,golang-1.9
define MODULE_PREINSTALL_go19
mkdir -p debian/unit-go1.9/usr/share/doc/unit-go1.9/examples/go-app
install -m 644 -p debian/unit.example-go-app debian/unit-go1.9/usr/share/doc/unit-go1.9/examples/go-app/let-my-people.go
install -m 644 -p debian/unit.example-go1.9-config debian/unit-go1.9/usr/share/doc/unit-go1.9/examples/unit.config
endef
export MODULE_PREINSTALL_go19
define MODULE_POST_go19
cat <<BANNER
----------------------------------------------------------------------
The $(MODULE_SUMMARY_go19) has been installed.
To check out the sample app, run these commands:
GOPATH=/usr/share/gocode /usr/lib/go-1.9/bin/go build -o /tmp/go1.9-app /usr/share/doc/unit-$(MODULE_SUFFIX_go19)/examples/go-app/let-my-people.go
sudo service unit restart
cd /usr/share/doc/unit-$(MODULE_SUFFIX_go19)/examples
sudo curl -X PUT --data-binary @unit.config --unix-socket /var/run/control.unit.sock http://localhost/config
curl http://localhost:8500/
Online documentation is available at https://unit.nginx.org
----------------------------------------------------------------------
BANNER
endef
export MODULE_POST_go19

View file

@ -1,15 +0,0 @@
{
"applications": {
"example_go": {
"type": "external",
"user": "nobody",
"executable": "/tmp/go1.10-app"
}
},
"listeners": {
"*:8500": {
"pass": "applications/example_go"
}
}
}

View file

@ -1,15 +0,0 @@
{
"applications": {
"example_go": {
"type": "external",
"user": "nobody",
"executable": "/tmp/go1.11-app"
}
},
"listeners": {
"*:8500": {
"pass": "applications/example_go"
}
}
}

View file

@ -1,15 +0,0 @@
{
"applications": {
"example_go": {
"type": "external",
"user": "nobody",
"executable": "/tmp/go1.12-app"
}
},
"listeners": {
"*:8500": {
"pass": "applications/example_go"
}
}
}

View file

@ -1,15 +0,0 @@
{
"applications": {
"example_go": {
"type": "external",
"user": "nobody",
"executable": "/tmp/go1.13-app"
}
},
"listeners": {
"*:8500": {
"pass": "applications/example_go"
}
}
}

View file

@ -1,15 +0,0 @@
{
"applications": {
"example_go": {
"type": "external",
"user": "nobody",
"executable": "/tmp/go1.7-app"
}
},
"listeners": {
"*:8500": {
"pass": "applications/example_go"
}
}
}

View file

@ -1,15 +0,0 @@
{
"applications": {
"example_go": {
"type": "external",
"user": "nobody",
"executable": "/tmp/go1.8-app"
}
},
"listeners": {
"*:8500": {
"pass": "applications/example_go"
}
}
}

View file

@ -1,15 +0,0 @@
{
"applications": {
"example_go": {
"type": "external",
"user": "nobody",
"executable": "/tmp/go1.9-app"
}
},
"listeners": {
"*:8500": {
"pass": "applications/example_go"
}
}
}

View file

@ -22,7 +22,7 @@ RUN set -x \
test -z "$found" && echo >&2 "error: failed to fetch GPG key $NGINX_GPGKEY" && exit 1; \
apt-get remove --purge --auto-remove -y gnupg1 && rm -rf /var/lib/apt/lists/* \
&& dpkgArch="$(dpkg --print-architecture)" \
&& unitPackages="unit=${UNIT_VERSION} unit-go1.11=${UNIT_VERSION} gcc" \
&& unitPackages="unit=${UNIT_VERSION} unit-go=${UNIT_VERSION} gcc" \
&& case "$dpkgArch" in \
amd64|i386) \
# arches officialy built by upstream

View file

@ -19,7 +19,7 @@ MODULE_python2.7="unit=$${UNIT_VERSION} unit-python2.7=$${UNIT_VERSION}"
MODULE_python3.7="unit=$${UNIT_VERSION} unit-python3.7=$${UNIT_VERSION}"
MODULE_go1.11-dev="unit=$${UNIT_VERSION} unit-go1.11=$${UNIT_VERSION} gcc"
MODULE_go1.11-dev="unit=$${UNIT_VERSION} unit-go=$${UNIT_VERSION} gcc"
MODULE_perl5.28="unit=$${UNIT_VERSION} unit-perl=$${UNIT_VERSION}"

View file

@ -8,7 +8,7 @@ MODULE_RELEASE_go= 1
MODULE_CONFARGS_go= go --go-path=%{gopath}
MODULE_MAKEARGS_go= go
MODULE_INSTARGS_go= go-install
MODULE_INSTARGS_go= go-install-src
MODULE_SOURCES_go= unit.example-go-app \
unit.example-go-config
@ -25,11 +25,15 @@ BUILD_DEPENDS+= $(BUILD_DEPENDS_go)
ifneq (,$(findstring $(OSVER),opensuse-leap opensuse-tumbleweed))
define MODULE_DEFINITIONS_go
BuildArch: noarch
Requires: unit-devel == $(VERSION)-$(RELEASE)%{?dist}.ngx
BuildRequires: $(BUILD_DEPENDS_go)
%define gopath /usr/share/go/contrib
endef
else
define MODULE_DEFINITIONS_go
BuildArch: noarch
Requires: unit-devel == $(VERSION)-$(RELEASE)%{?dist}.ngx
BuildRequires: $(BUILD_DEPENDS_go)
endef
endif