rpm-build/tools/Makefile.am
Arseny Maslennikov 5e1278ff0a CanonPath: reimplement, use an "ignore list" of path components
If e.g. /bin is a symbolic link, it is canonicalized into /usr/bin, so
packages get auto-generated dependencies on paths like /usr/bin/sh and
/usr/sbin/blkid.

Here is an example error message:
  The following packages have unmet dependencies:
    chrooted: Depends: /usr/bin/sh but it is not installable
              PreDepends: /usr/bin/sh but it is not installable
  E: Broken packages
  hsh-install: Failed to calculate package file list.
  hsh-install: Failed to generate package file list.

Try to work around this by replacing the current sorta-canonicalization
written in shell with a small C program which implements an algorithm
akin to realpath. It deviates from `realpath` and `readlink -e` in 3
following ways:
* it allows all path components to be missing, like `readlink -m` and
  like the previous CanonPath impl);
* it ignores the last path component even if it is present, like the
  previous CanonPath impl;
* it reserves the right to not follow some symlinks as each path
  component is traversed: if the component is a symbolic link and is
  present in the ignore-list (we set it to /bin and /sbin for now), the
  link is not followed.

Here are some observations on a merged-usr system:
  bash-5.2# readlink -vm -- /bin/sh
  /usr/bin/sh5
  bash-5.2# /bin/sh -ec '. /usr/lib/rpm/functions; CanonPath /bin/sh'
  /usr/bin/sh
  bash-5.2# /usr/lib/rpm/remappath2 '/bin:/sbin' /bin/sh
  /bin/sh

  bash-5.2# readlink -vm -- /bin/ping
  /usr/libexec/ping/ping
  bash-5.2# /bin/sh -ec '. /usr/lib/rpm/functions; CanonPath /bin/ping'
  /usr/bin/ping
  bash-5.2# /usr/lib/rpm/remappath2 '/bin:/sbin' /bin/ping
  /bin/ping

  bash-5.2# readlink -vm -- /sbin/blkid
  /usr/sbin/blkid
  bash-5.2# /bin/sh -ec '. /usr/lib/rpm/functions; CanonPath /sbin/blkid'
  /usr/sbin/blkid
  bash-5.2# /usr/lib/rpm/remappath2 '/bin:/sbin' /sbin/blkid
  /sbin/blkid

Also, explicitly add -D_FILE_OFFSET_BITS=64 to the remappath2 tool's
cflags.
2024-03-11 17:00:00 +03:00

85 lines
1.6 KiB
Makefile

# Makefile for rpm tools.
AUTOMAKE_OPTIONS = 1.4 foreign
AM_CPPFLAGS = -I. \
-I$(top_srcdir)/build \
-I$(top_srcdir)/lib \
-I$(top_srcdir)/rpmdb \
-I$(top_srcdir)/rpmio \
@INCPATH@ \
-I$(top_srcdir)/misc
EXTRA_DIST = rpmchecksig.c
EXTRA_PROGRAMS = rpminject
#myLDFLAGS= -L$(top_builddir)/build -L$(top_builddir)/lib \
# -L$(top_builddir)/rpmio
LDADD = \
$(top_builddir)/build/librpmbuild.la \
$(top_builddir)/lib/librpm.la \
$(top_builddir)/rpmdb/librpmdb.la \
$(top_builddir)/rpmio/librpmio.la \
@LIBINTL@
noinst_PROGRAMS = \
dump dumpdb rpmarchive rpmheader rpmlead rpmsignature setcmp.static
check_PROGRAMS = test_rpmvercmp
TESTS = $(check_PROGRAMS)
pkgbindir = @RPMCONFIGDIR@
pkgbin_PROGRAMS = remappath2 \
filesize \
dump_ld_config \
relative \
mkset \
setcmp \
suggest_bpp \
# javadeps pdeath_execute
#bin_PROGRAMS = rpmvercmp rpmevrcmp
remappath2_SOURCES = remappath2.c
remappath2_CFLAGS = -D_FILE_OFFSET_BITS=64
javadeps_SOURCES = javadeps.c
filesize_SOURCES = filesize.c
filesize_LDADD =
relative_SOURCES = relative.c
relative_LDADD =
dump_ld_config_SOURCES = dump_ld_config.c
dump_ld_config_LDADD =
pdeath_execute_SOURCES = pdeath_execute.c
pdeath_execute_LDADD =
mkset_SOURCES = mkset.c
setcmp_SOURCES = setcmp.c
setcmp_static_SOURCES = setcmp.c
setcmp_static_LDADD = @LDFLAGS_STATIC@ $(LDADD)
suggest_bpp_SOURCES = suggest_bpp.c
suggest_bpp_LDADD = -lm $(LDADD)
rpmvercmp_SOURCES = rpmvercmp.c
rpmevrcmp_SOURCES = rpmevrcmp.c
test_rpmvercmp_SOURCES = test_rpmvercmp.c
$(PROGRAMS): $(LDADD)
gnash.o: gnash.c
$(COMPILE) -o $@ -c gnash.c
gnash: gnash.o
$(LINK) -all-static -o $@ gnash.o $(LDADD)