Commit Graph

495 Commits

Author SHA1 Message Date
elros34 af06db1d55 Make check-files compatible with busybox diff
If busybox diff is used then script doesn't generate output when
rpmbuild is checking for installed (but unpackaged) file(s). This is
because busybox diff use unified format: '-' instead '< '.
2020-01-30 09:27:07 +02:00
Florian Festi 471e7d8bb2 Rename add_percent_dir to generate_percent_dir
to reflect what the function actually does.
2020-01-14 12:39:31 +02:00
Denys Vlasenko 5d20777b04 find-debuginfo.sh: speed up %dir generation
For kernel build, "${LISTFILE}.dirs.sed" is debugfiles.list.dirs.sed
and it contains 1782 lines of sed script.
It is applied to two files, both are about 4450 lines long.

This is slow (~30 seconds) because of ~16 million regex matches
performed by sed.

But we don't need or want regex match here
(and it's buggy, since dots in pattern match will be treated
as "any character", which is wrong here. For example,
      /usr/lib/debug/lib/modules/5@4@0-0@rc7@0@fc31@test@x86_64/vdso/
would match
      /usr/lib/debug/lib/modules/5.4.0-0.rc7.0.fc31.test.x86_64/vdso/
pattern, but it should not).

This change performs matching using shell string comparison ops.
For kernel build, this change results in run time of about one second.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2020-01-14 12:39:31 +02:00
Michal Čihař a34eb6b6ca Drop bash-specific message translation from check-rpaths
Message translation in scripts via $-prefix is bash-specific, but
check-rpaths is a /bin/sh script, drop the bashism. There are no
translations anyway so this is a no-op for all practial purposes.
Originally reported and fixed in Debian (DebBug:772404)
2020-01-14 12:37:41 +02:00
Florian Festi 177be9986a Make brp-strip run in parallel 2020-01-13 11:21:29 +02:00
Bernhard Rosenkränzer 0eb41c1794 brp-compress: Handle zstd compressed man/info pages
Handle zstd compressed man/info pages in brp-compress

Signed-off-by: Bernhard Rosenkränzer <bero@lindev.ch>
2020-01-10 10:31:27 +02:00
Miro Hrončok 2ea0b3a687 Python dist deps: Put bounded requirements into parenthesis
Fixes https://github.com/rpm-software-management/rpm/issues/995

For this input: pyparsing>=2.0.1,!=2.0.4,!=2.1.2,!=2.1.6

Instead of (invalid):
(python3.8dist(pyparsing) >= 2.0.1 with
 python3.8dist(pyparsing) < 2.1.2 or python3.8dist(pyparsing) >= 2.1.2.0 with
 python3.8dist(pyparsing) < 2.1.6 or python3.8dist(pyparsing) >= 2.1.6.0 with
 python3.8dist(pyparsing) < 2.0.4 or python3.8dist(pyparsing) >= 2.0.4.0)

Produces (valid):
(python3.8dist(pyparsing) >= 2.0.1 with
 (python3.8dist(pyparsing) < 2.1.2 or python3.8dist(pyparsing) >= 2.1.2.0) with
 (python3.8dist(pyparsing) < 2.0.4 or python3.8dist(pyparsing) >= 2.0.4.0) with
 (python3.8dist(pyparsing) < 2.1.6 or python3.8dist(pyparsing) >= 2.1.6.0))

For this input: babel>=1.3,!=2.0

Instead of (invalid):
(python3.8dist(babel) >= 1.3 with
 python3.8dist(babel) < 2 or python3.8dist(babel) >= 2.0)

Produces (valid):
(python3.8dist(babel) >= 1.3 with
 (python3.8dist(babel) < 2 or python3.8dist(babel) >= 2.0))

For this input: pbr!=2.1.0,>=2.0.0

Instead of (invalid):
(python3.8dist(pbr) >= 2 with
 python3.8dist(pbr) < 2.1 or python3.8dist(pbr) >= 2.1.0)

Produces (valid):
(python3.8dist(pbr) >= 2 with
 (python3.8dist(pbr) < 2.1 or python3.8dist(pbr) >= 2.1.0))
2020-01-03 17:55:28 +01:00
Gordon Messmer 3f58fc31f7 scripts/pythondistdeps: Only print rich dep list when required to. 2019-12-20 21:20:42 +01:00
Gordon Messmer 82971c6dea scripts/pythondistdeps: Only add setuptools requirement for egg-info packages. 2019-12-12 10:12:57 +01:00
Florian Festi a9e01be677 find-debuginfo.sh: Dont use xargs -d for portability
Use -0 instead which is more widly available.

Related: #948
2019-12-05 12:52:17 +02:00
Florian Festi a9b9fcbd46 brp-strip-static-archive: Do not use xargs -d
as it is not POSIX compliant and not supported on BSD and others

