Re: RPM packaging help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Robert,
Thank you,  this is very helpful, so I guess the questions I have is if I'm reading your email correctly 

1. Is for now we need to deal with the vendor directory, but should start working to packaging some of the go-lang dependencies as rpms?

2. With the bundled vendor directory we have a "functional" build of the rpm that should work in theory?


On Sun, Aug 13, 2023, 5:24 AM Robert-André Mauchin <zebob.m@xxxxxxxxx> wrote:
On 8/10/23 15:43, Andrew Heath wrote:
> All,
> My name is Andrew, and I have been working with the Fedora Infra team and we are trying to
> create some RPMs for some projects that we are working on, one of the RPMs we need to create
> is for the Ansible receptor[1 <https://github.com/ansible/receptor>]. I have a copy of the
> spec file from downstream Red Hat that gives some guidance but where its a mix of python and
> go-lang I was wondering if I could have some guidance from more experienced packers on how
> to package up the application correctly so that we can get the package in use for the Fedora
> Infra.
>
> Links:
> [1]: https://github.com/ansible/receptor <https://github.com/ansible/receptor>
>
> --
> Sincerely,
> Andrew Heath
> aheath1992@xxxxxxxxx <mailto:aheath1992@xxxxxxxxx>
>

Ok, let's roll, you will end up with a Frankstein SPEC, be warned. Here is the process:

Let's start with:

$ go2rpm github.com/ansible/receptor --name receptor


We clean up a bit the description, the docs and we got:

# receptor.spec
# Generated by go2rpm 1.9.0
%bcond_without check

# https://github.com/ansible/receptor
%global goipath         github.com/ansible/receptor
Version:                1.4.1

%gometa -f

%global goname receptor

%global common_description %{expand:
Receptor is an overlay network intended to ease the distribution of work across
a large and dispersed collection of workers. Receptor nodes establish
peer-to-peer connections with each other via existing networks. Once connected,
the Receptor mesh provides datagram (UDP-like) and stream (TCP-like)
capabilities to applications, as well as robust unit-of-work handling with
resiliency against transient network failures.

See the readthedocs page for Receptor at:

https://receptor.readthedocs.io/en/latest}

%global golicenses      LICENSE.md
%global godocs          docs tools README.md

Name:           %{goname}
Release:        %autorelease
Summary:        Multi-service relayer with remote execution and orchestration capabilities

License:        Apache-2.0
URL:            %{gourl}
Source:         %{gosource}

%description %{common_description}

%gopkg

%prep
%goprep
%autopatch -p1
mv receptor-python-worker/README.md README-receptor-python-worker.md
mv receptorctl/README.md README-receptorctl.md


%generate_buildrequires
%go_generate_buildrequires

%build
%gobuild -o %{gobuilddir}/bin/receptor %{goipath}/cmd/receptor-cl

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

%if %{with check}
%check
%gocheck
%endif

%files
%license LICENSE.md
%doc docs tools README.md
%{_bindir}/receptor

%gopkgfiles

%changelog
%autochangelog


Let's do a mockbuild on this and see what deps are needed for the Go binary:

$ spectool -g *.spec
$ fedpkg --release f40 mockbuild --mock-config /home/bob/packaging/mock2.cfg -N


Ok I had to make a small detour and send a patch upstream to work with Go 1.21 with is in F40:

# https://github.com/ansible/receptor/pull/816
Patch:          0001-Bump-quic-go-to-0.37.4.patch


Ok now we have our missing dependencies:

No matching package to install: 'golang(github.com/ghjm/cmdline)'
No matching package to install: 'golang(github.com/jupp0r/go-priority-queue)'
No matching package to install: 'golang(github.com/pbnjay/memory)'
No matching package to install: 'golang(github.com/prep/socketpair)'

rpmname.py github.com/ghjm/cmdline \
            github.com/jupp0r/go-priority-queue \
            github.com/pbnjay/memory \
            github.com/prep/socketpair

We thus need to package these new packages:

golang-github-ghjm-cmdline
golang-github-jupp0r-priority-queue
golang-github-pbnjay-memory
golang-github-prep-socketpair

You need to run go2rpm for each package. I've build them, there is no dependency hell, they
scratch build ok against Rawhide.

So now, we hit a snag during the build:

# github.com/ansible/receptor/pkg/workceptor
_build/src/github.com/ansible/receptor/pkg/workceptor/kubernetes.go:682:16:
exec.StreamWithContext undefined (type "k8s.io/client-go/tools/remotecommand".Executor has
no field or method StreamWithContext)


Our Kubernetes in Fedora is outdated. So we'll need to update it before being able to build
receptor.

For now we'll take the bundled route, we add a bundled condition, add an archive with
vendored deps and stuff.

# Generated by go2rpm 1.9.0
%bcond_without check
%bcond_without bundled
%if %{defined rhel}
%bcond_without bundled
%endif

# https://github.com/ansible/receptor
%global goipath         github.com/ansible/receptor
Version:                1.4.1

%gometa -f

%global goname receptor

%global common_description %{expand:
Receptor is an overlay network intended to ease the distribution of work across
a large and dispersed collection of workers. Receptor nodes establish
peer-to-peer connections with each other via existing networks. Once connected,
the Receptor mesh provides datagram (UDP-like) and stream (TCP-like)
capabilities to applications, as well as robust unit-of-work handling with
resiliency against transient network failures.

See the readthedocs page for Receptor at:

https://receptor.readthedocs.io/en/latest}

%global golicenses      LICENSE.md %{?with_bundled:vendor/modules.txt}
%global godocs          docs tools README.md

Name:           %{goname}
Release:        %autorelease
Summary:        Multi-service relayer with remote execution and orchestration capabilities

# License for github.com/ansible/receptor: Apache-2.0
# License for github.com/creack/pty: MIT
# License for github.com/davecgh/go-spew: ISC
# License for github.com/emicklei/go-restful/v3: MIT
# License for github.com/fortytw2/leaktest: BSD-3-Clause
# License for github.com/fsnotify/fsnotify: BSD-3-Clause
# License for github.com/ghjm/cmdline: Apache-2.0
# License for github.com/go-logr/logr: Apache-2.0
# License for github.com/go-openapi/jsonpointer: Apache-2.0
# License for github.com/go-openapi/jsonreference: Apache-2.0
# License for github.com/go-openapi/swag: Apache-2.0
# License for github.com/go-task/slim-sprig: MIT
# License for github.com/gogo/protobuf: BSD-3-Clause
# License for github.com/golang-jwt/jwt/v4: MIT
# License for github.com/golang/mock: Apache-2.0
# License for github.com/golang/protobuf: BSD-3-Clause
# License for github.com/google/gnostic: Apache-2.0
# License for github.com/google/go-cmp: BSD-3-Clause
# License for github.com/google/gofuzz: Apache-2.0
# License for github.com/google/pprof: Apache-2.0
# License for github.com/google/shlex: Apache-2.0
# License for github.com/google/uuid: BSD-3-Clause
# License for github.com/gorilla/websocket: BSD-2-Clause
# License for github.com/imdario/mergo: BSD-3-Clause
# License for github.com/josharian/intern: MIT
# License for github.com/json-iterator/go: MIT
# License for github.com/jupp0r/go-priority-queue: MIT
# License for github.com/mailru/easyjson: MIT
# License for github.com/minio/highwayhash: Apache-2.0
# License for github.com/moby/spdystream: Apache-2.0
# License for github.com/modern-go/concurrent: Apache-2.0
# License for github.com/modern-go/reflect2: Apache-2.0
# License for github.com/munnerz/goautoneg: BSD-3-Clause
# License for github.com/onsi/ginkgo/v2: MIT
# License for github.com/pbnjay/memory: BSD-3-Clause
# License for github.com/pmezard/go-difflib: BSD-3-Clause
# License for github.com/prep/socketpair: BSD-3-Clause
# License for github.com/quic-go/qtls-go1-19: BSD-3-Clause
# License for github.com/quic-go/qtls-go1-20: BSD-3-Clause
# License for github.com/quic-go/quic-go: MIT
# License for github.com/rogpeppe/go-internal: BSD-3-Clause
# License for github.com/songgao/water: BSD-3-Clause
# License for github.com/spf13/pflag: BSD-3-Clause
# License for github.com/stretchr/testify: MIT
# License for github.com/vishvananda/netlink: Apache-2.0
# License for github.com/vishvananda/netns: Apache-2.0
# License for golang.org/x/crypto: BSD-3-Clause
# License for golang.org/x/exp: BSD-3-Clause
# License for golang.org/x/mod: BSD-3-Clause
# License for golang.org/x/net: BSD-3-Clause
# License for golang.org/x/oauth2: BSD-3-Clause
# License for golang.org/x/sys: BSD-3-Clause
# License for golang.org/x/term: BSD-3-Clause
# License for golang.org/x/text: BSD-3-Clause
# License for golang.org/x/time: BSD-3-Clause
# License for golang.org/x/tools: BSD-3-Clause
# License for google.golang.org/appengine: Apache-2.0
# License for google.golang.org/protobuf: BSD-3-Clause
# License for gopkg.in/inf.v0: BSD-3-Clause
# License for gopkg.in/yaml.v2: Apache-2.0 AND MIT
# License for gopkg.in/yaml.v3: MIT AND Apache-2.0
# License for k8s.io/api: Apache-2.0
# License for k8s.io/apimachinery: Apache-2.0
# License for k8s.io/client-go: Apache-2.0
# License for k8s.io/klog/v2: Apache-2.0
# License for k8s.io/kube-openapi: Apache-2.0
# License for k8s.io/utils: Apache-2.0
# License for sigs.k8s.io/json: Apache-2.0 AND BSD-3-Clause
# License for sigs.k8s.io/structured-merge-diff/v4: Apache-2.0
# License for sigs.k8s.io/yaml: MIT AND BSD-3-Clause
License:        Apache-2.0 AND ISC AND MIT AND BSD-3-Clause AND BSD-2-Clause
URL:            %{gourl}
Source:         %{gosource}
Source:         vendor-%{version}.tar.gz
Source:         bundle_go_deps_for_rpm.sh
# https://github.com/ansible/receptor/pull/816
Patch:          0001-Bump-quic-go-to-0.37.4.patch

%if %{with bundled}
Provides:       bundled(golang(github.com/ansible/receptor) = 1.4.1
Provides:       bundled(golang(github.com/creack/pty) = 1.1.18
Provides:       bundled(golang(github.com/davecgh/go-spew) = 1.1.1
Provides:       bundled(golang(github.com/emicklei/go-restful/v3) = 3.10.2
Provides:       bundled(golang(github.com/fortytw2/leaktest) = 1.3.0
Provides:       bundled(golang(github.com/fsnotify/fsnotify) = 1.6.0
Provides:       bundled(golang(github.com/ghjm/cmdline) = 0.1.2
Provides:       bundled(golang(github.com/go-logr/logr) = 1.2.4
Provides:       bundled(golang(github.com/go-openapi/jsonpointer) = 0.19.6
Provides:       bundled(golang(github.com/go-openapi/jsonreference) = 0.20.2
Provides:       bundled(golang(github.com/go-openapi/swag) = 0.22.3
Provides:       bundled(golang(github.com/go-task/slim-sprig) = 0.0.0-20230315git52ccab3
Provides:       bundled(golang(github.com/gogo/protobuf) = 1.3.2
Provides:       bundled(golang(github.com/golang-jwt/jwt/v4) = 4.5.0
Provides:       bundled(golang(github.com/golang/mock) = 1.6.0
Provides:       bundled(golang(github.com/golang/protobuf) = 1.5.3
Provides:       bundled(golang(github.com/google/gnostic) = 0.6.9
Provides:       bundled(golang(github.com/google/go-cmp) = 0.5.9
Provides:       bundled(golang(github.com/google/gofuzz) = 1.2.0
Provides:       bundled(golang(github.com/google/pprof) = 0.0.0-20230502git255e3b9
Provides:       bundled(golang(github.com/google/shlex) = 0.0.0-20191202gite7afc7f
Provides:       bundled(golang(github.com/google/uuid) = 1.3.0
Provides:       bundled(golang(github.com/gorilla/websocket) = 1.5.0
Provides:       bundled(golang(github.com/imdario/mergo) = 0.3.15
Provides:       bundled(golang(github.com/josharian/intern) = 1.0.0
Provides:       bundled(golang(github.com/json-iterator/go) = 1.1.12
Provides:       bundled(golang(github.com/jupp0r/go-priority-queue) = 0.0.0-20160601gitab10738
Provides:       bundled(golang(github.com/mailru/easyjson) = 0.7.7
Provides:       bundled(golang(github.com/minio/highwayhash) = 1.0.2
Provides:       bundled(golang(github.com/moby/spdystream) = 0.2.0
Provides:       bundled(golang(github.com/modern-go/concurrent) = 0.0.0-20180306gitbacd9c7
Provides:       bundled(golang(github.com/modern-go/reflect2) = 1.0.2
Provides:       bundled(golang(github.com/munnerz/goautoneg) = 0.0.0-20191010gita7dc8b6
Provides:       bundled(golang(github.com/onsi/ginkgo/v2) = 2.9.4
Provides:       bundled(golang(github.com/pbnjay/memory) = 0.0.0-20210728git7b4eea6
Provides:       bundled(golang(github.com/pmezard/go-difflib) = 1.0.0
Provides:       bundled(golang(github.com/prep/socketpair) = 0.0.0-20171228gitc2c6a7f
Provides:       bundled(golang(github.com/quic-go/qtls-go1-19) = 0.3.2
Provides:       bundled(golang(github.com/quic-go/qtls-go1-20) = 0.2.2
Provides:       bundled(golang(github.com/quic-go/quic-go) = 0.34.0
Provides:       bundled(golang(github.com/rogpeppe/go-internal) = 1.10.0
Provides:       bundled(golang(github.com/songgao/water) = 0.0.0-20200317git2b4b6d7
Provides:       bundled(golang(github.com/spf13/pflag) = 1.0.5
Provides:       bundled(golang(github.com/stretchr/testify) = 1.8.1
Provides:       bundled(golang(github.com/vishvananda/netlink) = 1.1.0
Provides:       bundled(golang(github.com/vishvananda/netns) = 0.0.4
Provides:       bundled(golang(golang.org/x/crypto) = 0.8.0
Provides:       bundled(golang(golang.org/x/exp) = 0.0.0-20230425git47ecfdc
Provides:       bundled(golang(golang.org/x/mod) = 0.10.0
Provides:       bundled(golang(golang.org/x/net) = 0.9.0
Provides:       bundled(golang(golang.org/x/oauth2) = 0.7.0
Provides:       bundled(golang(golang.org/x/sys) = 0.8.0
Provides:       bundled(golang(golang.org/x/term) = 0.8.0
Provides:       bundled(golang(golang.org/x/text) = 0.9.0
Provides:       bundled(golang(golang.org/x/time) = 0.3.0
Provides:       bundled(golang(golang.org/x/tools) = 0.8.0
Provides:       bundled(golang(google.golang.org/appengine) = 1.6.7
Provides:       bundled(golang(google.golang.org/protobuf) = 1.30.0
Provides:       bundled(golang(gopkg.in/inf.v0) = 0.9.1
Provides:       bundled(golang(gopkg.in/yaml.v2) = 2.4.0
Provides:       bundled(golang(gopkg.in/yaml.v3) = 3.0.1
Provides:       bundled(golang(k8s.io/api) = 0.27.1
Provides:       bundled(golang(k8s.io/apimachinery) = 0.27.1
Provides:       bundled(golang(k8s.io/client-go) = 0.27.1
Provides:       bundled(golang(k8s.io/klog/v2) = 2.100.1
Provides:       bundled(golang(k8s.io/kube-openapi) = 0.0.0-20230501git8b0f38b
Provides:       bundled(golang(k8s.io/utils) = 0.0.0-20230505git9f67429
Provides:       bundled(golang(sigs.k8s.io/json) = 0.0.0-20221116gitbc3834c
Provides:       bundled(golang(sigs.k8s.io/structured-merge-diff/v4) = 4.2.3
Provides:       bundled(golang(sigs.k8s.io/yaml) = 1.3.0
%endif

%description %{common_description}

%gopkg

%prep
%if %{with bundled}
%goprep -k
# unpack vendored dependencies
%setup -q -T -D -a 1 -n %{name}-%{version}
%else
%goprep
%endif
%autopatch -p1
mv receptor-python-worker/README.md README-receptor-python-worker.md
mv receptorctl/README.md README-receptorctl.md


%if %{without bundled}
%generate_buildrequires
%go_generate_buildrequires
%endif

%build
%if %{with bundled}
export GO111MODULE=on
export GOFLAGS=-mod=vendor
%endif
export LDFLAGS="-X 'github.com/ansible/receptor/internal/version.Version=%{VERSION}' "
%gobuild -o %{gobuilddir}/bin/receptor %{goipath}/cmd/receptor-cl

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

%if %{with check}
%check
export PATH="%{gobuilddir}/bin:$PATH"
# Disable various test relying on Kube and network
%gocheck -t tests/functional/mesh
%endif

%files
%license LICENSE.md %{?with_bundled:vendor/modules.txt}
%doc docs tools README.md
%{_bindir}/receptor

%gopkgfiles

%changelog
%autochangelog


Ok, it works:

INFO: Done(/home/bob/packaging/receptor/receptor-1.4.1-1.fc40.src.rpm) Config(mock-golang5)
46 minutes 59 seconds
INFO: Results and/or logs in: /home/bob/packaging/receptor/results_receptor/1.4.1/1.fc40
Finish: run


Now we need to add the Python parts. This is actually way more tricky because the Python
macros are not designed
to work with multiple packages inside one repo. It can handles "extra" packages but not
independent packages.

So we have to rewrite the macros slightly, yay:

%define pyproject_install() %{expand:\\\
specifier=$(ls %{_pyproject_wheeldir}/*.whl | xargs basename --multiple | sed -E
's/([^-]+)-([^-]+)-.+\\\.whl/\\\1==\\\2/')
TMPDIR="%{_pyproject_builddir}" %{__python3} -m pip install --root %{buildroot} --prefix
%{_prefix} --no-deps --disable-pip-version-check --progress-bar off --verbose
--ignore-installed --no-warn-script-location --no-index --no-cache-dir --find-links
%{_pyproject_wheeldir} $specifier
if [ -d %{buildroot}%{_bindir} ]; then
   %py3_shebang_fix %{buildroot}%{_bindir}/*
   rm -rfv %{buildroot}%{_bindir}/__pycache__
fi
rm -f %{_pyproject_ghost_distinfo}
site_dirs=()
# Process %%{python3_sitelib} if exists
if [ -d %{buildroot}%{python3_sitelib} ]; then
   site_dirs+=( "%{python3_sitelib}" )
fi
# Process %%{python3_sitearch} if exists and does not equal to %%{python3_sitelib}
if [ %{buildroot}%{python3_sitearch} != %{buildroot}%{python3_sitelib} ] && [ -d
%{buildroot}%{python3_sitearch} ]; then
   site_dirs+=( "%{python3_sitearch}" )
fi
# Process all *.dist-info dirs in sitelib/sitearch
for site_dir in ${site_dirs[@]}; do
   for distinfo in %{buildroot}$site_dir/*.dist-info; do
     project_name=$(basename "$distinfo" | cut -d'-' -f1)
     %global _pyproject_record
%{_builddir}/%{_pyproject_files_prefix}-${project_name}-pyproject-record
     sed -i 's/pip/rpm/' ${distinfo}/INSTALLER
     PYTHONPATH=%{_rpmconfigdir}/redhat \\
       %{__python3} -B %{_rpmconfigdir}/redhat/pyproject_preprocess_record.py \\
       --buildroot %{buildroot} --record ${distinfo}/RECORD --output %{_pyproject_record}
     rm -fv ${distinfo}/RECORD
     rm -fv ${distinfo}/REQUESTED
   done
done
}

%define pyproject_save_files() %{expand:\\\
%global _pyproject_record %{_builddir}/%{_pyproject_files_prefix}-%{*}-pyproject-record
%global pyproject_files %{_builddir}/%{_pyproject_files_prefix}-%{*}-pyproject-files
%{expr:0%{?fedora} >= 39 || 0%{?rhel} >= 10 ? "RPM_PERCENTAGES_COUNT=2" :
"RPM_PERCENTAGES_COUNT=8" } \\
%{__python3} %{_rpmconfigdir}/redhat/pyproject_save_files.py \\
   --output-files "%{pyproject_files}" \\
   --output-modules "%{_pyproject_modules}" \\
   --buildroot "%{buildroot}" \\
   --sitelib "%{python3_sitelib}" \\
   --sitearch "%{python3_sitearch}" \\
   --python-version "%{python3_version}" \\
   --pyproject-record "%{_pyproject_record}" \\
   --prefix "%{_prefix}" \\
   %{*}
}

We have added some logic to handle separate record files for each package.


In the end with a few tweaks, we get:

# Generated by go2rpm 1.9.0
%bcond_without check
%bcond_without bundled
%bcond_without golang_library
%if %{defined rhel}
%bcond_without bundled
%endif
%if %{with bundled}
%bcond_with golang_library
%endif

%define pyproject_install() %{expand:\\\
specifier=$(ls %{_pyproject_wheeldir}/*.whl | xargs basename --multiple | sed -E
's/([^-]+)-([^-]+)-.+\\\.whl/\\\1==\\\2/')
TMPDIR="%{_pyproject_builddir}" %{__python3} -m pip install --root %{buildroot} --prefix
%{_prefix} --no-deps --disable-pip-version-check --progress-bar off --verbose
--ignore-installed --no-warn-script-location --no-index --no-cache-dir --find-links
%{_pyproject_wheeldir} $specifier
if [ -d %{buildroot}%{_bindir} ]; then
   %py3_shebang_fix %{buildroot}%{_bindir}/*
   rm -rfv %{buildroot}%{_bindir}/__pycache__
fi
rm -f %{_pyproject_ghost_distinfo}
site_dirs=()
# Process %%{python3_sitelib} if exists
if [ -d %{buildroot}%{python3_sitelib} ]; then
   site_dirs+=( "%{python3_sitelib}" )
fi
# Process %%{python3_sitearch} if exists and does not equal to %%{python3_sitelib}
if [ %{buildroot}%{python3_sitearch} != %{buildroot}%{python3_sitelib} ] && [ -d
%{buildroot}%{python3_sitearch} ]; then
   site_dirs+=( "%{python3_sitearch}" )
fi
# Process all *.dist-info dirs in sitelib/sitearch
for site_dir in ${site_dirs[@]}; do
   for distinfo in %{buildroot}$site_dir/*.dist-info; do
     project_name=$(basename "$distinfo" | cut -d'-' -f1)
     %global _pyproject_record
%{_builddir}/%{_pyproject_files_prefix}-${project_name}-pyproject-record
     sed -i 's/pip/rpm/' ${distinfo}/INSTALLER
     PYTHONPATH=%{_rpmconfigdir}/redhat \\
       %{__python3} -B %{_rpmconfigdir}/redhat/pyproject_preprocess_record.py \\
       --buildroot %{buildroot} --record ${distinfo}/RECORD --output %{_pyproject_record}
     rm -fv ${distinfo}/RECORD
     rm -fv ${distinfo}/REQUESTED
   done
done
}

%define pyproject_save_files() %{expand:\\\
%global _pyproject_record %{_builddir}/%{_pyproject_files_prefix}-%{*}-pyproject-record
%global pyproject_files %{_builddir}/%{_pyproject_files_prefix}-%{*}-pyproject-files
%{expr:0%{?fedora} >= 39 || 0%{?rhel} >= 10 ? "RPM_PERCENTAGES_COUNT=2" :
"RPM_PERCENTAGES_COUNT=8" } \\
%{__python3} %{_rpmconfigdir}/redhat/pyproject_save_files.py \\
   --output-files "%{pyproject_files}" \\
   --output-modules "%{_pyproject_modules}" \\
   --buildroot "%{buildroot}" \\
   --sitelib "%{python3_sitelib}" \\
   --sitearch "%{python3_sitearch}" \\
   --python-version "%{python3_version}" \\
   --pyproject-record "%{_pyproject_record}" \\
   --prefix "%{_prefix}" \\
   %{*}
}

# https://github.com/ansible/receptor
%global goipath         github.com/ansible/receptor
Version:                1.4.1

%gometa -f

%global goname receptor

%global common_description %{expand:
Receptor is an overlay network intended to ease the distribution of work across
a large and dispersed collection of workers. Receptor nodes establish
peer-to-peer connections with each other via existing networks. Once connected,
the Receptor mesh provides datagram (UDP-like) and stream (TCP-like)
capabilities to applications, as well as robust unit-of-work handling with
resiliency against transient network failures.

See the readthedocs page for Receptor at:

https://receptor.readthedocs.io/en/latest}

%global golicenses      LICENSE.md %{?with_bundled:vendor/modules.txt}
%global godocs          docs tools README.md

Name:           %{goname}
Release:        %autorelease
Summary:        Multi-service relayer with remote execution and orchestration capabilities

# License for github.com/ansible/receptor: Apache-2.0
# License for github.com/creack/pty: MIT
# License for github.com/davecgh/go-spew: ISC
# License for github.com/emicklei/go-restful/v3: MIT
# License for github.com/fortytw2/leaktest: BSD-3-Clause
# License for github.com/fsnotify/fsnotify: BSD-3-Clause
# License for github.com/ghjm/cmdline: Apache-2.0
# License for github.com/go-logr/logr: Apache-2.0
# License for github.com/go-openapi/jsonpointer: Apache-2.0
# License for github.com/go-openapi/jsonreference: Apache-2.0
# License for github.com/go-openapi/swag: Apache-2.0
# License for github.com/go-task/slim-sprig: MIT
# License for github.com/gogo/protobuf: BSD-3-Clause
# License for github.com/golang-jwt/jwt/v4: MIT
# License for github.com/golang/mock: Apache-2.0
# License for github.com/golang/protobuf: BSD-3-Clause
# License for github.com/google/gnostic: Apache-2.0
# License for github.com/google/go-cmp: BSD-3-Clause
# License for github.com/google/gofuzz: Apache-2.0
# License for github.com/google/pprof: Apache-2.0
# License for github.com/google/shlex: Apache-2.0
# License for github.com/google/uuid: BSD-3-Clause
# License for github.com/gorilla/websocket: BSD-2-Clause
# License for github.com/imdario/mergo: BSD-3-Clause
# License for github.com/josharian/intern: MIT
# License for github.com/json-iterator/go: MIT
# License for github.com/jupp0r/go-priority-queue: MIT
# License for github.com/mailru/easyjson: MIT
# License for github.com/minio/highwayhash: Apache-2.0
# License for github.com/moby/spdystream: Apache-2.0
# License for github.com/modern-go/concurrent: Apache-2.0
# License for github.com/modern-go/reflect2: Apache-2.0
# License for github.com/munnerz/goautoneg: BSD-3-Clause
# License for github.com/onsi/ginkgo/v2: MIT
# License for github.com/pbnjay/memory: BSD-3-Clause
# License for github.com/pmezard/go-difflib: BSD-3-Clause
# License for github.com/prep/socketpair: BSD-3-Clause
# License for github.com/quic-go/qtls-go1-19: BSD-3-Clause
# License for github.com/quic-go/qtls-go1-20: BSD-3-Clause
# License for github.com/quic-go/quic-go: MIT
# License for github.com/rogpeppe/go-internal: BSD-3-Clause
# License for github.com/songgao/water: BSD-3-Clause
# License for github.com/spf13/pflag: BSD-3-Clause
# License for github.com/stretchr/testify: MIT
# License for github.com/vishvananda/netlink: Apache-2.0
# License for github.com/vishvananda/netns: Apache-2.0
# License for golang.org/x/crypto: BSD-3-Clause
# License for golang.org/x/exp: BSD-3-Clause
# License for golang.org/x/mod: BSD-3-Clause
# License for golang.org/x/net: BSD-3-Clause
# License for golang.org/x/oauth2: BSD-3-Clause
# License for golang.org/x/sys: BSD-3-Clause
# License for golang.org/x/term: BSD-3-Clause
# License for golang.org/x/text: BSD-3-Clause
# License for golang.org/x/time: BSD-3-Clause
# License for golang.org/x/tools: BSD-3-Clause
# License for google.golang.org/appengine: Apache-2.0
# License for google.golang.org/protobuf: BSD-3-Clause
# License for gopkg.in/inf.v0: BSD-3-Clause
# License for gopkg.in/yaml.v2: Apache-2.0 AND MIT
# License for gopkg.in/yaml.v3: MIT AND Apache-2.0
# License for k8s.io/api: Apache-2.0
# License for k8s.io/apimachinery: Apache-2.0
# License for k8s.io/client-go: Apache-2.0
# License for k8s.io/klog/v2: Apache-2.0
# License for k8s.io/kube-openapi: Apache-2.0
# License for k8s.io/utils: Apache-2.0
# License for sigs.k8s.io/json: Apache-2.0 AND BSD-3-Clause
# License for sigs.k8s.io/structured-merge-diff/v4: Apache-2.0
# License for sigs.k8s.io/yaml: MIT AND BSD-3-Clause
License:        Apache-2.0 AND ISC AND MIT AND BSD-3-Clause AND BSD-2-Clause
URL:            %{gourl}
Source:         %{gosource}
Source:         vendor-%{version}.tar.gz
Source:         bundle_go_deps_for_rpm.sh
# https://github.com/ansible/receptor/pull/816
Patch:          0001-Bump-quic-go-to-0.37.4.patch

%if %{with bundled}
Provides:       bundled(golang(github.com/ansible/receptor) = 1.4.1
Provides:       bundled(golang(github.com/creack/pty) = 1.1.18
Provides:       bundled(golang(github.com/davecgh/go-spew) = 1.1.1
Provides:       bundled(golang(github.com/emicklei/go-restful/v3) = 3.10.2
Provides:       bundled(golang(github.com/fortytw2/leaktest) = 1.3.0
Provides:       bundled(golang(github.com/fsnotify/fsnotify) = 1.6.0
Provides:       bundled(golang(github.com/ghjm/cmdline) = 0.1.2
Provides:       bundled(golang(github.com/go-logr/logr) = 1.2.4
Provides:       bundled(golang(github.com/go-openapi/jsonpointer) = 0.19.6
Provides:       bundled(golang(github.com/go-openapi/jsonreference) = 0.20.2
Provides:       bundled(golang(github.com/go-openapi/swag) = 0.22.3
Provides:       bundled(golang(github.com/go-task/slim-sprig) = 0.0.0-20230315git52ccab3
Provides:       bundled(golang(github.com/gogo/protobuf) = 1.3.2
Provides:       bundled(golang(github.com/golang-jwt/jwt/v4) = 4.5.0
Provides:       bundled(golang(github.com/golang/mock) = 1.6.0
Provides:       bundled(golang(github.com/golang/protobuf) = 1.5.3
Provides:       bundled(golang(github.com/google/gnostic) = 0.6.9
Provides:       bundled(golang(github.com/google/go-cmp) = 0.5.9
Provides:       bundled(golang(github.com/google/gofuzz) = 1.2.0
Provides:       bundled(golang(github.com/google/pprof) = 0.0.0-20230502git255e3b9
Provides:       bundled(golang(github.com/google/shlex) = 0.0.0-20191202gite7afc7f
Provides:       bundled(golang(github.com/google/uuid) = 1.3.0
Provides:       bundled(golang(github.com/gorilla/websocket) = 1.5.0
Provides:       bundled(golang(github.com/imdario/mergo) = 0.3.15
Provides:       bundled(golang(github.com/josharian/intern) = 1.0.0
Provides:       bundled(golang(github.com/json-iterator/go) = 1.1.12
Provides:       bundled(golang(github.com/jupp0r/go-priority-queue) = 0.0.0-20160601gitab10738
Provides:       bundled(golang(github.com/mailru/easyjson) = 0.7.7
Provides:       bundled(golang(github.com/minio/highwayhash) = 1.0.2
Provides:       bundled(golang(github.com/moby/spdystream) = 0.2.0
Provides:       bundled(golang(github.com/modern-go/concurrent) = 0.0.0-20180306gitbacd9c7
Provides:       bundled(golang(github.com/modern-go/reflect2) = 1.0.2
Provides:       bundled(golang(github.com/munnerz/goautoneg) = 0.0.0-20191010gita7dc8b6
Provides:       bundled(golang(github.com/onsi/ginkgo/v2) = 2.9.4
Provides:       bundled(golang(github.com/pbnjay/memory) = 0.0.0-20210728git7b4eea6
Provides:       bundled(golang(github.com/pmezard/go-difflib) = 1.0.0
Provides:       bundled(golang(github.com/prep/socketpair) = 0.0.0-20171228gitc2c6a7f
Provides:       bundled(golang(github.com/quic-go/qtls-go1-19) = 0.3.2
Provides:       bundled(golang(github.com/quic-go/qtls-go1-20) = 0.2.2
Provides:       bundled(golang(github.com/quic-go/quic-go) = 0.34.0
Provides:       bundled(golang(github.com/rogpeppe/go-internal) = 1.10.0
Provides:       bundled(golang(github.com/songgao/water) = 0.0.0-20200317git2b4b6d7
Provides:       bundled(golang(github.com/spf13/pflag) = 1.0.5
Provides:       bundled(golang(github.com/stretchr/testify) = 1.8.1
Provides:       bundled(golang(github.com/vishvananda/netlink) = 1.1.0
Provides:       bundled(golang(github.com/vishvananda/netns) = 0.0.4
Provides:       bundled(golang(golang.org/x/crypto) = 0.8.0
Provides:       bundled(golang(golang.org/x/exp) = 0.0.0-20230425git47ecfdc
Provides:       bundled(golang(golang.org/x/mod) = 0.10.0
Provides:       bundled(golang(golang.org/x/net) = 0.9.0
Provides:       bundled(golang(golang.org/x/oauth2) = 0.7.0
Provides:       bundled(golang(golang.org/x/sys) = 0.8.0
Provides:       bundled(golang(golang.org/x/term) = 0.8.0
Provides:       bundled(golang(golang.org/x/text) = 0.9.0
Provides:       bundled(golang(golang.org/x/time) = 0.3.0
Provides:       bundled(golang(golang.org/x/tools) = 0.8.0
Provides:       bundled(golang(google.golang.org/appengine) = 1.6.7
Provides:       bundled(golang(google.golang.org/protobuf) = 1.30.0
Provides:       bundled(golang(gopkg.in/inf.v0) = 0.9.1
Provides:       bundled(golang(gopkg.in/yaml.v2) = 2.4.0
Provides:       bundled(golang(gopkg.in/yaml.v3) = 3.0.1
Provides:       bundled(golang(k8s.io/api) = 0.27.1
Provides:       bundled(golang(k8s.io/apimachinery) = 0.27.1
Provides:       bundled(golang(k8s.io/client-go) = 0.27.1
Provides:       bundled(golang(k8s.io/klog/v2) = 2.100.1
Provides:       bundled(golang(k8s.io/kube-openapi) = 0.0.0-20230501git8b0f38b
Provides:       bundled(golang(k8s.io/utils) = 0.0.0-20230505git9f67429
Provides:       bundled(golang(sigs.k8s.io/json) = 0.0.0-20221116gitbc3834c
Provides:       bundled(golang(sigs.k8s.io/structured-merge-diff/v4) = 4.2.3
Provides:       bundled(golang(sigs.k8s.io/yaml) = 1.3.0
%endif

BuildRequires:  python3-devel
# For Python tests
BuildRequires:  psmisc
BuildRequires:  openssh

%description %{common_description}

%package -n python3-receptorctl
Summary:        Front-end CLI and importable Python library that interacts with Receptor

%description -n python3-receptorctl
Receptorctl is a front-end CLI and importable Python library that interacts
with Receptor over its control socket interface.

%package -n python3-receptor-python-worker
Summary:        Python plugin called by Receptor

%description -n python3-receptor-python-worker
The receptor-python-worker command is called by Receptor to supervise the
operation of a Python worker plugin."

%if %{without golang_library}
%gopkg
%endif

%prep
%if %{with bundled}
%goprep -k
# unpack vendored dependencies
%setup -q -T -D -a 1 -n %{name}-%{version}
%else
%goprep
%endif
%autopatch -p1
echo "%{version}" > receptor-python-worker/.VERSION
echo "%{version}" > receptorctl/.VERSION
mv receptor-python-worker/README.md README-receptor-python-worker.md
mv receptorctl/README.md README-receptorctl.md

%generate_buildrequires
%if %{without bundled}
%go_generate_buildrequires
%endif
cd receptorctl
%pyproject_buildrequires -t
cd ../receptor-python-worker
%pyproject_buildrequires -t

%build
%if %{with bundled}
export GO111MODULE=on
export GOFLAGS=-mod=vendor
%endif
export LDFLAGS="-X 'github.com/ansible/receptor/internal/version.Version=%{VERSION}' "
%gobuild -o %{gobuilddir}/bin/receptor %{goipath}/cmd/receptor-cl
pushd receptorctl
%pyproject_wheel
popd
pushd receptor-python-worker
%pyproject_wheel
popd


%install
%if %{without golang_library}
%gopkginstall
%endif
install -m 0755 -vd                     %{buildroot}%{_bindir}
install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/
%pyproject_install
%pyproject_save_files receptorctl
%pyproject_save_files receptor_python_worker
%global receptorctl_pyproject_files
%{_builddir}/%{_pyproject_files_prefix}-receptorctl-pyproject-files
%global receptor_python_worker_pyproject_files
%{_builddir}/%{_pyproject_files_prefix}-receptor_python_worker-pyproject-files

%if %{with check}
%check
export PATH="%{gobuilddir}/bin:$PATH"
# Disable various test relying on Kube and network
%gocheck -t tests/functional/mesh
pushd receptorctl
rm -rfv tests/test_mesh.py
%tox
popd
%endif


%files
%license LICENSE.md %{?with_bundled:vendor/modules.txt}
%doc docs tools README.md
%{_bindir}/receptor

%files -n python3-receptorctl -f %{receptorctl_pyproject_files}
%doc README-receptorctl.md
%{_bindir}/receptorctl

%files -n python3-receptor-python-worker -f %{receptor_python_worker_pyproject_files}
%doc README-receptor-python-worker.md
%{_bindir}/receptor-python-worker

%if %{without golang_library}
%gopkgfiles
%endif

%changelog
%autochangelog


I added a condition to not build the golang library when bundled. If you do build it it
won't be installable because
it will be looking at the dependencies we have bundled in Fedora repo. We could bypass that
by adding the vendor
directory in the library package, but generally we end up in dependency hell for the project
that would depend on it,
because of conflicting versions.


All the relevant files are here:

https://eclipseo.fedorapeople.org/receptor/

You have the SPEC, the sources, the patch, the BASH for/and the vendor tar gz, and the SPEC
and sources of the missing dependencies.


Robert-André

FAS: eclipseo
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux