|
|
0b26f7 |
#!/bin/bash
|
|
|
0b26f7 |
# Auto-generating dependencies for glibc development snapshots.
|
|
|
0b26f7 |
#
|
|
|
0b26f7 |
# A glibc development snapshot (say version 2.33.9000) may define
|
|
|
0b26f7 |
# symbols in its under-development symbol version (GLIBC_2.34). RPM
|
|
|
0b26f7 |
# automatically derives RPM dependencies such as
|
|
|
0b26f7 |
# libc.so.6(GLIBC_2.34)(64bit) from that. While the GLIBC_2.34
|
|
|
0b26f7 |
# version is under development, these dependencies may be inaccurate
|
|
|
0b26f7 |
# and could be satisfied by glibc RPM package versions that lack the
|
|
|
0b26f7 |
# symbols because they were created from an earlier development
|
|
|
0b26f7 |
# snapshot that had some other GLIBC_2.34 symbols. Therefore, if the
|
|
|
0b26f7 |
# latest, under-development ELF symbol version is detected, this
|
|
|
0b26f7 |
# dependency generator adds an explicit RPM dependencies on the glibc
|
|
|
0b26f7 |
# packaging version against which an RPM package is built.
|
|
|
0b26f7 |
#
|
|
|
0b26f7 |
# This script runs for the glibc build itself. In this case, it may
|
|
|
0b26f7 |
# produce a >= dependency on the build-time glibc, but there will also
|
|
|
0b26f7 |
# be an (potentially indirect) = dependency, which takes precedence.
|
|
|
0b26f7 |
|
|
|
0b26f7 |
set -e
|
|
|
0b26f7 |
set -o pipefail
|
|
|
0b26f7 |
|
|
|
0b26f7 |
searching=true
|
|
|
0b26f7 |
# Pre-filter using eu-elfclassify, to skip kernel modules.
|
|
|
0b26f7 |
eu-elfclassify --loadable --file --stdin --print | while read path; do
|
|
|
0b26f7 |
# Assume that all dynamically linked objects depend on glibc in
|
|
|
0b26f7 |
# some way.
|
|
|
0b26f7 |
if $searching; then
|
|
|
0b26f7 |
# Undefined symbols within latest, under-development
|
|
|
0b26f7 |
# (changing) symbol versions trigger the versioned RPM
|
|
|
0b26f7 |
# dependency. Do not use "egrep -q" to keep reading from the
|
|
|
0b26f7 |
# pipe, avoiding a spurious EPIPE error in eu-readelf.
|
|
|
0b26f7 |
if eu-readelf -s "$path" \
|
|
|
0b26f7 |
| egrep '\sUNDEF\s.*@''@SYMVER@(\s|$)' >/dev/null
|
|
|
0b26f7 |
then
|
|
|
0b26f7 |
echo 'glibc >= @VERSION@-@RELEASE@'
|
|
|
0b26f7 |
# Stop searching after the first match, but keep reading from
|
|
|
0b26f7 |
# the pipe.
|
|
|
0b26f7 |
searching=false
|
|
|
0b26f7 |
fi
|
|
|
0b26f7 |
fi
|
|
|
0b26f7 |
done
|