From 51da5f32a8ba2fd2557459cc6bf048525be5872c Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Wed, 29 Apr 2020 17:14:05 +0200 Subject: [PATCH] - modified to support rpm-tld-macros which replaced rpm-build-macros --- rpm-compress-doc | 85 ----------- rpm-disable-features-ti.patch | 2 +- rpm-find-spec-bcond | 64 -------- rpm-java-requires | 126 ---------------- rpm-macros-ti.patch | 2 +- rpm-macros.patch | 4 +- rpm-php-provides | 20 --- rpm-php-requires | 82 ----------- rpm-php-requires.php | 174 ---------------------- rpm-provides-dont-obsolete.patch | 2 +- rpm-rpmpopt.patch | 12 +- rpm-rubyprov.patch | 20 --- rpm-tld-macros.patch | 243 +++++++++++++++++++++++++++++++ rpm.platform | 2 +- rpm.spec | 101 +------------ 15 files changed, 260 insertions(+), 679 deletions(-) delete mode 100644 rpm-compress-doc delete mode 100644 rpm-find-spec-bcond delete mode 100755 rpm-java-requires delete mode 100644 rpm-php-provides delete mode 100644 rpm-php-requires delete mode 100644 rpm-php-requires.php create mode 100644 rpm-tld-macros.patch diff --git a/rpm-compress-doc b/rpm-compress-doc deleted file mode 100644 index 3c5ff93..0000000 --- a/rpm-compress-doc +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/sh -# -# Compress documentation files found in $DOCDIR. Omit some files we don't -# want to get compressed. -# -# /etc/rpm/noautocompressdoc and --noautocompressdoc= option can contain -# whitespace delimated list of patters to omit. -# - -#set -x - -COMPRESS_CMD="gzip -9nf" -EXCLUDE_SUFFIXES="htm html jpg jpeg png gif pdf css dia js abw HTM JPG PNG GIF PDF CSS JS" -EXCLUDE_MASKS= -RECOMPRESS_BZIP2=yes - -nocompressdoc='' -while [ $# -gt 0 ]; do - case "$1" in - --noautocompressdoc=*) - EXCLUDE_MASKS=`echo "${1#--noautocompressdoc=}" | sed -e 's/^ *//;s/ *$//;s/ \+/|/g'` - esac - shift -done - -if [ -r /etc/rpm/noautocompressdoc ]; then - exclude=$(cat /etc/rpm/noautocompressdoc | grep -v '^#' | xargs echo | sed -e 's/^ *//;s/ *$//;s/ \+/|/g') - if [ -n "${exclude}" ]; then - if [ -n "${EXCLUDE_MASKS}" ]; then - EXCLUDE_MASKS="${EXCLUDE_MASKS}|${exclude}" - else - EXCLUDE_MASKS="${exclude}" - fi - fi -fi - -if [ "$DOCDIR" = "" ] ; then - echo '$DOCDIR not set; exiting.' - exit 1 -fi - -cd $DOCDIR - -echo "Compressing documentation in $DOCDIR..." - -if test "$EXCLUDE_MASKS" ; then - echo "Excluding pattern '$EXCLUDE_MASKS'" -fi - -FIND_CMD="find . -type f " -for SUF in $EXCLUDE_SUFFIXES ; do - FIND_CMD="$FIND_CMD -a -not -name '*.$SUF'" -done - -eval $FIND_CMD | while read FILENAME ; do - if test -n "$EXCLUDE_MASKS" ; then - if eval "case \$(basename \"$FILENAME\") in - $EXCLUDE_MASKS ) true ;; - * ) false ;; - esac" ; then - continue - fi - fi - case "$FILENAME" in - *.gz | *.Z) - gzip -d "$FILENAME" - FILENAME=$(echo "$FILENAME" | sed -e 's/\.gz$//; s/\.Z$//') - ;; - *.bz2) - if [ "$RECOMPRESS_BZIP2" = yes ] ; then - bzip2 -d "$FILENAME" - FILENAME=$(echo "$FILENAME" | sed -e 's/\.bz2$//') - else - continue - fi - ;; - esac - - $COMPRESS_CMD "$FILENAME" - - echo -n "$FILENAME " -done - -echo -echo "Documentation compressed." diff --git a/rpm-disable-features-ti.patch b/rpm-disable-features-ti.patch index b9200e8..7527eec 100644 --- a/rpm-disable-features-ti.patch +++ b/rpm-disable-features-ti.patch @@ -12,7 +12,7 @@ @@ -1476,7 +1476,7 @@ #%__scriptlet_requires /bin/bash --rpm-requires - # PLD rpm macros + # TLD rpm macros -%_enable_debug_packages 1 +%_enable_debug_packages 0 diff --git a/rpm-find-spec-bcond b/rpm-find-spec-bcond deleted file mode 100644 index f3d479b..0000000 --- a/rpm-find-spec-bcond +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/sh -# Display bcond (_with_*, _without_*) macros from given spec -# $Id$ - -if [ "$#" = 0 ]; then - echo "Usage: $0 SPEC" - exit 1 -fi - -SPEC=$1 -if [ $SPEC = "--" ]; then - if [ "$#" -lt 2 ]; then - echo "Usage: rpmbuikd --bcond SPEC" - exit 1 - fi - SPEC=$2 -fi - -if [ ! -f $SPEC ]; then - echo "rpmbuild: $SPEC: no such file" - exit 1 -fi - -bconds=`awk -F"\n" 'BEGIN { chlog=0 } - /^%changelog/ { chlog=1 } - /_with(out)?_[_a-zA-Z0-9]+/ && chlog == 0 { - match($0, /_with(out)?_[_a-zA-Z0-9]+/); - print substr($0, RSTART, RLENGTH) - } - /^%bcond_with/ && chlog == 0 { - match($0, /bcond_with(out)?[ \t]+[_a-zA-Z0-9]+/); - bcond = substr($0, RSTART +5 , RLENGTH -5); - gsub(/[ \t]+/,"_",bcond); - print bcond - }' $SPEC | sort -u` - -for c in $bconds; do - echo -n "$c" - - if ! echo `rpm --eval "%$c"` | grep $c >/dev/null; then - echo " (on)" - else - echo "" - fi -done - - -for bcond in $bconds; do - isset=`awk -F"\n" "BEGIN { val=0 } - /^%define[\t ]+$bcond/ { - if (match(\\$0, /$bcond[\t ]+0[\t ]*$/)) { - val = 0 - } else if (match(\\$0, /$bcond[\t ]+1[\t ]*$/)) { - val = 1 - } else { - print \"couldn't determine $bcond value from \", \\$0 - } - } END { print val }" $SPEC`; - - if [ x"$isset" = x"1" ]; then - echo "WARN: $bcond defined in spec"; - fi -done - diff --git a/rpm-java-requires b/rpm-java-requires deleted file mode 100755 index dc069c8..0000000 --- a/rpm-java-requires +++ /dev/null @@ -1,126 +0,0 @@ -#!/bin/sh -# This script reads filenames from STDIN and outputs any relevant requires -# information that needs to be included in the package. -# -# Based on rpm-4.4.2/scripts/find-req.pl -# Authors: Elan Ruusamäe - -export PATH="/sbin:/usr/sbin:/bin:/usr/bin" - -# Set the prefix, unless it is overriden -: ${RPM_LIBDIR=/usr/lib/rpm} - -# Enable debug: JAVADEPS_DEBUG=true -: ${JAVADEPS_DEBUG=false} - -# xsltproc for eclipse feature.xml -: ${xsltproc=/usr/bin/xsltproc} - -# save $- state, to enable in functions -debug=$- - -javaclassversion() { - set -$debug - local mode=$1; shift - [ $# -gt 0 ] || return 1 - $JAVADEPS_DEBUG && echo >&2 ">> javaclassversion($mode): $*" - - # process only requires - [ "$mode" = requires ] || return $ret - - local classver=$(echo "$@" | xargs -r file | grep -o 'compiled Java class data, version [0-9.]*' | awk '{print $NF}' | sort -u) - if [ -z "$classver" ]; then - return 1 - fi - - local v - for v in $classver; do - echo "java(ClassDataVersion) >= $v" - done - return 0 -} - -javajarversion() { - set -$debug - local mode=$1; shift - local jar=$1 - local tmp ret=0 - $JAVADEPS_DEBUG && echo >&2 ">> javajarversion($mode): $jar" - - # check only files, symlinks could point outside buildroot - [ -f "$jar" -a ! -L "$jar" ] || return $ret - - tmp=$(mktemp -d) - unzip -q -d $tmp $jar >&2 - # workaround for .jar files with stupid permissions - chmod -R u+rwX $tmp - - # find .jar and .class files - find_javadeps $mode $(find $tmp -type f -regextype posix-extended -regex '^.+\.(class|jar)$') || ret=1 - rm -rf $tmp - return $ret -} - -eclipse_feature() { - set -$debug - local mode=$1; shift - local file=$1 - local ret=0 - - $JAVADEPS_DEBUG && echo >&2 ">> eclipse_feature($mode): $file" - - if [ ! -x $xsltproc ]; then - return 0 - fi - - $xsltproc --stringparam mode $mode ${RPM_LIBDIR}/eclipse-feature.xslt $file -} - -find_javadeps() { - set -$debug - local mode=$1; shift - local ret=0 - - $JAVADEPS_DEBUG && echo >&2 ">> find_javadeps($mode): $*" - for file in $@; do - case $file in - *.jar) - javajarversion $mode "$file" || ret=1 - ;; - *.class) - javaclassversion $mode "$file" || { - echo >&2 "ERROR: Class version could not be extracted from $file" - ret=1 - } - ;; - */feature.xml) - eclipse_feature $mode "$file" || ret=1 - ;; - *) - $JAVADEPS_DEBUG && echo >&2 ">> find_javadeps($mode): no handle: $file" - ;; - esac - done - return $ret -} - -ret=0 -# default mode to requires for backward compat -mode=requires -case $1 in --P|--provides) - mode=provides - shift - ;; --R|--requires) - mode=requires - shift - ;; -esac - -t=$(mktemp) -find_javadeps $mode $(cat -) > $t || ret=1 -sort -u $t -rm -f $t - -exit $ret diff --git a/rpm-macros-ti.patch b/rpm-macros-ti.patch index 1e2a934..9ddff0b 100644 --- a/rpm-macros-ti.patch +++ b/rpm-macros-ti.patch @@ -5,7 +5,7 @@ diff -ur rpm-4.5.orig/macros.in rpm-4.5/macros.in # #%distribution -+# PLD Linux Release ++# TLD Linux Release for backward compatibility with PLD spec files +%pld_release ti + # Configurable distribution URL, same as DistURL: tag in a specfile. diff --git a/rpm-macros.patch b/rpm-macros.patch index 567b852..f41a082 100644 --- a/rpm-macros.patch +++ b/rpm-macros.patch @@ -152,7 +152,7 @@ -%__scriptlet_requires /bin/bash --rpm-requires +#%__scriptlet_requires /bin/bash --rpm-requires + -+# PLD rpm macros ++# TLD rpm macros +%_enable_debug_packages 1 + +#----------------------------------------------------------------- @@ -218,7 +218,7 @@ AC_SUBST(SYSCONFIGDIR) -MACROFILES="${USRLIBRPM}/${VERSION}/macros:${USRLIBRPM}/%{_target}/macros:${SYSCONFIGDIR}/%{_host_vendor}/macros:${SYSCONFIGDIR}/%{_host_vendor}/%{_target}/macros:${SYSCONFIGDIR}/macros.*:${SYSCONFIGDIR}/macros.d/*.macros:${SYSCONFIGDIR}/macros:${SYSCONFIGDIR}/%{_target}/macros:~/.rpmmacros" -+MACROFILES="${USRLIBRPM}/macros:${USRLIBRPM}/macros.build:${USRLIBRPM}/%{_target}/macros:${SYSCONFIGDIR}/macros.*:${SYSCONFIGDIR}/macros:${SYSCONFIGDIR}/%{_target}/macros:~/etc/.rpmmacros:~/.rpmmacros" ++MACROFILES="${USRLIBRPM}/macros:${USRLIBRPM}/macros.build:${USRLIBRPM}/macros.d/macros.*:${USRLIBRPM}/%{_target}/macros:${SYSCONFIGDIR}/macros.*:${SYSCONFIGDIR}/macros:${SYSCONFIGDIR}/%{_target}/macros:~/etc/.rpmmacros:~/.rpmmacros" AC_DEFINE_UNQUOTED(MACROFILES, "$MACROFILES", [Colon separated paths of macro files to read.]) AC_SUBST(MACROFILES) diff --git a/rpm-php-provides b/rpm-php-provides deleted file mode 100644 index a094cba..0000000 --- a/rpm-php-provides +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/perl -##################################################################### -# # -# Check system dependences between php-pear modules # -# # -# Pawe³ Go³aszewski # -# Micha³ Moskal # -# ------------------------------------------------------------------# -# TODO: # -##################################################################### - -$pear = "/usr/share/pear"; - -foreach (@ARGV ? @ARGV : <>) { - chomp; - $f = $_; - next unless ($f =~ /$pear.*\.php$/); - $f =~ s/.*$pear\///; - print "pear($f)\n"; -} diff --git a/rpm-php-requires b/rpm-php-requires deleted file mode 100644 index 2a3fb60..0000000 --- a/rpm-php-requires +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/perl -##################################################################### -# # -# Check system dependences between php-pear modules # -# # -# Pawe³ Go³aszewski # -# Micha³ Moskal # -# ------------------------------------------------------------------# -# TODO: # -# - extension_loaded - dependencies. # -# - some clean-up... # -##################################################################### - -$pear = "/usr/share/pear"; - -@files = (); -%req = (); - -foreach (@ARGV ? $ARGV : <> ) { - chomp; - $f = $_; - push @files, $f; - # skip non-php files - next unless ($f =~ /\.php$/); - open(F, "< $f") or die; - - if ($f =~ /$pear/) { - $file_dir = $f; - $file_dir =~ s|.*$pear/||; - $file_dir =~ s|/[^/]*$||; - } else { - $file_dir = undef; - } - - while () { - # skip comments - next if (/^\s*(#|\/\/|\*|\/\*)/); - - while (/(\W|^)(require|include)(_once)? - \s* \(? \s* ("([^"]*)"|'([^']*)') - \s* \)? \s* ;/xg) { - if ($5 ne "") { - $x = $5; - } elsif ($6 ne "") { - $x = $6; - } else { - next; - } - - next if ($x =~ m|^\./| or $x =~ /\$/); - next unless ($x =~ /\.php$/); - $req{$x} = 1; - } - - next unless (defined $file_dir); - - while (/(\W|^)(require|include)(_once)? - \s* \(? \s* dirname \s* \( \s* __FILE__ \s* \) \s* \. \s* - ("([^"]*)"|'([^']*)') - \s* \)? \s* ;/xg) { - if ($5 ne "") { - $x = $5; - } elsif ($6 ne "") { - $x = $6; - } else { - next; - } - - next if ($x =~ /\$/); - next unless ($x =~ /\.php$/); - - $x = "$file_dir/$x"; - $x =~ s|/+|/|g; - $req{$x} = 1; - } - } -} - -f: for $f (keys %req) { - for $g (@files) { next f if ($g =~ /\Q$f\E$/); } - print "pear($f)\n"; -} diff --git a/rpm-php-requires.php b/rpm-php-requires.php deleted file mode 100644 index b398029..0000000 --- a/rpm-php-requires.php +++ /dev/null @@ -1,174 +0,0 @@ -#!/usr/bin/php - (Perl version) - * Michał Moskal (Perl version) - * Elan Ruusamäe - * - * URL: - * - * Requires: php-pear-PHP_CompatInfo - * Requires: php-pcre - */ - -/** - * Produce pear(Path/To/File.php) deps - * Ported to PHP from Perl version of rpm-php-requires. - * - * @TODO: use tokenizer to parse php files. - */ -function peardeps($files) { - // files inside php_pear_dir have this prefix - $prefix = RPM_BUILD_ROOT. PHP_PEAR_DIR . DIRECTORY_SEPARATOR; - $length = strlen($prefix); - - $req = array(); - foreach ($files as $f) { - // skip non-php files - if (substr($f, -4) != '.php') { - continue; - } - - // subdir inside php_pear_dir - if (substr($f, 0, $length) == $prefix) { - $file_dir = dirname(substr($f, $length)); - } else { - $file_dir = null; - } - - foreach (file($f) as $line) { - // skip comments -- not perfect, matches "*" at start of line (very rare altho) - if (preg_match('/^\s*(#|\/\/|\*|\/\*)/', $line)) { - continue; - } - - if (preg_match("/(\W|^)(require|include)(_once)? - \s* \(? \s* - (\"([^\"]*)\"|'([^']*)') - \s* \)? \s* ;/x", $line, $m)) { - - if ($m[5]) { - $x = $m[5]; - } else if ($m[6]) { - $x = $m[6]; - } else { - continue 2; - } - - if (substr($x, 0, 2) == './' || substr($x, -1) == '$') { # XXX must be: CONTAINS DOLLAR - continue 2; - } - - if (substr($x, -4) != '.php') { - continue 2; - } - $req[$x] = 1; - continue 2; - } - - if (is_null($file_dir)) { - continue; - } - - if (preg_match("/(\W|^)(require|include)(_once)? - \s* \(? \s* dirname \s* \( \s* __FILE__ \s* \) \s* \. \s* - (\"([^\"]*)\"|'([^']*)') - \s* \)? \s* ;/x", $line, $m)) { - - if ($m[5]) { - $x = $m[5]; - } else if ($m[6]) { - $x = $m[6]; - } else { - continue 2; - } - - if (substr($x, -1) == '$') { # XXX must be: CONTAINS DOLLAR - continue 2; - } - if (substr($x, -4) != '.php') { - continue 2; - } - - $x = "$file_dir/$x"; - // remove double slashes - // TODO: resolve simpletest/test/../socket.php -> simpletest/socket.php - $x = str_replace("//", "/", $x); - $req[$x] = 1; - continue; - } - } - } - - foreach (array_keys($req) as $f) { - // skip self deps - if (array_key_exists($f, $files)) { - continue; - } - echo "pear($f)\n"; - } -} - -/** - * Produce dependencies for extensions using PEAR PHP_CompatInfo package. - */ -function extdeps($files) { - require_once 'PHP/CompatInfo.php'; - - $info = new PHP_CompatInfo('null'); - $res = $info->parseData($files); - - // minimum php version we accept - // "%define php_min_version 5.1.2" in spec to minimum version to be 5.1.2 - $version = max(PHP_MIN_VERSION, $res['version']); - - if (version_compare($version, '5.0.0', 'ge')) { - # force php- only deps when php5 - # XXX what about php-pecl- virtual provides? - $fmt = 'php-%s'; - $epoch = 4; - } else { - $fmt = 'php(%s)'; - $epoch = 3; - } - echo "php-common >= ", $epoch, ":", $version, "\n"; - - // process extensions - foreach ($res['extensions'] as $ext) { - // bz2 ext is in php-bzip2 package - if ($ext == 'bz2') { - $ext = 'bzip2'; - } - // libxml ext is in php-xml package - if ($ext == 'libxml') { - $ext = 'xml'; - } - - // these need to be lowercased - if (in_array($ext, array('SPL', 'PDO', 'SQLite', 'Reflection', 'SimpleXML'))) { - $ext = strtolower($ext); - } - - printf("$fmt\n", $ext); - } -} - -define('RPM_BUILD_ROOT', getenv('RPM_BUILD_ROOT')); -define('PHP_PEAR_DIR', '/usr/share/pear'); -define('PHP_MIN_VERSION', getenv('PHP_MIN_VERSION')); - -if ($argc > 1) { - $files = array_splice($argv, 1); -} else { - $files = explode(PHP_EOL, trim(file_get_contents('php://stdin'))); -} - -peardeps($files); -extdeps($files); diff --git a/rpm-provides-dont-obsolete.patch b/rpm-provides-dont-obsolete.patch index 5e764dc..1f09506 100644 --- a/rpm-provides-dont-obsolete.patch +++ b/rpm-provides-dont-obsolete.patch @@ -7,7 +7,7 @@ +# On upgrade, erase older packages of same color (if any). +# "name" for RPMTAG_NAME, otherwise RPMTAG_PROVIDENAME +# -+# in PLD Linux we don't want to remove packages which only provided ++# in TLD Linux we don't want to remove packages which only provided +# %{name} (e.g. perl-modules in case of some newer perl modules), +# so we use NAME instead of PROVIDENAME (as in vanilla rpm) here +%_upgrade_tag name diff --git a/rpm-rpmpopt.patch b/rpm-rpmpopt.patch index 6c44d0e..7d73d5d 100644 --- a/rpm-rpmpopt.patch +++ b/rpm-rpmpopt.patch @@ -4,13 +4,13 @@ rpmb alias --without --define "_without_!#:+ --without-!#:+" \ --POPTdesc=$"disable configure