python package %bindir/bin no such file

All, I'm trying to update my package gphotos-sync to the latest release, jumping from 2.x > 3.x, and the %install is failing during the %python_clone routine when setting the update-alternatives link, but from the logs it should be setting the link for python 3.10, but the it's trying to copy it to python 3.12. I'm pretty rusty at packaging at this point, having not done it regularly for a few years, so I'm hoping someone can point me in the right direction to resolve this. Any assistance is greatly appreciated. Thanks! [ 21s] ++ realpath /usr/bin/python3.10 [ 21s] + sed -ri '1s@#!.*python\S*@#!/usr/bin/python3.10@' /home/abuild/rpmbuild/BUILDROOT/python-gphotos-sync-3.2.5-2.1.x86_64/usr/bin/gphotos-sync-3.10 [ 21s] + cp /home/abuild/rpmbuild/BUILDROOT/python-gphotos-sync-3.2.5-2.1.x86_64/usr/bin/gphotos-sync /home/abuild/rpmbuild/BUILDROOT/python-gphotos-sync-3.2.5-2.1.x86_64/usr/bin/gphotos-sync-3.12 [ 21s] cp: cannot stat '/home/abuild/rpmbuild/BUILDROOT/python-gphotos-sync-3.2.5-2.1.x86_64/usr/bin/gphotos-sync': No such file or directory [ 21s] error: Bad exit status from /var/tmp/rpm-tmp.rbcznG (%install) [ 21s] [ 21s] RPM build errors: [ 21s] Bad exit status from /var/tmp/rpm-tmp.rbcznG (%install) ls -l /var/tmp/build-root/openSUSE_Tumbleweed-x86_64/home/abuild/rpmbuild/BUILDROOT/python-gphotos-sync-3.2.5-0.x86_64/usr/bin/ total 20 lrwxrwxrwx 1 399 399 30 Jan 7 07:00 gphotos-sync -> /etc/alternatives/gphotos-sync -rwxr-xr-x 1 399 399 223 Jan 7 07:00 gphotos-sync-3.10 -rwxr-xr-x 1 399 399 223 Jan 7 07:00 gphotos-sync-3.11 -rwxr-xr-x 1 399 399 223 Jan 7 07:00 gphotos-sync-3.12 -rwxr-xr-x 1 399 399 223 Jan 7 07:00 gphotos-sync-3.13 Subproject: https://build.opensuse.org/project/show/home:deadpoint:gphotos-sync Build logs: https://build.opensuse.org/package/live_build_log/home:deadpoint:gphotos-syn... -- Later, Darin

Hi Darin, though I have to admit I'm not sure why this is happening, I tried to build it locally and found that the comments in the spec file are somehow messing with the build. Removing the commented-out python_clone and pytest lines should help. Also you need to replace the dashes in the files section for the files in python_sitelib with underscores, so "gphotos_sync" instead of "gphotos-sync". One other thing is that your package name doesn't match with the name tag in the spec files and the license name isn't correct, if you want to submit your package to Factory you need to change that or it won't get accepted. Best regards, Nico On Wed, Jan 8, 2025 at 2:26 PM Darin Perusich <darin@darins.net> wrote:
All,
I'm trying to update my package gphotos-sync to the latest release, jumping from 2.x > 3.x, and the %install is failing during the %python_clone routine when setting the update-alternatives link, but from the logs it should be setting the link for python 3.10, but the it's trying to copy it to python 3.12.
I'm pretty rusty at packaging at this point, having not done it regularly for a few years, so I'm hoping someone can point me in the right direction to resolve this. Any assistance is greatly appreciated.
Thanks!
[ 21s] ++ realpath /usr/bin/python3.10 [ 21s] + sed -ri '1s@#!.*python\S*@#!/usr/bin/python3.10@'
/home/abuild/rpmbuild/BUILDROOT/python-gphotos-sync-3.2.5-2.1.x86_64/usr/bin/gphotos-sync-3.10 [ 21s] + cp /home/abuild/rpmbuild/BUILDROOT/python-gphotos-sync-3.2.5-2.1.x86_64/usr/bin/gphotos-sync
/home/abuild/rpmbuild/BUILDROOT/python-gphotos-sync-3.2.5-2.1.x86_64/usr/bin/gphotos-sync-3.12 [ 21s] cp: cannot stat
'/home/abuild/rpmbuild/BUILDROOT/python-gphotos-sync-3.2.5-2.1.x86_64/usr/bin/gphotos-sync': No such file or directory [ 21s] error: Bad exit status from /var/tmp/rpm-tmp.rbcznG (%install) [ 21s] [ 21s] RPM build errors: [ 21s] Bad exit status from /var/tmp/rpm-tmp.rbcznG (%install)
ls -l /var/tmp/build-root/openSUSE_Tumbleweed-x86_64/home/abuild/rpmbuild/BUILDROOT/python-gphotos-sync-3.2.5-0.x86_64/usr/bin/ total 20 lrwxrwxrwx 1 399 399 30 Jan 7 07:00 gphotos-sync -> /etc/alternatives/gphotos-sync -rwxr-xr-x 1 399 399 223 Jan 7 07:00 gphotos-sync-3.10 -rwxr-xr-x 1 399 399 223 Jan 7 07:00 gphotos-sync-3.11 -rwxr-xr-x 1 399 399 223 Jan 7 07:00 gphotos-sync-3.12 -rwxr-xr-x 1 399 399 223 Jan 7 07:00 gphotos-sync-3.13
Subproject: https://build.opensuse.org/project/show/home:deadpoint:gphotos-sync Build logs: https://build.opensuse.org/package/live_build_log/home:deadpoint:gphotos-syn...
-- Later, Darin
-- Nico Krapp Linux Engineer Packaging SUSE Software Solutions Germany GmbH Frankenstraße 146, 90461 Nürnberg, Germany Geschäftsführer: Ivo Totev, Andrew McDonald, Werner Knoblich (HRB 36809, AG Nürnberg)

