[opensuse-packaging] Problem on %doc -> %license macro for 0%{?OS_version}
Hello! Need to have package for wide row of RPM-distros, which such scheme: 1) Copy LICENSE file to %%doc for: - SLE 12 SP2 and lower - openSUSE Leap 42.2 and lower - RHEL 6 and lower - CentOS 6 and lower - Scientific Linux 6 and lower 2) Copy LICENSE file to %%license for: - SLE 12 SP3 and higher - openSUSE Leap 42.3 and higher - RHEL 7 and higher - CentOS 7 and higher - Scientific Linux 7 and higher due to these guidelines: Fedora: [0] https://fedoraproject.org/wiki/Packaging:LicensingGuidelines?rd=Packaging/Li... openSUSE: [1] https://en.opensuse.org/openSUSE:Specfile_guidelines#License_files To detect OS-es I use table from [2] https://en.opensuse.org/openSUSE:Build_Service_cross_distribution_howto Initially I had such construction in spec: %if ( 0%{?sles_version} <= 120200 && !0%{?is_opensuse} ) || ( 0%{?sles_version} <= 120200 && 0%{?is_opensuse} ) || 0%{?rhel_version} <= 600 || 0%{?centos_version} <= 600 || 0%{?scientificlinux_version} <= 600 %doc LICENSE LICENSE.GPL2 README.md %else %doc README.md %license LICENSE LICENSE.GPL2 %endif Here RPMs are OK to be built, but on openSUSE 42.3 both of LICENSE LICENSE.GPL2 files were put to %doc (/usr/share/doc/packages/) instead of %license (/usr/share/licenses). If to use %if ( 0%{?sles_version} < 120300 && !0%{?is_opensuse} ) || ( 0%{?sles_version} < 120300 && 0%{?is_opensuse} ) || 0%{?rhel_version} < 700 || 0%{?centos_version} < 700 || 0%{?scientificlinux_version} < 700 %doc LICENSE LICENSE.GPL2 README.md %else %doc README.md %license LICENSE LICENSE.GPL2 %endif this doesn't help -- on openSUSE 42.3 both of LICENSE LICENSE.GPL2 files were put to %doc (/usr/share/doc/packages/) instead of %license (/usr/share/licenses). Even using 0%{?suse_version} macro instead of 0%{?sles_version} also doesn't help. Where am I wrong here? Please, give a hint how to have scheme mentioned in 1) and 2). [0] and [1] doesn't have explicit restriction on using <= sign. Can it be is use generally for 0%{?OS_version} macro? Thanks! -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
On Nov 06 2018, Mikhail Kasimov <mikhail.kasimov@gmail.com> wrote:
%if ( 0%{?sles_version} < 120300 && !0%{?is_opensuse} ) || ( 0%{?sles_version} < 120300 && 0%{?is_opensuse} ) || 0%{?rhel_version} < 700 || 0%{?centos_version} < 700 || 0%{?scientificlinux_version} < 700
This condition is true if any of the version macros is undefined. It is generally better to formulate positive conditions on version macros. I.e., instead of checking for 0%{?foo_version} < x, reverse the condition and check for 0%{?foo_version} > y. Andreas. -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different." -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
Hello! Now I have "positive" construction: %if ( 0%{?sles_version} > 120200 && !0%{?is_opensuse} ) || ( 0%{?sles_version} > 120200 && 0%{?is_opensuse} ) || 0%{?rhel_version}
600 || 0%{?centos_version} > 600 || 0%{?scientificlinux_version} > 600 %doc README.md %license LICENSE LICENSE.GPL2 %else %doc LICENSE LICENSE.GPL2 README.md %endif
or even %if ( 0%{?sles_version} >= 120300 && !0%{?is_opensuse} ) || ( 0%{?sles_version} >= 120300 && 0%{?is_opensuse} ) || 0%{?rhel_version}
= 700 || 0%{?centos_version} >= 700 || 0%{?scientificlinux_version} >= 700 %doc README.md %license LICENSE LICENSE.GPL2 %else %doc LICENSE LICENSE.GPL2 README.md %endif
And... these all also don't work: on openSUSE 42.3 LICENSE LICENSE.GPL2 files are still in /usr/share/doc/ instead of /usr/share/licenses/ . o_O Any ideas, please? If construction is OK ("positive"), OS detection is OK (due to guidelines) -- why this doesn't work correctly... вт, 6 нояб. 2018 г. в 11:19, Andreas Schwab <schwab@suse.de>:
On Nov 06 2018, Mikhail Kasimov <mikhail.kasimov@gmail.com> wrote:
%if ( 0%{?sles_version} < 120300 && !0%{?is_opensuse} ) || ( 0%{?sles_version} < 120300 && 0%{?is_opensuse} ) || 0%{?rhel_version} < 700 || 0%{?centos_version} < 700 || 0%{?scientificlinux_version} < 700
This condition is true if any of the version macros is undefined. It is generally better to formulate positive conditions on version macros. I.e., instead of checking for 0%{?foo_version} < x, reverse the condition and check for 0%{?foo_version} > y.
Andreas.
-- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different." -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
-- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
On Thu, 2018-11-08 at 13:14 +0200, Mikhail Kasimov wrote:
Hello!
Now I have "positive" construction:
%if ( 0%{?sles_version} > 120200 && !0%{?is_opensuse} ) || ( 0%{?sles_version} > 120200 && 0%{?is_opensuse} ) || 0%{?rhel_version}
600 || 0%{?centos_version} > 600 || 0%{?scientificlinux_version} > 600 %doc README.md %license LICENSE LICENSE.GPL2 %else %doc LICENSE LICENSE.GPL2 README.md %endif
or even
%if ( 0%{?sles_version} >= 120300 && !0%{?is_opensuse} ) || ( 0%{?sles_version} >= 120300 && 0%{?is_opensuse} ) || 0%{?rhel_version}
= 700 || 0%{?centos_version} >= 700 || 0%{?scientificlinux_version} >= 700 %doc README.md %license LICENSE LICENSE.GPL2 %else %doc LICENSE LICENSE.GPL2 README.md %endif
And... these all also don't work: on openSUSE 42.3 LICENSE LICENSE.GPL2 files are still in /usr/share/doc/ instead of /usr/share/licenses/ . o_O
Any ideas, please? If construction is OK ("positive"), OS detection is OK (due to guidelines) -- why this doesn't work correctly... вт, 6 нояб. 2018 г. в 11:19, Andreas Schwab <schwab@suse.de>:
On Nov 06 2018, Mikhail Kasimov <mikhail.kasimov@gmail.com> wrote:
%if ( 0%{?sles_version} < 120300 && !0%{?is_opensuse} ) || ( 0%{?sles_version} < 120300 && 0%{?is_opensuse} ) || 0%{?rhel_version} < 700 || 0%{?centos_version} < 700 || 0%{?scientificlinux_version} < 700
This condition is true if any of the version macros is undefined. It is generally better to formulate positive conditions on version macros. I.e., instead of checking for 0%{?foo_version} < x, reverse the condition and check for 0%{?foo_version} > y.
I'm pretty sure you meant to use sle_version - not sles_version; sle_version is the variable shared between the SLE* and Leap releases Basically, this condition is never true: 0%{?sles_version} >= 120300 && 0%{?is_opensuse} if it's openSUSE, there is never a sles_version > 0 defined (but there is sle_versio 120300, asyou'd expect) Cheers Dominique
Hello! пт, 9 нояб. 2018 г. в 10:03, Dominique Leuenberger / DimStar <dimstar@opensuse.org>: [skipped]
I'm pretty sure you meant to use sle_version - not sles_version;
And you're right here: I've missed this dumb fingerfehler typo. :(
sle_version is the variable shared between the SLE* and Leap releases
Basically, this condition is never true:
0%{?sles_version} >= 120300 && 0%{?is_opensuse} if it's openSUSE, there is never a sles_version > 0 defined (but there is sle_versio 120300, asyou'd expect)
Now all works with correct sle_version macro. Resolved. Thanks! -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
participants (3)
-
Andreas Schwab
-
Dominique Leuenberger / DimStar
-
Mikhail Kasimov