#3 Fix vendoring for devel package
Merged 2 years ago by mattia. Opened 2 years ago by eclipseo.
rpms/ eclipseo/reg without_library  into  rawhide

file modified
+86 -123
@@ -1,9 +1,43 @@ 

+ # Generated by go2rpm 1.5.0

+ %bcond_without check

+ 

+ %if 0%{?epel}

+ %bcond_without bundled

+ %endif

+ 

+ # Redefine macros for EPEL

+ %if 0%{?epel}

+   %global gobuilddir %{_builddir}/%{name}-%{version}/_build

+   %global gourl https://%{goipath}

+   %global gosource %{gourl}/archive/v%{version}/%{name}-%{version}.tar.gz

+   %define gobuild(o:) %{expand:

+     # https://bugzilla.redhat.com/show_bug.cgi?id=995136#c12

+     %global _dwz_low_mem_die_limit 0

+     %ifnarch ppc64

+     go build -buildmode pie -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-}%{?currentgoldflags} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags %{?__golang_extldflags}' -compressdwarf=false" -a -v -x %{?**};

+     %else

+     go build                -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-}%{?currentgoldflags} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags %{?__golang_extldflags}' -compressdwarf=false" -a -v -x %{?**};

+     %endif

+   }

+   %define goprep(:k) %{expand:

+     if [[ ! -e "%{gobuilddir}/bin" ]] ; then

+       install -m 0755 -vd "%{gobuilddir}/bin"

+       export GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}/usr/share/gocode"

+     fi

+     if [[ ! -e "%{gobuilddir}/src/%{goipath}" ]] ; then

+       install -m 0755 -vd "$(dirname %{gobuilddir}/src/%{goipath})"

+       ln -fs "%{_builddir}/%{name}-%{version}" "%{gobuilddir}/src/%{goipath}"

+     fi

+   }

+ %endif

+ 

  # https://github.com/genuinetools/reg

- # EPEL build is curently broken due to golang macros not working

  %global goipath         github.com/genuinetools/reg

  Version:                0.16.1

  

+ %if !0%{?epel}

  %gometa

+ %endif

  

  %global common_description %{expand:

  Docker registry v2 command line client and repo listing generator with security
@@ -13,10 +47,9 @@ 

  %global godocs          VERSION.txt README.md

  

  Name:       reg

- Release:    4%{?dist}

+ Release:    5%{?dist}

  Summary:    Docker registry v2 command line client

  

- 

  License:    MIT

  URL:        %{gourl}

  Source0:    %{gosource}
@@ -30,90 +63,44 @@ 

  # https://github.com/genuinetools/reg/pull/200

  Patch0: fix-row-cell-index-for-server-searching-feature.patch

  

- BuildRequires:  golang

- BuildRequires:  systemd-rpm-macros

- BuildRequires:  golang-ipath(golang.org/x/net)

- BuildRequires:  golang-ipath(golang.org/x/sys)

- BuildRequires:  golang-ipath(golang.org/x/text)

- 

- # These are not packaged in EPEL

- %if 0%{!?epel}

- BuildRequires:  golang-ipath(github.com/Azure/go-ansiterm)

- BuildRequires:  golang-ipath(github.com/containerd/containerd)

- BuildRequires:  golang-ipath(github.com/davecgh/go-spew)

- BuildRequires:  golang-ipath(github.com/deckarep/golang-set)

- BuildRequires:  golang-ipath(github.com/docker/cli)

- BuildRequires:  golang-ipath(github.com/docker/distribution)

- BuildRequires:  golang-ipath(github.com/docker/docker)

- BuildRequires:  golang-ipath(github.com/docker/docker-credential-helpers)

- BuildRequires:  golang-ipath(github.com/docker/go-connections)

- BuildRequires:  golang-ipath(github.com/docker/go-units)

- BuildRequires:  golang-ipath(github.com/docker/libtrust)

- BuildRequires:  golang-ipath(github.com/fernet/fernet-go)

- BuildRequires:  golang-ipath(github.com/gogo/protobuf)

- BuildRequires:  golang-ipath(github.com/golang/protobuf)

- BuildRequires:  golang-ipath(github.com/google/go-cmp)

- BuildRequires:  golang-ipath(github.com/gorilla/mux)

- BuildRequires:  golang-ipath(github.com/grpc-ecosystem/grpc-gateway)

- BuildRequires:  golang-ipath(github.com/mitchellh/go-wordwrap)

- BuildRequires:  golang-ipath(github.com/morikuni/aec)

- BuildRequires:  golang-ipath(github.com/opencontainers/go-digest)

- BuildRequires:  golang-ipath(github.com/opencontainers/image-spec)

- BuildRequires:  golang-ipath(github.com/opencontainers/runc)

- BuildRequires:  golang-ipath(github.com/pkg/errors)

- BuildRequires:  golang-ipath(github.com/pmezard/go-difflib)

- BuildRequires:  golang-ipath(github.com/shurcooL/httpfs)

- BuildRequires:  golang-ipath(github.com/sirupsen/logrus)

- BuildRequires:  golang-ipath(github.com/stretchr/testify)

- BuildRequires:  golang-ipath(google.golang.org/genproto)

- BuildRequires:  golang-ipath(google.golang.org/grpc)

+ %if 0%{?epel}

+ ExclusiveArch:  %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 aarch64 %{arm}}

+ BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}

+ %endif

+ 

+ %if 0%{?epel} && 0%{?epel} < 8

+ BuildRequires: systemd

+ %else

+ BuildRequires: systemd-rpm-macros

  %endif

  

- # The following section is populated by parsing the modules.txt file

- # in the vendor dir of the source code.

- #

- # Bundled Provides are defined as per Fedora Guidelines:

- #   https://fedoraproject.org/wiki/Packaging:Guidelines#Bundling_and_Duplication_of_system_libraries

- #

- Provides: bundled(golang(github.com/coreos/clair)) = 2.0.1-0.20190910143208

- Provides: bundled(golang(github.com/genuinetools/pkg)) = 0.0.0-20181022210355

- Provides: bundled(golang(github.com/konsorten/go-windows-terminal-sequences)) = 1.0.1

- Provides: bundled(golang(github.com/Microsoft/go-winio)) = 0.4.14

- Provides: bundled(golang(github.com/Microsoft/hcsshim)) = 0.8.6

- Provides: bundled(golang(github.com/peterhellberg/link)) = 1.0.0

- 

- # These are not packaged in EPEL

- # We will use the bundled modules

- %if 0%{?epel}

- Provides: bundled(golang(github.com/Azure/go-ansiterm)) = 0.0.0-20170929234023

- Provides: bundled(golang(github.com/containerd/containerd)) = 1.2.9

- Provides: bundled(golang(github.com/davecgh/go-spew)) = 1.1.1

- Provides: bundled(golang(github.com/deckarep/golang-set)) = 1.7.1

- Provides: bundled(golang(github.com/docker/cli)) = 0.0.0-20190913211141

- Provides: bundled(golang(github.com/docker/distribution)) = 2.7.1

- Provides: bundled(golang(github.com/docker/docker)) = 1.4.2-0.20190916154449

- Provides: bundled(golang(github.com/docker/docker-credential-helpers)) = 0.6.3

- Provides: bundled(golang(github.com/docker/go-connections)) = 0.4.0

- Provides: bundled(golang(github.com/docker/go-units)) = 0.4.0

- Provides: bundled(golang(github.com/docker/libtrust)) = 0.0.0-20160708172513

- Provides: bundled(golang(github.com/fernet/fernet-go)) = 0.0.0-20180830025343

- Provides: bundled(golang(github.com/gogo/protobuf)) = 1.3.0

- Provides: bundled(golang(github.com/golang/protobuf)) = 1.2.0

- Provides: bundled(golang(github.com/google/go-cmp)) = 0.3.1

- Provides: bundled(golang(github.com/gorilla/mux)) = 1.7.3

- Provides: bundled(golang(github.com/grpc-ecosystem/grpc-gateway)) = 1.11.1

- Provides: bundled(golang(github.com/mitchellh/go-wordwrap)) = 1.0.0

- Provides: bundled(golang(github.com/morikuni/aec)) = 0.0.0-20170113033406

- Provides: bundled(golang(github.com/opencontainers/go-digest)) = 1.0.0-rc1

- Provides: bundled(golang(github.com/opencontainers/image-spec)) = 1.0.1

- Provides: bundled(golang(github.com/opencontainers/runc)) = 0.1.1

- Provides: bundled(golang(github.com/pkg/errors)) = 0.8.1

- Provides: bundled(golang(github.com/pmezard/go-difflib)) = 1.0.0

- Provides: bundled(golang(github.com/shurcooL/httpfs)) = 0.0.0-20190707220628

- Provides: bundled(golang(github.com/sirupsen/logrus)) = 1.4.2

- Provides: bundled(golang(github.com/stretchr/testify)) = 1.2.2

- Provides: bundled(golang(google.golang.org/genproto)) = 0.0.0-20180817151627

- Provides: bundled(golang(google.golang.org/grpc)) = 1.23.1

+ %if %{without bundled}

+ BuildRequires:  golang(github.com/coreos/clair/api/v3/clairpb)

+ BuildRequires:  golang(github.com/docker/cli/cli/config)

+ BuildRequires:  golang(github.com/docker/cli/cli/config/types)

+ BuildRequires:  golang(github.com/docker/distribution)

+ BuildRequires:  golang(github.com/docker/distribution/manifest/manifestlist)

+ BuildRequires:  golang(github.com/docker/distribution/manifest/schema1)

+ BuildRequires:  golang(github.com/docker/distribution/manifest/schema2)

+ BuildRequires:  golang(github.com/docker/distribution/reference)

+ BuildRequires:  golang(github.com/docker/docker/api/types)

+ BuildRequires:  golang(github.com/docker/docker/api/types/container)

+ BuildRequires:  golang(github.com/docker/docker/client)

