Commit Graph

2520 Commits

Author SHA1 Message Date
Arseny Maslennikov
76fa8b1172 Rename find-package to solve misconflict with rpm
It is not that easy to ship find-package as part of rpm-build.
We have to drop find-package from the filelist of rpm as well. For this
change to enter Sisyphus, both rpm-build and rpm have to be changed and
rebuilt in their own base build chroots.

If rpm-build is built to include find-package first, rpm is
uninstallable in the base chroot due to a misconflict, so it cannot be
rebuilt.
If rpm is built to exclude find-package first, it disappears from the
base chroot altogether, making rpm-build break, so no
package can be built as well.
2024-03-04 20:36:26 +03:00
Arseny Maslennikov
44ef3a03cd /usr/lib/rpm/find-package: re-import from rpm.git
In an environment created by `hsh --initroot-only`:
  $ for i in /usr/lib/rpm/*; do rpm -qf --qf='%{name}: '"$i"'\n' "$i"; done | grep '^rpm:'
  rpm: /usr/lib/rpm/0ldconfig.filetrigger
  rpm: /usr/lib/rpm/GROUPS
  rpm: /usr/lib/rpm/find-package
  rpm: /usr/lib/rpm/functions
  rpm: /usr/lib/rpm/macros.d
  rpm: /usr/lib/rpm/pdeath_execute
  rpm: /usr/lib/rpm/platform
  rpm: /usr/lib/rpm/posttrans-filetriggers
  rpm: /usr/lib/rpm/postupdate
  rpm: /usr/lib/rpm/rpmd
  rpm: /usr/lib/rpm/rpmdb_loadcvt
  rpm: /usr/lib/rpm/rpme
  rpm: /usr/lib/rpm/rpmi
  rpm: /usr/lib/rpm/rpmk
  rpm: /usr/lib/rpm/rpmpopt-4.13.0.1
  rpm: /usr/lib/rpm/rpmq
  rpm: /usr/lib/rpm/rpmu
  rpm: /usr/lib/rpm/rpmv

The `scripts/find-package` file is installed from the rpm project. We
replace our copy with that one, so the installed file does not change
but is installed as part of rpm-build.
2024-03-04 15:48:36 +03:00
Arseny Maslennikov
6bfa4a28aa /usr/lib/rpm/functions: split away to rpmb-functions
In an environment created by `hsh --initroot-only`:
  $ for i in /usr/lib/rpm/*; do rpm -qf --qf='%{name}: '"$i"'\n' "$i"; done | grep '^rpm:'
  rpm: /usr/lib/rpm/0ldconfig.filetrigger
  rpm: /usr/lib/rpm/GROUPS
  rpm: /usr/lib/rpm/find-package
  rpm: /usr/lib/rpm/functions
  rpm: /usr/lib/rpm/macros.d
  rpm: /usr/lib/rpm/pdeath_execute
  rpm: /usr/lib/rpm/platform
  rpm: /usr/lib/rpm/posttrans-filetriggers
  rpm: /usr/lib/rpm/postupdate
  rpm: /usr/lib/rpm/rpmd
  rpm: /usr/lib/rpm/rpmdb_loadcvt
  rpm: /usr/lib/rpm/rpme
  rpm: /usr/lib/rpm/rpmi
  rpm: /usr/lib/rpm/rpmk
  rpm: /usr/lib/rpm/rpmpopt-4.13.0.1
  rpm: /usr/lib/rpm/rpmq
  rpm: /usr/lib/rpm/rpmu
  rpm: /usr/lib/rpm/rpmv

The `scripts/functions` file is provided from the rpm project in real
installations. Let's ensure scripts in this package use the functions
file from this package.
2024-03-03 23:38:10 +03:00
Arseny Maslennikov
656f209e71 4.0.4.195-alt1
- debuginfo: Changed compression format (--lzma2=dict=2MiB ->
  --check=crc32 --lzma2=dict=1MiB) of xz-compressed modules for compatibility
  with kmod >= 31 (thx asheplyakov@).
- Introduced brp-verify-unit to check sanity of systemd units included
  in built packages.
2024-01-11 17:00:00 +03:00
Arseny Maslennikov
119d2f57f6 Introduce 044-verify-unit.brp
It is intended to check the sanity of systemd units installed in the
buildroot. As of today, it errors out on executable unit files and units
passing nobody as User=, Group= or in SupplementaryGroups=.
2024-01-11 17:00:00 +03:00
2b153b6f00 process-debuginfo: fixed re-compression of kernel modules
Linux kernel supports the direct loading of compressed modules
(via finit_module system call) since version 5.15. However
decompression options are less flexible (and are set at
the compile time). In particular kernel can read lzma archives
only with a dictionary size exactly 1 MiB, and crc32 checksum.

kmod started to make use of direct module loading since version
31. However kmod does not fall back to decompressing in the userspace
if the kernel compressed modules, which causes serious troubles
(boot failures, some devices not working, etc).

To avoid the problem teach process-debuginfo.in to re-compress
kernel modules correctly (crc32 checksum, 1 MiB dictionary)
so the kernel can load them directly.

Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fbf5892df21a8ccfcb2fda0fd65bc3169c89ed28
Reviewed-by: Vitaly Chikunov <vt@altlinux.org>
2024-01-11 17:00:00 +03:00
a3730231c5 4.0.4.194-alt1
- debuginfo: Do not strip debugging vmlinux binary.
2023-12-08 06:13:23 +03:00
2230d27006 process-debuginfo: Do not strip&split debugging vmlinux binary
crash is unable to handle vmlinux split into vmlinux.debug because it
cannot find `.symtab`[1]. This is not expected to be fixed soon.

Really, there is not point to split it because both halves are in
the same -debuginfo package and this is only complicates things.

This also undoes approach taken in 894f4140c ("process-debuginfo: Add
.gnu_debuglink symlink for vmlinux").

Link: https://github.com/crash-utility/crash/issues/160
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2023-12-08 06:11:26 +03:00
9dbb075285 4.0.4.193-alt1
- debuginfo: Add .gnu_debuglink symlink for vmlinux.
2023-11-17 08:21:09 +03:00
894f4140ce process-debuginfo: Add .gnu_debuglink symlink for vmlinux
`eu-strip --strip-all` started to strip .symtab for un-def kernel
triggering different code path in crash(8) thus making it follow
value of `.gnu_debuglink` section and miss vmlinux.debug.

Also, this seems to be more portable overall - we can find vmlinux by
prepending `/usr/lib/debug` or by appending `.debug`.

With educated guess we assume eu-strip will put "BASENAME.debug" in
`.gnu_debuglink`.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2023-11-17 08:21:09 +03:00
d92345495d 4.0.4.192-alt1
- Backport support of tilde in version & release (ALT#46585).
2023-09-10 21:33:18 +03:00
f7613246b1 tests: rpmvercmp: Test for tilde
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2023-09-10 21:33:18 +03:00
785ae7a9a2 Backport: Add support for dpkg-style sorting of tilde in version/release
Original commit message:

- This allows much nicer handling some common scenarios such as
  upstream pre-releases where the pre-release version would normally
  appear newer than final release, eg 1.0-rc1 vs 1.0. Previously this
  required mapping the pre-release tag into the release tag to achieve
  desired sorting, with tilde this becomes simply 1.0~rc1 < 1.0.
- Add a rpmlib() tracking dependency to prevent older rpm versions
  from getting confused with packages relying on the new behavior.

Picked: db28221a4a ("Add support for dpkg-style sorting of tilde in version/release")
Authored-by: Michael Schroeder <mls@suse.de>
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
Picked: 8002b3f985 ("Spelling fixes.")
Authored-by: Ville Skyttä <ville.skytta@iki.fi>
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
Link: https://bugzilla.altlinux.org/46585
[ vt: Change to parseRCPOT is not applied because no rpmCharCheck call.
  Unsupported RPM tags (ORDERVERSION, SUGGESTSVERSION, ENHANCESVERSION)
  are removed. haveTildeDep is reworked because we don't have headerGet
  API. ]
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2023-09-10 21:33:18 +03:00
2d55bbb3bf tests: Add simple test of rpmvercmp algorithm
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2023-09-10 21:33:18 +03:00
pauln
471e85ce22 Return 1 and -1 as we state we do - #113668
CVS patchset: 7099
CVS date: 2004/02/17 14:29:42

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2023-09-10 20:20:20 +03:00
dd1b743c6e 4.0.4.191-alt1
- Support LoongArch architecture (lp64d ABI) (closes: #45769).
2023-08-02 13:22:53 +04:00
Ivan A. Melnikov
b429760f9c Add support for loongarch64
Based on upstream commit 7a014dae736f9c7a7c75f63deaa4dbbb9ae0249c
by Zhang Wenlong <zhangwenlong@loongson.cn>.
2023-08-02 11:58:23 +04:00
Gleb Fotengauer-Malinovskiy
402b4e7832 4.0.4.190-alt1
- Added the new %_runstatedir macro as an alias to %_runtimedir (ALT#46988).
- Modified the behavior of the %configure macro (ALT#46988):
  + to pass the --runstatedir option when it is supported by the configure
  script;
  + to disable detection and passing of the --runstatedir if the
  %_configure_use_runstatedir macro is undefined.
2023-07-23 05:00:00 +00:00
Gleb Fotengauer-Malinovskiy
e96f79a7d0 platform.in (%configure): pass --runstatedir=%_runstatedir
During %configure, the --runstatedir option will be automatically passed
to the configure script if it is supported.  However, in certain
scenarios where the package contains multiple configure scripts that
invoke each other, the detection of --runstatedir support may fail.
This can happen when only some of the scripts support the --runstatedir
option.  To address this issue and prevent the automatic passing of
--runstatedir, you can use the following in the spec file of the package
specfile:
%undefine _configure_use_runstatedir

This change is inspired by Fedora's redhat-rpm-config package,
specifically from the following commits:
* c0d2923: Added the "runstatedir" option to configure macros (authored
  by Frederic Berat).
* f857d65: Introduced %_configure_use_runstatedir to disable the usage
  of --runstatedir during configuration (authored by Florian Weimer).

The key distinction in this implementation is that it will issue a
warning in case the configure script doesn't support the --runstatedir
argument.
2023-07-23 05:00:00 +00:00
Gleb Fotengauer-Malinovskiy
e8f7583644 platform.in: Introduce %_runstatedir macro as an alias to %_runtimedir
Fixes: https://bugzilla.altlinux.org/46988
Suggested-by: Anton Zhukharev <ancieg@altlinux.org>
2023-07-23 05:00:00 +00:00
Gleb Fotengauer-Malinovskiy
d0ef940b5a 4.0.4.189-alt1
- rpm-build: provided_symbols: switched to eu-readelf to fix missing provides
  for symbols with peculiar bits that affect the output format of readelf from
  the binutils package (ALT#46447).
2023-06-08 05:00:00 +00:00
Gleb Fotengauer-Malinovskiy
051d1fee67 scripts/provided_symbols: use elfutils' readelf instead of binutils' one
This script is designed to ignore lines that don't follow the expected
format, but it is widely known that the output format of readelf utility
from the binutils project can be quite unreliable.  The output format
may vary on certain architectures and ELFs created with certain build
tools may contain symbols with peculiar bits that affect the output.

Here is a couple of examples illustrating these issues:
* On PowerPC, ELF symbols frequently include the localentry bit.
  For instance:
$ readelf --wide --dyn-syms /lib64/libcrypto.so.1.1  | grep ASN1_VISIBLESTRING_new
   157: 00000000000938c0    60 FUNC    GLOBAL DEFAULT [<localentry>: 8]    11 ASN1_VISIBLESTRING_new@@OPENSSL_1_1_0
* On x86_64, a proprietary blob /usr/lib64/libjcPKCS11ds.so (distributed
  as an ELF) and on armh /usr/lib/libLLVM-16.so, contain symbols with
  OS-specific bits:
$ readelf --wide --dyn-syms /usr/lib64/libjcPKCS11ds.so | grep _ZNSt7collateIwE2idE
  2572: 00000000002df9c8     8 OBJECT  <OS specific>: 10 DEFAULT   26 _ZNSt7collateIwE2idE
$ readelf --wide --dyn-syms /usr/lib/libLLVM-16.so | grep _ZN4llvm13AllAnalysesOnINS_6ModuleEE6SetKeyE
 45060: 05af0478     8 OBJECT  <OS specific>: 10 DEFAULT   26 _ZN4llvm13AllAnalysesOnINS_6ModuleEE6SetKeyE@@LLVM_16

The issue related to PowerPC localentry bits was resolved in the commit
4f4a1d146 ("lib.prov, lib.req: enhance ProvidedSymbols") a long time
ago.  The issue related to OS-specific bits was discovered recently [1].

Instead of attempting to resolve the output issues of binutils' readelf
utility concerning OS-specific bits, it is more convenient to use
readelf from elfutils.  It has more reliable output (including the
handling of the cases described earlier) and is extensively utilized
within the project anyway.

[1] https://bugzilla.altlinux.org/46447

Reported-by: Konstantin A. Lepikhov <lakostis@altlinux.ru>
Reported-by: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
Fixes: https://bugzilla.altlinux.org/46447
2023-06-08 05:00:00 +00:00
Arseny Maslennikov
f3057a09ad 4.0.4.188-alt1
- Set stdin to an empty stream for all build scripts.
2023-05-24 15:09:04 +03:00
Arseny Maslennikov
70ad448746 build: Unconditionally nullify stdin for build scripts
When we run a build script, redirect its standard input to a newly
created pipe with no open writers. This makes the behaviour of build
scripts more robust against e. g. unsolicited interactivity (esp. if
inherited stdio points to a tty) and more reproducible.
2023-05-24 15:08:28 +03:00
Arseny Maslennikov
10160b2d46 4.0.4.187-alt1
- systemd-services.req.files: handle user units and drop-in directories
  correctly.
2023-03-22 16:31:45 +03:00
Arseny Maslennikov
95476ebe95 systemd-services.req.files: consider user units 2023-03-22 16:31:45 +03:00
Arseny Maslennikov
da32535a15 systemd-services.req.files: handle directories correctly 2023-03-22 15:24:26 +03:00
64c2725b61 4.0.4.186-alt1
- systemd-services.req.in: fixed autoreq for systemd units.
2023-01-25 19:51:20 +03:00
8b687ab59e systemd-services.req.in: fix autoreq for systemd units
Starting with systemd-239, Exec*= lines of unit files
are no longer required to reference absolute paths.
systemd-services.req, however, was expecting an absolute paths.

Given the new system-update-cleanup.service:
ExecStart=rm -fv /system-update
systemd-services.req used to find "/system-update" requirement:
systemd-services.req: /usr/src/tmp/systemd-buildroot/lib/systemd/system/system-update-cleanup.service: /system-update -> /system-update (raw, not installed)

This change updates systemd-services.req to the new systemd unit files
semantics, and also cleanups the code by removing redundant grep.
2023-01-25 19:50:49 +03:00
fcc5e33e0b 4.0.4.185-alt1
- Backport packaging '%pretrans' Lua scriptlets (ALT#36628).
2022-10-11 08:05:30 +03:00
36d9f39b47 Backport packaging '%pretrans' Lua scriptlets
Based on rpm-4.4 with minor changes.
Running functionality is not backported.

Based-on: 73260d956c ("Implemented %pretrans and %posttrans script slots.")
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-10-11 08:05:12 +03:00
Gleb Fotengauer-Malinovskiy
9cabb6dd24 4.0.4.184-alt1
- build: fixed double timezone adjustment of CHANGELOGTIME tag value.
2022-07-07 05:13:02 +00:00
Gleb Fotengauer-Malinovskiy
6ffd67d220 parseChangelog.c: fix double timezone adjustment of RPMTAG_CHANGELOGTIME value
The RPMTAG_CHANGELOGTIME tag contains an array of UNIX times of
changelog entries, but changelog entries time lack information about
hour, minute, second, and timezone, so it was decided to assume noon
(12:00:00) UTC.
This commit fixes time adjustment from local timezone to UTC.
2022-07-06 16:01:07 +00:00
2b00463743 4.0.4.183-alt1
- debuginfo: Fix building of kernel modules by keeping .BTF section for kernel
  objects.
2022-06-24 00:45:50 +03:00
156cf74278 process-debuginfo: Keep .BTF section for kernel objects
`.BTF' section is needed to load kernel modules if
`CONFIG_DEBUG_INFO_BTF_MODULES' is enabled. This requirement is
introduced in Linux commit c446fdacb10d ("bpf: fix
register_btf_kfunc_id_set for !CONFIG_DEBUG_INFO_BTF").

`--keep-section=.BTF' is added also for vmlinux processing, because
commit seems to affect vmlinux (in case of `CONFIG_DEBUG_INFO_BTF').

Encountered error message:

  # modprobe nf_nat; dmesg | tail -1
  modprobe: ERROR: could not insert 'nf_nat': Unknown symbol in module, or unknown parameter (see dmesg)
  [16781.315808] missing module BTF, cannot register kfuncs

Reported-by: Andrew A. Vasilyev <andy@altlinux.org>
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
2022-06-24 00:36:36 +03:00
56a8a2f028 4.0.4.182-alt1
- scripts: replaced "egrep" with "grep -E", "fgrep" with "grep -F".
2022-04-26 08:00:00 +00:00
93297e9c33 s/egrep/grep -E/ 2022-04-26 08:00:00 +00:00
61e11d51a2 s/fgrep/grep -F/ 2022-04-26 08:00:00 +00:00
cf44c38b35 4.0.4.181-alt1
- lib.req: upgraded "library not found" warnings to errors:
  these warnings are real packaging errors,
  they also cause further ldd errors down the line.
2022-02-06 08:00:00 +00:00
9db3eec288 lib.req: upgrade "library not found" warnings to errors
These "library not found" warnings are real packaging errors,
they also cause further ldd errors down the line.
2022-02-06 08:00:00 +00:00
6e809aef69 4.0.4.180-alt1
- platform.in: added %pre_service_stop_posttrans_start and
  %post_service_posttrans_restart.
- README.ALT-ru_RU.UTF-8: updated (by Dmitry V. Levin).
2021-12-15 04:08:41 +00:00
12b1601256 README.ALT-ru_RU.UTF-8: Document %pre_service_stop_posttrans_start and %post_service_posttrans_restart 2021-12-15 04:07:37 +00:00
6ccdef292e platform.in: add %pre_service_stop_posttrans_start and %post_service_posttrans_restart
The names of the macros were proposed by Vitaly Chikunov (vt@) and were
approved by Dmitry V. Levin (ldv@).
2021-12-12 00:26:51 +00:00
Gleb Fotengauer-Malinovskiy
7290314714 4.0.4.179-alt1
- brp-debuginfo, process-debuginfo: added support of zstd-compressed modules.
- brp-sign-kmodules:
  + added support of zstd-compressed modules;
  + changed to skip and warn about modules compressed with unsupported method.
2021-11-03 03:11:44 +03:00
Gleb Fotengauer-Malinovskiy
0240974c0a brp-sign-kmodules.in: add comment regarding this script's scope 2021-11-03 03:11:44 +03:00
Gleb Fotengauer-Malinovskiy
8e514bdbdd brp-sign-kmodules.in: sync xz compression flags with the Linux kernel 2021-11-03 03:11:44 +03:00
Gleb Fotengauer-Malinovskiy
f8431643d5 brp-sign-kmodules.in: add support for zstd-compressed modules
It means that we support all module compression methods supported by
the modern Linux kernel because the v5.15 version supports gzip-, xz-,
zstd-compressed and uncompressed modules.
2021-11-03 03:11:44 +03:00
Gleb Fotengauer-Malinovskiy
8e9f5a8100 brp-sign-kmodules.in: rewrite module (de)compression logic
This change makes easier to add support of zstd-compressed modules in
the next commit.
2021-11-03 03:11:44 +03:00
Gleb Fotengauer-Malinovskiy
b80ad41451 brp-sign-kmodules.in: call nproc(1) utility once 2021-11-03 03:11:44 +03:00
Gleb Fotengauer-Malinovskiy
d60876ea4f brp-sign-kmodules.in: fix couple of shellcheck warnings
SC2162 ("read without -r will mangle backslashes") and SC2086: ("Double
quote to prevent globbing and word splitting").  These actually seem to
be harmless in our case.
2021-11-03 03:11:44 +03:00