Red Hat specific rpm configuration files
Go to file
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
.gitignore Add .gitignore file. 2016-10-03 17:03:08 -05:00
brp-fix-pyc-reproducibility New opt-in possibility to fix byte-compilation reproducibility 2020-07-21 11:42:54 +00:00
brp-implant-ident-static add brp-implant-ident-static, which requires mktemp 2003-01-20 20:06:50 +00:00
brp-java-repack-jars Trim trailing whitespace 2014-04-27 11:58:46 +03:00
brp-ldconfig Silence the annoying warning from ldconfig brp-script (#1540971) 2018-12-17 16:16:25 +02:00
brp-mangle-shebangs brp-mangle-shebangs: do not stat / touch files needlessly 2019-12-03 13:00:36 +01:00
brp-python-bytecompile Use compileall from stdlib for Python >= 3.9 2020-06-16 13:54:43 +02:00
brp-strip-lto - Use eu-elfclassify to only run strip on ELF relocatables 2020-02-20 13:40:19 -07:00
buildflags.md Allow conditionally adding -fcommon to CFLAGS by defining %_legacy_common_support 2020-01-23 14:25:11 +01:00
common.lua explicitset has not been renamed to set yet 2020-05-31 16:08:44 +02:00
config.guess Update config.guess, config.sub to the latest versions from upstream. 2016-10-13 16:28:32 +01:00
config.sub Update config.guess, config.sub to the latest versions from upstream. 2016-10-13 16:28:32 +01:00
dist.sh Make check_rhel function compatible with CentOS 2020-05-06 09:30:47 -05:00
find-provides The attached patch kills a bogus comment in redhat-rpm-config 2014-09-16 09:31:34 +03:00
find-provides.ksyms Fix kernel ABI related scripts 2018-06-04 08:44:43 +02:00
find-requires - Drop most of the script-based dependency generation bits 2014-04-10 15:20:54 +03:00
find-requires.ksyms Fix kernel ABI related scripts 2018-06-04 08:44:43 +02:00
firmware.prov Flatten the directory structure in preparation to merge 2014-04-02 10:42:10 +03:00
forge.lua forge: add gitea driver 2020-05-23 16:53:03 +02:00
gpgverify Added gpgverify. 2019-05-30 19:54:13 +02:00
kmod.attr Optimize kernel module provides by using a parametric generator 2020-04-09 14:36:16 +03:00
kmodtool Trim trailing whitespace 2014-04-27 11:58:46 +03:00
libsymlink.attr Use %__libsymlink_path instead of %__libsymlink_exclude_path in libsymlink.attr 2015-07-15 10:39:19 +02:00
macros New opt-in possibility to fix byte-compilation reproducibility 2020-07-21 11:42:54 +00:00
macros.dwz - require dwz, enable dwarf compression for debuginfo packages (#833311) 2014-01-25 00:11:43 +02:00
macros.fedora-misc clean up macro and lua function documentation 2020-05-29 08:47:28 +02:00
macros.fedora-misc-srpm clean up macro and lua function documentation 2020-05-29 08:47:28 +02:00
macros.forge clean up macro and lua function documentation 2020-05-29 08:47:28 +02:00
macros.kmp Make %kernel_module_package actually honor %kmodtool_generate_buildreqs 2017-07-18 14:42:07 +02:00
macros.ldc-srpm Add aarch64 to ldc arches 2018-08-20 22:33:04 +02:00
macros.ldconfig ldconfig: make %ldconfig_post/%ldconfig_postun parameterized 2018-02-25 07:11:46 +01:00
macros.mono-srpm Enable aarch64 for mono arches 2016-10-12 12:44:52 +01:00
macros.nodejs-srpm Add s390x build target for Node.js packages (#1391999) 2016-11-07 15:30:35 +02:00
macros.valgrind-srpm Add valgrind_arches macro for BuildRequires of valgrind (#1334599) 2016-11-07 15:50:01 +02:00
macros.vpath Add macros.vpath from FPC ticket 655 2016-12-15 13:05:41 -06:00
modalias.prov Trim trailing whitespace 2014-04-27 11:58:46 +03:00
redhat-annobin-cc1 Enable binary annotations in compiler flags 2017-11-22 12:41:44 +01:00
redhat-hardened-cc1 Fix cc1 specs mishandling of incremental linking 2015-07-08 13:49:53 -04:00
redhat-hardened-clang.cfg Add support for selecting a clang as a toolchain 2020-06-03 21:30:21 +02:00
redhat-hardened-ld Remove -z now from GCC specs file, now on command line (#1548397) 2018-02-24 21:37:06 +01:00
redhat-rpm-config.spec New opt-in possibility to fix byte-compilation reproducibility 2020-07-21 11:42:54 +00:00
rpmlint.cf Add %_configure_disable_silent_rules 2016-10-03 12:55:00 -05:00
rpmrc rpmrc: Add PAC/BTI for aarch64 2020-07-17 13:29:54 -05:00
rpmsort Update upstream redhat-rpm-config release. 2006-10-12 03:33:42 +00:00
sources - Remember to update lookaside-source status (there aren't any) 2014-04-02 13:21:15 +03:00
STAGE2-redhat-rpm-config Adding STAGE2 bootstrap recipe 2015-11-04 16:43:28 +01:00
symset-table patch from jcm to adjust kmod handling 2007-06-19 15:18:25 +00:00