Hi all, yesterday I came across a line in a python spec file that somehow works, but I have no clue why.
https://build.opensuse.org/package/show/devel:languages:python/python-pycode...
%install %python_install %python_clone %{buildroot}%{_bindir}/pycodestyle ln -sf pycodestyle-%{python3_bin_suffix} %{buildroot}%{_bindir}/pycodestyle %python_expand %fdupes %{buildroot}/%{$python_sitelib}
I am talking about the "ln" line. Apparently it creates a relative soft link in the %{buildroot}%{_bindir}/ directory pointing to the file pycodestyle in the same directory %{buildroot}%{_bindir}/. For me this command looks "the wrong way round", because I am used to have "ln -sf foo bar" create a new link "bar" pointing to "foo". So "foo" is the file already existing, and "bar" is the link that gets created. Not the other way round. In addition, in the current working directory there is no file "pycodestyle-%{python3_bin_suffix}". So all this should do is create a broken link by overwriting "%{buildroot}%{_bindir}/pycodestyle" with a link pointing to a non-existent file. But it does not. Apparently it changes the working directory before creating the link. And: If I change the working directory to "%{buildroot}%{_bindir}/" and rewrite the line to be "in the correct order" (at least according to the man page and how I am used to writing ln commands), I get an error that there is an unpackaged file called "/usr/bin/_current_flavor". Huh? If I remove the line, it fails as soon as there are multiple python versions in %pythons, as there are file conflicts for /usr/bin/pycodestyle. It however builds successfully on e.g. 15.4 where there is only one python version present... Does the %python_clone macro also modify the following line? Or is this some magic inside the %{python3_bin_suffix} macro (which only seems to evaluate to either %_python3_bin_suffix or %python3_version, so no magic on first glance). I would be really glad if someone could remove the tomatoes from my eyes or explain why that works. Thanks in advance. Johannes -- Johannes Kastl Linux Consultant & Trainer Tel.: +49 (0) 151 2372 5802 Mail: kastl@b1-systems.de B1 Systems GmbH Osterfeldstraße 7 / 85088 Vohburg http://www.b1-systems.de GF: Ralph Dehner Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537