From 9bc21ce405de5216a3f82dc02daed562bd4aa769 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Wed, 11 May 2022 14:21:58 +0300 Subject: [PATCH 1/6] Improve CI workflow --- .github/workflows/ci.yml | 33 +++++++-------------------------- 1 file changed, 7 insertions(+), 26 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 397b837..05713de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,6 @@ jobs: env: SRC_DIR: src/github.com/${{ github.repository }} - GO111MODULE: auto strategy: matrix: @@ -24,13 +23,6 @@ jobs: uses: actions/setup-go@v2 with: go-version: ${{ matrix.go }} - id: go - - - name: Setup PATH - run: | - echo "GOPATH=${{ github.workspace }}" >> "$GITHUB_ENV" - echo "GOBIN=${{ github.workspace }}/bin" >> "$GITHUB_ENV" - echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH" - name: Checkout uses: actions/checkout@v3 @@ -39,8 +31,7 @@ jobs: - name: Download dependencies working-directory: ${{env.SRC_DIR}} - run: | - make deps + run: make deps - name: Build binaries working-directory: ${{env.SRC_DIR}} @@ -54,20 +45,12 @@ jobs: env: SRC_DIR: src/github.com/${{ github.repository }} - GO111MODULE: auto steps: - name: Set up Go uses: actions/setup-go@v2 with: go-version: '1.17.x' - id: go - - - name: Setup PATH - run: | - echo "GOPATH=${{ github.workspace }}" >> "$GITHUB_ENV" - echo "GOBIN=${{ github.workspace }}/bin" >> "$GITHUB_ENV" - echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH" - name: Checkout uses: actions/checkout@v3 @@ -94,16 +77,14 @@ jobs: - name: Code checkout uses: actions/checkout@v3 - - name: Login to DockerHub - uses: docker/login-action@v1 - env: - DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - if: ${{ env.DOCKERHUB_USERNAME != '' }} + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Check specs with Perfecto - uses: essentialkaos/perfecto-action@v1 + uses: essentialkaos/perfecto-action@v2 with: files: common/init-exporter-converter.spec From 58ee4b481f58867f6aa36508513fe84186d2e761 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Wed, 11 May 2022 14:22:57 +0300 Subject: [PATCH 2/6] Add Dependabot configuration --- .github/dependabot.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..5f4fe5e --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,30 @@ +version: 2 + +updates: + - package-ecosystem: "gomod" + directory: "/" + target-branch: "develop" + schedule: + interval: "daily" + timezone: "Europe/Moscow" + time: "15:00" + labels: + - "PR • MAINTENANCE" + assignees: + - "andyone" + reviewers: + - "andyone" + + - package-ecosystem: "github-actions" + directory: "/" + target-branch: "develop" + schedule: + interval: "daily" + timezone: "Europe/Moscow" + time: "15:00" + labels: + - "PR • MAINTENANCE" + assignees: + - "andyone" + reviewers: + - "andyone" From 64ebfa954c08589d741ecdaed17d05f8f6215809 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Wed, 11 May 2022 14:23:30 +0300 Subject: [PATCH 3/6] Regenerate Makefile with the latest version of gomakegen --- Makefile | 68 ++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 54 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index f66c3a9..78997a0 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ ################################################################################ -# This Makefile generated by GoMakeGen 1.5.1 using next command: +# This Makefile generated by GoMakeGen 2.0.0 using next command: # gomakegen --mod . # # More info: https://kaos.sh/gomakegen @@ -9,15 +9,21 @@ export GO111MODULE=on +ifdef VERBOSE ## Print verbose information (Flag) +VERBOSE_FLAG = -v +endif + +################################################################################ + .DEFAULT_GOAL := help -.PHONY = fmt vet all clean deps mod-init mod-update mod-vendor help +.PHONY = fmt vet all clean deps update init vendor mod-init mod-update mod-download mod-vendor help ################################################################################ all: init-exporter-converter ## Build all binaries -init-exporter-converter: ## Build init-exporter-converter binary - go build init-exporter-converter.go +init-exporter-converter: + go build $(VERBOSE_FLAG) init-exporter-converter.go install: ## Install all binaries cp init-exporter-converter /usr/bin/init-exporter-converter @@ -25,32 +31,66 @@ install: ## Install all binaries uninstall: ## Uninstall all binaries rm -f /usr/bin/init-exporter-converter -deps: mod-update ## Download dependencies +init: mod-init ## Initialize new module -mod-init: ## Initialize new module - go mod init - go mod tidy +deps: mod-download ## Download dependencies -mod-update: ## Download modules to local cache +update: mod-update ## Update dependencies to the latest versions + +vendor: mod-vendor ## Make vendored copy of dependencies + +mod-init: +ifdef MODULE_PATH ## Module path for initialization (String) + go mod init $(MODULE_PATH) +else + go mod init +endif + +ifdef COMPAT ## Compatible Go version (String) + go mod tidy $(VERBOSE_FLAG) -compat=$(COMPAT) +else + go mod tidy $(VERBOSE_FLAG) +endif + +mod-update: +ifdef UPDATE_ALL ## Update all dependencies (Flag) + go get -u $(VERBOSE_FLAG) all +else + go get -u $(VERBOSE_FLAG) ./... +endif + +ifdef COMPAT + go mod tidy $(VERBOSE_FLAG) -compat=$(COMPAT) +else + go mod tidy $(VERBOSE_FLAG) +endif + + test -d vendor && go mod vendor $(VERBOSE_FLAG) || : + +mod-download: go mod download -mod-vendor: ## Make vendored copy of dependencies - go mod vendor +mod-vendor: + go mod vendor $(VERBOSE_FLAG) fmt: ## Format source code with gofmt find . -name "*.go" -exec gofmt -s -w {} \; -vet: ## Runs go vet over sources +vet: ## Runs 'go vet' over sources go vet -composites=false -printfuncs=LPrintf,TLPrintf,TPrintf,log.Debug,log.Info,log.Warn,log.Error,log.Critical,log.Print ./... clean: ## Remove generated files rm -f init-exporter-converter help: ## Show this info - @echo -e '\n\033[1mSupported targets:\033[0m\n' + @echo -e '\n\033[1mTargets:\033[0m\n' @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \ | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[33m%-25s\033[0m %s\n", $$1, $$2}' + @echo -e '\n\033[1mVariables:\033[0m\n' + @grep -E '^ifdef [A-Z_]+ .*?## .*$$' $(abspath $(lastword $(MAKEFILE_LIST))) \ + | sed 's/ifdef //' \ + | awk 'BEGIN {FS = " .*?## "}; {printf " \033[32m%-14s\033[0m %s\n", $$1, $$2}' @echo -e '' - @echo -e '\033[90mGenerated by GoMakeGen 1.5.1\033[0m\n' + @echo -e '\033[90mGenerated by GoMakeGen 2.0.0\033[0m\n' ################################################################################ From bc81d32dd97b4ba9f558769c23c18dca75dde4e6 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Thu, 9 Mar 2023 17:11:41 +0300 Subject: [PATCH 4/6] Regenerate Makefile with the latest version of gomakegen --- Makefile | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 78997a0..4277020 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ ################################################################################ -# This Makefile generated by GoMakeGen 2.0.0 using next command: +# This Makefile generated by GoMakeGen 2.2.0 using next command: # gomakegen --mod . # # More info: https://kaos.sh/gomakegen @@ -13,6 +13,9 @@ ifdef VERBOSE ## Print verbose information (Flag) VERBOSE_FLAG = -v endif +MAKEDIR = $(dir $(realpath $(firstword $(MAKEFILE_LIST)))) +GITREV ?= $(shell test -s $(MAKEDIR)/.git && git rev-parse --short HEAD) + ################################################################################ .DEFAULT_GOAL := help @@ -23,7 +26,7 @@ endif all: init-exporter-converter ## Build all binaries init-exporter-converter: - go build $(VERBOSE_FLAG) init-exporter-converter.go + go build $(VERBOSE_FLAG) -ldflags="-X main.gitrev=$(GITREV)" init-exporter-converter.go install: ## Install all binaries cp init-exporter-converter /usr/bin/init-exporter-converter @@ -65,13 +68,13 @@ else go mod tidy $(VERBOSE_FLAG) endif - test -d vendor && go mod vendor $(VERBOSE_FLAG) || : + test -d vendor && rm -rf vendor && go mod vendor $(VERBOSE_FLAG) || : mod-download: go mod download mod-vendor: - go mod vendor $(VERBOSE_FLAG) + rm -rf vendor && go mod vendor $(VERBOSE_FLAG) fmt: ## Format source code with gofmt find . -name "*.go" -exec gofmt -s -w {} \; @@ -91,6 +94,6 @@ help: ## Show this info | sed 's/ifdef //' \ | awk 'BEGIN {FS = " .*?## "}; {printf " \033[32m%-14s\033[0m %s\n", $$1, $$2}' @echo -e '' - @echo -e '\033[90mGenerated by GoMakeGen 2.0.0\033[0m\n' + @echo -e '\033[90mGenerated by GoMakeGen 2.2.0\033[0m\n' ################################################################################ From 864228c516863a7ade1c1a0d307b119618711dc2 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Thu, 9 Mar 2023 18:00:43 +0300 Subject: [PATCH 5/6] Improvements --- .github/workflows/ci.yml | 29 ++++++--- README.md | 12 +--- go.mod | 8 +-- go.sum | 18 +++--- init-exporter-converter.go | 118 ++++++++++++++++++++++++++----------- 5 files changed, 122 insertions(+), 63 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 05713de..2671fd1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,18 +5,34 @@ on: branches: [master, develop] pull_request: branches: [master] + workflow_dispatch: + inputs: + force_run: + description: 'Force workflow run' + required: true + type: choice + options: [yes, no] + +permissions: + actions: read + contents: read + statuses: write + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + SRC_DIR: src/github.com/${{ github.repository }} jobs: Go: name: Go runs-on: ubuntu-latest - env: - SRC_DIR: src/github.com/${{ github.repository }} - strategy: matrix: - go: [ '1.17.x', '1.18.x' ] + go: [ '1.19.x', '1.20.x' ] steps: - name: Set up Go @@ -43,14 +59,11 @@ jobs: needs: Go - env: - SRC_DIR: src/github.com/${{ github.repository }} - steps: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: '1.17.x' + go-version: '1.19.x' - name: Checkout uses: actions/checkout@v3 diff --git a/README.md b/README.md index 92d4860..da543b8 100644 --- a/README.md +++ b/README.md @@ -6,22 +6,16 @@ Utility for converting [`init-exporter`](https://github.com/funbox/init-exporter #### From sources -To build the `init-exporter-converter` from scratch, make sure you have a working Go 1.16+ workspace ([instructions](https://golang.org/doc/install)), then: +To build the `init-exporter-converter` from scratch, make sure you have a working Go 1.18+ workspace ([instructions](https://golang.org/doc/install)), then: ``` -go get github.com/funbox/init-exporter-converter -``` - -If you want to update `init-exporter-converter` to latest stable release, do: - -``` -go get -u github.com/funbox/init-exporter-converter +go install github.com/funbox/init-exporter-converter@latest ``` #### From [ESSENTIAL KAOS Public Repository](https://yum.kaos.st) ``` -sudo yum install -y https://yum.kaos.st/get/$(uname -r).rpm +sudo yum install -y https://yum.kaos.st/kaos-repo-latest.el$(grep 'CPE_NAME' /etc/os-release | tr -d '"' | cut -d':' -f5).noarch.rpm sudo yum install init-exporter-converter ``` diff --git a/go.mod b/go.mod index f0fbceb..5e6cc7e 100644 --- a/go.mod +++ b/go.mod @@ -1,14 +1,14 @@ module github.com/funbox/init-exporter-converter -go 1.17 +go 1.18 require ( - github.com/essentialkaos/ek/v12 v12.42.1 - github.com/essentialkaos/go-simpleyaml/v2 v2.1.3 + github.com/essentialkaos/ek/v12 v12.62.0 + github.com/essentialkaos/go-simpleyaml/v2 v2.1.4 github.com/funbox/init-exporter v0.24.1 ) require ( - golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 // indirect + golang.org/x/sys v0.6.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/go.sum b/go.sum index b432a84..485028d 100644 --- a/go.sum +++ b/go.sum @@ -1,15 +1,15 @@ -github.com/essentialkaos/check v1.2.1 h1:avvyFy/1acUNwfxwuOLsHeCjfXtMygtbu0lVDr3nxFs= -github.com/essentialkaos/ek/v12 v12.42.1 h1:h3PPy0XNXUj1IsEid/p9IzaF0o5hZEGOBFh7XZawAyg= -github.com/essentialkaos/ek/v12 v12.42.1/go.mod h1:Cv/tOZshmFg4pMJnBkg4aW/WyYhzzc41qzZIfk5RSi4= -github.com/essentialkaos/go-simpleyaml/v2 v2.1.3 h1:DAFvXut4ZtkuiTKWqSux3W0myuv3TOAwiD6w5MKWxsM= -github.com/essentialkaos/go-simpleyaml/v2 v2.1.3/go.mod h1:LAUFukPmTZ4fmHa1K3LsH8MO257r/CL/BqlaP/2Vgcs= +github.com/essentialkaos/check v1.4.0 h1:kWdFxu9odCxUqo1NNFNJmguGrDHgwi3A8daXX1nkuKk= +github.com/essentialkaos/ek/v12 v12.62.0 h1:A+pnMGbSz2apjEjlHU3EQ6Uqam85GTryVPhzcLfY8o4= +github.com/essentialkaos/ek/v12 v12.62.0/go.mod h1:9MlSuHpewu7OZ9tM9dLFHvoA8dflBIUPCA0Ctt97wRs= +github.com/essentialkaos/go-simpleyaml/v2 v2.1.4 h1:B2bXdGWaQ6Xy3HTsO2DLBoNV7cbMW3KDmeeOKYLo9z0= +github.com/essentialkaos/go-simpleyaml/v2 v2.1.4/go.mod h1:pVQTleUBC8xBI9+HnTF38xWBZqANNrmMAzwmUemblJg= github.com/funbox/init-exporter v0.24.1 h1:nQXX4nEq6oh+6Ok7nSRoP2WP97DU5vf84+ASEw3qg+8= github.com/funbox/init-exporter v0.24.1/go.mod h1:/VrrNrdCYKcKZjoIPx6u0yra/M51tFPZ5v8GKV8eCz4= -github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= -golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 h1:OH54vjqzRWmbJ62fjuhxy7AxFFgoHN0/DPc/UrL8cAs= -golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= diff --git a/init-exporter-converter.go b/init-exporter-converter.go index c64e056..ae41d23 100644 --- a/init-exporter-converter.go +++ b/init-exporter-converter.go @@ -2,7 +2,7 @@ package main // ////////////////////////////////////////////////////////////////////////////////// // // // -// Copyright (c) 2006-2021 FUNBOX // +// Copyright (c) 2006-2023 FUNBOX // // // // ////////////////////////////////////////////////////////////////////////////////// // @@ -13,12 +13,15 @@ import ( "runtime" "strings" - "github.com/essentialkaos/ek/v12/env" "github.com/essentialkaos/ek/v12/fmtc" "github.com/essentialkaos/ek/v12/fsutil" "github.com/essentialkaos/ek/v12/knf" "github.com/essentialkaos/ek/v12/options" "github.com/essentialkaos/ek/v12/usage" + "github.com/essentialkaos/ek/v12/usage/completion/bash" + "github.com/essentialkaos/ek/v12/usage/completion/fish" + "github.com/essentialkaos/ek/v12/usage/completion/zsh" + "github.com/essentialkaos/ek/v12/usage/man" "github.com/essentialkaos/ek/v12/usage/update" "github.com/essentialkaos/go-simpleyaml/v2" @@ -31,7 +34,7 @@ import ( // App props const ( APP = "init-exporter-converter" - VER = "0.11.2" + VER = "0.12.0" DESC = "Utility for converting procfiles from v1 to v2 format" ) @@ -43,7 +46,10 @@ const ( OPT_IN_PLACE = "i:in-place" OPT_NO_COLOR = "nc:no-color" OPT_HELP = "h:help" - OPT_VERSION = "v:version" + OPT_VER = "v:version" + + OPT_COMPLETION = "completion" + OPT_GENERATE_MAN = "generate-man" ) // Config properies @@ -78,48 +84,55 @@ var optMap = options.Map{ OPT_IN_PLACE: {Type: options.BOOL}, OPT_NO_COLOR: {Type: options.BOOL}, OPT_HELP: {Type: options.BOOL}, - OPT_VERSION: {Type: options.BOOL}, + OPT_VER: {Type: options.BOOL}, + + OPT_COMPLETION: {}, + OPT_GENERATE_MAN: {Type: options.BOOL}, } var colorTagApp string var colorTagVer string +var gitrev string + // ////////////////////////////////////////////////////////////////////////////////// // func main() { runtime.GOMAXPROCS(1) - files, errs := options.Parse(optMap) - - if len(errs) != 0 { - fmtc.Println("Error while options parsing:") + preConfigureUI() - for _, err := range errs { - fmtc.Printf(" %v\n", err) - } + args, errs := options.Parse(optMap) + if len(errs) != 0 { + printError(errs[0].Error()) os.Exit(1) } configureUI() - if options.GetB(OPT_VERSION) { - showAbout() - return - } - - if options.GetB(OPT_HELP) || len(files) == 0 { - showUsage() - return + switch { + case options.Has(OPT_COMPLETION): + os.Exit(printCompletion()) + case options.Has(OPT_GENERATE_MAN): + printMan() + os.Exit(0) + case options.GetB(OPT_VER): + genAbout(gitrev).Print() + os.Exit(0) + case options.GetB(OPT_HELP) || len(args) == 0: + genUsage().Print() + os.Exit(0) } - process(files) + process(args.Strings()) } -// configureUI configures user interface -func configureUI() { - envVars := env.Get() - term := envVars.GetS("TERM") +// preConfigureUI preconfigures UI based on information about user terminal +func preConfigureUI() { + term := os.Getenv("TERM") + + fmtc.DisableColors = true if term != "" { switch { @@ -130,10 +143,17 @@ func configureUI() { } } - if !fsutil.IsCharacterDevice("/dev/stdout") && envVars.GetS("FAKETTY") == "" { + if !fsutil.IsCharacterDevice("/dev/stdout") && os.Getenv("FAKETTY") == "" { fmtc.DisableColors = true } + if os.Getenv("NO_COLOR") != "" { + fmtc.DisableColors = true + } +} + +// configureUI configures user interface +func configureUI() { if options.GetB(OPT_NO_COLOR) { fmtc.DisableColors = true } @@ -350,8 +370,36 @@ func printErrorAndExit(f string, a ...interface{}) { // ////////////////////////////////////////////////////////////////////////////////// // -// showUsage prints usage info to console -func showUsage() { +// printCompletion prints completion for given shell +func printCompletion() int { + info := genUsage() + + switch options.GetS(OPT_COMPLETION) { + case "bash": + fmt.Printf(bash.Generate(info, "init-exporter-converter")) + case "fish": + fmt.Printf(fish.Generate(info, "init-exporter-converter")) + case "zsh": + fmt.Printf(zsh.Generate(info, optMap, "init-exporter-converter")) + default: + return 1 + } + + return 0 +} + +// printMan prints man page +func printMan() { + fmt.Println( + man.Generate( + genUsage(), + genAbout(""), + ), + ) +} + +// genUsage generates usage info +func genUsage() *usage.Info { info := usage.NewInfo("", "procfile…") info.AppNameColorTag = "{*}" + colorTagApp @@ -360,7 +408,7 @@ func showUsage() { info.AddOption(OPT_IN_PLACE, "Edit procfile in place") info.AddOption(OPT_NO_COLOR, "Disable colors in output") info.AddOption(OPT_HELP, "Show this help message") - info.AddOption(OPT_VERSION, "Show version") + info.AddOption(OPT_VER, "Show version") info.AddExample( "-i config/Procfile.production", @@ -372,11 +420,11 @@ func showUsage() { "Convert all procfiles to version 2 with defaults from init-exporter config and print result to console", ) - info.Render() + return info } -// showAbout prints version info to console -func showAbout() { +// genAbout generates info about version +func genAbout(gitRev string) *usage.About { about := &usage.About{ App: APP, Version: VER, @@ -393,5 +441,9 @@ func showAbout() { VersionColorTag: colorTagVer, } - about.Render() + if gitRev != "" { + about.Build = "git:" + gitRev + } + + return about } From d22b4593970bcd46e220eb8a14ecdd9f514aa8b3 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Fri, 10 Mar 2023 11:01:13 +0300 Subject: [PATCH 6/6] Update spec --- common/init-exporter-converter.spec | 80 ++++++++++------------------- 1 file changed, 27 insertions(+), 53 deletions(-) diff --git a/common/init-exporter-converter.spec b/common/init-exporter-converter.spec index a5396f2..fadf5cc 100644 --- a/common/init-exporter-converter.spec +++ b/common/init-exporter-converter.spec @@ -1,60 +1,24 @@ ################################################################################ -# rpmbuilder:relative-pack true +%define debug_package %{nil} ################################################################################ -%define _posixroot / -%define _root /root -%define _bin /bin -%define _sbin /sbin -%define _srv /srv -%define _home /home -%define _lib32 %{_posixroot}lib -%define _lib64 %{_posixroot}lib64 -%define _libdir32 %{_prefix}%{_lib32} -%define _libdir64 %{_prefix}%{_lib64} -%define _logdir %{_localstatedir}/log -%define _rundir %{_localstatedir}/run -%define _lockdir %{_localstatedir}/lock/subsys -%define _cachedir %{_localstatedir}/cache -%define _spooldir %{_localstatedir}/spool -%define _crondir %{_sysconfdir}/cron.d -%define _loc_prefix %{_prefix}/local -%define _loc_exec_prefix %{_loc_prefix} -%define _loc_bindir %{_loc_exec_prefix}/bin -%define _loc_libdir %{_loc_exec_prefix}/%{_lib} -%define _loc_libdir32 %{_loc_exec_prefix}/%{_lib32} -%define _loc_libdir64 %{_loc_exec_prefix}/%{_lib64} -%define _loc_libexecdir %{_loc_exec_prefix}/libexec -%define _loc_sbindir %{_loc_exec_prefix}/sbin -%define _loc_bindir %{_loc_exec_prefix}/bin -%define _loc_datarootdir %{_loc_prefix}/share -%define _loc_includedir %{_loc_prefix}/include -%define _rpmstatedir %{_sharedstatedir}/rpm-state -%define _pkgconfigdir %{_libdir}/pkgconfig +Summary: Utility for converting init-exporter procfiles from v1 to v2 format +Name: init-exporter-converter +Version: 0.12.0 +Release: 0%{?dist} +Group: Development/Tools +License: MIT +URL: https://github.com/funbox/init-exporter-converter -################################################################################ - -%define debug_package %{nil} - -################################################################################ +Source0: %{name}-%{version}.tar.gz -Summary: Utility for converting init-exporter procfiles from v1 to v2 format -Name: init-exporter-converter -Version: 0.11.2 -Release: 0%{?dist} -Group: Development/Tools -License: MIT -URL: https://github.com/funbox/init-exporter-converter +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -Source0: %{name}-%{version}.tar.gz +BuildRequires: golang >= 1.19 -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) - -BuildRequires: golang >= 1.17 - -Provides: %{name} = %{version}-%{release} +Provides: %{name} = %{version}-%{release} ################################################################################ @@ -67,17 +31,21 @@ Utility for exporting services described by Procfile to init system. %setup -q %build -export GOPATH=$(pwd) -pushd src/github.com/funbox/%{name} - go build -mod vendor %{name}.go +if [[ ! -d "%{name}/vendor" ]] ; then + echo "This package requires vendored dependencies" + exit 1 +fi + +pushd %{name} + %{__make} %{?_smp_mflags} all + cp LICENSE .. popd %install rm -rf %{buildroot} install -dm 755 %{buildroot}%{_bindir} -install -pm 755 src/github.com/funbox/%{name}/%{name} \ - %{buildroot}%{_bindir}/ +install -pm 755 %{name}/%{name} %{buildroot}%{_bindir}/ %clean rm -rf %{buildroot} @@ -86,11 +54,17 @@ rm -rf %{buildroot} %files %defattr(-,root,root,-) +%doc LICENSE %{_bindir}/init-exporter-converter ################################################################################ %changelog +* Fri Mar 10 2023 Anton Novojilov - 0.12.0-0 +- Added verbose version output +- Dependencies update +- Code refactoring + * Fri Apr 01 2022 Anton Novojilov - 0.11.2-0 - Removed pkg.re usage - Added module info