Hi, I'm currently cleaning up and sanitizing OpenMandriva's rpm config (also splitting some distro specific bits into a separate package).
I think rpm doesn't have to carry on a lot of stuff nobody is using anymore -- I hope the attached patch is safe for everyone. It removes: * gcj aotcompile buildroot policies (even gcc (7.x) and gdb (8.x) are dropping gcj support these days...) * Old-style multiarch support bits * sparc64 buildroot hacks that moved anything from /usr/lib to /usr/lib64 (I hope that now that the 2 major platforms in use today use lib64, all spec files that may have needed that hack at some point will be fixed...) If anyone still uses any of that, now would be a good time to scream... ttyl bero
--- rpm/macros/mandriva.in.omv~ 2017-06-04 23:37:54.653593352 +0200 +++ rpm/macros/mandriva.in 2017-06-04 23:40:08.101503974 +0200 @@ -1,7 +1,7 @@ -%distribution Mandriva Linux -%vendor Mandriva -%bugurl http://qa.mandriva.com -%disturl http://mandriva.org +%distribution OpenMandriva Lx +%vendor OpenMandriva +%bugurl http://issues.openmandriva.org/ +%disturl http://openmandriva.org/ # This macro will disable the transaction lock on /var/lib/rpm/__db.*. # This lock is of no use to us and will also result in errors when trying to @@ -28,11 +28,6 @@ %_changelog_truncate 3 years ago -# This will die as soon as remaining usage has been phased out... -%mkrel(c:) %{-c: 0.%{-c*}.}%{1}%{?subrel:.%subrel} -%manbo_mkrel() %mkrel -%multiarch() %{1} - # This will enable the use of distepoch and disttag in stead of polluting # %release with such. %evr_tuple_select 1234 @@ -94,22 +89,4 @@ end\ %_systemdconfdir %{_sysconfdir}/systemd -# -# multiarch is used to deal with situations where headers that contain -# ie. architecture specific parts to solve file conflicts between -# packages of different archs in multilib environments. -# -# Note: more details at http://wiki.mandriva.com/en/Policies/Multiarch -%multiarch_platform multiarch-%{_arch}-%{_target_os} -%multiarch_bindir %{_bindir}/%{multiarch_platform} -%multiarch_includedir %{_includedir}/%{multiarch_platform} -%multiarch_binaries() %{_rpmhome}/mkmultiarch binaries %{1} -%multiarch_includes() %{_rpmhome}/mkmultiarch includes %{1} - -# Check for need of multiarch, terminate build if needed and not used. -# -# Note: The default value should be 0 for legacy compatibility. -# TODO: fix check script and implement support for using -#%_multiarch_required_terminate_build 1 - %{load:/etc/rpm/macros.d/*.macros} --- rpm/scripts/brp-java-gcjcompile.omv~ 2011-09-06 14:37:18.000000000 +0200 +++ rpm/scripts/brp-java-gcjcompile 2017-06-04 23:36:47.610144864 +0200 @@ -1,41 +0,0 @@ -#!/bin/sh - -# If using normal root, avoid changing anything. -[ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ] && exit 0 - -# If we are a noarch package, avoid changing anything. -[ "$RPM_ARCH" = "noarch" ] && exit 0 - -# If we don't have the required executables, avoid changing anything. -gcj=${1:-/usr/bin/gcj} -[ ! -x "$gcj" -o ! -x "$gcj-dbtool" ] && exit 0 - -# Now get to work... -libdir="/usr/lib" # XXX need to sed this in or something -dbdir=`gcj-dbtool -p "$libdir"`.d/"$RPM_PACKAGE_NAME-$RPM_PACKAGE_VERSION" -cflags="$RPM_OPT_FLAGS -fPIC -findirect-dispatch" -ldflags="-Wl,-Bsymbolic" - -# XXX make it so you can override the list, for mx4j et al. -find "$RPM_BUILD_ROOT" -type f -name "*.?ar" | while read jar ; do - [ `head -c 2 "$jar"` != "PK" ] && continue - - [ -d "$RPM_BUILD_ROOT/$libdir" ] || mkdir -p "$RPM_BUILD_ROOT/$libdir" - - bnjar=`basename "$jar"` - lib="$libdir/lib$bnjar.so" - [ -f "$RPM_BUILD_ROOT/$lib" ] && continue - - # XXX need splits to handle #158308 - # (til then we can just compile big ones ourselves) - echo "$PS4$gcj -shared $cflags $ldflags -o $lib $jar" - $gcj -shared $cflags $ldflags -o "$RPM_BUILD_ROOT/$lib" "$jar" - - [ -d "$RPM_BUILD_ROOT/$dbdir" ] || mkdir -p "$RPM_BUILD_ROOT/$dbdir" - - db="$dbdir/$bnjar.db" - [ -f "$RPM_BUILD_ROOT/$db" ] && exit 1 - - $gcj-dbtool -n "$RPM_BUILD_ROOT/$db" 64 - $gcj-dbtool -f "$RPM_BUILD_ROOT/$db" "$jar" "$lib" -done --- rpm/scripts/brp-sparc64-linux.omv~ 2000-06-01 02:54:36.000000000 +0200 +++ rpm/scripts/brp-sparc64-linux 2017-06-04 23:37:25.134276538 +0200 @@ -1,41 +0,0 @@ -#!/bin/sh -# If using normal root, avoid changing anything. -if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then - exit 0 -fi -files= -LC_ALL= -LANG= - -# Move 64bit ELF objects from /lib, /usr/lib, /usr/X11R6/lib to */lib64 -# directories - -for f in `find $RPM_BUILD_ROOT{,/usr,/usr/X11R6}/lib -maxdepth 1 -type f -o -type l 2>/dev/null`; do - ff=$f - while [ -L $ff ]; do - l=`ls -l $ff | awk '{ print $11 }'` - case $l in - /*) ff=$RPM_BUILD_ROOT$l ;; - *) ff=`dirname $ff`/$l ;; - esac - done - if file $ff 2>/dev/null | grep ': ELF 64-bit .SB' | grep -v ': ELF 64-bit .SB executable' > /dev/null; then - files="$files $f" - elif file $ff 2>/dev/null | grep 'ar archive' > /dev/null; then - if objdump -h $ff 2>/dev/null | grep ':[ ]*file format elf64-sparc' > /dev/null; then - files="$files $f" - fi - fi -done -for f in $files; do - d=`dirname $f` - n=`basename $f` - if [ ! -d ${d}64 ]; then mkdir -p ${d}64; fi - if [ -L $f ]; then - l=`ls -l $f | awk '{ print $11 }' | sed 's_lib\(/[^/]*\)$_lib64\1_'` - ln -sf $l ${d}64/$n - rm -f $f - else - mv -f $f ${d}64/$n - fi -done --- rpm/scripts/check-multiarch-files.omv~ 2011-06-28 14:00:19.000000000 +0200 +++ rpm/scripts/check-multiarch-files 2017-06-04 23:36:31.731512260 +0200 @@ -1,91 +0,0 @@ -#!/usr/bin/perl -#--------------------------------------------------------------- -# Original author: Gwenole Beauchesne <gbeauche...@mandriva.com> -# Created On: Mon Jan 24 18:02:21 CET 2005 -#--------------------------------------------------------------- - -use strict; - -my $RPM_BUILD_ROOT = (shift); - -if (! -d $RPM_BUILD_ROOT ) { - while (<STDIN>) { } # consume all inputs - exit 1 -} - -while (<STDIN>) { - chomp; - - # File must be located in the usual development directories - -f $_ or next; - m,^\Q$RPM_BUILD_ROOT\E/usr(/X11R6)?/(bin|include)/, or next; - m,/multiarch-.+-\w+/, and next; - m,/include/asm, and next; - - my $multiarch = 0; - my $multiarch_type; - - # Heuristics for binary files - if (/bin/) { - my $file_magic = `file $_`; - $multiarch_type = "binary"; - - # check for *-config script files - if (/.+[-_]config/ && $file_magic =~ /shell script/) { - my $options; - foreach (cat_($_)) { - foreach my $opt (qw(cflags libs ldflags cppflags libdir libtool)) { - $options .= " --$opt" if /(\[--$opt\]|--$opt\s+([\#\[]|display|print))/; - } - } - # run the script to find out any libdir dependent flags - if ($options) { - my $output = `$_ $options`; - $multiarch = 1 if ($output =~ /(?<!\/include)\/lib(32|64)?/); - } - } - } - - # Heuristics for include files - elsif (/include/) { - $multiarch_type = "header"; - my %archdefs; - foreach (cat_($_)) { - if (/\#\s*define\s+(\w+)\s+(.+)/) { - my ($def, $val) = ($1, $2); - - # check for typical arch-dependent macro definitions - my @keywords_with_int = qw(SIZEOF_VOID_P SIZEOF_CHAR_P SIZEOF_LONG BYTES_PER_LONG BITS_PER_LONG BITS_PER_WORD); - foreach my $pat (@keywords_with_int) { - if ($def =~ /$pat/ && int($val)) { - $archdefs{$def}++; - last; - } - } - - # check for libdir references, typically plugins dir - # XXX check for /DIR/ in $def ? - if ($val =~ /"\/usr(\/X11R6)?\/lib(32|64)?\/(?!(X11|font)\/).*"/) { - $multiarch = 1; - } - } - } - - # ignore multiple definitions of the same macro, assume - # arch-dependence is handled in that case - if (! $multiarch) { - foreach my $e (keys %archdefs) { - my $val = $archdefs{$e}; - $multiarch = 1 if ($val == 1); - } - } - } - - # Multiarch files detected? - print "$_\n" if $multiarch; -} - -# Local variables: -# tab-width: 4 -# indent-tabs-mode: nil -# End: --- rpm/scripts/Makefile.am.omv~ 2017-06-04 23:36:07.575071136 +0200 +++ rpm/scripts/Makefile.am 2017-06-04 23:43:24.578953283 +0200 @@ -6,9 +6,9 @@ HELPERS = \ makeshlibs EXTRA_DIST = abi-compliance-checker.pl api-sanity-autotest.pl \ - brp-compress brp-python-bytecompile brp-java-gcjcompile \ + brp-compress brp-python-bytecompile \ brp-strip brp-strip-comment-note brp-nobuildrootpath \ - brp-strip-shared brp-strip-static-archive brp-sparc64-linux \ + brp-strip-shared brp-strip-static-archive \ brp-implant-ident-static brp-java-repack-jars \ check-files cross-build dbconvert.sh \ deb_Packages deb_Sources \ @@ -23,8 +23,6 @@ EXTRA_DIST = abi-compliance-checker.pl a check-java-closure.sh java.prov.sh java.req.sh \ gstreamer.sh javadeps.sh libtooldeps.sh \ mono-find-provides mono-find-requires \ - check-multiarch-files multiarch-platform multiarch-dispatch \ - multiarch-dispatch.h mkmultiarch \ nix_meta \ osgideps.pl pkgconfigdeps.sh \ perldeps.pl perl.prov perl.req pythondeps.sh pythoneggs.py \ @@ -45,20 +43,19 @@ EXTRA_DIST = abi-compliance-checker.pl a all: -bin_SCRIPTS = gendiff multiarch-dispatch multiarch-platform +bin_SCRIPTS = gendiff pkglibdir = @USRLIBRPM@ pkglib_SCRIPTS = \ - brp-compress brp-python-bytecompile brp-java-gcjcompile \ + brp-compress brp-python-bytecompile \ brp-strip brp-strip-comment-note brp-nobuildrootpath \ - brp-strip-shared brp-strip-static-archive brp-sparc64-linux \ + brp-strip-shared brp-strip-static-archive \ check-files cross-build dbconvert.sh executabledeps.sh \ find-debuginfo.sh find-lang.sh find-prov.pl find-req.pl \ find-provides.perl \ find-requires.perl gem_helper.rb getpo.sh http.req \ kmod-deps.sh gstreamer.sh javadeps.sh libtooldeps.sh \ mono-find-provides mono-find-requires \ - check-multiarch-files mkmultiarch \ osgideps.pl pkgconfigdeps.sh \ perldeps.pl perl.prov perl.req pythondeps.sh pythoneggs.py \ php.prov php.req \ @@ -89,9 +86,6 @@ pkglibqf_DATA = \ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = rpm.pc -pkgincdir = $(includedir) -pkginc_HEADERS = multiarch-dispatch.h - install-exec-hook: if WITH_PATH_VERSIONED -for p in $(bin_SCRIPTS); do \ @@ -106,4 +100,3 @@ if WITH_PATH_VERSIONED `echo "$(DESTDIR)$(pkgconfigdir)/$${p}" | sed 's/\.\([^.]*\)$$/-$(VERSION).\1/'`; \ done endif - --- rpm/scripts/mkmultiarch.omv~ 2011-04-10 15:50:28.000000000 +0200 +++ rpm/scripts/mkmultiarch 2017-06-04 23:36:31.754511728 +0200 @@ -1,91 +0,0 @@ -#!/bin/bash -#--------------------------------------------------------------- -# Original author: Gwenole Beauchesne <gbeauche...@mandriva.com> -# Created On: Wed Jan 12 10:54:10 CET 2005 -#--------------------------------------------------------------- - -usage="Usage: $0 <binaries|includes> <file1> [<file2> ...]" -mplat=`multiarch-platform` -type=$1 -case $type in - binaries|includes) shift;; - *) echo $usage; exit 1;; -esac - -function error() { - echo ${1+"$@"} 1>&2 - exit 1 -} - -# read link on one level only -function read_link_1() { - perl -e 'print readlink(shift)' $1 -} - -function dispatch_binaries() { - local file=$1 - local bindir=`dirname $file` - local archbindir=$bindir/$mplat - [[ -d $archbindir ]] || mkdir -p $archbindir - if [[ -L $file ]]; then - link=`read_link_1 $file` - case $link in - /*) - mv $file $archbindir/ - ;; - ../*) - ln -s ../$link $archbindir/${file##*/} - rm -f $file - ;; - esac - elif [[ -f $file ]]; then - mv $file $archbindir/ - else - error "Unsupported file type for $file" - fi - ln -s `which multiarch-dispatch` $file -} - -function dispatch_includes() { - local file=$1 - local incdir=`dirname $file` - - # handle circular inclusions - local tag=$incdir/.multiarch-processing.${file##*/} - [[ -f "$tag" ]] && return - touch $tag - - # sanity checks, extract path parts - echo $file | grep -q '/include/' || error "Unsupported includedir $incdir" - local prefix=`echo $incdir | sed -n '/\(.*\/include\)\/.*/s//\1/p'` - [[ -z "$prefix" ]] && prefix="$incdir" - local suffix=`echo $incdir | sed -n '/.*\/include\/\(.*\)/s//\1/p'` - [[ -n "$suffix" ]] && suffix="$suffix/" - - # dispatch nested includes expected in local directory - sed -n '/^#[ \t]*include[ \t]*"\([^"][^"]*\)".*/s//\1/p' $file | \ - while read localfile; do - [[ -f "$incdir/$localfile" ]] && dispatch_includes $incdir/$localfile - done - - # dispatch selected include file, provided it's not already dispatched - grep -q _MULTIARCH_HEADER $file || { - local archincdir=$prefix/$mplat/$suffix - [[ -d $archincdir ]] || mkdir -p $archincdir - mv $file $archincdir/ - cat > $file << EOF -#define _MULTIARCH_HEADER $suffix${file##*/} -#include <multiarch-dispatch.h> -EOF - } - - # done with this file - rm -f $tag -} - -while [[ $# -gt 0 ]]; do - file=$1 - shift 1 - [[ -f $file ]] || error "$file does not exist!" - dispatch_$type $file -done --- rpm/scripts/multiarch-dispatch.h.omv~ 2011-04-10 15:50:28.000000000 +0200 +++ rpm/scripts/multiarch-dispatch.h 2017-06-04 23:36:31.790510895 +0200 @@ -1,172 +0,0 @@ -/* Undefine some built-ins */ -#ifdef linux -#undef linux -#define _multiarch_defined_linux -#endif -#ifdef i386 -#undef i386 -#define _multiarch_defined_i386 -#endif -#ifdef sparc -#undef sparc -#define _multiarch_defined_sparc -#endif -#ifdef mips -#undef mips -#define _multiarch_defined_mips -#endif -#ifdef arm -#undef arm -#define _multiarch_defined_arm -#endif - -/* Undefine some interfering definitions (not built-ins) */ -/* We can only redefine value 1, so we let it fail with other values */ -#if x86_64 == 1 -#define _multiarch_defined_x86_64 -#undef x86_64 -#endif -#if ppc64 == 1 -#define _multiarch_defined_ppc64 -#undef ppc64 -#endif -#if ppc == 1 -#define _multiarch_defined_ppc -#undef ppc -#endif -#if sparc64 == 1 -#define _multiarch_defined_sparc64 -#undef sparc64 -#endif -#if s390x == 1 -#define _multiarch_defined_s390x -#undef s390x -#endif -#if s390 == 1 -#define _multiarch_defined_s390 -#undef s390 -#endif -#if ia64 == 1 -#define _multiarch_defined_ia64 -#undef ia64 -#endif -#if alpha == 1 -#define _multiarch_defined_alpha -#undef alpha -#endif -#if mipsel == 1 -#define _multiarch_defined_mipsel -#undef mipsel -#endif -#if armeb == 1 -#define _multiarch_defined_armeb -#undef armeb -#endif - -/* Dispatch arch dependent header */ -#if defined(__linux__) -#define _MULTIARCH_OS linux -#endif -#define _MULTIARCH_MAKE_HEADER(arch,header) <multiarch-arch-_MULTIARCH_OS/header> -#if defined(__x86_64__) -#include _MULTIARCH_MAKE_HEADER(x86_64,_MULTIARCH_HEADER) -#elif defined(__i386__) -#include _MULTIARCH_MAKE_HEADER(i386,_MULTIARCH_HEADER) -#elif defined(__powerpc64__) -#include _MULTIARCH_MAKE_HEADER(ppc64,_MULTIARCH_HEADER) -#elif defined(__powerpc__) -#include _MULTIARCH_MAKE_HEADER(ppc,_MULTIARCH_HEADER) -#elif defined(__sparc__) && defined(__arch64__) -#include _MULTIARCH_MAKE_HEADER(sparc64,_MULTIARCH_HEADER) -#elif defined(__sparc__) -#include _MULTIARCH_MAKE_HEADER(sparc,_MULTIARCH_HEADER) -#elif defined(__s390x__) -#include _MULTIARCH_MAKE_HEADER(s390x,_MULTIARCH_HEADER) -#elif defined(__s390__) -#include _MULTIARCH_MAKE_HEADER(s390,_MULTIARCH_HEADER) -#elif defined(__ia64__) -#include _MULTIARCH_MAKE_HEADER(ia64,_MULTIARCH_HEADER) -#elif defined(__alpha__) -#include _MULTIARCH_MAKE_HEADER(alpha,_MULTIARCH_HEADER) -#elif defined(__mips__) -#if defined(__BIG_ENDIAN__) -#include _MULTIARCH_MAKE_HEADER(mips,_MULTIARCH_HEADER) -#else -#include _MULTIARCH_MAKE_HEADER(mipsel,_MULTIARCH_HEADER) -#endif -#elif defined(__arm__) -#if defined(__BIG_ENDIAN__) -#include _MULTIARCH_MAKE_HEADER(armeb,_MULTIARCH_HEADER) -#else -#include _MULTIARCH_MAKE_HEADER(arm,_MULTIARCH_HEADER) -#endif -#else -#error "Unknown architecture, please submit bug report" -#endif -#undef _MULTIARCH_MAKE_HEADER -#undef _MULTIARCH_OS -#undef _MULTIARCH_HEADER - -/* Redefine built-ins */ -#ifdef _multiarch_defined_linux -#undef _multiarch_defined_linux -#define linux 1 -#endif -#ifdef _multiarch_defined_i386 -#undef _multiarch_defined_i386 -#define i386 1 -#endif -#ifdef _multiarch_defined_sparc -#undef _multiarch_defined_sparc -#define sparc 1 -#endif -#ifdef _multiarch_defined_mips -#undef _multiarch_defined_mips -#define mips 1 -#endif -#ifdef _multiarch_defined_arm -#undef _multiarch_defined_arm -#define arm 1 -#endif - -/* Redefine interfering defitions */ -#ifdef _multiarch_defined_x86_64 -#undef _multiarch_defined_x86_64 -#define x86_64 1 -#endif -#ifdef _multiarch_defined_ppc64 -#undef _multiarch_defined_ppc64 -#define ppc64 1 -#endif -#ifdef _multiarch_defined_ppc -#undef _multiarch_defined_ppc -#define ppc 1 -#endif -#ifdef _multiarch_defined_sparc64 -#undef _multiarch_defined_sparc64 -#define sparc64 1 -#endif -#ifdef _multiarch_defined_s390x -#undef _multiarch_defined_s390x -#define s390x 1 -#endif -#ifdef _multiarch_defined_s390 -#undef _multiarch_defined_s390 -#define s390 1 -#endif -#ifdef _multiarch_defined_ia64 -#undef _multiarch_defined_ia64 -#define ia64 1 -#endif -#ifdef _multiarch_defined_alpha -#undef _multiarch_defined_alpha -#define alpha 1 -#endif -#ifdef _multiarch_defined_mipsel -#undef _multiarch_defined_mipsel -#define mipsel 1 -#endif -#ifdef _multiarch_defined_armeb -#undef _multiarch_defined_armeb -#define armeb 1 -#endif --- rpm/scripts/multiarch-dispatch.omv~ 2011-04-10 15:50:28.000000000 +0200 +++ rpm/scripts/multiarch-dispatch 2017-06-04 23:36:31.772511312 +0200 @@ -1,31 +0,0 @@ -#!/bin/sh -#--------------------------------------------------------------- -# Original author: Gwenole Beauchesne <gbeauche...@mandriva.com> -# Created On: Wed Jan 12 12:38:53 EST 2005 -#--------------------------------------------------------------- - -if [[ "$0" = "/usr/bin/multiarch-dispatch" ]]; then - echo "Helper script to dispatch a binary under a specific personality" - exit 0 -fi - -# go through symlinks until multiarch-dispatch leaf is reached -mprog="$0" -mcomp="$mprog" -while [[ -L "$mcomp" ]]; do - mprog="$mcomp" - mcomp=`readlink "$mprog"` - case "$mcomp" in - /*) ;; - *) mcomp=`dirname "$mprog"`/"$mcomp";; - esac -done - -bin=`dirname "$mprog"`/`multiarch-platform`/"${mprog##*/}" - -if [[ ! -x "$bin" ]]; then - echo "Cannot execute $bin" 1>&2 - exit 1 -fi - -exec $bin ${1+"$@"} --- rpm/scripts/multiarch-platform.omv~ 2011-04-10 15:50:28.000000000 +0200 +++ rpm/scripts/multiarch-platform 2017-06-04 23:36:31.811510409 +0200 @@ -1,14 +0,0 @@ -#!/bin/sh -arch=`uname -m` -`perl -e '$le = unpack("h*", pack("s", 1)) =~ /^1/; exit $le;'` -le=$? -case $arch in -i?86) arch=i386;; -mips*) [ $le -eq 1 ] && arch="$arch"el ;; -arm*) [ $le -eq 0 ] && arch="armeb" || arch="arm" ;; -esac -os=`uname -s` -case $os in -Linux*) os=linux;; -esac -echo multiarch-$arch-$os