Commit Graph

2380 Commits

Author SHA1 Message Date
08c5331f48 debugedit: Build newly imported debugedit 2020-11-09 23:07:25 +03:00
90136608c8 Merge (theirs) branch 'debugedit' into sisyphus
On rpm commit 98b71f7a92e8e9d902e2bfcd6c30af84dd80289b:
  $ git fast-export HEAD -- tools/debugedit.c > a

On rpm-build:
  $ git fast-import < a
  $ git br -m master debugedit
  $ git merge -X theirs --allow-unrelated-histories debugedit
2020-11-09 22:36:32 +03:00
32943fad62 4.0.4-alt152
- debuginfo: Allow kbuilds with the output directory.
- debugedit: Fix 'canonicalization unexpectedly shrank by one character'
  (closes: #39184).
- brp-sign-kmodules: Sign kernel modules after kernel build.
2020-11-06 15:16:45 +03:00
8b68c147ee brp-sign-kmodules: Sign kernel modules after kernel build
Try to work similar to `CONFIG_MODULE_SIG_ALL=y'.
2020-11-06 15:16:45 +03:00
dfc381d732 debugedit: Fix 'canonicalization unexpectedly shrank by one character'
Do not let canonicalization shrink directory name by 1 character. Or else
that would prevent (in-place) changing of Directory Table entries in
.debug_line section, causing following error in brp-debuginfo:

  /usr/lib/rpm/debugedit: canonicalization unexpectedly shrank by one character

Fixes: https://bugzilla.altlinux.org/show_bug.cgi?id=39184
2020-11-06 15:16:45 +03:00
4738619b15 debuginfo: Allow kbuilds with the output directory
Consider another directory level when searching for vmlinux, for kernel
builds in sub-directory using `make O=output_dir'. Also, improve warning
message making it more understandable.
2020-11-06 15:16:45 +03:00
4f5394b5a1 scripts/brp-compress.in: extend the range of autocompressed file types
Autocompress "[^:]*ASCII.* text.*" file types in addition to
"[^:]*troff or preprocessor input text.*".
2020-09-11 08:00:00 +00:00
1357563e49 scripts/brp-compress.in: use sed -rn 2020-09-11 08:00:00 +00:00
0dafa18b37 4.0.4-alt151
- debuginfo: Do not try to use eu-elfcompress if it does not exist.
- debuginfo: Fix adding non-existent files into debuginfo package.
2020-08-28 03:09:00 +03:00
453b0907f5 debuginfo: Do not try to use eu-elfcompress if it does not exist
Reason: ae1ecef8 ("process-debuginfo: Do not call eu-elfcompress if it doesn't exist")
Fixes: 8682814b ("debuginfo: Try to uncompress if debugedit failed to extract sources list")
2020-08-28 03:09:00 +03:00
b9ea232966 debuginfo: Fix adding non-existent files into debuginfo package
Do not add (uncompressed) module (or vmlinux) into debuginfo package if
it does not actually exists.

Due to other bugs there could be compressed kernel module, (which
implies adding uncompressed module into debuginfo), but, uncompressed
version (which brp-debuginfo should create) does not exist, making
build errors such as:

  error: No such file or directory: /usr/src/tmp/kernel-image-std-def-buildroot/usr/lib/debug/lib/modules/5.8.0-std-def-alt1/kernel/fs/nfs/flexfilelayout/nfs_layout_flexfiles.ko

Reported-by: Anton V. Boyarshinov <boyarsh@altlinux.org>
Fixes: 7aa048df ("Generate debuginfo for kernel packages")
2020-08-28 03:09:00 +03:00
506c6c5e4d 4.0.4-alt150
- Removed obsolete ldconfig, update menu, and install info macros.
- Implemented canonicalization of symlink destinations.
- Backported:
  + added a warning on absolute symlinks;
  + disabled calculation of digests for ghost files.
2020-08-24 19:38:47 +00:00
62037838a4 build: canonicalise symlink destinations
The canonicalization is based on the code lifted from tools/debugedit.c

The new behaviour is enabled by default and controlled by
%_canonicalize_symlinks macro.
2020-08-24 19:38:47 +00:00
Panu Matilainen
5f7fe6577f Warn on absolute symlinks at build-time
While supported of course, absolute symlinks are nasty in many ways
so issue a warning to packagers. Update two affected test-cases.
Related to #668.

(cherry picked from rpm.org commit 8359ded6784579b9f2527a09888132034783e1de)
2020-08-24 19:38:47 +00:00
Bernhard M. Wiedemann
7dba4f2bba Do not store digests of ghost files
when the files exist during build time.
The hash will never be used for verification anyway.

This helps making packages build more reproducibly.

(cherry picked from rpm.org commit 8cda485e1150dc6be990a7aa4496da848154cf55)
2020-08-24 19:38:47 +00:00
Panu Matilainen
308bc34ea9 Handle readlink() failure in genCpioListAndHeader() correctly
It might be a rare condition but it /can/ happen, and previously that would cause '\0' written out of bounds (at negative array offset). Also leave room for the terminating '\0' at the end of buffer when calling readlink(), previously a link exactly the size of buffer would've been silently truncated.

(cherry picked from rpm.org commit c499a0b912629eeeabc3554d3e3a95c088e96422)
2020-08-24 19:38:47 +00:00
7bae988692 Remove obsolete install info macros
This removes %install_info and %uninstall_info macros which point
to stabs since texinfo-4.13-alt1 released back in 2009.
2020-08-24 19:38:47 +00:00
c4685d6094 Remove obsolete ldconfig macros
This removes %post_ldconfig, %post_ldconfig_lib, %post_ldconfig_sys,
and %postun_ldconfig macros which were marked as obsolete by commit
da3de4082f back in 2008.
2020-08-24 19:38:47 +00:00
1b3396c94c Remove obsolete update menu macros
This removes %_update_menus_bin, %update_menus, and %clean_menus macros
which were marked as obsolete by commit
c9231cb270 back in 2008.
2020-08-24 19:38:47 +00:00
e66c512280 platform.in: remove @redhat@ and @mandrake@ lines, strip @alt@ prefix
The former are long unused and irrelevant,
the @alt@ prefix is a useless noise.
2020-08-24 19:38:47 +00:00
89f9245180 4.0.4-alt149
- find-debuginfo-files: Fix processing of root directory (closes: #38842).
2020-08-24 22:38:47 +03:00
f946b5c3b5 find-debuginfo-files: Fix processing of root directory
`%dir /' would cause errors (ALT#38842):

  error: No such file or directory: /usr/src/tmp/broken-debug-buildroot/usr/lib/debug/lib/modules
  error: No such file or directory: /usr/src/tmp/broken-debug-buildroot/usr/lib/debug/lib/modules/vmlinux

Reported-by: Vitaly Lipatov <lav@altlinux.org>
BZ: https://bugzilla.altlinux.org/show_bug.cgi?id=38842
2020-08-24 22:11:27 +03:00
fe545f319e 4.0.4-alt148
- debuginfo: Warn if stripped ELFs are found.
- debuginfo: Implement %_stripped_files_terminate_build.
- debuginfo: Try to uncompress if debugedit failed to extract sources.
2020-08-23 17:02:24 +03:00
8682814b04 debuginfo: Try to uncompress if debugedit failed to extract sources list
If debugedit failed to extract sources list, uncompress and try again.
Then compress back.

ps. Interesting relevant reading:
  https://blogs.oracle.com/solaris/elf_section_compression-v2

Spelling suggestions by Dmitry V. Levin <ldv@altlinux.org>.
2020-08-23 17:02:20 +03:00
aba565d889 debuginfo: Implement %_stripped_files_terminate_build
Terminate build if stripped ELF files are found. Usage:

  %define _stripped_files_terminate_build 1

Formatting suggestions by Dmitry V. Levin <ldv@altlinux.org>.
2020-08-23 17:01:20 +03:00
1f5bc5f866 debuginfo: Warn if stripped ELFs are found 2020-08-23 17:00:58 +03:00
5b7f0b0e50 4.0.4-alt147
- debuginfo: Show warnings if .debug sections are absent.
2020-08-21 23:38:49 +03:00
a64fcaf7a3 process-debuginfo: Change 'echo Warning' to 'Warning' call
Use dedicated `Warning' function instead of `echo'.

Suggested-by: Dmitry V. Levin <ldv@altlinux.org>
2020-08-21 23:38:49 +03:00
deaca8d8e3 debuginfo: Show warnings if .debug sections are absent
Actually, `.debug_line` section is checked (implicitly by debugedit)
which should go together with all `.debug_*` sections. This
simplification will make check faster.

Note: Only non-stripped binaries are checked.

Spelling fixes, usage of `Warning' function, and redirect to stderr is
suggested by Dmitry V. Levin <ldv@altlinux.org>.
2020-08-21 23:37:05 +03:00
Jan Kratochvil
c93ac72a8e debugedit: Fix missing relocation of .debug_types section. 2020-08-12 11:21:13 +03:00
Jan Kratochvil
612e1ecd4c [NFC] debugedit: Move code from edit_dwarf2() to edit_info(). 2020-08-12 11:21:13 +03:00
0175090680 4.0.4-alt146
- brp-debuginfo: Re-enable processing of kernel modules.
- debuginfo.req: Fix 'vmlinux' processing error on ppc64le.
- process-debuginfo: Do not call eu-elfcompress if it doesn't exist.
2020-07-09 19:23:18 +03:00
ae1ecef8bd process-debuginfo: Do not call eu-elfcompress if it doesn't exist
E2K arch have old elfutils-0.159 which doesn't have eu-elfcompress.
Error:

  /usr/lib/rpm/process-debuginfo: line 68: eu-elfcompress: command not found

Reported-by: Andrey Savchenko <bircoph@altlinux.org>
2020-07-09 19:23:18 +03:00
30d528d7bc debuginfo.req: Fix 'vmlinux' processing error on ppc64le
`vmlinux' on ppc appears to have `Dynamic Section', this triggers its
processing with `/usr/lib/rpm/ldd' which returns error:

  ldd: ERROR: /usr/src/tmp/kernel-image-std-test-buildroot/usr/lib/debug/lib/modules/5.4.49-std-test-alt4/vmlinux: failed to find the program interpreter
  find-requires: ERROR: /usr/lib/rpm/debuginfo.req failed
  error: /bin/sh failed
  error: Failed to find Requires

Reported-by: Anton V. Boyarshinov <boyarsh@altlinux.org>
2020-07-09 19:23:18 +03:00
ce2db3795b brp-debuginfo: fix thinko in the previous fix
Re-enable processing of ELF relocatable objects that *are* kernel modules.

Reported-by: Vitaly Chikunov <vt@altlinux.org>
Fixes: d71728c2c8 ("brp-debuginfo: fix handling of packages containing
ELF relocatable objects")
2020-07-09 08:00:00 +00:00
3d92ea81b8 4.0.4-alt145
- brp-debuginfo: fixed regression (in handling of packages containing
  ELF relocatable objects) introduced in 4.0.4-alt142.
2020-07-08 08:00:00 +00:00
d71728c2c8 brp-debuginfo: fix handling of packages containing ELF relocatable objects
Do not try to process ELF relocatable objects that are not kernel
modules, this fixes the following regression:

/usr/lib/rpm/debugedit: ./usr/lib64/gcc/x86_64-alt-linux/9/crtfastmath.o: DWARF version 0 unhandled
objdump: ./usr/lib64/gcc/x86_64-alt-linux/9/crtfastmath.o: bad value
verify-elf: ERROR: ./usr/lib64/gcc/x86_64-alt-linux/9/crtfastmath.o: objdump failed

Fixes: 7aa048df38 ("Generate debuginfo for kernel packages")
2020-07-08 08:00:00 +00:00
6eb60d94cf 4.0.4-alt144
- debuginfo: Fix processing of hard-linked binaries.
2020-07-07 13:44:54 +03:00
50705f69b7 debuginfo: Fix processing of hard-linked binaries
while-end output into the pipe forgets all set inside variables.

Error message:

  ln: .debuginfo/src/: hard link not allowed for directory
2020-07-07 13:44:03 +03:00
3cc270f50e 4.0.4-alt143
- debuginfo: Improve search for vmlinux binary.
2020-07-07 02:10:01 +03:00
ea366ac608 process-debuginfo: Better search for vmlinux
Find first file, in any dir name, three levels max from $RPM_BUILD_DIR.

Fix incompatibility found by building ovz kernel.
2020-07-07 02:09:44 +03:00
3bd1e2675b 4.0.4-alt142
- Generate debuginfo for kernel packages.
- Process debuginfo in parallel using process-debuginfo script.
- debugedit -n to avoid recomputing build-id.
2020-07-06 08:48:55 +03:00
f73a3de55c process-debuginfo: Do not eu-elfcompress vmlinux.debug
Allow `crash` (gdb-7.6 based) to work out of the box.

Otherwise it will fail with the error:

  Dwarf Error: wrong version in compilation unit header (is 0, should be 2, 3, or 4)

Alas, it will not be able to load debuginfo for the ko modules, but, advanced
user can `eu-elfcompress -t none` them manually.

We can't keep modules uncompressed due to `cpio archive too big - 4136M'
RPM build error.
2020-07-06 08:48:55 +03:00
1f2ad272a1 debugedit: Add -n to avoid recomputing of build-id
Avoid `DWARF version 0 unhandled' for compressed ELFs in
find-debuginfo-files.

Based on 6e9fd97f6 ("debugedit: Add -n, --no-recompute-build-id.")
by Mark Wielaard <mark@klomp.org>.
2020-07-05 01:06:16 +03:00
5cc014bed6 Process debuginfo in parallel
- Split processing of single binary into separate script.
- Call it from xargs -P.
2020-07-05 01:06:16 +03:00
7aa048df38 Generate debuginfo for kernel packages
- Support uncompressed (std-def) and compressed (un-def) modules. Also,
  support xz(1) compression if we'd switch to it.
- If module is uncompressed it stays in the kernel-image rpm, if it's
  compressed then uncompressed module goes into /usr/lib/debug tree and
  will be in debuginfo rpm. Compressed modules will be re-compressed after
  stripping.
- vmlinuz binary triggers extraction of vmlinux from the kernel-source
  tree, and it's then placed into /usr/lib/debug tree, then processed and
  stripped as usual.
- Logic of processing of vmlinux binary for domU packages is not changed.
  Some flavours do not even pack it. Thus, do not remove your
  `%brp_strip_none'.
- Output of file(1) for vmlinuz is only parsed for filename, because, on
  different architectures it detects completely different things.
- Debug files are compressed with `eu-elfcompress'.
- You still need to enable `CONFIG_DEBUG_INFO=y' in for `.config'.
  No other changes to spec should be needed.

Thanks to Nikita Ermakov for starting this work.
2020-07-05 01:06:16 +03:00
Ivan Zakharyaschev
019977a4d4 4.0.4-alt141
- Added /usr/lib/rpm/armv8l-alt-linux/macros for builds on armv8l machines.
  (Fixes 4.0.4-alt108:
  - installplatform, rpmrc.in: made armv8l compatible with armh.)
2020-07-03 14:42:32 +03:00
Ivan Zakharyaschev
d86252b853 checkinstall subpkg: add the new quick rpminstall-tests-archcompat-checkinstall 2020-07-03 14:42:32 +03:00
Ivan Zakharyaschev
ffd516be0e rpmrc.in: inessential tweaks to follow upstream rpmrc.in more closely
* * *

Add arch_canon statements for "armh", "armv7l", "armv8l". Re-order
them to be more similar to the current upstream rpmrc.in (say,
rpm-4.15 or rpm-4.13.0.1-alt22). Note, however, that this change
doesn't seem to be essential for anything, since "the arch in the lead
[the arch number] is not used for any purpose for most of this
century".[1]

[1]: https://stackoverflow.com/a/39426935/94687 "answer by Jeff Johnson"

* * *

Re-order ARM arch_compat statements to get an order similar to the
upstream (say, rpm-4.15 or rpm-4.13.0.1-alt22) to be able to compare
them more easily; compare to our rpmrc.in:

* the upstream first lists the big-endian archs (noarch -> armv4b);
* then the little-endian ones without hardfloat (noarch -> armv3l -> armv4l ->
  -> armv4tl -> armv5tl -> armv5tel -> armv5tejl -> armv6l -> armv7l -> armv8l);
* the the little-endian ones with hardfloat
  (noarch -> armv6hl -> armv7hl -> armv7hnl -> armv8hl);
* and separately the 64-bit one (noarch -> aarch64).

In our version of rpm-build we don't have any code for the detection
of the 'h' (hardfloat) or 'n' (neon) CPU features, but we actually
insert our "armh" arch into this chain (with 'h' hardfloat) between
what ought to be "armv6hl" and "armv7hl", and drop "armv6hl" from our
chain; in our compatibility chain, 'h' is silently supposed for "armv7l"
and "armv8l".

However, note a bad thing about this discrepancy: when our rpm-build
builds a package on armv8l targeting this arch, it's arch is armv8l.
However, when installing such a package on a normal ARMv8-A machine,
the 'h' feature must have been detected by "rpm -i", so our just built
package must not match the system arch and the installation must be
denied. However, in practice, I don't see such bad behavior in our
Girar builder when rpminstall-test-archcompat-checkinstall is
invoked... (I don't know why. Perhaps, the 'h' detection code doesn't
work as expected in rpm.)

* * *

Re-order similarly buildarch_compat statements.
2020-07-03 14:42:32 +03:00
Ivan Zakharyaschev
9e9b1c497f macros.in: %%arm += armv8l; rpmrc.in: optflags for armv8l target added
Targeting armv8l should trigger all the general ARM conditions in
specfiles and set the custom optflags.

Fixes: c18f1b7d ("installplatform, rpmrc.in: made armv8l compatible with armh")
2020-07-03 14:42:11 +03:00