+ BuildRequires:  golang(github.com/docker/docker/pkg/jsonmessage)

+ BuildRequires:  golang(github.com/docker/docker/pkg/term)

+ BuildRequires:  golang(github.com/genuinetools/pkg/cli)

+ BuildRequires:  golang(github.com/gorilla/mux)

+ BuildRequires:  golang(github.com/mitchellh/go-wordwrap)

+ BuildRequires:  golang(github.com/opencontainers/go-digest)

+ BuildRequires:  golang(github.com/peterhellberg/link)

+ BuildRequires:  golang(github.com/shurcooL/httpfs/html/vfstemplate)

+ BuildRequires:  golang(github.com/sirupsen/logrus)

+ BuildRequires:  golang(google.golang.org/grpc)

+ 

+ %if %{with check}

+ # Tests

+ BuildRequires:  golang(github.com/google/go-cmp/cmp)

+ %endif

  %endif

  

  Obsoletes: reg-server < %{version}
@@ -121,49 +108,24 @@ 

  %description

  %{common_description}

  

- %gopkg

- 

  %prep

+ %if 0%{?epel}

  %setup -q -n %{name}-%{version}

- %patch0 -p1

- 

- # Do not remove 'vendor' dir entirely

- %goprep -ke

- 

- # Remove bundled modules packaged in Fedora

- rm -rf vendor/golang.org

- 

- %if 0%{!?epel}

- rm -rf vendor/github.com/Azure

- rm -rf vendor/github.com/containerd

- rm -rf vendor/github.com/davecgh

- rm -rf vendor/github.com/deckarep

- rm -rf vendor/github.com/docker

- rm -rf vendor/github.com/fernet

- rm -rf vendor/github.com/gogo

- rm -rf vendor/github.com/golang

- rm -rf vendor/github.com/google

- rm -rf vendor/github.com/gorilla

- rm -rf vendor/github.com/grpc-ecosystem

- rm -rf vendor/github.com/mitchellh

- rm -rf vendor/github.com/morikuni

- rm -rf vendor/github.com/opencontainers

- rm -rf vendor/github.com/pkg

- rm -rf vendor/github.com/pmezard

- rm -rf vendor/github.com/shurcooL

- rm -rf vendor/github.com/sirupsen

- rm -rf vendor/github.com/stretchr

- rm -rf vendor/google.golang.org

  %endif

+ %goprep %{?with_bundled:-k}

+ %patch0 -p1

  

  %build

+ # When vendoring, use Go modules

+ %if %{with bundled}

+ %global gomodulesmode GO111MODULE=on

+ export GO111MODULE=on

+ export GOFLAGS=-mod=vendor

+ %endif

  %gobuild -o %{gobuilddir}/bin/reg %{goipath}

  

- 

  %install

- 

  # Install the binaries

- %gopkginstall

  install -m 0755 -vd                     %{buildroot}%{_bindir}

  install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/

  
@@ -182,7 +144,6 @@ 

  mkdir -p %{buildroot}%{_sysconfdir}/sysconfig

  install -p -m 0640 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/%{name}-server

  

- 

  %post

  %systemd_post %{name}-server.service

  
@@ -192,7 +153,6 @@ 

  %postun

  %systemd_postun %{name}-server.service

  

- 

  %files

  %doc README.md Dockerfile Makefile

  %license LICENSE
@@ -202,9 +162,12 @@ 

  %config(noreplace) %{_sharedstatedir}/%{name}-server/static/

  %config(noreplace) %{_sharedstatedir}/%{name}-server/templates/

  

- %gopkgfiles

- 

  %changelog

+ * Sun Sep 19 2021 Robert-André Mauchin <zebob.m@gmail.com> - 0.16.1-5

+ - Fix vendoring for devel package

+ - Make compatible with EPEL8

+ - Close: rhbz#1941017, rhbz#1933618

+ 

  * Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.16.1-4

  - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

  

Make compatible with EPEL8
Close: rhbz#1941017, rhbz#1933618

This is the version with the devel package removed, let me know if this is okay. I have another version on my fork with the devel package kept.

I have the missing dependencies built in side tags:

Side tag 'f36-build-side-46049'
Side tag 'f35-build-side-46051'
Side tag 'f34-build-side-46053'

Let me know if you want me to build it in each side tag.

You can also build it in EPEL7 and EPEL8.

Also to answer your message on Bugzilla, I do not seek to maintain this package, I already have a lot of Go packages to handle, but if you need help sometimes, just send me a mail.

Looks fine to me. We don't need/use the devel package, I am fine with not shipping it...

Do you want to merge and build? or want me to?

Thank you @eclipseo. I agree with @kevin to not ship the devel package.
I'll merge this PR and proceed in building reg in the sidetags.

Pull-Request has been merged by mattia

2 years ago

@eclipseo I've built reg in the f34, f35 and f36 sidetags. Do you want me to create the updates or will you take care of that? I see there are many golang packages in the sidetags which seem unrelated to reg.

I will push the updates.

Metadata