Skip to content

Commit

Permalink
Merge pull request #22556 from cyverse/gocommands
Browse files Browse the repository at this point in the history
Adding gocommands package
  • Loading branch information
xhochy committed Feb 7, 2024
2 parents 8ade71c + 175bdbe commit e16f3ee
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 0 deletions.
37 changes: 37 additions & 0 deletions recipes/gocommands/bld.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
@echo off

set PKG=github.com/cyverse/gocommands
set VERSION=v%PKG_VERSION%

SET BUILD_DATE=%date%-%time%
set LDFLAGS="-X '%PKG%/commons.clientVersion=%VERSION%' -X '%PKG%/commons.buildDate=%BUILD_DATE%'"
set GO111MODULE=on
set GOPROXY=direct

FOR /F "tokens=* USEBACKQ" %%F IN (`go env GOPATH`) DO (
SET GOPATH=%%F
)

set CGO_ENABLED=0

if not exist "%PREFIX%\bin" (
mkdir "%PREFIX%\bin"
if errorlevel 1 exit 1
)

echo "building gocommands"
go build -v -ldflags=%LDFLAGS% -o gocmd .\cmd\gocmd.go
copy gocmd.exe %PREFIX%\bin\gocmd.exe

echo "{{ range . }}" > ./thirdparty_license_template
echo "## {{ .Name }}" >> ./thirdparty_license_template
echo "" >> ./thirdparty_license_template
echo "* Name: {{ .Name }}" >> ./thirdparty_license_template
echo "* Version: {{ .Version }}" >> ./thirdparty_license_template
echo "* License: [{{ .LicenseName }}]({{ .LicenseURL }})" >> ./thirdparty_license_template
echo "```" >> ./thirdparty_license_template
echo "{{ .LicenseText }}" >> ./thirdparty_license_template
echo "```" >> ./thirdparty_license_template
echo "{{ end }}" >> ./thirdparty_license_template

go-licenses report .\cmd --template .\thirdparty_license_template > THIRDPARTY_LICENSES
29 changes: 29 additions & 0 deletions recipes/gocommands/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
PKG=github.com/cyverse/gocommands
VERSION=v${PKG_VERSION}
BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
LDFLAGS="-X '${PKG}/commons.clientVersion=${VERSION}' -X '${PKG}/commons.buildDate=${BUILD_DATE}'"
GO111MODULE=on
GOPROXY=direct
GOPATH=$(go env GOPATH)
CGO_ENABLED=0

mkdir -p ${PREFIX}/bin
echo "building gocommands"
go build -v "-ldflags=${LDFLAGS}" -o gocmd ./cmd/gocmd.go
cp gocmd ${PREFIX}/bin/gocmd

cat <<EOF >thirdparty_license_template
{{ range . }}
## {{ .Name }}
* Name: {{ .Name }}
* Version: {{ .Version }}
* License: [{{ .LicenseName }}]({{ .LicenseURL }})
```
{{ .LicenseText }}
```
{{ end }}
EOF

go-licenses report ./cmd --template ./thirdparty_license_template > THIRDPARTY_LICENSES
41 changes: 41 additions & 0 deletions recipes/gocommands/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{% set name = "gocommands" %}
{% set version = "0.7.17" %}

package:
name: {{ name|lower }}
version: {{ version }}

source:
url: https://github.com/cyverse/gocommands/archive/v{{ version }}.tar.gz
sha256: 301ab74431a4b5c1559f3c3488965b9053bb7fbccd151d6c499178ea7e3edc44

build:
skip: true # [win]
number: 0

requirements:
build:
- {{ compiler('go') }}
- ca-certificates
- go-licenses

test:
commands:

about:
home: https://github.com/cyverse/gocommands
summary: 'A protable command-line toolkit for iRODS'
description: |
gocommands is a portable command-line toolkit for iRODS data management service.
It can run on any systems, including linux, osx, and windows. As it is written in
pure Go language, it has no dependencies.
license: BSD-3-Clause
license_family: BSD
license_file:
- LICENSE
- THIRDPARTY_LICENSES
doc_url: https://github.com/cyverse/gocommands

extra:
recipe-maintainers:
- iychoi

0 comments on commit e16f3ee

Please sign in to comment.