sailfishos-patches / patchmanager

Patchmanager for SailfishOS
https://openrepos.net/content/patchmanager/patchmanager
Other
21 stars 22 forks source link

Use modern statements in spec file #326

Closed Olf0 closed 1 year ago

Olf0 commented 1 year ago
nephros commented 1 year ago

I believe the %setup -n foo is required for OBS to work but have to check.

nephros commented 1 year ago

When you say the rm on the bildroot is obsolete, does this mean it is done implicitly?

I know the %clean macro is obsolete, but cleaning the buildroot is useful when building locally.

nephros commented 1 year ago

believe the %setup -n foo is required for OBS to work but have to check.

Scratch that, works fine without it.

Olf0 commented 1 year ago

I believe the %setup -n foo is required for OBS to work but have to check.

Definitely not by OBS in general, but maybe by Jolla's tar_git: I once analysed it somewhere, it is a shell script. Will try to find my analysis.

Edit: Found my analysis of Jolla's tar_git, AFAICS / IIRC it uses %{name} and extracts %{version} from a git tag, if one is set / used (plus %{release}, but that is heavily processed after its extraction). If no git tag is set or specified (in the OBS' .service file), then tar_git uses the %{version} from the spec file and appends the a part of the hash of the latest commit (in the branch which is configured in the .service file or which tar_git decides to use) to the processed %{release} string.

Actually, it is this behaviour which creates the necessity to have the %{version} in the spec file and in a correspondingly created git tag set to the same version string. But I cannot see, why %{name}-%{version} would be altered by anything so it is not the original string (at any time, including the point in time the %setup macro is called in the %prep section of a spec file).

When you say the rm on the buildroot is obsolete, does this mean it is done implicitly?

I know the %clean macro is obsolete, but cleaning the buildroot is useful when building locally.

Yes, both the %clean macro and rm -rf %{buildroot} are long obsolete, according to the RPM documentation etc. (Fedora packaging guidelines and many more) and I checked that in many rpmbuild runs.

And it is successfully build by our CI workflow, which utilises Coderus' Sailfish-SDK images, hence mb2 and all the other pieces of Jolla's SDK. But you are absolutely right, this way I never checked what happens if the SDK environment has been used before (as these images are always freshly instanciated in a docker container).

Olf0 commented 1 year ago

all good.

I am still glad (every time), that you double-checked and triggered me to re-evaluate and properly document my reasoning.