Skip to content

Commit

Permalink
fix(source_hash): remove unused 'source_hash' consant
Browse files Browse the repository at this point in the history
  • Loading branch information
noelmcloughlin committed Jun 16, 2019
1 parent 6feafa9 commit a12c5f7
Show file tree
Hide file tree
Showing 10 changed files with 98 additions and 87 deletions.
9 changes: 4 additions & 5 deletions golang/config/alternatives/clean.sls
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,20 @@
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import golang with context %}
{%- set sls_archive_clean = tplroot ~ '.archive.clean' %}
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
{%- set sls_package_clean = tplroot ~ '.package.clean' %}
{%- if grains.kernel|lower == 'linux' and golang.linux.altpriority|int > 0 %}
include:
- {{ sls_archive_clean }}
- {{ sls_archive_clean if golang.pkg.use_upstream_archive else sls_package_clean }}
golang-package-archive-remove-home-alternative-remove:
alternatives.remove:
- name: golang-home
- path: {{ golang.base_dir }}/go
- onlyif: update-alternatives --get-selections |grep ^golang-home
- require:
- sls: {{ sls_archive_clean }}
- sls: {{ sls_archive_clean if golang.pkg.use_upstream_archive else sls_package_clean }}
{% for i in ['go', 'godoc', 'gofmt'] %}
Expand All @@ -29,7 +28,7 @@ golang-package-archive-remove-{{ i }}-alternative-remove:
- path: {{ golang.base_dir }}/go/bin/{{ i }}
- onlyif: update-alternatives --get-selections |grep ^link-{{ i }}
- require:
- sls: {{ sls_archive_clean }}
- sls: {{ sls_archive_clean if golang.pkg.use_upstream_archive else sls_package_clean }}
{% endfor %}
{%- endif %}
67 changes: 1 addition & 66 deletions golang/config/alternatives/init.sls
Original file line number Diff line number Diff line change
@@ -1,70 +1,5 @@
# -*- coding: utf-8 -*-
# vim: ft=sls

{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import golang with context %}
{%- set sls_archive_install = tplroot ~ '.archive.install' %}
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
{%- if grains.kernel|lower == 'linux' and golang.linux.altpriority|int > 0 %}
include:
- {{ sls_archive_install }}
golang-package-archive-install-home-alternative-install:
cmd.run:
- name: update-alternatives --install {{ golang.go_root }} golang-home {{ golang.base_dir }}/go {{ golang.linux.altpriority }}
- watch:
- archive: golang-package-archive-install-archive-extracted
- require:
- sls: {{ sls_archive_install }}
- onlyif: {{ grains.os_family in ('Suse',) }}
alternatives.install:
- name: golang-home
- link: {{ golang.go_root }}
- path: {{ golang.base_dir }}/go
- priority: {{ golang.linux.altpriority }}
- order: 10
- watch:
- archive: golang-package-archive-install-archive-extracted
- unless: {{ grains.os_family in ('Suse',) }}
- require:
- sls: {{ sls_archive_install }}
golang-package-archive-install-home-alternative-set:
alternatives.set:
- name: golang-home
- path: {{ golang.base_dir }}/go
- require:
- alternatives: golang-package-archive-install-home-alternative-install
- unless: {{ grains.os_family in ('Suse',) }}
{% for i in ['go', 'godoc', 'gofmt'] %}
golang-package-archive-install-{{ i }}-alternative-install:
cmd.run:
- name: update-alternatives --install /usr/bin/{{i}} link-{{i}} {{ golang.base_dir }}/go/bin/{{i}} {{golang.linux.altpriority}}
- require:
- cmd: golang-package-archive-install-home-alternative-install
- onlyif: {{ grains.os_family in ('Suse',) }}
alternatives.install:
- name: link-{{ i }}
- link: /usr/bin/{{ i }}
- path: {{ golang.base_dir }}/go/bin/{{ i }}
- priority: {{ golang.linux.altpriority }}
- order: 10
- require:
- alternatives: golang-package-archive-install-home-alternative-install
- unless: {{ grains.os_family in ('Suse',) }}
golang-package-archive-install-{{ i }}-alternative-set:
alternatives.set:
- name: link-{{ i }}
- path: {{ golang.base_dir }}/go/bin/{{ i }}
- require:
- alternatives: golang-package-archive-install-{{ i }}-alternative-install
- unless: {{ grains.os_family in ('Suse',) }}
{% endfor %}
{%- endif %}
- .install
70 changes: 70 additions & 0 deletions golang/config/alternatives/install.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# -*- coding: utf-8 -*-
# vim: ft=sls

