Commit Graph

354 Commits

Author SHA1 Message Date
Michel Alexandre Salim edc19bf3dc Fix macros.build-constraints' %limit_build
number of CPUs will never be set to less than 1
  this now outputs build flag overrides to be used with %make_build etc.
  add documentation

Signed-off-by: Michel Alexandre Salim <salimma@fedoraproject.org>
2021-08-15 15:10:27 -07:00
Michel Alexandre Salim 0fbc36d215 Add macros.build-constraints
Keep the misc macros in alphabetical order

Signed-off-by: Michel Alexandre Salim <salimma@fedoraproject.org>
2021-08-01 21:19:24 -07:00
Stephen Coady 5c7a58b423 add Requires: rpmautospec-rpm-macros
Signed-off-by: Stephen Coady <scoady@redhat.com>
2021-04-29 15:59:10 +01:00
Kalev Lember c6015fffb6 BRP Python Bytecompile: Avoid hardcoding /usr/bin prefix for python
Avoid using the full path and instead rely on PATH being correctly set
up to find the executable.

This fixes byte compilation for python2.7 when doing flatpak module
builds where python2.7 can be in either /usr/bin or /app/bin, depending
on how it's compiled.
2021-03-13 18:39:59 +01:00
Miro Hrončok c022fd5270 BRP Python Bytecompile: Also detect Python files in /app/lib/pythonX.Y
This is needed for flatpaks.

Alternatively, we could pass %{_prefix} as an argument to this script,
but that could make things a tad more complicated.

This solution is less general, but more pragmatic.

