From 21a29ab5aa7926a478ad9a031532059337af95f5 Mon Sep 17 00:00:00 2001 From: Kamila Souckova Date: Thu, 4 May 2017 17:29:07 +0200 Subject: [PATCH 1/6] add __go_get, __golang_from_vendor --- cdist/conf/explorer/kernel_name | 1 + .../conf/type/__go_get/explorer/go-executable | 3 +++ cdist/conf/type/__go_get/gencode-remote | 8 ++++++ cdist/conf/type/__go_get/manifest | 17 ++++++++++++ .../type/__golang_from_vendor/gencode-remote | 26 +++++++++++++++++++ cdist/conf/type/__golang_from_vendor/manifest | 1 + .../parameter/default/version | 1 + .../__golang_from_vendor/parameter/optional | 1 + .../conf/type/__golang_from_vendor/singleton | 0 9 files changed, 58 insertions(+) create mode 100644 cdist/conf/explorer/kernel_name create mode 100644 cdist/conf/type/__go_get/explorer/go-executable create mode 100644 cdist/conf/type/__go_get/gencode-remote create mode 100644 cdist/conf/type/__go_get/manifest create mode 100644 cdist/conf/type/__golang_from_vendor/gencode-remote create mode 100644 cdist/conf/type/__golang_from_vendor/manifest create mode 100644 cdist/conf/type/__golang_from_vendor/parameter/default/version create mode 100644 cdist/conf/type/__golang_from_vendor/parameter/optional create mode 100644 cdist/conf/type/__golang_from_vendor/singleton diff --git a/cdist/conf/explorer/kernel_name b/cdist/conf/explorer/kernel_name new file mode 100644 index 00000000..98ebac2a --- /dev/null +++ b/cdist/conf/explorer/kernel_name @@ -0,0 +1 @@ +uname -s diff --git a/cdist/conf/type/__go_get/explorer/go-executable b/cdist/conf/type/__go_get/explorer/go-executable new file mode 100644 index 00000000..4c84ce07 --- /dev/null +++ b/cdist/conf/type/__go_get/explorer/go-executable @@ -0,0 +1,3 @@ +[ -f /etc/environment ] && . /etc/environment +[ -f /etc/profile ] && . /etc/profile +go version 2>/dev/null || true diff --git a/cdist/conf/type/__go_get/gencode-remote b/cdist/conf/type/__go_get/gencode-remote new file mode 100644 index 00000000..5f1d3aae --- /dev/null +++ b/cdist/conf/type/__go_get/gencode-remote @@ -0,0 +1,8 @@ +package=$__object_id + +cat<&2 && exit 1 + +os=$(cat "$__global/explorer/os") +case $os in + debian|devuan|ubuntu) + __package build-essential + ;; + *) + echo "__go_get: Don't know how to install g++ on $os" >&2 + echo "__go_get: Send a pull request or contact to add support for $os." >&2 + exit 1 + ;; +esac + diff --git a/cdist/conf/type/__golang_from_vendor/gencode-remote b/cdist/conf/type/__golang_from_vendor/gencode-remote new file mode 100644 index 00000000..e372bf61 --- /dev/null +++ b/cdist/conf/type/__golang_from_vendor/gencode-remote @@ -0,0 +1,26 @@ +#!/bin/sh + +version=$(cat "$__object/parameter/version") + +kernel_name=$(cat "$__global/explorer/kernel_name" | tr '[:upper:]' '[:lower:]') +machine=$(cat "$__global/explorer/machine") +case $machine in + x86_64|amd64) + arch=amd64 + ;; + x86) + arch=386 + ;; + *) + arch=$machine # at least try... + ;; +esac + +PACKAGE="go${version}.${kernel_name}-${arch}" +URL="https://storage.googleapis.com/golang/${PACKAGE}.tar.gz" +cat </dev/null)" = "xgo$version" ] && exit 0 # already there +wget --no-verbose "$URL" -O "/tmp/${PACKAGE}.tar.gz" +rm -rf /usr/local/go +tar -C /usr/local -xzf /tmp/${PACKAGE}.tar.gz +EOF diff --git a/cdist/conf/type/__golang_from_vendor/manifest b/cdist/conf/type/__golang_from_vendor/manifest new file mode 100644 index 00000000..9d320830 --- /dev/null +++ b/cdist/conf/type/__golang_from_vendor/manifest @@ -0,0 +1 @@ +__line go_in_path --line 'export PATH=/usr/local/go/bin:$PATH' --file /etc/profile diff --git a/cdist/conf/type/__golang_from_vendor/parameter/default/version b/cdist/conf/type/__golang_from_vendor/parameter/default/version new file mode 100644 index 00000000..a8fdfda1 --- /dev/null +++ b/cdist/conf/type/__golang_from_vendor/parameter/default/version @@ -0,0 +1 @@ +1.8.1 diff --git a/cdist/conf/type/__golang_from_vendor/parameter/optional b/cdist/conf/type/__golang_from_vendor/parameter/optional new file mode 100644 index 00000000..088eda41 --- /dev/null +++ b/cdist/conf/type/__golang_from_vendor/parameter/optional @@ -0,0 +1 @@ +version diff --git a/cdist/conf/type/__golang_from_vendor/singleton b/cdist/conf/type/__golang_from_vendor/singleton new file mode 100644 index 00000000..e69de29b From 8d4fd9e7d81acfc2feee0f65cca3095185d73aa7 Mon Sep 17 00:00:00 2001 From: Kamila Souckova Date: Thu, 4 May 2017 17:43:03 +0200 Subject: [PATCH 2/6] add __go_get, __golang_from_vendor manpages --- cdist/conf/type/__go_get/man.rst | 48 ++++++++++++++++++++ cdist/conf/type/__golang_from_vendor/man.rst | 48 ++++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 cdist/conf/type/__go_get/man.rst create mode 100644 cdist/conf/type/__golang_from_vendor/man.rst diff --git a/cdist/conf/type/__go_get/man.rst b/cdist/conf/type/__go_get/man.rst new file mode 100644 index 00000000..66d9bdba --- /dev/null +++ b/cdist/conf/type/__go_get/man.rst @@ -0,0 +1,48 @@ +cdist-type__go_get(7) +===================== + +NAME +---- +cdist-type__go_get - Install go packages with go get + + +DESCRIPTION +----------- +This cdist type allows you to install golang packages with go get. +A sufficiently recent version of go must be present on the system. + +The object ID is the go package to be installed. + + +REQUIRED PARAMETERS +------------------- +None. + + +OPTIONAL PARAMETERS +------------------- +None. + + +EXAMPLES +-------- + +.. code-block:: sh + + __go_get github.com/prometheus/prometheus/cmd/... + + # usually you'd need to require golang from somewhere: + require="__golang_from_vendor" __go_get github.com/prometheus/prometheus/cmd/... + + +AUTHORS +------- +Kamila Součková + + +COPYING +------- +Copyright \(C) 2017 Kamila Součková. You can redistribute it +and/or modify it under the terms of the GNU General Public License as +published by the Free Software Foundation, either version 3 of the +License, or (at your option) any later version. diff --git a/cdist/conf/type/__golang_from_vendor/man.rst b/cdist/conf/type/__golang_from_vendor/man.rst new file mode 100644 index 00000000..070710c1 --- /dev/null +++ b/cdist/conf/type/__golang_from_vendor/man.rst @@ -0,0 +1,48 @@ +cdist-type__golang_from_vendor(7) +===================== + +NAME +---- +cdist-type__golang_from_vendor - Install any version of golang from golang.org + + +DESCRIPTION +----------- +This cdist type allows you to install golang from archives provided by https://golang.org/dl/. + +See https://golang.org/dl/ for the list of supported versions, operating systems and architectures. + +This is a singleton type. + + +REQUIRED PARAMETERS +------------------- +None. + + +OPTIONAL PARAMETERS +------------------- +version + The golang version to install, defaults to 1.8.1 + + +EXAMPLES +-------- + +.. code-block:: sh + + __golang_from_vendor --version 1.8.1 + + + +AUTHORS +------- +Kamila Součková + + +COPYING +------- +Copyright \(C) 2017 Kamila Součková. You can redistribute it +and/or modify it under the terms of the GNU General Public License as +published by the Free Software Foundation, either version 3 of the +License, or (at your option) any later version. From d1fae4a75e84cdf043d0995609438b99ad950227 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamila=20Sou=C4=8Dkov=C3=A1?= Date: Fri, 5 May 2017 14:57:18 +0200 Subject: [PATCH 3/6] Update changelog --- docs/changelog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/changelog b/docs/changelog index b61f818b..89c0c9b1 100644 --- a/docs/changelog +++ b/docs/changelog @@ -1,6 +1,10 @@ Changelog --------- +next: + * Type __golang_from_vendor: Install golang from https://golang.org/dl/ (Kamila Součková) + * Type __go_get: Install go packages using go get (Kamila Součková) + 4.4.2: 2017-03-08 * Core: Fix suppression of manifests' outputs (Darko Poljak) * Type __user_groups: Support FreeBSD (Andres Erbsen) From 0aec30907760099fa9a029cb67f9e25c68485695 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamila=20Sou=C4=8Dkov=C3=A1?= Date: Fri, 5 May 2017 14:58:00 +0200 Subject: [PATCH 4/6] Update changelog --- docs/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog b/docs/changelog index 89c0c9b1..4ef58429 100644 --- a/docs/changelog +++ b/docs/changelog @@ -4,6 +4,7 @@ Changelog next: * Type __golang_from_vendor: Install golang from https://golang.org/dl/ (Kamila Součková) * Type __go_get: Install go packages using go get (Kamila Součková) + * Explorer kernel_name: uname -s 4.4.2: 2017-03-08 * Core: Fix suppression of manifests' outputs (Darko Poljak) From 3e83ee82c9d2efbbcda64c3ae58470bdfa85f89b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamila=20Sou=C4=8Dkov=C3=A1?= Date: Fri, 5 May 2017 14:58:27 +0200 Subject: [PATCH 5/6] Update changelog --- docs/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog b/docs/changelog index 4ef58429..292472c9 100644 --- a/docs/changelog +++ b/docs/changelog @@ -4,7 +4,7 @@ Changelog next: * Type __golang_from_vendor: Install golang from https://golang.org/dl/ (Kamila Součková) * Type __go_get: Install go packages using go get (Kamila Součková) - * Explorer kernel_name: uname -s + * Explorer kernel_name: uname -s (Kamila Součková) 4.4.2: 2017-03-08 * Core: Fix suppression of manifests' outputs (Darko Poljak) From abd5f11b989d304946570ec3758d8b7800a903bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamila=20Sou=C4=8Dkov=C3=A1?= Date: Fri, 5 May 2017 15:29:48 +0200 Subject: [PATCH 6/6] man.rst: fix underline --- cdist/conf/type/__golang_from_vendor/man.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cdist/conf/type/__golang_from_vendor/man.rst b/cdist/conf/type/__golang_from_vendor/man.rst index 070710c1..2b4f065e 100644 --- a/cdist/conf/type/__golang_from_vendor/man.rst +++ b/cdist/conf/type/__golang_from_vendor/man.rst @@ -1,5 +1,5 @@ cdist-type__golang_from_vendor(7) -===================== +================================= NAME ----