Dropping the use of grep here and using -regex of find instead to get rid of
the need for looking at lines terminated by newline.

Using only basic regular expressions for portability.

Resolves: #948
2019-11-29 08:46:48 +02:00
Gordon Messmer 18a3a046d0 scripts/pythondistdeps: Handle version ending with ".*" 2019-11-29 08:36:44 +02:00
Gordon Messmer ed864b8842 scripts/pythondistdeps: Handle compatible-release operator. 2019-11-29 08:36:44 +02:00
Gordon Messmer 403f75cdbb scripts/pythondistdeps: Use rich deps for semantically versioned dependencies 2019-11-29 08:36:44 +02:00
Gordon Messmer 54b5004cda scripts/pythondistdeps: Match python version if minor has multiple digits. 2019-11-29 08:36:44 +02:00
Panu Matilainen d666497bb2 Add generic rpmdb_dump and rpmdb_load utility scripts
There's plenty of documentation pointing to /usr/lib/rpm/rpmdb_dump
and rpmdb_load, which always were BDB specific utilities. Add a simple
wrapper scripts by the same names that perform --exportdb/--importdb
which is the database agostic way to achieve roughly the same as the
BDB tools by the same name used to do.
2019-10-21 15:43:28 +03:00
Panu Matilainen e40dc5eb58 Drop unused, BDB-specific rpmdb_loadcvt script 2019-10-21 15:43:28 +03:00
Tom de Vries 08ca76f1ca Remove unused variable id in find-debuginfo.sh
There's code setting variable id in scripts/find-debuginfo.sh, but there's no
subsequent use.  The only use of $id in the script is in do_file, where it is
a local variable.

The variable setting was introduced in commit 6b3b435fa "Add dwz debuginfo
compression support" in combination with a subsequent make_id_link using the
variable, but the make_id_link was removed in commit bbfe1f86b
"Add build-id links to rpm for all ELF files".

Remove the unused variable.
2019-08-26 13:48:40 +03:00
Pavlina Moravcova Varekova e9c13c6565 Eliminate use of ambiguous logical operators in script conditionals
Prefer '[] && []' to '[ -a ]' and '[] || []' to '[ -o ]' in tests.
-a and -o to mean AND and OR in a [ .. ] test expression is not well
defined, and can cause incorrect results when arguments start with
dashes or contain !. Moreover binary -a and -o are inherently
ambiguous. test(1) man page recommends to use
'test EXPR1 && test EXPR2' or 'test EXPR1 || test EXPR2' instead.

It corrects warnings [SC2166] spotted by covscan.
2019-08-21 14:09:37 +03:00
Pavlina Moravcova Varekova 7b76b2c062 Prefer '[] && []' to '[ -a ]' in test in find-debuginfo.sh (RhBug:1720590)
Spotted by covscan:
warning: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. [SC2166]
Originally introduced in commit 9aae21d.

Thanks to Florian Festi for spotting this and proposing the solution.
2019-07-29 16:12:25 +02:00
Florian Festi 09d181d78c Use newline as a delimiter to avoid xargs messing up file names with quotes
which is the default behaviour otherwise.