Hi, Am 08.01.25 um 14:58 schrieb Nico Krapp:
Hi Darin,
though I have to admit I'm not sure why this is happening, I tried to build it locally and found that the comments in the spec file are somehow messing with the build. Removing the commented-out python_clone and pytest lines should help.
Yes, note how the copy from the original file and sed is successfull for all flavors, and then deletes the original file. But after it tries to start over all again, failing to find the original. It starts at the second line of the expanded macro body, only the first line is commeted out from the specfile. [ 21s] + cp /home/abuild/rpmbuild/BUILDROOT/python-gphotos-sync-3.2.5-2.1.x86_64/usr/bin/gphotos-sync /home/abuild/rpmbuild/BUILDROOT/python-gphotos-sync-3.2.5-2.1.x86_64/usr/bin/gphotos-sync-3.10 [ 21s] ++ realpath /usr/bin/python3.10 [ 21s] + sed -ri '1s@#!.*python\S*@#!/usr/bin/python3.10@' /home/abuild/rpmbuild/BUILDROOT/python-gphotos-sync-3.2.5-2.1.x86_64/usr/bin/gphotos-sync-3.10 [ 21s] + cp /home/abuild/rpmbuild/BUILDROOT/python-gphotos-sync-3.2.5-2.1.x86_64/usr/bin/gphotos-sync /home/abuild/rpmbuild/BUILDROOT/python-gphotos-sync-3.2.5-2.1.x86_64/usr/bin/gphotos-sync-3.12 [ 21s] ++ realpath /usr/bin/python3.12 [ 21s] + sed -ri '1s@#!.*python\S*@#!/usr/bin/python3.12@' /home/abuild/rpmbuild/BUILDROOT/python-gphotos-sync-3.2.5-2.1.x86_64/usr/bin/gphotos-sync-3.12 [ 21s] + cp /home/abuild/rpmbuild/BUILDROOT/python-gphotos-sync-3.2.5-2.1.x86_64/usr/bin/gphotos-sync /home/abuild/rpmbuild/BUILDROOT/python-gphotos-sync-3.2.5-2.1.x86_64/usr/bin/gphotos-sync-3.13 [ 21s] ++ realpath /usr/bin/python3.13 [ 21s] + sed -ri '1s@#!.*python\S*@#!/usr/bin/python3.13@' /home/abuild/rpmbuild/BUILDROOT/python-gphotos-sync-3.2.5-2.1.x86_64/usr/bin/gphotos-sync-3.13 [ 21s] + cp /home/abuild/rpmbuild/BUILDROOT/python-gphotos-sync-3.2.5-2.1.x86_64/usr/bin/gphotos-sync /home/abuild/rpmbuild/BUILDROOT/python-gphotos-sync-3.2.5-2.1.x86_64/usr/bin/gphotos-sync-3.11 [ 21s] ++ realpath /usr/bin/python3.11 [ 21s] + sed -ri '1s@#!.*python\S*@#!/usr/bin/python3.11@' /home/abuild/rpmbuild/BUILDROOT/python-gphotos-sync-3.2.5-2.1.x86_64/usr/bin/gphotos-sync-3.11 [ 21s] + rm -f /home/abuild/rpmbuild/BUILDROOT/python-gphotos-sync-3.2.5-2.1.x86_64/usr/bin/gphotos-sync [ 21s] + alternative_target=/usr/bin/gphotos-sync [ 21s] + [[ /usr/bin/gphotos-sync == /usr/share/man* ]] [ 21s] + '[' 0 -eq 1 ']' [ 21s] + mkdir -p /home/abuild/rpmbuild/BUILDROOT/python-gphotos-sync-3.2.5-2.1.x86_64/etc/alternatives [ 21s] + touch /home/abuild/rpmbuild/BUILDROOT/python-gphotos-sync-3.2.5-2.1.x86_64/etc/alternatives/gphotos-sync [ 21s] + ln -sf /etc/alternatives/gphotos-sync /home/abuild/rpmbuild/BUILDROOT/python-gphotos-sync-3.2.5-2.1.x86_64/usr/bin/gphotos-sync [ 21s] ++ realpath /usr/bin/python3.10 [ 21s] + sed -ri '1s@#!.*python\S*@#!/usr/bin/python3.10@' /home/abuild/rpmbuild/BUILDROOT/python-gphotos-sync-3.2.5-2.1.x86_64/usr/bin/gphotos-sync-3.10 [ 21s] + cp /home/abuild/rpmbuild/BUILDROOT/python-gphotos-sync-3.2.5-2.1.x86_64/usr/bin/gphotos-sync /home/abuild/rpmbuild/BUILDROOT/python-gphotos-sync-3.2.5-2.1.x86_64/usr/bin/gphotos-sync-3.12 [ 21s] cp: cannot stat '/home/abuild/rpmbuild/BUILDROOT/python-gphotos-sync-3.2.5-2.1.x86_64/usr/bin/gphotos-sync': No such file or directory abuild@skylab:~> rpm -E '%python_clone -a buildroot/path/to/mybin' cp buildroot/path/to/mybin /usr/bin/buildroot/path/to/mybin-3.10 sed -ri "1s@#!.*python\S*@#!$(realpath /usr/bin/python3.10)@" /usr/bin/buildroot/path/to/mybin-3.10 cp buildroot/path/to/mybin /usr/bin/buildroot/path/to/mybin-3.12 sed -ri "1s@#!.*python\S*@#!$(realpath /usr/bin/python3.12)@" /usr/bin/buildroot/path/to/mybin-3.12 cp buildroot/path/to/mybin /usr/bin/buildroot/path/to/mybin-3.13 sed -ri "1s@#!.*python\S*@#!$(realpath /usr/bin/python3.13)@" /usr/bin/buildroot/path/to/mybin-3.13 cp buildroot/path/to/mybin /usr/bin/buildroot/path/to/mybin-3.11 sed -ri "1s@#!.*python\S*@#!$(realpath /usr/bin/python3.11)@" /usr/bin/buildroot/path/to/mybin-3.11 rm -f /home/abuild/rpmbuild/BUILDROOT/%{NAME}-%{VERSION}-%{RELEASE}.x86_64/usr/bin/buildroot/path/to/mybin alternative_target="/usr/bin/buildroot/path/to/mybin" # (...) mkdir -p /home/abuild/rpmbuild/BUILDROOT/%{NAME}-%{VERSION}-%{RELEASE}.x86_64/etc/alternatives touch /home/abuild/rpmbuild/BUILDROOT/%{NAME}-%{VERSION}-%{RELEASE}.x86_64/etc/alternatives/mybin ln -sf /etc/alternatives/mybin /home/abuild/rpmbuild/BUILDROOT/%{NAME}-%{VERSION}-%{RELEASE}.x86_64/usr/bin/buildroot/path/to/mybin # (...) abuild@skylab:~> rpm -E '# %python_clone -a buildroot/path/to/mybin' # cp buildroot/path/to/mybin /usr/bin/buildroot/path/to/mybin-3.10 sed -ri "1s@#!.*python\S*@#!$(realpath /usr/bin/python3.10)@" /usr/bin/buildroot/path/to/mybin-3.10 cp buildroot/path/to/mybin /usr/bin/buildroot/path/to/mybin-3.12 # (...) Too bad that rpmlint only warns you at the end of a build, if it comes that far: [ 10s] gphotos-sync.spec:81: W: macro-in-comment %some_macro_that_does_not_cause_a_hard_fail [ 10s] There is a unescaped macro after a shell style comment in the specfile. Macros [ 10s] are expanded everywhere, so check if it can cause a problem in this case and [ 10s] escape the macro with another leading % if appropriate. There are more problems in the specfile, some of them already mentioned by Nico which rpmlint will you tell about.
Best regards, Nico
On Wed, Jan 8, 2025 at 2:26 PM Darin Perusich <darin@darins.net> wrote:
Subproject: https://build.opensuse.org/project/show/home:deadpoint:gphotos-sync Build logs: https://build.opensuse.org/package/live_build_log/home:deadpoint:gphotos-syn...
-- Later, Darin
-- Nico Krapp Linux Engineer Packaging
SUSE Software Solutions Germany GmbH Frankenstraße 146, 90461 Nürnberg, Germany Geschäftsführer: Ivo Totev, Andrew McDonald, Werner Knoblich (HRB 36809, AG Nürnberg)
- Ben

