Johannes Kastl
Good morning Dan,
On 13.01.23 at 08:23 Dan Čermák wrote:
But it does not. Apparently it changes the working directory before creating the link.
The magic here is the %python_clone macro, which according to the upstream documentation [1] performs the following:
--8<---------------cut here---------------start------------->8--- %python_clone filename creates a copy of filename under a flavor-specific name for every flavor. This is useful for packages that install unversioned executables: /usr/bin/foo is copied to /usr/bin/foo-%{python_bin_suffix} for all flavors, and the shebang is modified accordingly. --8<---------------cut here---------------end--------------->8---
The %python_clone creates the file and modifies its shebang. But it does not create a link.
The state before the ln line is that there are multiple versions of pycodestlye in the %{buildroot}%{_bindir}/ directory. Files, not links (otherwise the ln line would be unnecessary).
This is the state before the ln:
[ 11s] -rwxr-xr-x. 1 abuild abuild 984 Jan 13 09:14 pycodestyle
[ 11s] -rwxr-xr-x. 1 abuild abuild 984 Jan 13 09:14 pycodestyle-3.10
[ 11s] -rwxr-xr-x. 1 abuild abuild 983 Jan 13 09:14 pycodestyle-3.8
[ 11s] -rwxr-xr-x. 1 abuild abuild 983 Jan 13 09:14 pycodestyle-3.9
and this is how it looks after the ln:
[ 11s] lrwxrwxrwx. 1 abuild abuild 16 Jan 13 09:14 pycodestyle -> pycodestyle-3.10
[ 11s] -rwxr-xr-x. 1 abuild abuild 984 Jan 13 09:14 pycodestyle-3.10
[ 11s] -rwxr-xr-x. 1 abuild abuild 983 Jan 13 09:14 pycodestyle-3.8
[ 11s] -rwxr-xr-x. 1 abuild abuild 983 Jan 13 09:14 pycodestyle-3.9
which, is more or less what I'd expect, is it not?
Cheers,
Dan
--
Dan Čermák