See https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/4FBBB3C5E63VDNGUJRLLW27LPZ74SEJH/
2020-12-07 12:41:38 +01:00
Florian Weimer fbe630a91e x86_64: Re-add -fcf-protection to build flags (#1891308)
Fixes commit c18bafdecc
("Enable -fstack-clash-protection for clang on x86, s390x, and
ppc64le").
2020-10-30 15:28:59 +01:00
Miro Hrončok 0d621460ce Filter out LTO flags from %%extension flags macros
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1877652
2020-09-11 20:42:36 +02:00
Michel Alexandre Salim ee8888f636 Add Requires: lua-srpm-macros
Signed-off-by: Michel Alexandre Salim <salimma@fedoraproject.org>
2020-09-02 19:03:55 -07:00
Tom Stellard c18bafdecc Enable -fstack-clash-protection for clang on x86, s390x, and ppc64le
This is supported with LLVM >= 11
2020-08-21 16:50:54 +00:00
Igor Raits 72a5199a5f
Fixup changelog
Signed-off-by: Igor Raits <ignatenkobrain@fedoraproject.org>
2020-08-20 19:05:06 +02:00
Tom Stellard d698d04313
Add -flto to ldflags for clang toolchain
Also, add a gating CI tests to ensure that future macro changes work
with clang.
2020-08-20 19:03:54 +02:00
Neal Gompa 8a5ee87c50 Fix CC/CXX exports and allow overrides like CFLAGS and CXXFLAGS
Some packages require being able to redefine the compiler variables
set to add additional base arguments that must be used everywhere.
This change makes it possible for that to work correctly.
2020-08-20 08:45:21 -04:00
Neal Gompa 61f9eb90ba Fix bad datestamp in changelog entry 2020-08-20 08:44:00 -04:00
Troy Dawson 1e92e63ac8 Add Requires: kernel-srpm-macros
The kernel doesn't do a complete build for all arches.  And example is i686 in Fedora, where only kernel-headers is built.
kernel-srpm-macros provides %kernel_arches so that the various packages have a consistent way to check for this.
2020-08-03 09:44:46 -07:00
Jeff Law 4637e1bd55 - Use -flto=auto for GCC to speed up builds 2020-07-30 10:45:53 -06:00
Tom Stellard 06f1d527d7 Only use supported lto flags for clang toolchain 2020-07-28 02:16:26 +00:00
Lumir Balhar 5a7ab8f927 Disable Python hash seed randomization in brp-python-bytecompile
This change should help with byte-compilation reproducibility: https://bugzilla.redhat.com/show_bug.cgi?id=1686078
2020-07-23 12:37:34 +02:00
Jeff Law 5baaf4a99c Enable LTO by default 2020-07-21 21:38:41 -06:00
Lumir Balhar 5f32aac09e New opt-in possibility to fix byte-compilation reproducibility
A new script brp-fix-pyc-reproducibility creates an opt-in way of how to fix
problems with the reproducibility of byte-compiled Python files. The script
uses marshalparser [0] which currently doesn't provide solutions for all issues
but can fix at least problems with reference flags. For more info see
this Bugzilla [1].

If you want to use this new feature, you need to define
`%py_reproducible_pyc_path` to specify a path you want to fix `.pyc`
files in (recursively) and build-require /usr/bin/marshalparser.

if you forget to build-require the parser. The error message is:
```
+ /usr/lib/rpm/redhat/brp-python-bytecompile '' 1 0
Bytecompiling .py files below /builddir/build/BUILDROOT/tldr-0.5-2.fc33.x86_64/usr/lib/python3.9 using /usr/bin/python3.9
+ /usr/lib/rpm/redhat/brp-fix-pyc-reproducibility /builddir/build/BUILDROOT/tldr-0.5-2.fc33.x86_64
ERROR: If %py_reproducible_pyc_path is defined, you have to also BuildRequire: /usr/bin/marshalparser !
error: Bad exit status from /var/tmp/rpm-tmp.UUJr4v (%install)
```

A build fails if the parser is not able to parse any of the `.pyc` files.

And finally, if a build is properly configured it produces fixed `.pyc` files.

Currently, `.pyc` files in the tldr package contain a lot of unused reference flags:
```
$ dnf install -y tldr
$ marshalparser --unused /usr/lib/python3.9/site-packages/__pycache__/tldr.cpython-39.pyc
… long output …
190 - Flag_ref(byte=9610, type='TYPE_SHORT_ASCII_INTERNED', content=b'init', usages=0)
191 - Flag_ref(byte=9633, type='TYPE_SHORT_ASCII_INTERNED', content=b'source', usages=0)
192 - Flag_ref(byte=9651, type='TYPE_SHORT_ASCII_INTERNED', content=b'argv', usages=0)
193 - Flag_ref(byte=9657, type='TYPE_SHORT_ASCII_INTERNED', content=b'print_help', usages=0)
194 - Flag_ref(byte=9669, type='TYPE_SHORT_ASCII_INTERNED', content=b'stderr', usages=0)
195 - Flag_ref(byte=9682, type='TYPE_SHORT_ASCII_INTERNED', content=b'parse_args', usages=0)
196 - Flag_ref(byte=9737, type='TYPE_SHORT_ASCII_INTERNED', content=b'encode', usages=0)
197 - Flag_ref(byte=9782, type='TYPE_SHORT_ASCII_INTERNED', content=b'parser', usages=0)
198 - Flag_ref(byte=9790, type='TYPE_SHORT_ASCII_INTERNED', content=b'options', usages=0)
199 - Flag_ref(byte=9799, type='TYPE_SHORT_ASCII_INTERNED', content=b'rest', usages=0)
200 - Flag_ref(byte=9821, type='TYPE_SHORT_ASCII_INTERNED', content=b'result', usages=0)
202 - Flag_ref(byte=10022, type='TYPE_SHORT_ASCII_INTERNED', content=b'__main__', usages=0)
203 - Flag_ref(byte=10102, type='TYPE_SHORT_ASCII_INTERNED', content=b'argparse', usages=0)
204 - Flag_ref(byte=10433, type='TYPE_SHORT_ASCII_INTERNED', content=b'__name__', usages=0)
205 - Flag_ref(byte=10463, type='TYPE_SHORT_ASCII_INTERNED', content=b'<module>', usages=0)
```

This new feature fixes them:

```
$ marshalparser --unused /usr/lib/python3.9/site-packages/__pycache__/tldr.cpython-39.pyc
<empty output>
```

[0] https://github.com/fedora-python/marshalparser
[1] https://bugzilla.redhat.com/show_bug.cgi?id=1686078
2020-07-21 11:42:54 +00:00
Lumir Balhar 8a4f0edb9a Use compileall from stdlib for Python >= 3.9
All enhancements from compileall2 are merged in Python 3.9.
2020-06-16 13:54:43 +02:00
Lumir Balhar ecf9fd3bdb No more automagic Python bytecompilation (phase 3) 2020-06-15 16:20:05 +02:00
Igor Raits 2c5594c9af
Fix broken %configure
Signed-off-by: Igor Raits <ignatenkobrain@fedoraproject.org>
2020-06-04 03:14:15 +02:00
Igor Raits 828c69effe
Fixes for new_package macro
Signed-off-by: Igor Raits <ignatenkobrain@fedoraproject.org>
2020-06-03 21:39:18 +02:00
Igor Raits 91333a9c7c Merge #91 `Fix PR 83` 2020-06-03 19:37:14 +00:00
Igor Raits 7562b38ec5
Add support for selecting a clang as a toolchain
Signed-off-by: Igor Raits <ignatenkobrain@fedoraproject.org>
2020-06-03 21:30:21 +02:00
Nicolas Mailhot a468b36e29 rpm will happily evaluate macros in changelogs — remove those 2020-05-31 16:08:58 +02:00
Jeff Law 891c721814 Latest version of sed fixes for broken/compromised configure macros 2020-05-30 13:21:08 -06:00
Jason Tibbitts 7324b32455 Add %new_package macro and associated lua framework. 2020-05-30 02:19:05 -05:00
Igor Raits 2a236590f5
forge: add gitea driver
Signed-off-by: Igor Raits <ignatenkobrain@fedoraproject.org>
2020-05-23 16:53:03 +02:00
Panu Matilainen cecab66c5d Optimize kernel module provides by using a parametric generator
This cuts the kernel provide generation time from ~33s to 2.5s on my laptop.
Tighten the path matching rule a bit while at it - it doesn't matter that
much with parametric generator but there's no point looking at entries
we don't generate dependencies on.
2020-04-09 14:36:16 +03:00
Jason Tibbitts 1b85ce0ce8 Keep the macro deps in alphabetical order. 2020-02-21 11:54:53 -06:00
Jason Tibbitts 3a4ec69bee Add dependency on fonts-srpm-macros.
The font guidelines overhaul was approved by FPC, so bring the macros
into the buildroot.  https://pagure.io/packaging-committee/issue/935
2020-02-20 16:56:42 -06:00
Jeff Law 9dd5528cf9 - Use eu-elfclassify to only run strip on ELF relocatables
and archive libraries.
2020-02-20 13:40:19 -07:00
Igor Raits edd94328ae
Fixup parallel algorithm for brp-strip-lto
Same as in RPM upstream.

Signed-off-by: Igor Raits <ignatenkobrain@fedoraproject.org>
2020-02-14 14:26:36 +01:00
Igor Raits b92766d4d9
Fix year in changelog
Signed-off-by: Igor Raits <ignatenkobrain@fedoraproject.org>
2020-02-14 14:20:25 +01:00
Jeff Law 20749d9857
Strip LTO sections/symbols from installed .o/.a files 2020-02-14 13:39:34 +01:00
Jeff Law 3e759e70ac Allow conditionally adding -fcommon to CFLAGS by defining %_legacy_common_support
Co-Authored-By: Miro Hrončok <miro@hroncok.cz>
2020-01-23 14:25:11 +01:00
Florian Weimer fff3459086 Reenable annobin after GCC 10 integration (#1792892)
This reverts commit c18924507d
("Temporarily disable annobin for GCC 10 (#1792892)").
2020-01-20 13:52:38 +01:00
Florian Weimer c18924507d Temporarily disable annobin for GCC 10 (#1792892) 2020-01-20 11:42:04 +01:00
Denys Vlasenko 40a9e696d6 Bump version
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2019-12-05 13:56:00 +01:00
Igor Gnatenko 2721f1c528
Bump version
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2019-12-03 15:48:35 +01:00
Denys Vlasenko ddce306578
Bump version
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2019-12-03 13:01:10 +01:00
Lumir Balhar 6335a7ff4a Fix brp-python-bytecompile with the new features from compileall2
Resolves: rhbz#1595265

The problem this change is intended to solve is with how `real_libdir`
is calculated. Let's assume we want to recursively byte-compile all
`*.py` files in
`/builddir/build/BUILDROOT/python-scales-1.0.9-250.fc32.x86_64/usr/lib/python3.8`.
Then, `real_libdir` is this path without `$RPM_BUILD_ROOT` with
the filename at the end which displays in the error message like this:

```
Bytecompiling .py files below /builddir/build/BUILDROOT/python-scales-1.0.9-250.fc32.x86_64/usr/lib/python3.8 using /usr/bin/python3.8
*** Error compiling '/builddir/build/BUILDROOT/python-scales-1.0.9-250.fc32.x86_64/usr/lib/python3.8/site-packages/greplin/bar.py'...
  File "/usr/lib/python3.8/bar.py", line 1
    import sin from math
               ^
SyntaxError: invalid syntax
```

`/usr/lib/python3.8/bar.py` is obviously wrong.

One of the new features of the `compileall2` module (which will
be available in stdlib in Python 3.9) is that the path byte-compiled to
`*.pyc` files is calculated for each file. This means that by using
`-s` and `-p` we can strip `$RPM_BUILD_ROOT` and prepend `/` for each
file individually which will fix the problem.

```
Bytecompiling .py files below /builddir/build/BUILDROOT/python-scales-1.0.9-250.fc32.x86_64/usr/lib/python3.8 using /usr/bin/python3.8
*** Error compiling '/builddir/build/BUILDROOT/python-scales-1.0.9-250.fc32.x86_64/usr/lib/python3.8/site-packages/greplin/bar.py'...
  File "/usr/lib/python3.8/site-packages/greplin/bar.py", line 1
    import sin from math
               ^
SyntaxError: invalid syntax
```

This change has an effect only for Python >= 3.4.
2019-12-02 16:39:32 +01:00
Miro Hrončok 4d93255fb3 Fix the simple API of %gpgverify 2019-11-01 08:04:12 +01:00
Jason Tibbitts 2c88f0ec58 Bump release and add changelog entry. 2019-08-22 10:46:36 -05:00
Richard W.M. Jones 0b30be56e5 Bump version and rebuild. 2019-07-25 10:13:28 +01:00
Igor Gnatenko 4a1d1dd78f
Fixup python-srpm-macros version
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2019-07-20 18:47:27 +02:00
Lumir Balhar 5437dfca81 Use compileall2 Python module for byte-compilation in brp-python-bytecompile 2019-07-20 08:08:26 +02:00
Miro Hrončok 53617406d9 Move brp-python-bytecompile from rpm, so we can easily adapt it 2019-07-20 08:07:57 +02:00
Nicolas Mailhot faef29eb93 bump release 2019-07-08 23:32:20 +02:00