How to invoke --disable-autoupdate in rpm spec

Sorry if this has been asked/answered before. I’m trying to figure out how to modify the rpm spec file to build picard and --diable-autoupdate.

I’ve tried:

%generate_buildrequires
%pyproject_buildrequires -C–disable-autoupdate

%build
%pyproject_wheel

%install
%pyproject_install

but that isn’t working.

I’m probably looking in all the wrong documentation places. Does anyone have experience in doing this?

Thanks!

I posted a link to this thread in the Picard Development room on Matrix, so hopefully someone who understands the build process better than I do can give you some pointers. My go-to for stuff like that is @outsidecontext.

1 Like

I’m not very familiar with RPM packages or the Fedora packaging workflow, so I can’t directly advise you on how pass the parameter.

This is what Debian is doing: debian/rules · master · Debian Multimedia Team / picard · GitLab

I assume the pyproject_wheel part is expecting a PEP 517 compatible build system? This makes building so much easier compared to the old way of calling setup.py, and Picard’s build is compatible with this. But depending on the builder being used it makes it more complicated or sometimes impossible to pass the custom parameters.

Maybe we need to rethink how we handle such build time options to be able to use them with any compatible builder (such as python -m build).

At least Arch Linux also seems to have lost the parameter when they switched from directly calling setup.py to python -m build (Upgrade to 2.8.1. (8c3860aa) · Commits · Arch Linux / Packaging / Packages / picard · GitLab).

1 Like

Does this work?

%pyproject_wheel -C–disable-autoupdate

According to Overview - rpms/pyproject-rpm-macros - src.fedoraproject.org the pyproject_wheel macro accepts a -C parameter for passing config settings for the build backend.

Thanks! I got a little closer, but still an error. After reading that I needed KEY=VALUE I tried the entry below and many variations but none worked. I’ll keep hacking at it, if you can think of anything else, let me know!

%pyproject_wheel -C–disable-autoupdate=None

Usage:
/usr/bin/python3 -m pip wheel [options] …
/usr/bin/python3 -m pip wheel [options] -r …
/usr/bin/python3 -m pip wheel [options] [-e] …
/usr/bin/python3 -m pip wheel [options] [-e] …
/usr/bin/python3 -m pip wheel [options] <archive url/path> …

Arguments to --config-settings must be of the form KEY=VAL
error: Bad exit status from /var/tmp/rpm-tmp.cx52NB (%build)

RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.cx52NB (%build)

I tried getting options to pass with python -m build, but without success.

Picard is using the setuptools backend, and it looks like passing arbitrary options is currently not working there. See the discussion at Setuptools does not pass config_settings through backend · Issue #2491 · pypa/setuptools · GitHub .

I would have expected something like python -m build --wheel -C--disable-autoupdate or maybe python -m build --wheel -C--disable-autoupdate=True should work, but it doesn’t for now, as the parameters are not passed on.

One workaround seems to be to add a custom build backend that overrides the relevant parts to handle the customer build parameters as it was done for example in Add custom build backend to support build args by tobiasah · Pull Request #328 · capnproto/pycapnp · GitHub

We could also maybe check for specific environment variables or such. But ideally the issue gets solved in setuptools itself.

2 Likes

Thank you very much for taking the time to reply. So basically the functionality to pass arbitrary options isn’t working correctly or hasn’t been provisioned. I’m going to open a ticket with the Fedora Python folks and see what they recommend, if anything. I’ll report back here.

Edit: In the meantime, I’ll just patch setup.py as a work-around until this gets solved.

1 Like

For anyone else who may encounter this issue, rather than creating a patch, you can workaround via sed:

%define setup             setup.py
%define autoupdate_on     'disable-autoupdate', None
%define autoupdate_off    'disable-autoupdate', True
%define selfauto_on       self.disable_autoupdate = None
%define selfauto_off      self.disable_autoupdate = True
%build
sed -r -i -e "s|%{autoupdate_on}|%{autoupdate_off}|g" \
  -e "s|%{selfauto_on}|%{selfauto_off}|g" \
  %{setup}
%pyproject_wheel

1 Like