Re: RPM packaging help

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

 





On Sun, 13 Aug 2023, 21:39 Maxwell G, <maxwell@xxxxxxx> wrote:
Hi Robert-André and Andrew,


On Sun Aug 13, 2023 at 11:23 +0200, Robert-André Mauchin 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:

This is great. Thanks! Here are some notes:

> License:        Apache-2.0 AND ISC AND MIT AND BSD-3-Clause AND BSD-2-Clause

What did you use to generate that list of licenses?


 

What I've mentioned on Matrix this weekend or last night, the wrapper around the deps.devs I coded Saturday, and subsequent script I added to the new tools repo I added to Go-sig on Pagure. 

https://github.com/eclipseo/pydepsdev
https://pagure.io/GoSIG/tools



> %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

You don't need manual bundled(golang(...)) Provides in the specfile
anymore. This is handled by a generator after the build when
vendor/modules.txt is marked with %license in %files. This specfile
already does that.

Ok


> %build
> %if %{with bundled}
> export GO111MODULE=on
> export GOFLAGS=-mod=vendor
> %endif

I think you can remove these GO* exports.


 

Why though? If we vendor the stuff, wouldn't it be better to run on Go modules to be closer to upstream? 

We should move all the ecosystem to go modules but ENOTIME. 


> 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.

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

Hmm, you shouldn't need to do that.


  

I don't know, I think it is better to use the Python guidelines and macros if possible. 




> # 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

would be better written as

%bcond check 1
%bcond bundled 1
%bcond golang_library %{without bundled}

 

I need to read the doc regarding bcond compared to bcond_without.

After getting rid of those macro definitions:

> %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.

This package should be named receptorctl not python3-receptorctl.
Change `-n python3-receptorctl` to `-n receptorctl` everywhere.


 

Ok


> %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

Remove all of this %pyproject_save_files stuff. You can handle it
manually instead of using the macros.


Change

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

to


%files -n receptorctl
%doc README-receptorctl.md
%{_bindir}/receptorctl
%{python3_sitelib}/receptorctl/
%{python3_sitelib}/receptorctl-%{version}.dist-info/

and change

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

to

%files -n python3-receptor-python-worker
%doc README-receptor-python-worker.md
%{_bindir}/receptor-python-worker
%{python3_sitelib}/receptor_python_worker/
%{python3_sitelib}receptor_python_worker-%{version}.dist-info/


--
Best,

Maxwell G (@gotmax23)
Pronouns: He/They

Cheers, 

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

[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