Commit Graph

404 Commits

Author SHA1 Message Date
Igor Gnatenko 83e4d44b80 pythondistdeps.py: skip .egg-link files
From setuptools's documentation:
These files are not eggs, strictly speaking. They simply provide a way
to reference an egg that is not physically installed in the desired
location. They exist primarily as a cross-platform alternative to
symbolic links, to support "installing" code that is being developed in
a different location than the desired installation location.

If we read .egg-link using pkg_resources.Distribution it will
never have version as it is just list of directories which should be
taken into account.

We could change into that directories and add eggs from those locations
for parsing, but RPM's dependency generator already passing all files
from built RPM so it just does not make any sense to traverse those
directories.

After all written above, let's just ignore .egg-link files.

Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
2016-08-22 15:19:08 +02:00
Igor Gnatenko 2f51022e15 pythondistdeps.py: show warning if version is not found in metadata
In 49197c930b we introduced skipping
metadata which has no version, but it's better to show some warning.

Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
2016-08-22 15:04:42 +02:00
Neal Gompa (ニール・ゴンパ) 49197c930b pythondistdeps.py: skip distribution metadata if there is no version
For example, reading .egg-link using pkg_resources.Distribution returns
actual metadata, but it does not contain version. It returns traceback like:

File "/usr/lib/rpm/pythondistdeps.py", line 113, in <module>
    pyver_major = dist.py_version.split('.')[0]
AttributeError: 'NoneType' object has no attribute 'split'
Traceback (most recent call last):
  File "/usr/lib/rpm/pythondistdeps.py", line 113, in <module>
    pyver_major = dist.py_version.split('.')[0]
AttributeError: 'NoneType' object has no attribute 'split'

Let's just skip such errors as we can't do much about that.

Reference: https://bugzilla.redhat.com/show_bug.cgi?id=1368673
Reported-and-tested-by: Igor Gnatenko <ignatenko@redhat.com>
2016-08-22 15:02:54 +02:00
Igor Gnatenko 9571218345 let debuginfo packages provide the build-id
This patch lets debuginfo packages provide build-id like follows:

 debuginfo(build-id) = c63cb23876c5fa85f36beaff58f8557e1bf22517

Originally this patch was written by Jan Blunck <jblunck@suse.de>.

Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
2016-08-03 12:10:40 +02:00
Mark Wielaard 45bfecbf7d Add option to have unique debug file names across version/release/arch.
Introduce a new macro _unique_debug_names that when set will pass
--unique-debug-arch "%{_arch}" to find-debuginfo.sh to create debuginfo
files which end in "-<ver>-<rel>.<arch>.debug" instead of simply ".debug".

Adds testcases for dwz and buildid with and without unique debug file names.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
2016-07-29 18:29:10 +02:00
Mark Wielaard 67d3df3388 Make adding GDB index sections configurable.
Introduces _include_gdb_index macro and -i flag to find-debuginfo.sh to
enable or disable adding a .gdb_index section to debug files. Adds tests
to make sure the .gdb_index is really added (or not) when requested.
Checks that gdb-add-index is actually installed instead of silently
failing if not. Similar for dwz.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
2016-07-29 18:28:53 +02:00
Mark Wielaard 5ef1166ad9 Make it possible to have unique build-ids across build versions/releases.
Introduce a new macro _unique_build_ids that when set will pass the
version and release to find-debuginfo.sh and debugedit to recalculate
the build-id of ELF files.

Includes two new testcases to make sure the new setting works as expected
both when set and unset.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
2016-07-29 18:28:53 +02:00
Mark Wielaard bbfe1f86b2 Add build-id links to rpm for all ELF files.
This patch moves the main ELF file build-id symlinks from the
debuginfo package into the main package. And uses different
base directories for the main ELF file build-id symlink.
For the main build-id use /usr/lib/.build-id and for the debug
build-id use /usr/lib/debug/.build-id.

There are two reasons for doing this. The main package and the
debuginfo package might get out of sync, or the debuginfo package
might not be installed at all. In which case finding the main ELF
file through the build-id symlink becomes impossible. Secondly by
moving the main ELF build-id symlink in its own directory the
/usr/lib/debug directory gets populated with only debuginfo files
which is convenient if the user might want to have that directory
populated through a network mountpoint.

To support the new logic the symlink code has been moved from
find-debuginfo.sh to build/files.c.