{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import golang with context %}
{%- set sls_archive_install = tplroot ~ '.archive.install' %}
{%- set sls_package_install = tplroot ~ '.package.install' %}
{%- if grains.kernel|lower == 'linux' and golang.linux.altpriority|int > 0 %}
include:
- {{ sls_archive_install if golang.pkg.use_upstream_archive else sls_package_install }}
golang-package-archive-install-home-alternative-install:
cmd.run:
- name: update-alternatives --install {{ golang.dir }} golang-home {{ golang.base_dir }}/go {{ golang.linux.altpriority }}
- watch:
- archive: golang-package-archive-install-archive-extracted
- require:
- sls: {{ sls_archive_install if golang.pkg.use_upstream_archive else sls_package_install }}
- onlyif: {{ grains.os_family in ('Suse',) }}
alternatives.install:
- name: golang-home
- link: {{ golang.dir }}
- path: {{ golang.base_dir }}/go
- priority: {{ golang.linux.altpriority }}
- order: 10
- watch:
- archive: golang-package-archive-install-archive-extracted
- unless: {{ grains.os_family in ('Suse',) }}
- require:
- sls: {{ sls_archive_install if golang.pkg.use_upstream_archive else sls_package_install }}
golang-package-archive-install-home-alternative-set:
alternatives.set:
- name: golang-home
- path: {{ golang.base_dir }}/go
- require:
- alternatives: golang-package-archive-install-home-alternative-install
- unless: {{ grains.os_family in ('Suse',) }}
{% for i in ['go', 'godoc', 'gofmt'] %}
golang-package-archive-install-{{ i }}-alternative-install:
cmd.run:
- name: update-alternatives --install /usr/bin/{{i}} link-{{i}} {{ golang.base_dir }}/go/bin/{{i}} {{golang.linux.altpriority}}
- require:
- cmd: golang-package-archive-install-home-alternative-install
- onlyif: {{ grains.os_family in ('Suse',) }}
alternatives.install:
- name: link-{{ i }}
- link: /usr/bin/{{ i }}
- path: {{ golang.base_dir }}/go/bin/{{ i }}
- priority: {{ golang.linux.altpriority }}
- order: 10
- require:
- alternatives: golang-package-archive-install-home-alternative-install
- unless: {{ grains.os_family in ('Suse',) }}
golang-package-archive-install-{{ i }}-alternative-set:
alternatives.set:
- name: link-{{ i }}
- path: {{ golang.base_dir }}/go/bin/{{ i }}
- require:
- alternatives: golang-package-archive-install-{{ i }}-alternative-install
- unless: {{ grains.os_family in ('Suse',) }}
{% endfor %}
{%- endif %}
14 changes: 12 additions & 2 deletions golang/config/clean.sls
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,22 @@
{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import golang with context %}
{%- set sls_archive_clean = tplroot ~ '.archive.clean' %}
{%- set sls_package_clean = tplroot ~ '.package.clean' %}
{%- set sls_alternatives_clean = tplroot ~ '.config.alternatives.clean' %}
{%- if grains.kernel|lower == 'linux' and golang.linux.altpriority|int > 0 %}
include:
- {{ tplroot ~ '.config.alternatives.clean' }}
- {{ sls_archive_clean if golang.pkg.use_upstream_archive else sls_package_clean }}
- {{ sls_alternatives_clean }}
golang-config-clean-file-absent:
file.absent:
- names:
- {{ golang.config }}
- {{ golang.environ_file }}
- require:
- sls: {{ sls_archive_clean if golang.pkg.use_upstream_archive else sls_package_clean }}
- sls: {{ sls_alternatives_clean }}
{%- endif %}
5 changes: 3 additions & 2 deletions golang/config/environ.sls
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- set sls_archive_install = tplroot ~ '.archive.install' %}
{%- set sls_package_install = tplroot ~ '.package.install' %}
{%- from tplroot ~ "/map.jinja" import golang with context %}
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
include:
- {{ sls_archive_install }}
- {{ sls_archive_install if golang.pkg.use_upstream_archive else sls_package_install }}
golang-config-file-managed-environ_file:
file.managed:
Expand All @@ -25,4 +26,4 @@ golang-config-file-managed-environ_file:
- context:
golang: {{ golang|json }}
- require:
- sls: {{ sls_archive_install }}
- sls: {{ sls_archive_install if golang.pkg.use_upstream_archive else sls_package_install }}
7 changes: 4 additions & 3 deletions golang/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# vim: ft=yaml
---
golang:
go_root: /usr/local/go
go_path: /usr/local/golang/packages
dir: /usr/local/go ## go_root
version: '1.10.1'
go_path: /usr/local/golang/packages
pkg:
name: go
use_upstream_repo: False
Expand All @@ -15,7 +15,8 @@ golang:
source: None
source_hash: None
trim_output: True {# works in 2018.3.2. onwards #}
archive_format: tar.gz
archive_suffix: tar.gz
archive_format: tar
enforce_toplevel: True
repo: {}

Expand Down
2 changes: 1 addition & 1 deletion golang/files/default/golang.sh.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Your changes may be overwritten.
########################################################################

export GOROOT={{ golang.go_root }}
export GOROOT={{ golang.dir }}
export GOPATH={{ golang.go_path }}
export GOBASE={{ golang.base_dir }}/go
export PATH=$PATH:$GOROOT/bin:$GOBASE/bin
Expand Down
6 changes: 3 additions & 3 deletions golang/map.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@
{%- set uri = golang.pkg.archive.uri + '/' + name %}
{%- do golang.pkg.archive.update({
'name': golang.pkg.archive.name + '/' + name,
'source': uri + '.' + golang.pkg.archive.archive_format,
'source_hash': uri + '.' + golang.pkg.archive.archive_format + '.sha256',
'archive_format': golang.pkg.archive.archive_format.split('.')[0]
'source': uri + '.' + golang.pkg.archive.archive_suffix,
'source_hash': uri + '.' + golang.pkg.archive.archive_suffix + '.sha256',
'archive_format': golang.pkg.archive.archive_format
}) %}
{%- do golang.update({'base_dir': golang.pkg.archive.name}) %}
{%- do golang.environ.append('export PATH=${PATH}:' + golang.pkg.archive.name) %}
Expand Down
3 changes: 0 additions & 3 deletions golang/osfamilymap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ FreeBSD:
pkg:
archive:
source: https://storage.googleapis.com/golang/go1.10.2.freebsd-386.tar.gz
source_hash: 62ac523c68a0d9b29df2ca1eb8057635

OpenBSD:
rootgroup: wheel
Expand All @@ -48,12 +47,10 @@ Windows:
archive:
name: 'C:\\Program Files\\'
source: https://storage.googleapis.com/golang/go1.10.1.linux-amd64.tar.gz
source_hash: ad5d557f69f8cb6a6a7773eb374a24c9

MacOS:
rootgroup: {{ macos_rootgroup | d('') }}
pkg:
archive:
source: https://storage.googleapis.com/golang/go1.10.2.darwin-amd64.tar.gz
source_hash: 5dfa18e856f90c406919e795bb3cb866

2 changes: 0 additions & 2 deletions pillar.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ golang:
winner: lookup
added_in_lookup: lookup_value

# Using package archive as an example to test golang formula itself.
# You should set these parameters to values that make sense.
pkg:
archive:
uri: https://storage.googleapis.com/golang
Expand Down

0 comments on commit a12c5f7

Please sign in to comment.