On Wed, 2025-01-08 at 08:25 -0500, Darin Perusich wrote:
All,
I'm trying to update my package gphotos-sync to the latest release, jumping from 2.x > 3.x, and the %install is failing during the %python_clone routine when setting the update-alternatives link, but from the logs it should be setting the link for python 3.10, but the it's trying to copy it to python 3.12.
I'm pretty rusty at packaging at this point, having not done it regularly for a few years, so I'm hoping someone can point me in the right direction to resolve this. Any assistance is greatly appreciated.
Thanks!
Big, big warning! #%python_clone -a %{buildroot}%{_bindir}/gphotos-sync %python_clone is still being expanded - and if this expands to more than one line, then only the FIRST LINE of that macro is prefixed with #
rpm -E %python_clone cp %1 /usr/bin/%1-!!_{/usr/bin/python3.12}_not_installed_!! sed -ri "1s@#!.*python\S*@#!$(realpath /usr/bin/python3.12)@" /usr/bin/%1-!!_{/usr/bin/python3.12}_not_installed_!! cp %1 /usr/bin/%1-!!_{/usr/bin/python3.13}_not_installed_!! sed -ri "1s@#!.*python\S*@#!$(realpath /usr/bin/python3.13)@" /usr/bin/%1-!!_{/usr/bin/python3.13}_not_installed_!! cp %1 /usr/bin/%1-3.11 sed -ri "1s@#!.*python\S*@#!$(realpath /usr/bin/python3.11)@" /usr/bin/%1-3.11
As the macro is still expanded behind the the '#', this means the first cp is ignored, all the rest is happening. Definitively NOT what you wanted when commenting that line. Be sure to use #%%python_clone to ensure the macro is not expanded. Or in newer RPM versions (TW, not Leap though IIRC) you can do %dnl %python_clone … => %dnl is an RPM style comment, not a shell comment and makes RPM not expand the macro. Cheers, Domninique

On Fri, Jan 10, 2025 at 6:21 AM Dominique Leuenberger <dimstar@opensuse.org> wrote:
On Wed, 2025-01-08 at 08:25 -0500, Darin Perusich wrote:
All,
I'm trying to update my package gphotos-sync to the latest release, jumping from 2.x > 3.x, and the %install is failing during the %python_clone routine when setting the update-alternatives link, but from the logs it should be setting the link for python 3.10, but the it's trying to copy it to python 3.12.
I'm pretty rusty at packaging at this point, having not done it regularly for a few years, so I'm hoping someone can point me in the right direction to resolve this. Any assistance is greatly appreciated.
Thanks!
Big, big warning!
#%python_clone -a %{buildroot}%{_bindir}/gphotos-sync
%python_clone is still being expanded - and if this expands to more than one line, then only the FIRST LINE of that macro is prefixed with #
This was likely the issue. I totally forgot that adding # did not comment it out and it was still expanded. I also renamed the .spec and .changes and defined a variable to address the actual name having an underscore and not a dash. Thanks all for your help!
participants (4)
-
Ben Greiner
-
Darin Perusich
-
Dominique Leuenberger
-
Nico Krapp