This also includes support for a new config %_build_id_links that
defaults to compat. The other settings are none, alldebug (the old
style) and separate. compat is like separate, but adds a compatibility
link under /usr/lib/debug/.build-id for the main build-id symlink.

There are several new testcases added to test the various settings
using the new keyword "buildid".

Signed-off-by: Mark Wielaard <mjw@redhat.com>
2016-07-29 18:28:53 +02:00
Mark Wielaard 4ec7c396fb Add sepdebugcrcfix to fixup old style gnu_debuglink CRC checksum.
Some old tools might still use the .gnu_debuglink section to find
separate debuginfo files instead of build-id style lookups. When
dwz has compresses the .debug files the original CRC in the main
ELF file will no longer match. Make sure to run sepdebugcrcfix
after dwz to recalculate the CRC.

The original fix was created by Jan Kratochvil based on code
from GNU binutils BFD. https://bugzilla.redhat.com/show_bug.cgi?id=971119
I added a testcase to make sure the CRCs were all correctly
updated after dwz has run to compress a debuginfo package.
And a change (plus testcase) to make sure implicit suid binaries
didn't accidentially got their suid flag bit.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
2016-07-29 18:28:53 +02:00
Mark Wielaard 41c4dcf507 Don't use hardcoded paths to tools/scripts in find-debuginfo.sh.
This prevents installation and testing in any other location than
/usr/lib/rpm.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
2016-07-29 18:28:53 +02:00
Mark Wielaard 6b3b435fa6 Add dwz debuginfo compression support.
Support for dwz compression has been in Fedora since a couple of years.
https://fedoraproject.org/wiki/Features/DwarfCompressor

The original find-debuginfo.sh patch was written by Jakub Jelinek.
https://bugzilla.redhat.com/show_bug.cgi?id=833311
The new testcase using the macros.debug was added by me.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
2016-07-29 18:28:53 +02:00
Mark Wielaard b33a41da36 Add find-debuginfo.sh -m minisymtab support.
Support for minisymtab (a minimal function symbol table in a compressed
section in the main binary) has been in gdb and elfutils based tools
since some years. Fedora has had this as rpm-4.10.0-minidebuginfo.patch
since 2012.

The patch adjusts macros to pass -m to find-debuginfo.sh when
_include_minidebuginfo has been set. find-debuginfo.sh now takes -m
as argument to generate the .gnu_debugdata ELF section to be added
to the main executable.

To support the testcases a new macros.debug is added that is used to
generate debuginfo packages in the rpmbuild.at testsuite.

The original support was added to Fedora rpm by Alexander Larsson.
Lubos Kardos fixed a bug in it when strip -g was used. I added some
configuration macros and two testcases to check the basic support works
and for the strip -g bug.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
2016-07-29 18:28:53 +02:00
Florian Festi 6a8754b215 perl.req: Skip over multi line return statements
See Rhbz#1275551
2016-06-14 15:01:16 +02:00
Florian Festi 8e744513df Allow lang code only QT translation file names in find-lang.sh
Previously the file names hat to have appname_langcode.pm now just
langcode.pm is supported.
Resolves: RhBz:#729336
2016-04-15 16:33:03 +02:00
Lubos Kardos 87456ecff1 Don't fail build if there are no pyc/pyo/... files to link
The fact that pyc and pyo doesn't have same the content doens't mean
an error. It just means they can't be hard linked but that is not
an error. In normal circumstances the file brp-python-hardlink from
the rpm packages is often overrided by the file from redhat-rpm-config
that is why this problem wasn't revealed earlier.
2016-04-14 14:26:12 +02:00
Zbigniew Jędrzejewski-Szmek f8a75ae6a2 Fix option parsing in pythondistdeps
Followup for d636ab1.
2016-03-02 14:10:43 -05:00
Florian Festi 0534715479 Fix Makefile for rename scripts/pythoneggs.py -> scripts/pythondistdeps.py 2016-02-15 15:57:55 +01:00
Neal Gompa (ニール・ゴンパ) 29abb07fbf Rename to pythonX.Ydist, read .dist-info, support legacy pythoneggs()()
Per the recommendation of Nick Coghlan and Toshio Kuratomi,
pythonXegg(M) is being renamed to pythonX.Ydist(M).

An option has also been added to add a pythonXdist(M)
Provides for distributions that may prefer to have it.
The option '--majorver-provides' is intended for use
if only one Python stack per major version will be
available at a given time, as unexpected results may
occur if there are multiple independent Python stacks
per major version available.

Consequently, it will not be on by default when using
the generator for generating Provides.

Additionally, .egg-info data is being replaced with
.dist-info data, so we need to handle that case, too.

See for more details:
https://lists.fedoraproject.org/archives/list/python-devel%40lists.fedoraproject.org/thread/SQBSAS4T25HK5YJBNBSFDD7KDQWDELL6/

Also, Thierry Vignaud brought up on rpm-maint that Mageia
currently uses "pythonegg(X)(M)" (e.g. "pythonegg(3)(rpm)"
for python3 rpm bindings package) in their Python packages
to pull in Python dependencies and requested a way to
not break Mageia.

After discussing with Florian Festi about it, Mageia's
pythonegg(X)(M) will be supported by adding '--legacy'
as a switch to generate legacy Provides/Requires to maintain
compatibility with Mageia's existing usage.

The '--legacy-provides' switch will enable pythonegg(X)(M)
Provides in addition to the new pythonX.Ydist(M) format to
allow for a easier transition.
2016-02-11 18:23:19 +01:00
Thierry Vignaud d636ab156f kill unimplemented -O option
let's not over-engineering
2016-02-11 10:09:43 +01:00
Thierry Vignaud 8f0ddfe072 kill now unused is_exe() 2016-02-11 10:09:43 +01:00
Thierry Vignaud e6cc5a5a51 kill now useless --buildroot option 2016-02-11 10:09:42 +01:00
Thierry Vignaud f5168b4619 do not call typelib deps generator
rationale:
1) typelib deps are unrelated to python
2) typelib deps are computed by suse generator
3) suse generator is not present upstream
4) let's not reinvent internal deps generator here...
2016-02-11 10:09:42 +01:00
Lubos Kardos 33158b3b00 Fix recursive calling of rpmdeps tool (rhbz:1297557) 2016-01-15 15:41:52 +01:00
Lubos Kardos 1d9a0018f9 Improve perl.req script
This commit 0d5929ba5e tries to ignore
"use" and "require" within multi-line print statements that start with
line like this "print <<EOF" but it incorrectly parses lines in
following format "print <<EOF unless $o" and every "use" or "require"
below this line to the end of file is ignored. That causes that some
requires which was previously found are not found now. This commit
fixes this problem (#1268021).
2015-11-25 15:10:16 +01:00
Ville Skyttä 36a681d107 pythoneggs.py: flake8 fixes 2015-11-19 11:12:25 +01:00
Ville Skyttä 489a08c840 brp-python-hardlink: Use cmp instead of sha1summing
diffutils is a rpm-build dependency anyway nowadays,
e.g. find-debuginfo.sh uses cmp too.
2015-11-19 11:08:47 +01:00
Neal Gompa (ニール・ゴンパ) a8accc3d72 Switch shebang to /usr/bin/python
Using '/usr/bin/env python' could lead to unexpected results,
so switching to this guarantees that it will use the system-wide
Python environment, instead of any virtual environments or whatnot.
2015-11-12 17:22:26 +01:00
Neal Gompa (ニール・ゴンパ) 514b6401c3 Cosmetic refactor to rename 'dlower' to 'lower_dir' 2015-11-12 17:22:26 +01:00
Neal Gompa (ニール・ゴンパ) 79c7825622 Conditionally import pkg_resources to speed up Python dep extraction
This change was brought over from the fix used by Mageia to speed
up the extraction of Python dependencies. As Mageia found out
(and verified to be true with this generator too), the generator
is now called on every file in the package. This means that the
pkg_resources import time is now a drag on the performance of
generating dependencies.

For more details, see the following link:
http://gitweb.mageia.org/software/rpm/rpm-setup/commit/pythoneggs.py?id=b77d47f90289413e20f295b93ae8c51012f53e3d
2015-11-12 17:22:26 +01:00
Neal Gompa (ニール・ゴンパ) dc862a67d6 Properly generate pythonXegg() Req/Prov & refactor string formatting
The egg dependency generator was slightly inconsistent here.
While it would generate python2egg() for Py2 Requires/Recommends and
pythonegg() for Py3 Requires/Recommends, it would generate python3egg()
for Py3 Provides and pythonegg() for Py2 Provides. Rather than make a
decision on which is the "proper" Python here, let's just handle them
the same way: pythonXegg(), with "X" being the Python major version.

This way, it's absolutely clear which Python it is for, and as
new major versions of Python become a reality, we should be able to
handle that quite easily and (of course) sanely. The approach is
inspired by the method used in Mageia's python dependency generator.

In case the generator is being used in an environment where
Python 2 is the default still, the appropriate import to ensure
that print() works has been added.

Additionally, the string formatting calls have been refactored
to use string.format() instead of old-style printf-esque calls.
This enhances the readability slightly by making it so that '%'
isn't being used for anything but RPM stuff in strings.
2015-11-12 17:22:26 +01:00
Ville Skyttä a4a6f7afb6 brp-python-hardlink: Handle Python 3.5's *.opt-[12].pyc
https://www.python.org/dev/peps/pep-0488/
2015-11-12 13:37:41 +01:00
Per Øyvind Karlsen a33f81d945 in rpm.org, soft dependencies has their own 'Recommends' tag, rather than 'Suggests' alias for 'Requires(missingok)' as in rpm5.org... 2015-08-31 16:43:56 +02:00
Per Øyvind Karlsen 3523921ea9 generate python2egg(foo) deps for python 2, and pythonegg(foo) for python 3, rather than the opposite 2015-08-31 16:43:56 +02:00
Per Øyvind Karlsen 178a944584 update email and description in header of python egg dep generator 2015-08-31 16:43:56 +02:00
Per Øyvind Karlsen (proyvind) 26218b2b2e add new python dependency generator script that use python egg metadata 2015-08-31 16:43:56 +02:00
Jerome Quelin 1382ef0c6c add support for _ in perl module version 2015-08-28 15:14:50 +02:00
Jérôme Quelin 3ee146e1e2 skip plain, regular comments
how comes this has not been spotted earlier? (sigh)
2015-08-28 15:14:50 +02:00
Rafael Garcia-Suarez 548dc9f38f ignore non module perl files for provides if
Don't search perl files for provides if they don't end with .pm (because
if they don't, the perl interpreter won't look them up in @INC)
2015-08-28 15:11:33 +02:00
Per Øyvind Karlsen 936956715c add support for MATE (GNOME 2 fork) desktop help files to find-lang.sh 2015-08-28 15:05:02 +02:00
Per Øyvind Karlsen f78e5643c9 make find-lang.sh handle man pages already compressed 2015-08-28 15:05:02 +02:00
Per Øyvind Karlsen 0c42871ff4 add support for finding html files with find-lang.sh --with-html 2015-08-28 15:05:02 +02:00
Per Øyvind Karlsen 74913fc97a only set default values for $COMPRESS & $COMPRESS_EXT if environment variables isn't already set, allowing to overriding these 2015-08-28 15:05:02 +02:00
Thierry Vignaud 8fc3026739 do not bytecompile python scripts in docdir
Signed-off-by: Lubos Kardos <lkardos@redhat.com>
2015-08-28 13:11:45 +02:00
Florian Festi 5b4805df20 Fix stripping of binaries for changed file output.
file will print a "warning" that it only processed up to 256 notes.

 - Related: 659614aeb6
 - Related: http://rpm.org/ticket/887
 - Related: rhbz#1206312
2015-06-30 11:42:11 +02:00
Lubos Kardos d2a6bec000 Don't bytecompile symlinks which point outside buildroot (rhbz:#1026469). 2015-06-22 11:25:31 +02:00
Lubos Kardos 679556fa1f Replace using of undocumented bash feature with documented one. 2015-04-17 10:23:14 +02:00
Lubos Kardos 0f051ab3b5 Pass _find_debuginfo_opts -g to eu-strip for executables (rhbz:#1186563) 2015-03-27 16:08:14 +01:00
Pascal Terjan 659614aeb6 Fix debuginfo creation for changed file output.
file will print a "warning" that it only processed up to 256 notes.
Fixes: http://rpm.org/ticket/887
2015-02-16 13:36:55 +01:00
Lubos Kardos 4c621e9777 Ignore "use" or "requires" within multi-line print or assign statement
- Now script perl.req ignores "use" and "requires" on lines that are
  part of printing or assigning multi-line string i. e. string that
  hasn't starting and ending quote on the same line.
  (RhBug:1024517)
2014-12-03 17:29:40 +01:00
Lubos Kardos 4f05fa0e15 Fix parsing multi-line print statement with unquoted tag
- script perl.req was able to parse only multi-line print statements
  with quoted tag e.g. 'print <<"tag"' or "print <<'tag'". Now it can
  also parse "print <<tag".
2014-12-03 17:29:40 +01:00