Fixes rhbz#1721348
2019-06-26 15:41:47 +03:00
Miro Hrončok 4c8b584074 Canonicalize Python versions and properly handle != spec
Fixes https://github.com/rpm-software-management/rpm/issues/639
2019-06-20 12:15:44 +02:00
nickclifton cc1965ce3a Add step to find-debuginfo.sh script to compress annobin notes.
With the introduction of the annobin gcc plugin to the build process,
built binary files have become larger.  Sometimes significantly so.
This is a patch that adds a new step to the post-link process performed
by rpmbuild, to run the objcopy program with the --merge-notes option
specified.  This will reduce the size of the annobin notes in binary
files, thus alleviating the size growth.
2019-06-19 14:45:09 +03:00
Pavlina Moravcova Varekova 9aae21d761 Use [ ] in condition to avoid sub processes in find-debuginfo.sh (#735)
Introduced in commit 1da9e83, spotted by covscan.
2019-06-05 12:06:15 +03:00
Florian Festi f23af97c41 Make check-buildroot check the build files in parallel
Thanks to Denys Vlasenko for pointing this out in rhbz#1704353
2019-05-06 16:22:23 +03:00
Florian Festi 1fd84fa0cf Fix brp-strip-static-archive parallelism
The change made in fc2c986 can break for large values of %_smp_build_ncpus as
this many processes are able to overflow the following pipe.

Thanks to Denys Vlasenko for testing this.

This change solves this problem by running a whole processing pileline for each
parallel (file) process. This has also the benefit of running at least some
stip commands in parallel.

The -n param fro xargs was increased to 32 to further reduce the over head of
spawing the helpers as they are now needed for each run of the file command.
2019-05-06 12:32:02 +03:00
Panu Matilainen 32055d7946 Drop outdated and unmaintained Mono dependency generators
Upstream Mono is being a good citizen and maintains their own
dependency generators nowadays, so let them.

Closes: #673
2019-04-24 13:43:01 +03:00
Florian Festi fc2c986d8f Use RPM_BUILD_NCPUS in brp-strip-static-archive
to speed the script up for large number of files to be looked at.
Use xargs -P instead of find -exec.

Add xargs to the test environment

Resolves rhbz1691822
2019-04-17 12:03:28 +03:00
Miro Hrončok 98d6b7bce0 Python generators: console_scripts entry points require setuptools
Fixes https://github.com/rpm-software-management/rpm/issues/664
2019-04-16 14:37:49 +02:00
Pavlina Moravcova Varekova 35b09eed94 Sort list of hard linked files in find-debuginfo.sh (RhBug:1421272)
It helps to make build results reproducible. Based on Mark Wielaard's idea.
2019-04-08 11:31:13 +03:00
Pavlina Moravcova Varekova 1da9e839bb Add flag to use strip -g instead of full strip on DSOs (RhBug:1663264)
The find-debuginfo.sh flag -g had exactly this meaning. But from
version rpm-4.13.0-alpha flag -g changes its behavior. It affects
both libraries and executables.

For some packages the original behavior was preferred. That is why
the new find-debuginfo.sh flag --g-libs is created.

Options -g and --g-libs are mutually exclusive.
2019-03-21 10:17:42 +02:00
Ernestas Kulik 0917da26bf find-debuginfo.sh: Handle position-independent executables
Since file 5.33, PIEs are identified by a new MIME type, meaning that,
currently, for such executables, the .gnu_debugdata section is not
added, even if -m is passed.

Signed-off-by: Ernestas Kulik <ekulik@redhat.com>
2019-02-26 09:44:11 +02:00
Panu Matilainen ba85c95963 Eliminate our script language helper macros and associated scripts
Having these kind of macros has increasingly forced us to ponder questions
like "what is the system default python", which have absolutely nothing
to do with rpm. And to that issue the only possible solution is eliminating
such content from rpm.

And yes this will break existing packages and force distros to deal
with the fallout, but we believe its for the best:
these macros are also best maintained by people closer to the languages
in question, as has been done with all the newer languages predating
perl and python. rpm-extras exists as the place for maintaining and
collaborating on such material.
2019-02-22 12:24:40 +02:00
Panu Matilainen 0e2b8a390e Take %_prefix into account when compressing man pages etc, take II
brp-compress used to be all hardcoded around /usr for no good reason.
Support passing prefix as an argument and only look for things to
compress there. First attempt in 5e65f92b53
had an embarrassing typo/thinko/case of missing brain in the assign syntax.

Based on feedback and work of Owen Taylor and Yanko Kaneti in PR #538
2018-10-01 15:39:03 +03:00
Panu Matilainen def91b85cc Revert "Take %_prefix into account when compressing man pages etc"
This reverts the broken commit 5e65f92b53.
2018-10-01 15:36:57 +03:00
Panu Matilainen 5e65f92b53 Take %_prefix into account when compressing man pages etc
brp-compress used to be all hardcoded around /usr for no good reason.
Support passing prefix as an argument and only look for things to
compress there.

Based on feedback and work of Owen Taylor and Yanko Kaneti in PR #538
2018-10-01 14:36:45 +03:00
Panu Matilainen 62d901a22b Report debuginfo size in kilobytes
By standard, 'du' defaults to 512 byte units, but this differs between
implementations: GNU du defaults to 1024 unless POSIXLY_CORRECT is set
and also allows overriding via number of environment variables. It also
supports various other ways of controlling the block size, but the
only standard means to control the size is -k, and we really don't
want to break portability for the sake of FYI statistics.

Inspired by Marxim Liska's patch at in #554.
2018-10-01 13:41:45 +03:00
marxin 6169f437f2 Info how beneficial is dwz compression.
Example output:
...
original debug info size: 120600, size after compression: 77604
...
2018-09-17 13:54:50 +03:00
Panu Matilainen fb8eb1c05d Revert "find-debuginfo.sh: decompress DWARF compressed ELF sections"
This is breaking suid bit handling in packaging unless an unreleased
bleeding edge version of elfutils is used. In other words it's not
an acceptable requirement and wont be for a long time. This needs
to be fixed in some other way.

This reverts commit 1c3bf3d649.
2018-09-06 11:39:15 +03:00
Pavlina Moravcova Varekova 93ac73ae01 Add missing documentation for --jobs in find-debuginfo.sh 2018-08-09 08:37:16 +02:00
Bernhard M. Wiedemann 801ee2e8eb find-debuginfo.sh: sort output of find
to make build results more reproducible
in spite of indeterministic filesystem readdir order.

For openSUSE, this helped to make squid, openssh, postfix and shadow
packages build reproducibly.

See https://reproducible-builds.org/ for why this is good.
2018-08-08 13:05:30 +03:00
Panu Matilainen 4bd45009b4 Fix an obvious typo in dwz filename generation
This typo has always been there since the initial implementation in
Fedora-specific patches in 2012 and inherited upstream. Which suggests
something hasn't been working right all this time, or then this will
break something all of a sudden...
2018-08-01 11:29:10 +03:00
Miro Hrončok fc449e06e5 Python generators: Use nonstandardlib for purelib definition
The purelib and platlib were both defined to /usr/lib64/python on
64bits systems. This is because:

    >>> get_python_lib(standard_lib=1, plat_specific=0)
    '/usr/lib64/python3.7'

    >>> get_python_lib(standard_lib=1, plat_specific=1)
    '/usr/lib64/python3.7'

    >>> get_python_lib(standard_lib=0, plat_specific=0)
    '/usr/lib/python3.7/site-packages'

    >>> get_python_lib(standard_lib=0, plat_specific=1)
    '/usr/lib64/python3.7/site-packages'

So now we use standard_lib=0 to get the site-packages base path
from /usr/lib and not /usr/lib64.
2018-07-28 22:55:00 +02:00
Mark Wielaard 1c3bf3d649 find-debuginfo.sh: decompress DWARF compressed ELF sections
debugedit and dwz do not support DWARF compressed ELF sections, let's
just decompress those before extracting debuginfo.

Tested-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2018-07-27 09:53:57 +02:00
Pavlina Moravcova Varekova df6ca7a76f Fix creating bogus requirements by perl.req (RhBug: 1539344)
When matching the module names demand a string of allowed characters
instead accepting everything and relying on terminating characters to
end the name.

Thanks to Jitka Plesnikova for the patch.
2018-06-29 09:53:52 +02:00
Mark Wielaard c68c2f1d8c find-debuginfo.sh: Handle application/x-pie-executable (file 5.33 output).
A new version of file (5.33) changed the output for PIE executables.
Which are now represented as application/x-pie-executable; charset=binary.

The following change simply recognizes that binary format as one for
which -g applies. This fixes accidental stripping of the .symtab in
glibc (which use -g to keep that symbol table).

https://bugzilla.redhat.com/show_bug.cgi?id=1581224

Signed-off-by: Mark Wielaard <mark@klomp.org>
2018-05-30 14:47:02 +03:00
Miro Hrončok d5e599d6c9 Provide a way to opt out from Python bytecompilation out side of lib dir
One can now unset %_python_bytecompile_extra (or set it to 0) to
opt out from Python bytecompilation outside of
/usr/lib(64)?/pythonX.Y.

One can also set %_python_bytecompile_extra to 1 to explicitly
opt in, even tough this is currently still the default.

Python bytecompilation of files outside of Python's own
directories (/usr/lib(64)?/pythonX.Y) with /usr/bin/python is
error prone. For context, see this Fedora change [1], it describes
all the problems and provides a longer explanation about why we
are doing this.

[1] https://fedoraproject.org/wiki/Changes/No_more_automagic_Python_bytecompilation

Also adds _python_bytecompile_errors_terminate_build macro which is passed to
the brp-python-bytecompile script.

Fixes #434
2018-05-28 13:32:09 +02:00
Panu Matilainen faf7d87fda Avoid hard dependency on python via the python macro helper script (#387)
Rpm always executes the script as an argument to /usr/bin/python[23], so
it doesn't need a shebang and then it shouldn't be executable either.
2018-02-12 13:38:14 +02:00
Miro Hrončok 7209c22a06 brp-python-bytecompile: Run a pre-flight find before invoking $default_python
This added check figures out whether invoking $default_python is necessary
and exits early if no files would be bytecompiled by the two blocks below.

This prevent's invoking $default_python (i.e. %{__python} (i.e. most likely
/usr/bin/python)) when not needed. Currently (before this change) it has
been invoked twice for each build (iff the executable was present in the
buildroot), even tough in most cases it did nothing. While this might have been
harmless, it prevents us to deprecate or even forbid /usr/bin/python invocation
during RPM build as proposed in Fedora in [1].

While this change is driven by Fedora's needs, I believe it can be useful
for others as well. It doesn't render the script utterly more complex,
while it prevents it from doing 2 superfluous (possibly slow) operations.

[1]: https://fedoraproject.org/wiki/Changes/Avoid_usr_bin_python_in_RPM_Build
2018-02-05 12:11:15 +01:00
Igor Gnatenko 0850547eb7 brp-compress: compress fish manpages
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2018-01-15 11:49:34 +02:00