Hi everyone,
I recently became a co-maintainer of gh, and I noticed that the package's `%goipath` is incorrectly set to `github.com/cli/cli` when, according to the go.mod, it should be `github.com/cli/cli/v2`. How should I go about correcting this? We have overridden the package's `%goname` to `gh`, so I can correct the `%goipath` without again having to go through the review process, but the `%godevelname` will change from `golang-github-cli-devel` to `golang-github-cli-2-devel`. Besides obsoleting the old package (see below), is there anything else I need to do?
``` %global godevelheader %{expand: Obsoletes: golang-github-cli-devel < 2.4.0-3 } ```
Thank you for your input, Maxwell
On 1/10/22 07:04, Maxwell G wrote:
Hi everyone,
I recently became a co-maintainer of gh, and I noticed that the package's `%goipath` is incorrectly set to `github.com/cli/cli` when, according to the go.mod, it should be `github.com/cli/cli/v2`. How should I go about correcting this? We have overridden the package's `%goname` to `gh`, so I can correct the `%goipath` without again having to go through the review process, but the `%godevelname` will change from `golang-github-cli-devel` to `golang-github-cli-2-devel`. Besides obsoleting the old package (see below), is there anything else I need to do?
%global godevelheader %{expand: Obsoletes: golang-github-cli-devel < 2.4.0-3 }Thank you for your input, Maxwell
This is correct but add the Provides too. Added couple of tweaks but haven't tested them yet, especially the SOURCE_DATE_EPOCH. Try to build it and see if the output is coherent.
# Generated by go2rpm 1.5.0 %bcond_without check
# https://github.com/cli/cli %global goipath github.com/cli/cli/v2 %global forgeurl https://github.com/cli/cli Version: 2.4.0
%gometa
%global goname gh
%global godevelheader %{expand: Obsoletes: golang-github-cli-devel < 2.4.0-3 Provides: golang-github-cli-devel < %{version}-%{release} }
%global common_description %{expand: GitHub’s official command line tool.}
%global golicenses LICENSE %global godocs README.md
Name: %{goname} Release: %autorelease Summary: GitHub’s official command line tool
License: MIT URL: %{gourl} Source0: %{gosource}
BuildRequires: git BuildRequires: go-rpm-macros
%description %{common_description}
%gopkg
%prep %goprep
%generate_buildrequires %go_generate_buildrequires
%build export LDFLAGS="-X github.com/cli/cli/v2/internal/build.Version=%{version}-Fedora \ -X github.com/cli/cli/v2/internal/build.Date=$(date -d@"$SOURCE_DATE_EPOCH" +%Y-%m-%d)"
%gobuild -o %{gobuilddir}/cmd/%{name} %{goipath}/cmd/%{name}
%{gobuilddir}/cmd/%{name} completion bash > %{name}.bash %{gobuilddir}/cmd/%{name} completion fish > %{name}.fish %{gobuilddir}/cmd/%{name} completion zsh > %{name}.zsh
%install %gopkginstall install -m 0755 -vd %{buildroot}%{_bindir} install -m 0755 -vp %{gobuilddir}/cmd/%{name} %{buildroot}%{_bindir}/
install -Dp %{name}.bash %{buildroot}%{_datadir}/bash-completion/completions/%{name} install -Dp %{name}.fish %{buildroot}%{_datadir}/fish/vendor_completions.d/%{name}.fish install -Dp %{name}.zsh %{buildroot}%{_datadir}/zsh/site-functions/_%{name}
%if %{with check} %check # pkg/liveshare fails with golang-1.18 %gocheck -d pkg/liveshare %endif
%files %license LICENSE %doc README.md %{_bindir}/%{name} %dir %{_datadir}/bash-completion %dir %{_datadir}/bash-completion/completions %{_datadir}/bash-completion/completions/%{name} %dir %{_datadir}/fish %dir %{_datadir}/fish/vendor_completions.d %{_datadir}/fish/vendor_completions.d/%{name}.fish %dir %{_datadir}/zsh %dir %{_datadir}/zsh/site-functions %{_datadir}/zsh/site-functions/_%{name}
%gopkgfiles
%changelog %autochangelog
Hi Robert-André,
On Monday, January 10, 2022 8:12:02 PM CST Robert-André Mauchin wrote:
This is correct but add the Provides too.
According to the Packaging Guidelines[1]: "If a package supersedes/replaces an existing package without being a sufficiently compatible replacement as defined above, use only the Obsoletes: line from the above example." I purposely left it out, because changing the ipath also changes the destination from `/usr/share/gocode/src/github.com/cli/cli` to `/usr/share/gocode/src/github.com/cli/cli/v2`. Is that still "sufficiently compatible"?
[1]: https://docs.fedoraproject.org/en-US/packaging-guidelines/#renaming-or-repla...
Added couple of tweaks but haven't tested them yet, especially the SOURCE_DATE_EPOCH. Try to build it and see if the output is coherent.
Thank you for the suggestions. I was already going to change the version to use the macro, but assuming it works, the SOURCE_DATE_EPOCH change is much nicer than manually specifying the date.
Thanks again, Maxwell
golang@lists.fedoraproject.org