diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 2918c86..567a6ee 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go: ["1.18", "1.19", "1.20"] + go: ["1.18", "1.19", "1.20", "1.21", "1.22"] steps: - name: Updating ... run: sudo apt-get -qq update @@ -23,10 +23,10 @@ jobs: go-version: ${{ matrix.go }} - name: Go build (source) - run: make + run: go build ./... - name: Go build (tests) - run: make tests + run: go test ./... - name: Go vet - run: make vet + run: go vet ./... diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 5500690..8e4825e 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -41,7 +41,7 @@ jobs: - name: Install shellcheck run: sudo apt install shellcheck - name: Check shell bash scripts - run: shellcheck ./rhc.bash + run: shellcheck ./data/completion/rhc.bash lint-language: name: Lint language runs-on: ubuntu-latest diff --git a/.packit.yml b/.packit.yml index 03868cb..d86ced6 100644 --- a/.packit.yml +++ b/.packit.yml @@ -1,23 +1,25 @@ upstream_package_name: rhc downstream_package_name: rhc -specfile_path: rhc.spec +specfile_path: builddir/dist/srpm/rhc.spec srpm_build_deps: - gawk - git-core - golang - - make - - 'pkgconfig(dbus-1)' - - 'pkgconfig(systemd)' + - meson + - "pkgconfig(bash-completion)" + - "pkgconfig(dbus-1)" + - "pkgconfig(systemd)" - rpm-build actions: post-upstream-clone: - - bash -c 'make rhc.spec dist' + - meson setup builddir -Dbuild_srpm=True -Dvendor=True --wipe + - meson compile tarball -C builddir get-current-version: - - awk '/^Version:/ {print $2;}' ./rhc.spec + - awk '/^Version:/ {print $2;}' builddir/dist/srpm/rhc.spec create-archive: - - bash -c 'echo rhc-*.tar.*' + - bash -c 'echo builddir/dist/srpm/rhc-*.tar.*' fix-spec-file: - echo 'nothing to fix' diff --git a/Makefile b/Makefile deleted file mode 100644 index 36fe27e..0000000 --- a/Makefile +++ /dev/null @@ -1,185 +0,0 @@ -SHELL := bash -.ONESHELL: -.SHELLFLAGS := -eu -o pipefail -c -.DELETE_ON_ERROR: -MAKEFLAGS += --warn-undefined-variables -MAKEFLAGS += --no-builtin-rules -.POSIX: -.SUFFIXES: - -# Project variables - -# Used as a prefix to binary names. Cannot contain spaces. -SHORTNAME := rhc -# Used as file and directory names. Cannot contain spaces. -LONGNAME := rhc -# Used as the tarball file name. Cannot contain spaces. -PKGNAME := rhc -VERSION := 0.2.4 -# Used for service name of yggdrasil service (rhcd service). Cannot contain spaces -SERVICENAME := yggdrasil -# Used as the prefix for MQTT topic names -TOPICPREFIX := redhat/insights -# Used to force sending all HTTP traffic to a specific host. -DATAHOST := cert.cloud.redhat.com -# Used to identify the agency providing the connection broker. -PROVIDER := Red Hat - -# Installation directories -PREFIX ?= /usr/local -BINDIR ?= $(PREFIX)/bin -SBINDIR ?= $(PREFIX)/sbin -LIBEXECDIR ?= $(PREFIX)/libexec -SYSCONFDIR ?= $(PREFIX)/etc -DATADIR ?= $(PREFIX)/share -DATAROOTDIR ?= $(PREFIX)/share -MANDIR ?= $(DATADIR)/man -DOCDIR ?= $(DATADIR)/doc -LOCALSTATEDIR ?= $(PREFIX)/var -DESTDIR ?= - -# Dependent package directories -SYSTEMD_SYSTEM_UNIT_DIR := $(shell pkg-config --variable systemdsystemunitdir systemd) -SYSTEMD_SYSTEM_PRESET_DIR := $(shell pkg-config --variable systemdsystempresetdir systemd) - -# Build flags -LDFLAGS := -LDFLAGS += -X 'main.Version=$(VERSION)' -LDFLAGS += -X 'main.ShortName=$(SHORTNAME)' -LDFLAGS += -X 'main.LongName=$(LONGNAME)' -LDFLAGS += -X 'main.PrefixDir=$(PREFIX)' -LDFLAGS += -X 'main.BinDir=$(BINDIR)' -LDFLAGS += -X 'main.SbinDir=$(SBINDIR)' -LDFLAGS += -X 'main.LibexecDir=$(LIBEXECDIR)' -LDFLAGS += -X 'main.SysconfDir=$(SYSCONFDIR)' -LDFLAGS += -X 'main.DataDir=$(DATADIR)' -LDFLAGS += -X 'main.DatarootDir=$(DATAROOTDIR)' -LDFLAGS += -X 'main.ManDir=$(MANDIR)' -LDFLAGS += -X 'main.DocDir=$(DOCDIR)' -LDFLAGS += -X 'main.LocalstateDir=$(LOCALSTATEDIR)' -LDFLAGS += -X 'main.TopicPrefix=$(TOPICPREFIX)' -LDFLAGS += -X 'main.Provider=$(PROVIDER)' -LDFLAGS += -X 'main.ServiceName=$(SERVICENAME)' - -BUILDFLAGS ?= -BUILDFLAGS += -buildmode=pie -ifeq ($(shell find . -name vendor), ./vendor) -BUILDFLAGS += -mod=vendor -endif - -BIN = rhc -DATA = rhc.1.gz \ - USAGE.md - -GOSRC := $(shell find . -name '*.go') -GOSRC += go.mod go.sum - -.PHONY: all -all: $(BIN) $(DATA) - -.PHONY: bin -bin: $(BIN) - -$(BIN): $(GOSRC) - go build $(BUILDFLAGS) -ldflags "$(LDFLAGS)" -o $@ . - -.PHONY: data -data: $(DATA) - -%.1: $(GOSRC) - go run $(BUILDFLAGS) -ldflags "$(LDFLAGS)" . --generate-man-page > $@ - -%.1.gz: %.1 - gzip -k -f $^ - -USAGE.md: $(GOSRC) - go run $(BUILDFLAGS) -ldflags "$(LDFLAGS)" . --generate-markdown > $@ - -%: %.in Makefile - sed \ - -e 's,[@]SHORTNAME[@],$(SHORTNAME),g' \ - -e 's,[@]LONGNAME[@],$(LONGNAME),g' \ - -e 's,[@]VERSION[@],$(VERSION),g' \ - -e 's,[@]PACKAGE[@],$(PACKAGE),g' \ - -e 's,[@]TOPICPREFIX[@],$(TOPICPREFIX),g' \ - -e 's,[@]DATAHOST[@],$(DATAHOST),g' \ - -e 's,[@]PROVIDER[@],$(PROVIDER),g' \ - -e 's,[@]PREFIX[@],$(PREFIX),g' \ - -e 's,[@]BINDIR[@],$(BINDIR),g' \ - -e 's,[@]SBINDIR[@],$(SBINDIR),g' \ - -e 's,[@]LIBEXECDIR[@],$(LIBEXECDIR),g' \ - -e 's,[@]DATAROOTDIR[@],$(DATAROOTDIR),g' \ - -e 's,[@]DATADIR[@],$(DATADIR),g' \ - -e 's,[@]SYSCONFDIR[@],$(SYSCONFDIR),g' \ - -e 's,[@]LOCALSTATEDIR[@],$(LOCALSTATEDIR),g' \ - -e 's,[@]DOCDIR[@],$(DOCDIR),g' \ - -e 's,[@]SERVICENAME[@],$(SERVICENAME),g' \ - $< > $@.tmp && mv $@.tmp $@ - -.PHONY: install -install: $(BIN) $(DATA) - pkg-config --modversion dbus-1 || exit 1 - pkg-config --modversion systemd || exit 1 - install -D -m755 ./rhc $(DESTDIR)$(BINDIR)/$(SHORTNAME) - install -D -m644 ./rhc.1.gz $(DESTDIR)$(MANDIR)/man1/$(SHORTNAME).1.gz - install -D -m644 ./rhc.bash $(DESTDIR)$(DATADIR)/bash-completion/completions/$(SHORTNAME) - install -D -m644 ./rhc-canonical-facts.service $(DESTDIR)$(SYSTEMD_SYSTEM_UNIT_DIR)/rhc-canonical-facts.service - install -D -m644 ./rhc-canonical-facts.timer $(DESTDIR)$(SYSTEMD_SYSTEM_UNIT_DIR)/rhc-canonical-facts.timer - install -D -m644 ./80-rhc.preset $(DESTDIR)$(SYSTEMD_SYSTEM_PRESET_DIR)/80-rhc.preset - -.PHONY: uninstall -uninstall: - rm -f $(DESTDIR)$(BINDIR)/$(SHORTNAME) - rm -f $(DESTDIR)$(MANDIR)/man1/$(SHORTNAME).1.gz - rm -f $(DESTDIR)$(DATADIR)/bash-completion/completions/$(SHORTNAME) - -.PHONY: dist -dist: - go mod vendor - tar --create \ - --gzip \ - --file /tmp/$(PKGNAME)-$(VERSION).tar.gz \ - --exclude=.git \ - --exclude=.vscode \ - --exclude=.github \ - --exclude=.gitignore \ - --exclude=rhc-*.tar.gz \ - --exclude=rhc \ - --transform s/^\./$(PKGNAME)-$(VERSION)/ \ - . && mv /tmp/$(PKGNAME)-$(VERSION).tar.gz . - rm -rf ./vendor - -rhc.spec: rhc.spec.in - sed \ - -e 's,[@]SHORTNAME[@],$(SHORTNAME),g' \ - -e 's,[@]LONGNAME[@],$(LONGNAME),g' \ - -e 's,[@]VERSION[@],$(VERSION),g' \ - -e 's,[@]PKGNAME[@],$(PKGNAME),g' \ - -e 's,[@]TOPICPREFIX[@],$(TOPICPREFIX),g' \ - -e 's,[@]DATAHOST[@],$(DATAHOST),g' \ - -e 's,[@]PROVIDER[@],$(PROVIDER),g' \ - -e 's,[@]PREFIX[@],$(PREFIX),g' \ - -e 's,[@]BINDIR[@],$(BINDIR),g' \ - -e 's,[@]SBINDIR[@],$(SBINDIR),g' \ - -e 's,[@]LIBEXECDIR[@],$(LIBEXECDIR),g' \ - -e 's,[@]DATAROOTDIR[@],$(DATAROOTDIR),g' \ - -e 's,[@]DATADIR[@],$(DATADIR),g' \ - -e 's,[@]SYSCONFDIR[@],$(SYSCONFDIR),g' \ - -e 's,[@]LOCALSTATEDIR[@],$(LOCALSTATEDIR),g' \ - -e 's,[@]DOCDIR[@],$(DOCDIR),g' \ - -e 's,[@]SERVICENAME[@],$(SERVICENAME),g' \ - $^ > $@ - -.PHONY: clean -clean: - go mod tidy - rm -f $(BIN) - rm -f $(DATA) - -.PHONY: tests -tests: - go test -v ./... - -.PHONY: vet -vet: - go vet -v ./... diff --git a/data/completion/meson.build b/data/completion/meson.build new file mode 100644 index 0000000..78411e5 --- /dev/null +++ b/data/completion/meson.build @@ -0,0 +1,5 @@ +install_data( + 'rhc.bash', + rename: 'rhc', + install_dir: bash_completion.get_variable(pkgconfig: 'completionsdir'), +) diff --git a/rhc.bash b/data/completion/rhc.bash similarity index 100% rename from rhc.bash rename to data/completion/rhc.bash diff --git a/data/meson.build b/data/meson.build new file mode 100644 index 0000000..397cdc1 --- /dev/null +++ b/data/meson.build @@ -0,0 +1,2 @@ +subdir('completion') +subdir('systemd') diff --git a/80-rhc.preset b/data/systemd/80-rhc.preset similarity index 100% rename from 80-rhc.preset rename to data/systemd/80-rhc.preset diff --git a/data/systemd/meson.build b/data/systemd/meson.build new file mode 100644 index 0000000..9ce025e --- /dev/null +++ b/data/systemd/meson.build @@ -0,0 +1,6 @@ +systemd_system_unit_dir = systemd.get_variable(pkgconfig: 'systemdsystemunitdir') +systemd_system_preset_dir = systemd.get_variable(pkgconfig: 'systemdsystempresetdir') + +install_data('80-rhc.preset', install_dir: systemd_system_preset_dir) +install_data('rhc-canonical-facts.service', install_dir: systemd_system_unit_dir) +install_data('rhc-canonical-facts.timer', install_dir: systemd_system_unit_dir) diff --git a/rhc-canonical-facts.service b/data/systemd/rhc-canonical-facts.service similarity index 100% rename from rhc-canonical-facts.service rename to data/systemd/rhc-canonical-facts.service diff --git a/rhc-canonical-facts.timer b/data/systemd/rhc-canonical-facts.timer similarity index 100% rename from rhc-canonical-facts.timer rename to data/systemd/rhc-canonical-facts.timer diff --git a/dist/meson.build b/dist/meson.build new file mode 100644 index 0000000..d1d085b --- /dev/null +++ b/dist/meson.build @@ -0,0 +1,3 @@ +if get_option('build_srpm') + subdir('srpm') +endif diff --git a/dist/srpm/meson.build b/dist/srpm/meson.build new file mode 100644 index 0000000..7cbf96f --- /dev/null +++ b/dist/srpm/meson.build @@ -0,0 +1,61 @@ +git = find_program('git') +rpmbuild = find_program('rpmbuild') +tar = find_program('tar') +bash = find_program('bash') + +commit = run_command(git, 'rev-parse', 'HEAD', capture: true, check: true).stdout().strip() + +systemd_sysusers_dir = systemd.get_variable(pkgconfig: 'sysusersdir') + +if get_option('vendor') + run_command( + [bash, files(meson.project_source_root() / 'scripts' / 'vendor.sh')], + check: true, + ) +endif + +build_root_basename = meson.project_build_root().split('/').get(-1) +tarball = custom_target( + 'tarball', + command: [ + tar, + '--create', + '--gzip', + '--absolute-names', + '--file', '@OUTPUT@', + '--transform', 's+@0@+@1@-@2@+'.format( + meson.project_source_root(), + meson.project_name(), + meson.project_version(), + ), + '--exclude', build_root_basename, + '--exclude', '.git', + '--exclude', '.vscode', + '--exclude', '.github', + '--exclude', '.copr', + meson.project_source_root(), + ], + output: '@0@-@1@.tar.gz'.format(meson.project_name(), meson.project_version()), +) + +specfile = configure_file( + input: 'rhc.spec.in', + output: '@BASENAME@', + configuration: { + 'COMMIT': commit, + 'VERSION': meson.project_version(), + }, +) + +run_target( + 'srpm', + command: [ + rpmbuild, + '-bs', + '--define', 'commit @0@'.format(commit), + '--define', '_srcrpmdir @0@'.format(meson.current_build_dir()), + '--define', '_sourcedir @0@'.format(meson.current_build_dir()), + specfile, + ], + depends: [tarball], +) diff --git a/dist/srpm/rhc.spec.in b/dist/srpm/rhc.spec.in new file mode 100644 index 0000000..a50b1a0 --- /dev/null +++ b/dist/srpm/rhc.spec.in @@ -0,0 +1,155 @@ +# This RPM spec file exists primarily to enable CI/CD pipelines and automatic +# testing of built RPMs. This RPM can be used as a suitable baseline for a +# proper distribution package, but changes should be made to suit the needs of +# the package. + +%bcond_without check + +%global has_go_rpm_macros (0%{?fedora}) +%define source_date_epoch_from_changelog 0 + +# must be before %%gometa +Version: @VERSION@ + +# https://github.com/redhatinsights/rhc +%global goipath github.com/redhatinsights/rhc +%global commit @COMMIT@ +%global shortcommit %(c=%{commit}; echo ${c:0:7}) +%global archivename rhc-%{version} + +%if %{has_go_rpm_macros} +%gometa %{?fedora:-f} +%else +%global gourl https://github.com/RedHatInsights/%{name} +%global gomodulesmode GO111MODULES=off +%global gosource %{gourl}/releases/download/%{version}/rhc-%{version}.tar.gz +%global gocompilerflags "-buildmode pie -compiler gc" +%endif + +# Manually redefine %%dist to work around an issue in COPR where the build root +# that creates the srpm does not define a value for %%dist. This should *NOT* be +# carried in downstream; this is strictly an upstream/COPR/CI workaround. +%if "%{dist}" == "" +%global dist %{distprefix}.fc%{fedora} +%endif + +%if 0%{?fedora} +%global setup_flags -Dvendor=False +%else +%global setup_flags -Dvendor=True +%endif + +%global common_description %{expand: +rhc is a client that registers a system with RHSM and activates the Red Hat yggd +MQTT client.} + +%global golicenses LICENSE +%global godocs CONTRIBUTING.md README.md + +Name: rhc +Release: 0%{?dist} +Epoch: 1 +Summary: Client for registering Red Hat Enterprise Linux systems + +License: GPL-3.0-only +URL: %{gourl} +Source0: %{gosource} + +Requires: insights-client +Requires: yggdrasil >= 0.4 +Requires: yggdrasil-worker-package-manager +Requires: subscription-manager + +BuildRequires: systemd-rpm-macros +BuildRequires: meson +BuildRequires: pkgconfig(systemd) +BuildRequires: pkgconfig(bash-completion) +BuildRequires: golang >= 1.18 + + +%description %{common_description} + +%package compat +Summary: Transition package to support migrating from rhcd to yggd + +Requires: yggdrasil >= 0.4.2 +Recommends: rhc + +%description compat +Transition package to support migrating from rhcd to yggd. + +%if %{has_go_rpm_macros} +%gopkg +%endif + +%prep +%if %{has_go_rpm_macros} +%goprep %{?rhel:-k} +%else +%autosetup +%endif + +%if 0%{?fedora} +%generate_buildrequires +%go_generate_buildrequires +%endif + +%build +%undefine _auto_set_build_flags +export %gomodulesmode +%{?gobuilddir:export GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}"} +%meson %setup_flags "-Dgobuildflags=[%(echo %{expand:%gocompilerflags} | sed -e s/"^"/"'"/ -e s/" "/"', '"/g -e s/"$"/"'"/), '-tags', '"rpm_crashtraceback\ ${BUILDTAGS:-}"', '-a', '-v', '-x']" -Dgoldflags='%{?currentgoldflags} -B 0x%(head -c20 /dev/urandom|od -An -tx1|tr -d " \n") -compressdwarf=false -linkmode=external -extldflags "%{build_ldflags} %{?__golang_extldflags}"' +%meson_build + +%install +%meson_install +install --directory %{buildroot}%{_unitdir} +install --directory %{buildroot}%{_sysconfdir}/rhc +ln -sf yggdrasil.service %{buildroot}%{_unitdir}/rhcd.service +ln -sf ../yggdrasil/config.toml %{buildroot}%{_sysconfdir}/rhc/config.toml +%if %{has_go_rpm_macros} +%gopkginstall +%endif + +%if %{with check} +%check +%if %{has_go_rpm_macros} +%gocheck +%else +%meson_test +%endif +%endif + +%post +%systemd_post rhc-canonical-facts.timer +if [ $1 -eq 1 ]; then + systemctl daemon-reload + systemctl start rhc-canonical-facts.timer +fi + +%preun +%systemd_preun rhc-canonical-facts.timer + +%postun +%systemd_postun_with_restart rhc-canonical-facts.timer +if [ $1 -eq 0 ]; then + systemctl daemon-reload +fi + +%files +%license LICENSE +%doc CONTRIBUTING.md README.md +%{_bindir}/* +%{_datadir}/bash-completion/completions/* +%{_mandir}/man1/* +%{_unitdir}/* +%{_presetdir}/* + +%files compat +%{_unitdir}/rhcd.service +%{_sysconfdir}/rhc/config.toml + +%changelog +%if (0%{?fedora} || 0%{?rhel} >= 9) +%autochangelog +%endif diff --git a/doc/meson.build b/doc/meson.build new file mode 100644 index 0000000..5db36e4 --- /dev/null +++ b/doc/meson.build @@ -0,0 +1,8 @@ +custom_target( + 'rhc.1', + output: 'rhc.1', + capture: true, + command: [rhc, '--generate-man-page'], + install: true, + install_dir: join_paths(get_option('mandir'), 'man1'), +) diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..b33f009 --- /dev/null +++ b/meson.build @@ -0,0 +1,54 @@ +project('rhc', version: '0.3.0', meson_version: '>= 0.56.0') + +go = find_program('go') +systemd = dependency('systemd', version: '>=239') +bash_completion = dependency('bash-completion') + +if get_option('vendor') + meson.add_dist_script(join_paths('scripts', 'vendor.sh')) +endif + +goldflags = get_option('goldflags') +goldflags += ' -X "main.Version=' + meson.project_version() + '"' +goldflags += ' -X "main.ShortName=rhc"' +goldflags += ' -X "main.LongName=rhc"' +goldflags += ' -X "main.PrefixDir=' + get_option('prefix') + '"' +goldflags += ' -X "main.BinDir=' + get_option('bindir') + '"' +goldflags += ' -X "main.SbinDir=' + get_option('sbindir') + '"' +goldflags += ' -X "main.LibexecDir=' + get_option('libexecdir') + '"' +goldflags += ' -X "main.SysconfDir=' + get_option('sysconfdir') + '"' +goldflags += ' -X "main.DataDir=' + get_option('datadir') + '"' +goldflags += ' -X "main.DatarootDir=' + get_option('datadir') + '"' +goldflags += ' -X "main.ManDir=' + get_option('mandir') + '"' +goldflags += ' -X "main.DocDir=' + get_option('prefix') / 'doc' + '"' +goldflags += ' -X "main.LocalstateDir=' + get_option('localstatedir') + '"' +goldflags += ' -X "main.ServiceName=yggdrasil"' + +gobuildflags = get_option('gobuildflags') + +rhc = custom_target( + 'rhc', + build_always_stale: true, + output: 'rhc', + command: [ + go, + 'build', + gobuildflags, + '-o', '@OUTPUT@', + '-ldflags', goldflags, + meson.project_source_root(), + ], + install: true, + install_dir: get_option('bindir'), +) + +subdir('data') +subdir('dist') +subdir('doc') + +summary( + { + 'vendor': get_option('vendor'), + }, + section: 'Options', +) diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..503b72f --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,24 @@ +option( + 'build_srpm', + type: 'boolean', + value: false, + description: 'Enable SRPM builds', +) +option( + 'gobuildflags', + type: 'array', + value: ['-buildmode', 'pie'], + description: 'Additional build flags to be passed to the Go compiler', +) +option( + 'goldflags', + type: 'string', + value: '', + description: 'Additional linker flags to be passed to the Go compiler', +) +option( + 'vendor', + type: 'boolean', + value: false, + description: 'Bundle go module dependencies in the vendor directory', +) diff --git a/rhc.spec.in b/rhc.spec.in deleted file mode 100644 index dd80fda..0000000 --- a/rhc.spec.in +++ /dev/null @@ -1,116 +0,0 @@ -# This RPM spec file exists primarily to enable CI/CD pipelines and automatic -# testing of built RPMs. This RPM can be used as a suitable baseline for a -# proper distribution package, but changes should be made to suit the needs of -# the package. - -%define debug_package %{nil} -%define source_date_epoch_from_changelog 0 - -Name: @LONGNAME@ -Version: @VERSION@ -Release: 0%{?dist} -Epoch: 1 -Summary: Client for registering Red Hat Enterprise Linux systems -License: GPL-3.0-only -URL: https://github.com/redhatinsights/rhc - -Source0: %{name}-%{version}.tar.gz - -ExclusiveArch: %{go_arches} - -Requires: insights-client -Requires: yggdrasil >= 0.4 -Requires: yggdrasil-worker-package-manager -Requires: subscription-manager - -BuildRequires: golang -BuildRequires: dbus-devel -BuildRequires: systemd-devel -BuildRequires: systemd - - -%description -rhc is a client that registers a system with RHSM and activates the Red Hat yggd -MQTT client. - -%package compat -Summary: Transition package to support migrating from rhcd to yggd - -Requires: yggdrasil >= 0.4.2 -Recommends: rhc - -%description compat -Transition package to support migrating from rhcd to yggd. - -%prep -%setup -c - - -%build -cd %{name}-%{version} -make PREFIX=%{_prefix} \ - SYSCONFDIR=%{_sysconfdir} \ - LOCALSTATEDIR=%{_localstatedir} \ - SHORTNAME=@SHORTNAME@ \ - LONGNAME=@LONGNAME@ \ - PKGNAME=@PKGNAME@ \ - TOPICPREFIX=@TOPICPREFIX@ \ - VERSION=%{version} \ - DATAHOST=@DATAHOST@ \ - SERVICENAME=@SERVICENAME@ \ - 'PROVIDER=@PROVIDER@' - - -%install -cd %{name}-%{version} -make PREFIX=%{_prefix} \ - SYSCONFDIR=%{_sysconfdir} \ - LOCALSTATEDIR=%{_localstatedir} \ - DESTDIR=%{buildroot} \ - SHORTNAME=@SHORTNAME@ \ - LONGNAME=@LONGNAME@ \ - PKGNAME=@PKGNAME@ \ - TOPICPREFIX=@TOPICPREFIX@ \ - VERSION=%{version} \ - DATAHOST=@DATAHOST@ \ - SERVICENAME=@SERVICENAME@ \ - 'PROVIDER=@PROVIDER@' \ - install -install --directory %{buildroot}%{_unitdir} -install --directory %{buildroot}%{_sysconfdir}/rhc -ln -sf yggdrasil.service %{buildroot}%{_unitdir}/rhcd.service -ln -sf ../yggdrasil/config.toml %{buildroot}%{_sysconfdir}/rhc/config.toml - -%post -%systemd_post rhc-canonical-facts.timer -if [ $1 -eq 1 ]; then - systemctl daemon-reload - systemctl start rhc-canonical-facts.timer -fi - -%preun -%systemd_preun rhc-canonical-facts.timer - -%postun -%systemd_postun_with_restart rhc-canonical-facts.timer -if [ $1 -eq 0 ]; then - systemctl daemon-reload -fi - -%files -%doc %{name}-%{version}/README.md -%{_bindir}/@SHORTNAME@ -%{_datadir}/bash-completion/completions/* -%{_mandir}/man1/* -%{_unitdir}/* -%{_presetdir}/* - - -%files compat -%{_unitdir}/rhcd.service -%{_sysconfdir}/rhc/config.toml - -%changelog -%if (0%{?fedora} || 0%{?rhel} >= 9) -%autochangelog -%endif diff --git a/scripts/vendor.sh b/scripts/vendor.sh new file mode 100644 index 0000000..e8cce6b --- /dev/null +++ b/scripts/vendor.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +pushd "${MESON_DIST_ROOT}" || exit 1 +go mod vendor +popd || exit 1