Re: small problem with vendored deps in rust packages

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

 



On Mon, Dec 2, 2024 at 1:16 PM Zbigniew Jędrzejewski-Szmek <zbyszek@xxxxxxxxx> wrote:
On Sun, Dec 01, 2024 at 04:54:12PM +0100, Fabio Valentini wrote:
> There's a WIP of a simplified "conditional vendor" handling here:
> https://src.fedoraproject.org/rpms/rust-vhost-device-sound/pull-request/4
> As soon as this is in good shape it might serve as a template for
> other packages too.

Per Fabio's request, I'm copying my comment from that pull request here
for discussion:

There is one shortcoming that I see: the command to create the vendor
tarball is provided in a comment with escaped macros, so actually
running the command requires the user to rewrite the command
manually. Can we have some mechanism where the full command is visible
and can be selected&pasted into a terminal for execution?

The command should have %name and %version and other details inserted
automatically. It should also be joined with && and not change the
callers cwd. So probably something like

  (spectool -g %{name}.spec && tar xvf %{name}-%{version}.create &&
   cd %{name}-%{version} && cargo vendor-filterer … && tar …)

rpmspec -P *.spec doesn't show comments.

One idea: insert the following at the beginning of %prep:

# The command to generate a tarball with vendor code:
if false; then
  (spectool -g %{name}.spec && \
   tar -xvf %{name}-%{version}.crate && \
   cd %{name}-%{version} && \
   cargo vendor-filterer cargo vendor-filterer --platform {x86_64,powerpc64le,aarch64,i686}-unknown-linux-gnu && \
   tar --sort=name --mtime='2024-11-29' --owner=0 --group=0 --numeric-owner -Jcf rust-vhost-device-sound-%%{version}-vendor.tar.xz vendor)
fi

Then the user can run rpmspec -P *.spec | grep spectool and select&paste the right invocation.

I wonder if it would make sense to echo the tarball generating commands as a first thing at the beginning of %prep, with all the macros already substituted? Or maybe wrap it in test -f vendor-tarball || echo command-to-execute ?

This way, 'fedpkg prep' would echo the vendor tarball generating command without needing to do anything else.

Another idea: Maybe rpm could make this easier by providing a %download_sources section that is run before %prep, and then we could just put the right commands there?

-- 
Kalev
-- 
_______________________________________________
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