Browse Source

rpm package update

Signed-off-by: basebuilder_pel7ppc64bebuilder0 <basebuilder@powerel.org>
master
basebuilder_pel7ppc64bebuilder0 7 years ago
parent
commit
d5c8369b2c
  1. 4
      SOURCES/libsymlink.attr
  2. 303
      SOURCES/rpm
  3. 101
      SOURCES/rpm-4.10.0-dwz-debuginfo.patch
  4. 98
      SOURCES/rpm-4.10.0-minidebuginfo.patch
  5. 125
      SOURCES/rpm-4.10.90-rpmlib-filesystem-check.patch
  6. 70
      SOURCES/rpm-4.11.1-libtool-ppc64le.patch
  7. 472
      SOURCES/rpm-4.11.1-sepdebugcrcfix.patch
  8. 30
      SOURCES/rpm-4.11.3-EVR-validity-check.patch
  9. 91
      SOURCES/rpm-4.11.3-Initialize-plugins-based-on-DSO-discovery.patch
  10. 17
      SOURCES/rpm-4.11.3-disable-collection-plugins.patch
  11. 364
      SOURCES/rpm-4.11.3-update-config.guess.patch
  12. 37
      SOURCES/rpm-4.11.x-Add-make_build-macro.patch
  13. 109
      SOURCES/rpm-4.11.x-Add-noplugins.patch
  14. 12
      SOURCES/rpm-4.11.x-CVE-2014-8118.patch
  15. 72
      SOURCES/rpm-4.11.x-Fix-Python-hdr-refcount.patch
  16. 30
      SOURCES/rpm-4.11.x-Fix-off-by-one-base64.patch
  17. 31
      SOURCES/rpm-4.11.x-Handle-line-continuation.patch
  18. 10
      SOURCES/rpm-4.11.x-bdb-warings.patch
  19. 45
      SOURCES/rpm-4.11.x-broken-pipe.patch
  20. 22
      SOURCES/rpm-4.11.x-chmod.patch
  21. 30
      SOURCES/rpm-4.11.x-color-skipping.patch
  22. 16
      SOURCES/rpm-4.11.x-defattr-permissions.patch
  23. 32
      SOURCES/rpm-4.11.x-define-PY_SSIZE_T_CLEAN.patch
  24. 25
      SOURCES/rpm-4.11.x-deprecate-addsign.patch
  25. 27
      SOURCES/rpm-4.11.x-dirlink-verify.patch
  26. 27
      SOURCES/rpm-4.11.x-do-not-filter-ld64.patch
  27. 77
      SOURCES/rpm-4.11.x-elem-progress.patch
  28. 87
      SOURCES/rpm-4.11.x-export-verifysigs-to-python.patch
  29. 80
      SOURCES/rpm-4.11.x-filter-soname-deps.patch
  30. 27
      SOURCES/rpm-4.11.x-fix-debuginfo-creation.patch
  31. 56
      SOURCES/rpm-4.11.x-fix-stripping-of-binaries.patch
  32. 68
      SOURCES/rpm-4.11.x-man-systemd-inhibit.patch
  33. 15
      SOURCES/rpm-4.11.x-minidebuginfo-ppc64.patch
  34. 89
      SOURCES/rpm-4.11.x-move-rename.patch
  35. 111
      SOURCES/rpm-4.11.x-multitheaded_xz.patch
  36. 46
      SOURCES/rpm-4.11.x-no-longer-config.patch
  37. 32
      SOURCES/rpm-4.11.x-parametrized-macro-invocations.patch
  38. 30
      SOURCES/rpm-4.11.x-perl.req-1.patch
  39. 41
      SOURCES/rpm-4.11.x-perl.req-2.patch
  40. 37
      SOURCES/rpm-4.11.x-perl.req-3.patch
  41. 32
      SOURCES/rpm-4.11.x-perl.req-4.patch
  42. 39
      SOURCES/rpm-4.11.x-perl.req-skip-my-var-block.patch
  43. 25
      SOURCES/rpm-4.11.x-python-binding-test-case.patch
  44. 63
      SOURCES/rpm-4.11.x-quiet-signing.patch
  45. 368
      SOURCES/rpm-4.11.x-reinstall.patch
  46. 25
      SOURCES/rpm-4.11.x-setperms-setugids-mutual-exclusion.patch
  47. 61
      SOURCES/rpm-4.11.x-skipattr.patch
  48. 43
      SOURCES/rpm-4.11.x-sources-to-lua-variables.patch
  49. 657
      SOURCES/rpm-4.11.x-systemd-inhibit.patch
  50. 96
      SOURCES/rpm-4.11.x-verify-data-range.patch
  51. 102
      SOURCES/rpm-4.11.x-weakdep-tags.patch
  52. 33
      SOURCES/rpm-4.13.x-Implement-noconfig-query.patch
  53. 11
      SOURCES/rpm-4.13.x-Make-the-stftime-buffer-big-enuff.patch
  54. 86
      SOURCES/rpm-4.13.x-RPMCALLBACK_ELEM_PROGRESS-available-header.patch
  55. 59
      SOURCES/rpm-4.13.x-increase_header_size.patch
  56. 106
      SOURCES/rpm-4.13.x-writable-tmp-dir.patch
  57. 44
      SOURCES/rpm-4.14.x-Add-justdb-to-the-erase-man.patch
  58. 61
      SOURCES/rpm-4.6.0-niagara.patch
  59. 14
      SOURCES/rpm-4.7.1-geode-i686.patch
  60. 39
      SOURCES/rpm-4.8.0-ignore-multiline2.patch
  61. 12
      SOURCES/rpm-4.8.1-use-gpg2.patch
  62. 20
      SOURCES/rpm-4.8.x-error-in-log.patch
  63. 83
      SOURCES/rpm-4.9.0-armhfp-logic.patch
  64. 15
      SOURCES/rpm-4.9.1.1-ld-flags.patch
  65. 67
      SOURCES/rpm-4.9.90-armhfp.patch
  66. 78
      SOURCES/rpm-4.9.90-fedora-specspo.patch
  67. 12
      SOURCES/rpm-4.9.90-no-man-dirs.patch
  68. 1570
      SPECS/rpm.spec

4
SOURCES/libsymlink.attr

@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
# Make libfoo.so symlinks require the soname-provide of the target library
%__libsymlink_requires %{_rpmconfigdir}/elfdeps --provides --soname-only
%__libsymlink_magic ^symbolic link to `.*lib.*\.so\..*'$
%__libsymlink_exclude_path ^.*[[:digit:]]$

303
SOURCES/rpm

@ -0,0 +1,303 @@ @@ -0,0 +1,303 @@
# bash completion for rpm -*- shell-script -*-

# helper functions

_rpm_installed_packages()
{
if [[ -r /var/log/rpmpkgs && \
/var/log/rpmpkgs -nt /var/lib/rpm/Packages ]]; then
# using RHL 7.2 or later - this is quicker than querying the DB
COMPREPLY=( $( compgen -W "$( sed -ne \
's|^\([^[:space:]]\{1,\}\)-[^[:space:]-]\{1,\}-[^[:space:]-]\{1,\}\.rpm$|\1|p' \
/var/log/rpmpkgs )" -- "$cur" ) )
elif type rpmqpack &>/dev/null ; then
# SUSE's rpmqpack is faster than rpm -qa
COMPREPLY=( $( compgen -W '$( rpmqpack )' -- "$cur" ) )
else
COMPREPLY=( $( ${1:-rpm} -qa --nodigest --nosignature \
--queryformat='%{NAME} ' "$cur*" 2>/dev/null ) )
fi
}

_rpm_groups()
{
local IFS=$'\n'
COMPREPLY=( $( compgen -W "$( ${1:-rpm} -qa --nodigest --nosignature \
--queryformat='%{GROUP}\n' 2>/dev/null )" -- "$cur" ) )
}

_rpm_macros()
{
# get a list of macros
COMPREPLY=( $( compgen -W "$( ${1:-rpm} --showrc | sed -ne \
's/^-\{0,1\}[0-9]\{1,\}[:=][[:space:]]\{1,\}\([^[:space:](]\{3,\}\).*/%\1/p' )" \
-- "$cur" ) )
}

_rpm_buildarchs()
{
COMPREPLY=( $( compgen -W "$( ${1:-rpm} --showrc | sed -ne \
's/^\s*compatible\s\s*build\s\s*archs\s*:\s*\(.*\)/\1/ p' )" \
-- "$cur" ) )
}

# rpm(8) completion
#
_rpm()
{
local cur prev words cword split
_init_completion -s || return

if [[ $cword -eq 1 ]]; then
# first parameter on line
case $cur in
--*)
COMPREPLY=( $( compgen -W '--help --version --initdb
--checksig --addsign --delsign --rebuilddb --showrc
--setperms --setugids --eval --install --upgrade --query
--freshen --erase --verify --querytags --import' \
-- "$cur" ) )
;;
*)
COMPREPLY=( $( compgen -W '-e -E -F -i -q -t -U -V' \
-- "$cur" ) )
;;
esac
return 0
fi

case $prev in
--dbpath|--excludepath|--prefix|--relocate|--root|-r)
_filedir -d
return 0
;;
--eval|-E)
_rpm_macros $1
return 0
;;
--pipe)
compopt -o filenames
COMPREPLY=( $( compgen -c -- "$cur" ) )
return 0
;;
--rcfile)
_filedir
return 0
;;
--specfile)
# complete on .spec files
_filedir spec
return 0
;;
--whatprovides)
if [[ "$cur" == */* ]]; then
_filedir
else
# complete on capabilities
local IFS=$'\n'
COMPREPLY=( $( compgen -W "$( $1 -qa --nodigest --nosignature \
--queryformat='%{PROVIDENAME}\n' 2>/dev/null )" \
-- "$cur" ) )
fi
return 0
;;
--whatrequires)
if [[ "$cur" == */* ]]; then
_filedir
else
# complete on capabilities
local IFS=$'\n'
COMPREPLY=( $( compgen -W "$( $1 -qa --nodigest --nosignature \
--queryformat='%{REQUIRENAME}\n' 2>/dev/null )" \
-- "$cur" ) )
fi
return 0
;;
--define|-D|--fileid|--hdrid|--pkgid)
# argument required but no completions available
return 0
;;
esac

$split && return 0

# options common to all modes
local opts="--define= --eval= --macros= --nodigest --nosignature --rcfile=
--quiet --pipe --verbose"

case ${words[1]} in
-[iFU]*|--install|--freshen|--upgrade)
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$opts --percent --force --test
--replacepkgs --replacefiles --root --excludedocs --includedocs
--noscripts --ignorearch --dbpath --prefix= --ignoreos --nodeps
--allfiles --ftpproxy --ftpport --justdb --httpproxy --httpport
--noorder --relocate= --badreloc --notriggers --excludepath=
--ignoresize --oldpackage --queryformat --repackage
--nosuggests" -- "$cur" ) )
else
_filedir '[rs]pm'
fi
;;
-e|--erase)
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$opts --allmatches --noscripts
--notriggers --nodeps --test --repackage" -- "$cur" ) )
else
_rpm_installed_packages $1
fi
;;
-q*|--query)
# options common to all query types
opts+=" --changelog --configfiles --conflicts --docfiles --dump
--enhances --filesbypkg --filecaps --fileclass --filecolor
--fileprovide --filerequire --filesbypkg --info --list
--obsoletes --pipe --provides --queryformat= --requires
--scripts --suggests --triggers --xml"

if [[ ${words[@]} == *\ -@(*([^ -])f|-file )* ]]; then
# -qf completion
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$opts --dbpath --fscontext
--last --root --state" -- "$cur" ) )
else
_filedir
fi
elif [[ ${words[@]} == *\ -@(*([^ -])g|-group )* ]]; then
# -qg completion
_rpm_groups $1
elif [[ ${words[@]} == *\ -@(*([^ -])p|-package )* ]]; then
# -qp; uninstalled package completion
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$opts --ftpport --ftpproxy
--httpport --httpproxy --nomanifest" -- "$cur" ) )
else
_filedir '[rs]pm'
fi
else
# -q; installed package completion
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$opts --all --file --fileid
--dbpath --fscontext --ftswalk --group --hdrid --last
--package --pkgid --root= --specfile --state
--triggeredby --whatprovides --whatrequires" \
-- "$cur" ) )
elif [[ ${words[@]} != *\ -@(*([^ -])a|-all )* ]]; then
_rpm_installed_packages $1
fi
fi
;;
-K*|--checksig)
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$opts --nopgp --nogpg --nomd5" \
-- "$cur" ) )
else
_filedir '[rs]pm'
fi
;;
-[Vy]*|--verify)
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$opts --root= --dbpath --nodeps
--nogroup --nolinkto --nomode --nomtime --nordev --nouser
--nofiles --noscripts --nomd5 --querytags --specfile
--whatrequires --whatprovides" -- "$cur" ) )
# check whether we're doing file completion
elif [[ ${words[@]} == *\ -@(*([^ -])f|-file )* ]]; then
_filedir
elif [[ ${words[@]} == *\ -@(*([^ -])g|-group )* ]]; then
_rpm_groups $1
elif [[ ${words[@]} == *\ -@(*([^ -])p|-package )* ]]; then
_filedir '[rs]pm'
else
_rpm_installed_packages $1
fi
;;
--resign|--addsign|--delsign)
_filedir '[rs]pm'
;;
--setperms|--setgids)
_rpm_installed_packages $1
;;
--import|--dbpath|--root)
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--import --dbpath --root=' \
-- "$cur" ) )
else
_filedir
fi
;;
esac
[[ $COMPREPLY == *= ]] && compopt -o nospace

return 0
} &&
complete -F _rpm rpm

_rpmbuild()
{
local cur prev words cword split
_init_completion -s || return

local rpm="${1%build*}"
[[ $rpm == $1 ]] || ! type $rpm &>/dev/null && rpm=

case $prev in
--buildroot|--root|-r|--dbpath)
_filedir -d
return 0
;;
--target)
_rpm_buildarchs
return 0
;;
--eval|-E)
_rpm_macros $rpm
return 0
;;
--macros|--rcfile)
_filedir
return 0
;;
--buildpolicy)
local cfgdir=$( $rpm --eval '%{_rpmconfigdir}' 2>/dev/null )
if [[ $cfgdir ]]; then
COMPREPLY=( $( compgen -W "$( command ls $cfgdir 2>/dev/null \
| sed -ne 's/^brp-//p' )" -- "$cur" ) )
fi
;;
--define|-D|--with|--without)
return 0
;;
esac

$split && return 0

if [[ $cur == -* ]]; then
COMPREPLY=( $( compgen -W "$( _parse_help "$1" )" -- "$cur" ) )
[[ $COMPREPLY == *= ]] && compopt -o nospace
return 0
fi

# Figure out file extensions to complete
local word ext
for word in ${words[@]}; do
case $word in
-b?)
ext=spec
break
;;
-t?|--tarbuild)
ext='@(t?(ar.)@([gx]z|bz?(2))|tar?(.@(lzma|Z)))'
break
;;
--rebuild|--recompile)
ext='@(?(no)src.r|s)pm'
break
;;
esac
done
[[ -n $ext ]] && _filedir $ext
} &&
complete -F _rpmbuild rpmbuild rpmbuild-md5

# ex: ts=4 sw=4 et filetype=sh

101
SOURCES/rpm-4.10.0-dwz-debuginfo.patch

@ -0,0 +1,101 @@ @@ -0,0 +1,101 @@
--- rpm-4.10.0/scripts/find-debuginfo.sh 2012-03-20 09:07:25.000000000 +0100
+++ rpm-4.10.0/scripts/find-debuginfo.sh.jj 2012-06-19 12:32:33.147503858 +0200
@@ -4,6 +4,8 @@
#
# Usage: find-debuginfo.sh [--strict-build-id] [-g] [-r]
# [-o debugfiles.list]
+# [--run-dwz] [--dwz-low-mem-die-limit N]
+# [--dwz-max-die-limit N]
# [[-l filelist]... [-p 'pattern'] -o debuginfo.list]
# [builddir]
#
@@ -20,6 +22,10 @@
# The -p argument is an grep -E -style regexp matching the a file name,
# and must not use anchors (^ or $).
#
+# The --run-dwz flag instructs find-debuginfo.sh to run the dwz utility
+# if available, and --dwz-low-mem-die-limit and --dwz-max-die-limit
+# provide detailed limits. See dwz(1) -l and -L option for details.
+#
# All file names in switches are relative to builddir (. if not given).
#
@@ -32,6 +38,11 @@ strip_r=false
# Barf on missing build IDs.
strict=false
+# DWZ parameters.
+run_dwz=false
+dwz_low_mem_die_limit=
+dwz_max_die_limit=
+
BUILDDIR=.
out=debugfiles.list
nout=0
@@ -40,6 +51,17 @@ while [ $# -gt 0 ]; do
--strict-build-id)
strict=true
;;
+ --run-dwz)
+ run_dwz=true
+ ;;
+ --dwz-low-mem-die-limit)
+ dwz_low_mem_die_limit=$2
+ shift
+ ;;
+ --dwz-max-die-limit)
+ dwz_max_die_limit=$2
+ shift
+ ;;
-g)
strip_g=true
;;
@@ -266,6 +288,37 @@ while read nlinks inum f; do
fi
done || exit
+# Invoke the DWARF Compressor utility.
+if $run_dwz && type dwz >/dev/null 2>&1 \
+ && [ -d "${RPM_BUILD_ROOT}/usr/lib/debug" ]; then
+ dwz_files="`cd "${RPM_BUILD_ROOT}/usr/lib/debug"; find -type f -name \*.debug`"
+ if [ -n "${dwz_files}" ]; then
+ dwz_multifile_name="${RPM_PACKAGE_NAME}-${RPM_PACKAGE_VERSION}-${RPM_PACKAGE_RELEASE}.${RPM_ARCH}"
+ dwz_multifile_suffix=
+ dwz_multifile_idx=0
+ while [ -f "${RPM_BUILD_ROOT}/usr/lib/debug/.dwz/${dwz_multifile_name}${dwz_multifile_suffix}" ]; do
+ let ++dwz_multifile_idx
+ dwz_multifile_suffix=".${dwz_multifile_idx}"
+ done
+ dwz_multfile_name="${dwz_multifile_name}${dwz_multifile_suffix}"
+ dwz_opts="-h -q -r -m .dwz/${dwz_multifile_name}"
+ mkdir -p "${RPM_BUILD_ROOT}/usr/lib/debug/.dwz"
+ [ -n "${dwz_low_mem_die_limit}" ] \
+ && dwz_opts="${dwz_opts} -l ${dwz_low_mem_die_limit}"
+ [ -n "${dwz_max_die_limit}" ] \
+ && dwz_opts="${dwz_opts} -L ${dwz_max_die_limit}"
+ ( cd "${RPM_BUILD_ROOT}/usr/lib/debug" && dwz $dwz_opts $dwz_files )
+ # Remove .dwz directory if empty
+ rmdir "${RPM_BUILD_ROOT}/usr/lib/debug/.dwz" 2>/dev/null
+ if [ -f "${RPM_BUILD_ROOT}/usr/lib/debug/.dwz/${dwz_multifile_name}" ]; then
+ id="`readelf -Wn "${RPM_BUILD_ROOT}/usr/lib/debug/.dwz/${dwz_multifile_name}" \
+ 2>/dev/null | sed -n 's/^ Build ID: \([0-9a-f]\+\)/\1/p'`"
+ [ -n "$id" ] \
+ && make_id_link "$id" "/usr/lib/debug/.dwz/${dwz_multifile_name}" .debug
+ fi
+ fi
+fi
+
# For each symlink whose target has a .debug file,
# make a .debug symlink to that file.
find "$RPM_BUILD_ROOT" ! -path "${debugdir}/*" -type l -print |
--- rpm-4.10.0/macros.in 2012-03-20 09:07:25.000000000 +0100
+++ rpm-4.10.0/macros.in.jj 2012-06-19 12:32:33.147503858 +0200
@@ -176,7 +176,7 @@
# the script. See the script for details.
#
%__debug_install_post \
- %{_rpmconfigdir}/find-debuginfo.sh %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_find_debuginfo_opts} "%{_builddir}/%{?buildsubdir}"\
+ %{_rpmconfigdir}/find-debuginfo.sh %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_find_debuginfo_dwz_opts} %{?_find_debuginfo_opts} "%{_builddir}/%{?buildsubdir}"\
%{nil}
# Template for debug information sub-package.

98
SOURCES/rpm-4.10.0-minidebuginfo.patch

@ -0,0 +1,98 @@ @@ -0,0 +1,98 @@
--- rpm-4.10.0/macros.in 2012-06-11 11:16:21.216952339 +0200
+++ rpm-4.10.0/macros.in.minidebug 2012-06-11 11:16:23.686912455 +0200
@@ -175,7 +175,7 @@
# the script. See the script for details.
#
%__debug_install_post \
- %{_rpmconfigdir}/find-debuginfo.sh %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_find_debuginfo_dwz_opts} %{?_find_debuginfo_opts} "%{_builddir}/%{?buildsubdir}"\
+ %{_rpmconfigdir}/find-debuginfo.sh %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_include_minidebuginfo:-m} %{?_find_debuginfo_dwz_opts} %{?_find_debuginfo_opts} "%{_builddir}/%{?buildsubdir}"\
%{nil}
# Template for debug information sub-package.
@@ -418,6 +418,12 @@ package or when debugging this package.\
#%_missing_build_ids_terminate_build 1
#
+# Include minimal debug information in build binaries.
+# Requires _enable_debug_packages.
+#
+#%_include_minidebuginfo 1
+
+#
# Use internal dependency generator rather than external helpers?
%_use_internal_dependency_generator 1
--- rpm-4.10.0/scripts/find-debuginfo.sh 2012-06-11 11:16:09.698138273 +0200
+++ rpm-4.10.0/scripts/find-debuginfo.sh.minidebug 2012-06-11 11:16:13.399078526 +0200
@@ -2,7 +2,7 @@
#find-debuginfo.sh - automagically generate debug info and file list
#for inclusion in an rpm spec file.
#
-# Usage: find-debuginfo.sh [--strict-build-id] [-g] [-r]
+# Usage: find-debuginfo.sh [--strict-build-id] [-g] [-r] [-m]
# [-o debugfiles.list]
# [--run-dwz] [--dwz-low-mem-die-limit N]
# [--dwz-max-die-limit N]
@@ -29,6 +29,9 @@ strip_g=false
# with -r arg, pass --reloc-debug-sections to eu-strip.
strip_r=false
+# with -m arg, add minimal debuginfo to binary.
+include_minidebug=false
+
# Barf on missing build IDs.
strict=false
@@ -43,6 +46,9 @@ while [ $# -gt 0 ]; do
-g)
strip_g=true
;;
+ -m)
+ include_minidebug=true
+ ;;
-o)
if [ -z "${lists[$nout]}" -a -z "${ptns[$nout]}" ]; then
out=$2
@@ -105,6 +111,32 @@ strip_to_debug()
chmod 444 "$1" || exit
}
+add_minidebug()
+{
+ local debuginfo="$1"
+ local binary="$2"
+
+ local dynsyms=`mktemp`
+ local funcsyms=`mktemp`
+ local keep_symbols=`mktemp`
+ local mini_debuginfo=`mktemp`
+
+ # Extract the dynamic symbols from the main binary, there is no need to also have these
+ # in the normal symbol table
+ nm -D "$binary" --format=posix --defined-only | awk '{ print $1 }' | sort > "$dynsyms"
+ # Extract all the text (i.e. function) symbols from the debuginfo
+ nm "$debuginfo" --format=posix --defined-only | awk '{ if ($2 == "T" || $2 == "t") print $1 }' | sort > "$funcsyms"
+ # Keep all the function symbols not already in the dynamic symbol table
+ comm -13 "$dynsyms" "$funcsyms" > "$keep_symbols"
+ # Copy the full debuginfo, keeping only a minumal set of symbols and removing some unnecessary sections
+ objcopy -S --remove-section .gdb_index --remove-section .comment --keep-symbols="$keep_symbols" "$debuginfo" "$mini_debuginfo" &> /dev/null
+ #Inject the compressed data into the .gnu_debugdata section of the original binary
+ xz "$mini_debuginfo"
+ mini_debuginfo="${mini_debuginfo}.xz"
+ objcopy --add-section .gnu_debugdata="$mini_debuginfo" "$binary"
+ rm -f "$dynsyms" "$funcsyms" "$keep_symbols" "$mini_debuginfo"
+}
+
# Make a relative symlink to $1 called $3$2
shopt -s extglob
link_relative()
@@ -260,6 +292,9 @@ while read nlinks inum f; do
chmod u-w "$f"
fi
+ $include_minidebug && add_minidebug "${debugfn}" "$f"
+
+
if [ -n "$id" ]; then
make_id_link "$id" "$dn/$(basename $f)"
make_id_link "$id" "/usr/lib/debug$dn/$bn" .debug

125
SOURCES/rpm-4.10.90-rpmlib-filesystem-check.patch

@ -0,0 +1,125 @@ @@ -0,0 +1,125 @@
diff -up rpm-4.10.90.git11978/lib/depends.c.rpmlib-filesystem-check rpm-4.10.90.git11978/lib/depends.c
--- rpm-4.10.90.git11978/lib/depends.c.rpmlib-filesystem-check 2012-11-01 09:40:26.000000000 +0200
+++ rpm-4.10.90.git11978/lib/depends.c 2012-11-05 10:53:42.294733695 +0200
@@ -537,6 +537,109 @@ static int rpmdbProvides(rpmts ts, depCa
return rc;
}
+/*
+ * Temporary support for live-conversion of the filesystem hierarchy
+ * mailto: kay@redhat.com, harald@redhat.com
+ * https://fedoraproject.org/wiki/Features/UsrMove
+ *
+ * X-CheckUnifiedSystemdir:
+ * /bin, /sbin, /lib, /lib64 --> /usr
+ *
+ * X-CheckUnifiedBindir:
+ * /usr/sbin -> /usr/bin
+ *
+ * X-CheckMultiArchLibdir:
+ * /usr/lib64 /usr/lib/<platform tuple> (e.g. x86_64-linux-gnu)
+ *
+ * This code is not needed for new installations, it can be removed after
+ * updates from older systems are no longer supported: Fedora 19 / RHEL 8.
+ */
+
+static int CheckLink(const char *dir, const char *root)
+{
+ char *d = NULL;
+ struct stat sbuf;
+ int rc = 0;
+
+ if (!root)
+ root = "/";
+
+ rasprintf(&d, "%s%s", root, dir);
+ if (!d) {
+ rc = -1;
+ goto exit;
+ }
+
+ /* directory or symlink does not exist, all is fine */
+ if (lstat(d, &sbuf) < 0) {
+ rc = 1;
+ goto exit;
+ }
+
+ /* if it is a symlink, all is fine */
+ if (S_ISLNK(sbuf.st_mode))
+ rc = 1;
+
+exit:
+ free(d);
+ return rc;
+}
+
+static int CheckFilesystemHierarchy(rpmds * dsp, const char *root)
+{
+ static const char *dirs[] = { "bin", "sbin", "lib", "lib64" };
+ int check;
+ int i;
+ rpmds ds;
+ rpmstrPool pool = rpmdsPool(*dsp);
+ int rc = 0;
+
+ for (i = 0; i < sizeof(dirs) / sizeof(dirs[0]); i++) {
+ check = CheckLink(dirs[i], root);
+ if (check < 0) {
+ rc = -1;
+ goto exit;
+ }
+
+ if (check == 0)
+ goto exit;
+ }
+ ds = rpmdsSinglePool(pool, RPMTAG_PROVIDENAME,
+ "rpmlib(X-CheckUnifiedSystemdir)", "1",
+ RPMSENSE_EQUAL);
+ rpmdsMerge(dsp, ds);
+ rpmdsFree(ds);
+
+ check = CheckLink("usr/lib64", root);
+ if (check < 0) {
+ rc = -1;
+ goto exit;
+ }
+ if (check > 0) {
+ ds = rpmdsSinglePool(pool, RPMTAG_PROVIDENAME,
+ "rpmlib(X-CheckMultiArchLibdir)", "1",
+ RPMSENSE_EQUAL);
+ rpmdsMerge(dsp, ds);
+ rpmdsFree(ds);
+ }
+
+ check = CheckLink("usr/sbin", root);
+ if (check < 0) {
+ rc = -1;
+ goto exit;
+ }
+ if (check > 0) {
+ ds = rpmdsSinglePool(pool, RPMTAG_PROVIDENAME,
+ "rpmlib(X-CheckUnifiedBindir)", "1",
+ RPMSENSE_EQUAL);
+ rpmdsMerge(dsp, ds);
+ rpmdsFree(ds);
+ }
+
+exit:
+ return rc;
+}
+
/**
* Check dep for an unsatisfied dependency.
* @param ts transaction set
@@ -560,8 +663,10 @@ retry:
* Check those dependencies now.
*/
if (dsflags & RPMSENSE_RPMLIB) {
- if (tsmem->rpmlib == NULL)
+ if (tsmem->rpmlib == NULL) {
rpmdsRpmlibPool(rpmtsPool(ts), &(tsmem->rpmlib), NULL);
+ CheckFilesystemHierarchy(&(tsmem->rpmlib), rpmtsRootDir(ts));
+ }
if (tsmem->rpmlib != NULL && rpmdsSearch(tsmem->rpmlib, dep) >= 0) {
rpmdsNotify(dep, "(rpmlib provides)", rc);

70
SOURCES/rpm-4.11.1-libtool-ppc64le.patch

@ -0,0 +1,70 @@ @@ -0,0 +1,70 @@
--- ./rpm-4.11.1/configure.aa 2014-04-25 08:59:19.704797276 -0700
+++ ./rpm-4.11.1/configure 2014-04-25 09:08:29.701167788 -0700
@@ -8433,7 +8433,7 @@
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -8451,7 +8451,10 @@
x86_64-*linux*)
LD="${LD-ld} -m elf_i386"
;;
- ppc64-*linux*|powerpc64-*linux*)
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
@@ -8470,7 +8472,10 @@
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
- ppc*-*linux*|powerpc*-*linux*)
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ powerpc-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
--- ./rpm-4.11.1/m4/libtool.m4.aa 2014-04-25 09:11:55.512115764 -0700
+++ ./rpm-4.11.1/m4/libtool.m4 2014-04-25 09:12:08.932179982 -0700
@@ -1312,7 +1312,7 @@
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -1326,7 +1326,10 @@
x86_64-*linux*)
LD="${LD-ld} -m elf_i386"
;;
- ppc64-*linux*|powerpc64-*linux*)
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
@@ -1345,7 +1347,10 @@
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
- ppc*-*linux*|powerpc*-*linux*)
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ powerpc-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)

472
SOURCES/rpm-4.11.1-sepdebugcrcfix.patch

@ -0,0 +1,472 @@ @@ -0,0 +1,472 @@
--- rpm-4.11.1-rc1-orig/Makefile.am 2013-06-07 12:19:21.000000000 +0200
+++ rpm-4.11.1-rc1/Makefile.am 2013-06-24 18:34:06.342894002 +0200
@@ -162,6 +162,10 @@ rpmlibexec_PROGRAMS += elfdeps
elfdeps_SOURCES = tools/elfdeps.c
elfdeps_LDADD = rpmio/librpmio.la
elfdeps_LDADD += @WITH_LIBELF_LIB@ @WITH_POPT_LIB@
+
+rpmlibexec_PROGRAMS += sepdebugcrcfix
+sepdebugcrcfix_SOURCES = tools/sepdebugcrcfix.c
+sepdebugcrcfix_LDADD = @WITH_LIBELF_LIB@
endif
endif
--- rpm-4.11.1-rc1-orig/Makefile.in 2013-06-10 08:38:51.000000000 +0200
+++ rpm-4.11.1-rc1/Makefile.in 2013-06-24 18:34:06.342894002 +0200
@@ -74,7 +74,8 @@ bin_PROGRAMS = rpm2cpio$(EXEEXT) rpmbuil
rpmgraph$(EXEEXT)
rpmlibexec_PROGRAMS = $(am__EXEEXT_1) rpmdeps$(EXEEXT)
@LIBDWARF_TRUE@@LIBELF_TRUE@am__append_6 = scripts/find-debuginfo.sh
-@LIBDWARF_TRUE@@LIBELF_TRUE@am__append_7 = debugedit elfdeps
+@LIBDWARF_TRUE@@LIBELF_TRUE@am__append_7 = debugedit elfdeps \
+@LIBDWARF_TRUE@@LIBELF_TRUE@ sepdebugcrcfix
@DOXYGEN_TRUE@@HACKINGDOCS_TRUE@am__append_8 = doc/hacking/html/index.html
@DOXYGEN_TRUE@am__append_9 = doc/librpm/html/index.html
@WITH_INTERNAL_DB_TRUE@am__append_10 = db.h
@@ -110,7 +111,8 @@ am__installdirs = "$(DESTDIR)$(bindir)"
"$(DESTDIR)$(rpmconfigdir)" "$(DESTDIR)$(rpmvardir)" \
"$(DESTDIR)$(pkgincludedir)" "$(DESTDIR)$(pkgincludedir)"
@LIBDWARF_TRUE@@LIBELF_TRUE@am__EXEEXT_1 = debugedit$(EXEEXT) \
-@LIBDWARF_TRUE@@LIBELF_TRUE@ elfdeps$(EXEEXT)
+@LIBDWARF_TRUE@@LIBELF_TRUE@ elfdeps$(EXEEXT) \
+@LIBDWARF_TRUE@@LIBELF_TRUE@ sepdebugcrcfix$(EXEEXT)
PROGRAMS = $(bin_PROGRAMS) $(rpmbin_PROGRAMS) $(rpmlibexec_PROGRAMS)
am__debugedit_SOURCES_DIST = tools/debugedit.c tools/hashtab.c \
tools/hashtab.h
@@ -157,6 +159,11 @@ am_rpmspec_OBJECTS = rpmspec-rpmspec.$(O
rpmspec_OBJECTS = $(am_rpmspec_OBJECTS)
rpmspec_DEPENDENCIES = libcliutils.la build/librpmbuild.la \
lib/librpm.la rpmio/librpmio.la
+am__sepdebugcrcfix_SOURCES_DIST = tools/sepdebugcrcfix.c
+@LIBDWARF_TRUE@@LIBELF_TRUE@am_sepdebugcrcfix_OBJECTS = \
+@LIBDWARF_TRUE@@LIBELF_TRUE@ tools/sepdebugcrcfix.$(OBJEXT)
+sepdebugcrcfix_OBJECTS = $(am_sepdebugcrcfix_OBJECTS)
+sepdebugcrcfix_DEPENDENCIES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -223,12 +230,12 @@ SOURCES = $(libcliutils_la_SOURCES) $(de
$(elfdeps_SOURCES) $(rpm_SOURCES) $(rpm2cpio_SOURCES) \
$(rpmbuild_SOURCES) $(rpmdb_SOURCES) $(rpmdeps_SOURCES) \
$(rpmgraph_SOURCES) $(rpmkeys_SOURCES) $(rpmsign_SOURCES) \
- $(rpmspec_SOURCES)
+ $(rpmspec_SOURCES) $(sepdebugcrcfix_SOURCES)
DIST_SOURCES = $(libcliutils_la_SOURCES) $(am__debugedit_SOURCES_DIST) \
$(am__elfdeps_SOURCES_DIST) $(rpm_SOURCES) $(rpm2cpio_SOURCES) \
$(rpmbuild_SOURCES) $(rpmdb_SOURCES) $(rpmdeps_SOURCES) \
$(rpmgraph_SOURCES) $(rpmkeys_SOURCES) $(rpmsign_SOURCES) \
- $(rpmspec_SOURCES)
+ $(rpmspec_SOURCES) $(am__sepdebugcrcfix_SOURCES_DIST)
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
ctags-recursive dvi-recursive html-recursive info-recursive \
install-data-recursive install-dvi-recursive \
@@ -636,6 +643,8 @@ rpm2cpio_LDADD = lib/librpm.la rpmio/lib
@LIBDWARF_TRUE@@LIBELF_TRUE@elfdeps_LDADD = rpmio/librpmio.la \
@LIBDWARF_TRUE@@LIBELF_TRUE@ @WITH_LIBELF_LIB@ @WITH_POPT_LIB@ \
@LIBDWARF_TRUE@@LIBELF_TRUE@ $(am__empty)
+@LIBDWARF_TRUE@@LIBELF_TRUE@sepdebugcrcfix_SOURCES = tools/sepdebugcrcfix.c
+@LIBDWARF_TRUE@@LIBELF_TRUE@sepdebugcrcfix_LDADD = @WITH_LIBELF_LIB@
rpmdeps_SOURCES = tools/rpmdeps.c
rpmdeps_LDADD = lib/librpm.la rpmio/librpmio.la build/librpmbuild.la @WITH_POPT_LIB@
rpmgraph_SOURCES = tools/rpmgraph.c
@@ -903,6 +912,11 @@ rpmsign$(EXEEXT): $(rpmsign_OBJECTS) $(r
rpmspec$(EXEEXT): $(rpmspec_OBJECTS) $(rpmspec_DEPENDENCIES) $(EXTRA_rpmspec_DEPENDENCIES)
@rm -f rpmspec$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(rpmspec_OBJECTS) $(rpmspec_LDADD) $(LIBS)
+tools/sepdebugcrcfix.$(OBJEXT): tools/$(am__dirstamp) \
+ tools/$(DEPDIR)/$(am__dirstamp)
+sepdebugcrcfix$(EXEEXT): $(sepdebugcrcfix_OBJECTS) $(sepdebugcrcfix_DEPENDENCIES) $(EXTRA_sepdebugcrcfix_DEPENDENCIES)
+ @rm -f sepdebugcrcfix$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(sepdebugcrcfix_OBJECTS) $(sepdebugcrcfix_LDADD) $(LIBS)
install-dist_binSCRIPTS: $(dist_bin_SCRIPTS)
@$(NORMAL_INSTALL)
@list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
@@ -994,6 +1008,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@tools/$(DEPDIR)/hashtab.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@tools/$(DEPDIR)/rpmdeps.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@tools/$(DEPDIR)/rpmgraph.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tools/$(DEPDIR)/sepdebugcrcfix.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
--- rpm-4.11.1-rc1-orig/scripts/find-debuginfo.sh 2013-06-24 17:20:55.407538301 +0200
+++ rpm-4.11.1-rc1/scripts/find-debuginfo.sh 2013-06-24 18:34:41.270897302 +0200
@@ -114,10 +114,12 @@ done
LISTFILE="$BUILDDIR/$out"
SOURCEFILE="$BUILDDIR/debugsources.list"
LINKSFILE="$BUILDDIR/debuglinks.list"
+ELFBINSFILE="$BUILDDIR/elfbins.list"
> "$SOURCEFILE"
> "$LISTFILE"
> "$LINKSFILE"
+> "$ELFBINSFILE"
debugdir="${RPM_BUILD_ROOT}/usr/lib/debug"
@@ -316,6 +318,7 @@ while read nlinks inum f; do
$include_minidebug && add_minidebug "${debugfn}" "$f"
+ echo "./${f#$RPM_BUILD_ROOT}" >> "$ELFBINSFILE"
if [ -n "$id" ]; then
make_id_link "$id" "$dn/$(basename $f)"
@@ -354,6 +357,10 @@ if $run_dwz && type dwz >/dev/null 2>&1
fi
fi
+# dwz invalidates .gnu_debuglink CRC32 in the main files.
+cat "$ELFBINSFILE" |
+(cd "$RPM_BUILD_ROOT"; xargs -d '\n' /usr/lib/rpm/sepdebugcrcfix usr/lib/debug)
+
# For each symlink whose target has a .debug file,
# make a .debug symlink to that file.
find "$RPM_BUILD_ROOT" ! -path "${debugdir}/*" -type l -print |
--- rpm-4.11.1-rc1-orig/tools/sepdebugcrcfix.c 1970-01-01 01:00:00.000000000 +0100
+++ rpm-4.11.1-rc1/tools/sepdebugcrcfix.c 2013-06-24 18:31:54.927881439 +0200
@@ -0,0 +1,344 @@
+/* Copyright (C) 2013 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Version 2013-06-24. */
+
+#define _GNU_SOURCE
+#include <string.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <endian.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <error.h>
+#include <libelf.h>
+#include <gelf.h>
+#include <bfd.h>
+
+#define _(x) x
+#define static_assert(expr) \
+ extern int never_defined_just_used_for_checking[(expr) ? 1 : -1]
+#ifndef min
+# define min(a, b) ((a) < (b) ? (a) : (b))
+#endif
+
+static_assert (sizeof (unsigned long) >= sizeof (uint32_t));
+
+typedef int bool;
+static const bool false = 0, true = 1;
+
+/* This is bfd_calc_gnu_debuglink_crc32 from bfd/opncls.c. */
+static unsigned long
+ calc_gnu_debuglink_crc32 (unsigned long crc,
+ const unsigned char *buf,
+ bfd_size_type len)
+{
+ static const unsigned long crc32_table[256] =
+ {
+ 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
+ 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
+ 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
+ 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
+ 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
+ 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
+ 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
+ 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
+ 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
+ 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
+ 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
+ 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
+ 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
+ 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
+ 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
+ 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
+ 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
+ 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
+ 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
+ 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
+ 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
+ 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
+ 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
+ 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
+ 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
+ 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
+ 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
+ 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
+ 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
+ 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
+ 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
+ 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
+ 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
+ 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
+ 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
+ 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
+ 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
+ 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
+ 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
+ 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
+ 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
+ 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
+ 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
+ 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
+ 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
+ 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
+ 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
+ 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
+ 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
+ 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
+ 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
+ 0x2d02ef8d
+ };
+ const unsigned char *end;
+
+ crc = ~crc & 0xffffffff;
+ for (end = buf + len; buf < end; ++ buf)
+ crc = crc32_table[(crc ^ *buf) & 0xff] ^ (crc >> 8);
+ return ~crc & 0xffffffff;
+}
+
+static size_t updated_count, matched_count, failed_count;
+
+static const char *usr_lib_debug;
+
+static bool
+crc32 (const char *fname, const char *base_fname, uint32_t *crcp)
+{
+ char *reldir = strdup (base_fname);
+ if (reldir == NULL)
+ error (1, 0, _("out of memory"));
+ char *s = reldir + strlen (reldir);
+ while (s > reldir && s[-1] != '/')
+ *--s = '\0';
+ char *debugname;
+ if (asprintf (&debugname, "%s/%s/%s", usr_lib_debug, reldir, fname) <= 0)
+ error (1, 0, _("out of memory"));
+ free (reldir);
+ int fd = open (debugname, O_RDONLY);
+ if (fd == -1)
+ {
+ error (0, errno, _("cannot open \"%s\""), debugname);
+ return false;
+ }
+ off64_t size = lseek64 (fd, 0, SEEK_END);
+ if (size == -1)
+ {
+ error (0, errno, _("cannot get size of \"%s\""), debugname);
+ return false;
+ }
+ off_t offset = 0;
+ uint32_t crc = 0;
+ void *buf = NULL;
+ while (offset < size)
+ {
+ const size_t maplen = min (0x10000, size - offset);
+ void *map = NULL;
+ if (buf == NULL)
+ {
+ map = mmap (NULL, maplen, PROT_READ, MAP_PRIVATE | MAP_POPULATE,
+ fd, offset);
+ if (map == MAP_FAILED)
+ {
+ error (0, errno, _("cannot map 0x%llx bytes at offset 0x%llx "
+ "of file \"%s\""),
+ (unsigned long long) maplen, (unsigned long long) offset,
+ debugname);
+ map = NULL;
+ }
+ }
+ if (map == NULL)
+ {
+ if (buf == NULL)
+ {
+ buf = malloc (maplen);
+ if (buf == NULL)
+ error (1, 0, _("out of memory"));
+ }
+ ssize_t got = pread (fd, buf, maplen, offset);
+ if (got != maplen)
+ {
+ error (0, errno, _("cannot read 0x%llx bytes at offset 0x%llx "
+ "of file \"%s\""),
+ (unsigned long long) maplen, (unsigned long long) offset,
+ debugname);
+ free (buf);
+ free (debugname);
+ return false;
+ }
+ }
+ crc = calc_gnu_debuglink_crc32 (crc, map ?: buf, maplen);
+ if (map && munmap (map, maplen) != 0)
+ error (1, errno, _("cannot unmap 0x%llx bytes at offset 0x%llx "
+ "of file \"%s\""),
+ (unsigned long long) maplen, (unsigned long long) offset,
+ debugname);
+ offset += maplen;
+ }
+ free (buf);
+ if (close (fd) != 0)
+ {
+ error (0, errno, _("cannot close \"%s\""), debugname);
+ free (debugname);
+ return false;
+ }
+ free (debugname);
+ *crcp = crc;
+ return true;
+}
+
+static bool
+process (Elf *elf, int fd, const char *fname)
+{
+ GElf_Ehdr ehdr_mem, *ehdr = gelf_getehdr (elf, &ehdr_mem);
+ if (ehdr == NULL)
+ {
+ error (0, 0, _("cannot get ELF header of \"%s\""), fname);
+ return false;
+ }
+ if (ehdr->e_ident[EI_DATA] != ELFDATA2LSB
+ && ehdr->e_ident[EI_DATA] != ELFDATA2MSB)
+ {
+ error (0, 0, _("invalid ELF endianity of \"%s\""), fname);
+ return false;
+ }
+ Elf_Scn *scn = NULL;
+ const char scnname[] = ".gnu_debuglink";
+ while ((scn = elf_nextscn (elf, scn)) != NULL)
+ {
+ GElf_Shdr shdr_mem, *shdr = gelf_getshdr (scn, &shdr_mem);
+ if (shdr == NULL)
+ {
+ error (0, 0, _("cannot get section # %zu in \"%s\""),
+ elf_ndxscn (scn), fname);
+ continue;
+ }
+ const char *sname = elf_strptr (elf, ehdr->e_shstrndx, shdr->sh_name);
+ if (sname == NULL)
+ {
+ error (0, 0, _("cannot get name of section # %zu in \"%s\""),
+ elf_ndxscn (scn), fname);
+ continue;
+ }
+ if (strcmp (sname, scnname) != 0)
+ continue;
+ Elf_Data *data = elf_getdata (scn, NULL);
+ if (data == NULL)
+ {
+ error (0, 0, _("cannot get data of section \"%s\" # %zu in \"%s\""),
+ scnname, elf_ndxscn (scn), fname);
+ continue;
+ }
+ if ((data->d_size & 3) != 0)
+ {
+ error (0, 0, _("invalid size of section \"%s\" # %zu in \"%s\""),
+ scnname, elf_ndxscn (scn), fname);
+ continue;
+ }
+ const uint8_t *zerop = memchr (data->d_buf, '\0', data->d_size);
+ const uint8_t *crcp = (zerop == NULL
+ ? NULL
+ : (const uint8_t *) ((uintptr_t) (zerop + 1 + 3)
+ & -4));
+ if (crcp + 4 != (uint8_t *) data->d_buf + data->d_size)
+ {
+ error (0, 0, _("invalid format of section \"%s\" # %zu in \"%s\""),
+ scnname, elf_ndxscn (scn), fname);
+ continue;
+ }
+ uint32_t had_crc_targetendian = *(const uint32_t *) crcp;
+ uint32_t had_crc = (ehdr->e_ident[EI_DATA] == ELFDATA2LSB
+ ? le32toh (had_crc_targetendian)
+ : be32toh (had_crc_targetendian));
+ uint32_t crc;
+ if (! crc32 (data->d_buf, fname, &crc))
+ return false;
+ if (crc == had_crc)
+ {
+ matched_count++;
+ return true;
+ }
+ updated_count++;
+ off64_t seekto = (shdr->sh_offset + data->d_off
+ + (crcp - (const uint8_t *) data->d_buf));
+ uint32_t crc_targetendian = (ehdr->e_ident[EI_DATA] == ELFDATA2LSB
+ ? htole32 (crc) : htobe32 (crc));
+ ssize_t wrote = pwrite (fd, &crc_targetendian, sizeof (crc_targetendian),
+ seekto);
+ if (wrote != sizeof (crc_targetendian))
+ {
+ error (0, 0, _("cannot write new CRC to 0x%llx "
+ "inside section \"%s\" # %zu in \"%s\""),
+ (unsigned long long) seekto, scnname, elf_ndxscn (scn), fname);
+ return false;
+ }
+ return true;
+ }
+ error (0, 0, _("cannot find section \"%s\" in \"%s\""), scnname, fname);
+ return false;
+}
+
+int
+main (int argc, char **argv)
+{
+ if (argc < 2)
+ error (1, 0, _("usr/lib/debug [<relative filenames>...]"));
+ usr_lib_debug = argv[1];
+ if (elf_version (EV_CURRENT) == EV_NONE)
+ error (1, 0, _("error initializing libelf: %s"), elf_errmsg (-1));
+ for (int argi = 2; argi < argc; argi++)
+ {
+ const char *fname = argv[argi];
+ int fd = open64 (fname, O_RDWR);
+ if (fd == -1)
+ {
+ error (0, errno, _("cannot open \"%s\""), fname);
+ failed_count++;
+ continue;
+ }
+ bool failed = false;
+ Elf *elf = elf_begin (fd, ELF_C_READ_MMAP, NULL);
+ if (elf == NULL)
+ {
+ error (0, 0, _("cannot open \"%s\" as ELF: %s"), fname,
+ elf_errmsg (-1));
+ failed = true;
+ }
+ else
+ {
+ if (! process (elf, fd, fname))
+ failed = true;
+ if (elf_end (elf) != 0)
+ {
+ error (0, 0, _("cannot close \"%s\" as ELF: %s"), fname,
+ elf_errmsg (-1));
+ failed = true;
+ }
+ }
+ if (close (fd) != 0)
+ {
+ error (0, errno, _("cannot close \"%s\""), fname);
+ failed = true;
+ }
+ if (failed)
+ failed_count++;
+ }
+ printf ("%s: Updated %zu CRC32s, %zu CRC32s did match.\n", argv[0],
+ updated_count, matched_count);
+ if (failed_count)
+ printf ("%s: Failed for %zu files.\n", argv[0], failed_count);
+ return failed_count == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
+}

30
SOURCES/rpm-4.11.3-EVR-validity-check.patch

@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
--- rpm-4.11.3/build/parseReqs.c.orig 2015-08-19 16:24:55.343033682 +0200
+++ rpm-4.11.3/build/parseReqs.c 2015-08-19 16:25:26.166111719 +0200
@@ -35,16 +35,6 @@
#define SKIPWHITE(_x) {while(*(_x) && (risspace(*_x) || *(_x) == ',')) (_x)++;}
#define SKIPNONWHITE(_x){while(*(_x) &&!(risspace(*_x) || *(_x) == ',')) (_x)++;}
-static int checkSep(const char *s, char c, char **emsg)
-{
- const char *sep = strchr(s, c);
- if (sep && strchr(sep + 1, c)) {
- rasprintf(emsg, "Invalid version (double separator '%c'): %s", c, s);
- return 1;
- }
- return 0;
-}
-
rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTagVal tagN,
int index, rpmsenseFlags tagflags)
{
@@ -165,10 +155,6 @@
rstrlcpy(EVR, v, (ve-v) + 1);
if (rpmCharCheck(spec, EVR, ve-v, ".-_+:%{}~")) goto exit;
- /* While ':' and '-' are valid, only one of each is valid. */
- if (checkSep(EVR, '-', &emsg) || checkSep(EVR, ':', &emsg))
- goto exit;
-
re = ve; /* ==> next token after EVR string starts here */
} else
EVR = NULL;

91
SOURCES/rpm-4.11.3-Initialize-plugins-based-on-DSO-discovery.patch

@ -0,0 +1,91 @@ @@ -0,0 +1,91 @@
From b62a75b137bde84ec8bac92c0238502b422c56ce Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Tue, 24 Jun 2014 14:37:38 +0300
Subject: [PATCH] Initialize plugins based on DSO discovery

- %__transaction_plugins style configuration is problematic for plugins
because we want plugins to be, well, pluggable. As in drop-in to
enable, which is not achievable with a single macro entry. Look up
all DSO's from the plugin dir and enable if a matching
%__transaction_foo macro is defined.
- This isn't optimal but it'll buy us the drop-in capability, which
is what matters most right now. We'll want to have forcability as
well later on (ie it should be possible to require given plugins
to be present)

Conflicts:
lib/transaction.c
---
lib/rpmplugins.c | 3 ++-
lib/transaction.c | 34 +++++++++++++++++-----------------
2 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/lib/rpmplugins.c b/lib/rpmplugins.c
index 7285f54..4e600db 100644
--- a/lib/rpmplugins.c
+++ b/lib/rpmplugins.c
@@ -84,8 +84,9 @@ rpmRC rpmpluginsAddPlugin(rpmPlugins plugins, const char *type, const char *name
path = rpmExpand("%{?__", type, "_", name, "}", NULL);
if (!path || rstreq(path, "")) {
- rpmlog(RPMLOG_ERR, _("Failed to expand %%__%s_%s macro\n"),
+ rpmlog(RPMLOG_DEBUG, _("Plugin %%__%s_%s not configured\n"),
type, name);
+ rc = RPMRC_NOTFOUND;
goto exit;
}
diff --git a/lib/transaction.c b/lib/transaction.c
index 08a5643..386f107 100644
--- a/lib/transaction.c
+++ b/lib/transaction.c
@@ -1440,29 +1440,29 @@ static int rpmtsProcess(rpmts ts)
static rpmRC rpmtsSetupTransactionPlugins(rpmts ts)
{
rpmRC rc = RPMRC_OK;
- char *plugins = NULL, *plugin = NULL;
- const char *delims = ",";
+ ARGV_t files = NULL;
+ int nfiles = 0;
+ char *dsoPath = NULL;
- plugins = rpmExpand("%{?__transaction_plugins}", NULL);
- if (!plugins || rstreq(plugins, "")) {
- goto exit;
- }
+ /*
+ * Assume allocated equals initialized. There are some oddball cases
+ * (verification of non-installed package) where this is not true
+ * currently but that's not a new issue.
+ */
- plugin = strtok(plugins, delims);
- while(plugin != NULL) {
- rpmlog(RPMLOG_DEBUG, "plugin is %s\n", plugin);
- if (!rpmpluginsPluginAdded(ts->plugins, (const char*)plugin)) {
- if (rpmpluginsAddPlugin(ts->plugins, "transaction",
- (const char*)plugin) == RPMRC_FAIL) {
- /* any configured plugin failing to load is a failure */
+ dsoPath = rpmExpand("%{__plugindir}/*.so", NULL);
+ if (rpmGlob(dsoPath, &nfiles, &files) == 0) {
+ rpmPlugins tsplugins = rpmtsPlugins(ts);
+ for (int i = 0; i < nfiles; i++) {
+ char *bn = basename(files[i]);
+ bn[strlen(bn)-strlen(".so")] = '\0';
+ if (rpmpluginsAddPlugin(tsplugins, "transaction", bn) == RPMRC_FAIL)
rc = RPMRC_FAIL;
- }
}
- plugin = strtok(NULL, delims);
+ files = argvFree(files);
}
+ free(dsoPath);
-exit:
- free(plugins);
return rc;
}
--
2.1.0

17
SOURCES/rpm-4.11.3-disable-collection-plugins.patch

@ -0,0 +1,17 @@ @@ -0,0 +1,17 @@
--- rpm-4.11.3/macros.in.orig 2015-08-19 11:09:48.785440045 +0200
+++ rpm-4.11.3/macros.in 2015-08-19 11:10:15.322505916 +0200
@@ -1038,10 +1038,10 @@
#------------------------------------------------------------------------------
# Collection specific macros
%__plugindir %{_libdir}/rpm-plugins
-%__collection_font %{__plugindir}/exec.so /usr/bin/fc-cache
-%__collection_java %{__plugindir}/exec.so /usr/bin/rebuild-gcj-db
-%__collection_sepolicy %{__plugindir}/sepolicy.so
-%__collection_sepolicy_flags 1
+# %__collection_font %{__plugindir}/exec.so /usr/bin/fc-cache
+# %__collection_java %{__plugindir}/exec.so /usr/bin/rebuild-gcj-db
+# %__collection_sepolicy %{__plugindir}/sepolicy.so
+# %__collection_sepolicy_flags 1
# Transaction plugin macros
%__transaction_systemd_inhibit %{__plugindir}/systemd_inhibit.so

364
SOURCES/rpm-4.11.3-update-config.guess.patch

@ -0,0 +1,364 @@ @@ -0,0 +1,364 @@
--- rpm-4.11.3/config.guess.orig 2012-11-07 13:55:52.000000000 +0100
+++ rpm-4.11.3/config.guess 2013-12-27 18:11:24.000000000 +0100
@@ -1,14 +1,12 @@
#! /bin/sh
# Attempt to guess a canonical system name.
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-# 2011, 2012 Free Software Foundation, Inc.
+# Copyright 1992-2013 Free Software Foundation, Inc.
-timestamp='2012-02-10'
+timestamp='2013-06-10'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
@@ -22,19 +20,17 @@
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-# Originally written by Per Bothner. Please send patches (context
-# diff format) to <config-patches@gnu.org> and include a ChangeLog
-# entry.
+# the same distribution terms that you use for the rest of that
+# program. This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
#
-# This script attempts to guess a canonical system name similar to
-# config.sub. If it succeeds, it prints the system name on stdout, and
-# exits with 0. Otherwise, it exits with 1.
+# Originally written by Per Bothner.
#
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+#
+# Please send patches with a ChangeLog entry to config-patches@gnu.org.
+
me=`echo "$0" | sed -e 's,.*/,,'`
@@ -54,9 +50,7 @@
GNU config.guess ($timestamp)
Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
-Free Software Foundation, Inc.
+Copyright 1992-2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -138,6 +132,27 @@
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+case "${UNAME_SYSTEM}" in
+Linux|GNU|GNU/*)
+ # If the system lacks a compiler, then just pick glibc.
+ # We could probably try harder.
+ LIBC=gnu
+
+ eval $set_cc_for_build
+ cat <<-EOF > $dummy.c
+ #include <features.h>
+ #if defined(__UCLIBC__)
+ LIBC=uclibc
+ #elif defined(__dietlibc__)
+ LIBC=dietlibc
+ #else
+ LIBC=gnu
+ #endif
+ EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
+ ;;
+esac
+
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
@@ -200,6 +215,10 @@
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}"
exit ;;
+ *:Bitrig:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
+ echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
+ exit ;;
*:OpenBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
@@ -302,7 +321,7 @@
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit ;;
- arm:riscos:*:*|arm:RISCOS:*:*)
+ arm*:riscos:*:*|arm*:RISCOS:*:*)
echo arm-unknown-riscos
exit ;;
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
@@ -801,6 +820,9 @@
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
exit ;;
+ *:MINGW64*:*)
+ echo ${UNAME_MACHINE}-pc-mingw64
+ exit ;;
*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
@@ -852,21 +874,21 @@
exit ;;
*:GNU:*:*)
# the GNU system
- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit ;;
*:GNU/*:*:*)
# other systems with GNU libc and userland
- echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
exit ;;
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit ;;
aarch64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
aarch64_be:Linux:*:*)
UNAME_MACHINE=aarch64_be
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
@@ -879,59 +901,54 @@
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
objdump --private-headers /bin/sh | grep -q ld.so.1
- if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
- echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+ if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
+ arc:Linux:*:* | arceb:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
arm*:Linux:*:*)
eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
else
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP
then
- echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
else
- echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
fi
fi
exit ;;
avr32*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
cris:Linux:*:*)
- echo ${UNAME_MACHINE}-axis-linux-gnu
+ echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;;
crisv32:Linux:*:*)
- echo ${UNAME_MACHINE}-axis-linux-gnu
+ echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;;
frv:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
hexagon:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
i*86:Linux:*:*)
- LIBC=gnu
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #ifdef __dietlibc__
- LIBC=dietlibc
- #endif
-EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
- echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+ echo ${UNAME_MACHINE}-pc-linux-${LIBC}
exit ;;
ia64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
m32r*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
m68*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
mips:Linux:*:* | mips64:Linux:*:*)
eval $set_cc_for_build
@@ -950,54 +967,63 @@
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
;;
+ or1k:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
or32:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
padre:Linux:*:*)
- echo sparc-unknown-linux-gnu
+ echo sparc-unknown-linux-${LIBC}
exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
- echo hppa64-unknown-linux-gnu
+ echo hppa64-unknown-linux-${LIBC}
exit ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
- PA7*) echo hppa1.1-unknown-linux-gnu ;;
- PA8*) echo hppa2.0-unknown-linux-gnu ;;
- *) echo hppa-unknown-linux-gnu ;;
+ PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
+ PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
+ *) echo hppa-unknown-linux-${LIBC} ;;
esac
exit ;;
ppc64:Linux:*:*)
- echo powerpc64-unknown-linux-gnu
+ echo powerpc64-unknown-linux-${LIBC}
exit ;;
ppc:Linux:*:*)
- echo powerpc-unknown-linux-gnu
+ echo powerpc-unknown-linux-${LIBC}
+ exit ;;
+ ppc64le:Linux:*:*)
+ echo powerpc64le-unknown-linux-${LIBC}
+ exit ;;
+ ppcle:Linux:*:*)
+ echo powerpcle-unknown-linux-${LIBC}
exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
- echo ${UNAME_MACHINE}-ibm-linux
+ echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
exit ;;
sh64*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
sh*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
sparc:Linux:*:* | sparc64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
tile*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
vax:Linux:*:*)
- echo ${UNAME_MACHINE}-dec-linux-gnu
+ echo ${UNAME_MACHINE}-dec-linux-${LIBC}
exit ;;
x86_64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
xtensa*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
@@ -1201,6 +1227,9 @@
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
echo i586-pc-haiku
exit ;;
+ x86_64:Haiku:*:*)
+ echo x86_64-unknown-haiku
+ exit ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE}
exit ;;
@@ -1227,19 +1256,21 @@
exit ;;
*:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
- case $UNAME_PROCESSOR in
- i386)
- eval $set_cc_for_build
- if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
- if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
- grep IS_64BIT_ARCH >/dev/null
- then
- UNAME_PROCESSOR="x86_64"
- fi
- fi ;;
- unknown) UNAME_PROCESSOR=powerpc ;;
- esac
+ eval $set_cc_for_build
+ if test "$UNAME_PROCESSOR" = unknown ; then
+ UNAME_PROCESSOR=powerpc
+ fi
+ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
+ then
+ case $UNAME_PROCESSOR in
+ i386) UNAME_PROCESSOR=x86_64 ;;
+ powerpc) UNAME_PROCESSOR=powerpc64 ;;
+ esac
+ fi
+ fi
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
exit ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
@@ -1256,7 +1287,7 @@
NEO-?:NONSTOP_KERNEL:*:*)
echo neo-tandem-nsk${UNAME_RELEASE}
exit ;;
- NSE-?:NONSTOP_KERNEL:*:*)
+ NSE-*:NONSTOP_KERNEL:*:*)
echo nse-tandem-nsk${UNAME_RELEASE}
exit ;;
NSR-?:NONSTOP_KERNEL:*:*)
@@ -1330,9 +1361,6 @@
exit ;;
esac
-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
eval $set_cc_for_build
cat >$dummy.c <<EOF
#ifdef _SEQUENT_

37
SOURCES/rpm-4.11.x-Add-make_build-macro.patch

@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
From 89df36524bace71decee4ab4f979d4ffb449c9a7 Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Wed, 22 Jan 2014 10:56:00 +0200
Subject: [PATCH] Add %make_build macro for hiding parallel-build magic from
specs (ticket #115)

- This allows simplifying the make invokations from specs. In particular
the parallel build options no longer need to be messed with from specs,
and %__make can be overridden to force a different make implementation
to be used throughout the spec.
- While a lot of software builds correctly in parallel, there are always
exceptions... together with _smp_ncpus_max macro this can now be
expressed with a separate "%global _smp_ncpus_max 1" (or any other
arbitrary value beyond which parallel build is buggy) line which
is easy to grep for and experiment with.
---
macros.in | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/macros.in b/macros.in
index 5a075a3..9c7a111 100644
--- a/macros.in
+++ b/macros.in
@@ -861,6 +861,10 @@ package or when debugging this package.\
--infodir=%{_infodir}
#------------------------------------------------------------------------------
+# The "make" analogue, hiding the _smp_mflags magic from specs
+%make_build %{__make} %{?_smp_mflags}
+
+#------------------------------------------------------------------------------
# The make install analogue of %configure for modern autotools:
%make_install %{__make} install DESTDIR=%{?buildroot}
--
2.1.0

109
SOURCES/rpm-4.11.x-Add-noplugins.patch

@ -0,0 +1,109 @@ @@ -0,0 +1,109 @@
From 454285b3a259c6bbf5fee4300fac2f50a40e4ac4 Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Tue, 24 Jun 2014 15:11:32 +0300
Subject: [PATCH] Add disabler flag + --noplugins cli switch for plugins

- Always knew we'd need a plugin disabler flag sooner than later but
didn't realize enabled plugins would fail basically the entire
test-suite :)
- Enable --noplugins for entire test-suite for now, but eventually
we'll need to come up with ways to test plugins as well
---
lib/poptALL.c | 5 +++++
lib/rpmts.h | 2 +-
lib/transaction.c | 2 +-
python/rpmmodule.c | 1 +
tests/atlocal.in | 2 +-
5 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/lib/poptALL.c b/lib/poptALL.c
index 31e1210..2e894e0 100644
--- a/lib/poptALL.c
+++ b/lib/poptALL.c
@@ -187,6 +187,11 @@ struct poptOption rpmcliAllPoptTable[] = {
N_("read <FILE:...> instead of default file(s)"),
N_("<FILE:...>") },
+ /* XXX this is a bit out of place here but kinda unavoidable... */
+ { "noplugins", '\0', POPT_BIT_SET,
+ &rpmIArgs.transFlags, RPMTRANS_FLAG_NOPLUGINS,
+ N_("don't enable any plugins"), NULL },
+
{ "nodigest", '\0', 0, 0, RPMCLI_POPT_NODIGEST,
N_("don't verify package digest(s)"), NULL },
{ "nohdrchk", '\0', POPT_ARGFLAG_DOC_HIDDEN, 0, RPMCLI_POPT_NOHDRCHK,
diff --git a/lib/rpmts.h b/lib/rpmts.h
index e1b260d..5231c80 100644
--- a/lib/rpmts.h
+++ b/lib/rpmts.h
@@ -34,7 +34,7 @@ enum rpmtransFlags_e {
RPMTRANS_FLAG_NOTRIGGERS = (1 << 4), /*!< from --notriggers */
RPMTRANS_FLAG_NODOCS = (1 << 5), /*!< from --excludedocs */
RPMTRANS_FLAG_ALLFILES = (1 << 6), /*!< from --allfiles */
- /* bit 7 unused */
+ RPMTRANS_FLAG_NOPLUGINS = (1 << 7), /*!< from --noplugins */
RPMTRANS_FLAG_NOCONTEXTS = (1 << 8), /*!< from --nocontexts */
/* bits 9-15 unused */
RPMTRANS_FLAG_NOTRIGGERPREIN= (1 << 16), /*!< from --notriggerprein */
diff --git a/lib/transaction.c b/lib/transaction.c
index 0317c1e..736f64d 100644
--- a/lib/transaction.c
+++ b/lib/transaction.c
@@ -1361,6 +1361,9 @@ rpmRC rpmtsSetupTransactionPlugins(rpmts ts)
* (verification of non-installed package) where this is not true
* currently but that's not a new issue.
*/
+
+ if (rpmtsFlags(ts) & RPMTRANS_FLAG_NOPLUGINS)
+ return RPMRC_OK;
dsoPath = rpmExpand("%{__plugindir}/*.so", NULL);
if (rpmGlob(dsoPath, &nfiles, &files) == 0) {
diff --git a/python/rpmmodule.c b/python/rpmmodule.c
index e0fcef0..4e6fe27 100644
--- a/python/rpmmodule.c
+++ b/python/rpmmodule.c
@@ -428,6 +428,7 @@ static int initModule(PyObject *m)
REGISTER_ENUM(RPMTRANS_FLAG_NOTRIGGERS);
REGISTER_ENUM(RPMTRANS_FLAG_NODOCS);
REGISTER_ENUM(RPMTRANS_FLAG_ALLFILES);
+ REGISTER_ENUM(RPMTRANS_FLAG_NOPLUGINS);
REGISTER_ENUM(RPMTRANS_FLAG_KEEPOBSOLETE);
REGISTER_ENUM(RPMTRANS_FLAG_NOCONTEXTS);
REGISTER_ENUM(RPMTRANS_FLAG_REPACKAGE);
diff --git a/tests/atlocal.in b/tests/atlocal.in
index 10ff27a..c2a07d5 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -30,6 +30,6 @@ function run()
function runroot()
{
(cd ${RPMTEST} && \
- MAGIC="/magic/magic" FAKECHROOT_BASE="${RPMTEST}" fakechroot "$@" --define "_topdir /build"
+ MAGIC="/magic/magic" FAKECHROOT_BASE="${RPMTEST}" fakechroot "$@" --define "_topdir /build" --noplugins
)
}
--
2.5.5

--- current/doc/rpm.8.orig 2016-07-14 14:34:14.286125290 +0200
+++ current/doc/rpm.8 2016-07-14 14:36:29.715481426 +0200
@@ -86,7 +86,7 @@
[\fB--excludedocs\fR] [\fB--force\fR] [\fB-h,--hash\fR]
[\fB--ignoresize\fR] [\fB--ignorearch\fR] [\fB--ignoreos\fR]
[\fB--includedocs\fR] [\fB--justdb\fR] [\fB--nocollections\fR]
- [\fB--nodeps\fR] [\fB--nodigest\fR] [\fB--nosignature\fR]
+ [\fB--nodeps\fR] [\fB--nodigest\fR] [\fB--nosignature\fR] [\fB--noplugins\fR]
[\fB--noorder\fR] [\fB--noscripts\fR] [\fB--notriggers\fR]
[\fB--oldpackage\fR] [\fB--percent\fR] [\fB--prefix \fINEWPATH\fB\fR]
[\fB--relocate \fIOLDPATH\fB=\fINEWPATH\fB\fR]
@@ -269,6 +269,9 @@
Don't reorder the packages for an install. The list of
packages would normally be reordered to satisfy dependencies.
.TP
+\fB--noplugins\fR
+Do not load and execute plugins.
+.TP
\fB--noscripts\fR
.TP
\fB--nopre\fR

12
SOURCES/rpm-4.11.x-CVE-2014-8118.patch

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
--- rpm-4.11.1.orig/lib/cpio.c 2014-11-28 12:21:50.444158675 +0100
+++ rpm-4.11.1/lib/cpio.c 2014-11-28 12:22:53.776453253 +0100
@@ -296,6 +296,9 @@
st->st_rdev = makedev(major, minor);
GET_NUM_FIELD(hdr.namesize, nameSize);
+ if (nameSize <= 0 || nameSize > 4096) {
+ return CPIOERR_BAD_HEADER;
+ }
*path = xmalloc(nameSize + 1);
read = Fread(*path, nameSize, 1, cpio->fd);

72
SOURCES/rpm-4.11.x-Fix-Python-hdr-refcount.patch

@ -0,0 +1,72 @@ @@ -0,0 +1,72 @@
From 40326b5724b0cd55a21b2d86eeef344e4826f863 Mon Sep 17 00:00:00 2001
From: Florian Festi <ffesti@redhat.com>
Date: Thu, 20 Oct 2016 16:06:06 +0200
Subject: [PATCH] Do not call headerLink() in hdr_Wrap()

as headers often already have an ref count of 1.
Add headerLink() only where it is necessary.
Plugs memory leaks in Python binding
Resolves: rhbz:#1358467
---
python/header-py.c | 4 ++--
python/rpmmi-py.c | 2 ++
python/rpmts-py.c | 1 -
3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/python/header-py.c b/python/header-py.c
index 63167d9..5d98f89 100644
--- a/python/header-py.c
+++ b/python/header-py.c
@@ -394,6 +394,7 @@ static PyObject *hdr_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds)
h = headerNew();
} else if (CAPSULE_CHECK(obj)) {
h = CAPSULE_EXTRACT(obj, "rpm._C_Header");
+ headerLink(h);
} else if (hdrObject_Check(obj)) {
h = headerCopy(((hdrObject*) obj)->h);
} else if (PyBytes_Check(obj)) {
@@ -778,8 +779,7 @@ PyObject * hdr_Wrap(PyTypeObject *subtype, Header h)
{
hdrObject * hdr = (hdrObject *)subtype->tp_alloc(subtype, 0);
if (hdr == NULL) return NULL;
-
- hdr->h = headerLink(h);
+ hdr->h = h;
return (PyObject *) hdr;
}
diff --git a/python/rpmmi-py.c b/python/rpmmi-py.c
index 0e27575..379cafb 100644
--- a/python/rpmmi-py.c
+++ b/python/rpmmi-py.c
@@ -1,6 +1,7 @@
#include "rpmsystem-py.h"
#include <rpm/rpmdb.h>
+#include <rpm/header.h>
#include "rpmmi-py.h"
#include "header-py.h"
@@ -74,6 +75,7 @@ rpmmi_iternext(rpmmiObject * s)
s->mi = rpmdbFreeIterator(s->mi);
return NULL;
}
+ headerLink(h);
return hdr_Wrap(&hdr_Type, h);
}
diff --git a/python/rpmts-py.c b/python/rpmts-py.c
index 13951df..f05371c 100644
--- a/python/rpmts-py.c
+++ b/python/rpmts-py.c
@@ -384,7 +384,6 @@ rpmts_HdrFromFdno(rpmtsObject * s, PyObject *arg)
if (rpmrc == RPMRC_OK) {
ho = hdr_Wrap(&hdr_Type, h);
- h = headerFree(h); /* ref held by python object */
} else {
Py_INCREF(Py_None);
ho = Py_None;
--
2.9.3

30
SOURCES/rpm-4.11.x-Fix-off-by-one-base64.patch

@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
From 0964912b94f9f48a0a812fbfbb2f996dbd93eff0 Mon Sep 17 00:00:00 2001
From: Jonathan Wakely <github@kayari.org>
Date: Wed, 25 May 2016 12:31:19 +0100
Subject: [PATCH] Fix off-by-one error

There's an off-by-one error in base64_decode_value which results in undefined behaviour:

void* out;
size_t len;
rpmBase64Decode("\x7b", &out, &len);
---
rpmio/base64.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rpmio/base64.c b/rpmio/base64.c
index 60e67d4..4424aab 100644
--- a/rpmio/base64.c
+++ b/rpmio/base64.c
@@ -104,7 +104,7 @@ static int base64_decode_value(unsigned char value_in)
{
static const int decoding[] = {62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-2,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51};
value_in -= 43;
- if (value_in > sizeof(decoding)/sizeof(int))
+ if (value_in >= sizeof(decoding)/sizeof(int))
return -1;
return decoding[value_in];
}
--
2.9.3

31
SOURCES/rpm-4.11.x-Handle-line-continuation.patch

@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
From 817959609b95afe34ce0f7f6c3dc5d7d0d9a8470 Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Wed, 25 Jun 2014 11:28:02 +0300
Subject: [PATCH] Handle line continuation in grabArgs() (related to
RhBug:1045723)

- Commit 1bdcd0500865efd3566efd7f951228f69b58e755 to fix RhBug:1045723
broke some funky java macros in Fedora which include line continuation
in the argument (comments 6-7 in the bug). That it ever worked seems
far more like luck than by design but since this seems to fix it...
---
rpmio/macro.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/rpmio/macro.c b/rpmio/macro.c
index 12a65a4..b00155c 100644
--- a/rpmio/macro.c
+++ b/rpmio/macro.c
@@ -771,7 +771,8 @@ grabArgs(MacroBuf mb, const rpmMacroEntry me, const char * se,
exit:
argvFree(argv);
- return (*lastc == '\0' || *lastc == '\n') ? lastc : lastc + 1;
+ return ((*lastc == '\0' || *lastc == '\n') && *(lastc-1) != '\\') ?
+ lastc : lastc + 1;
}
/**
--
2.1.0

10
SOURCES/rpm-4.11.x-bdb-warings.patch

@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
--- rpm-4.11.3/lib/backend/db3.c.orig 2016-04-22 09:16:15.019084419 +0200
+++ rpm-4.11.3/lib/backend/db3.c 2016-04-22 09:17:16.448291533 +0200
@@ -190,6 +190,7 @@
dbenv->set_alloc(dbenv, rmalloc, rrealloc, NULL);
dbenv->set_errcall(dbenv, NULL);
dbenv->set_errpfx(dbenv, _errpfx);
+ dbenv->set_msgfile(dbenv, stderr);
/*
* These enable automatic stale lock removal.

45
SOURCES/rpm-4.11.x-broken-pipe.patch

@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
From f515907c71c03019a52f89921c41303fa5926b2a Mon Sep 17 00:00:00 2001
From: Lubos Kardos <lkardos@redhat.com>
Date: Fri, 12 Jun 2015 13:38:23 +0200
Subject: [PATCH] Don't show error message if log function fails because of
broken pipe.

- regression from commit 11b005c957fb0e52d42078480104d3e27e95e609
- rhbz: #1231138
---
rpmio/rpmlog.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/rpmio/rpmlog.c b/rpmio/rpmlog.c
index f43e622..43ae36f 100644
--- a/rpmio/rpmlog.c
+++ b/rpmio/rpmlog.c
@@ -4,7 +4,8 @@
#include "system.h"
#include <stdarg.h>
+#include <errno.h>
#include <stdlib.h>
#include <rpm/rpmlog.h>
#include "debug.h"
@@ -127,13 +128,13 @@ static int rpmlogDefault(FILE *stdlog, rpmlogRec rec)
break;
}
- if (fputs(rpmlogLevelPrefix(rec->pri), msgout) == EOF)
+ if (fputs(rpmlogLevelPrefix(rec->pri), msgout) == EOF && errno != EPIPE)
perror("Error occurred during writing of a log message");
- if (fputs(rec->message, msgout) == EOF)
+ if (fputs(rec->message, msgout) == EOF && errno != EPIPE)
perror("Error occurred during writing of a log message");
- if (fflush(msgout) == EOF)
+ if (fflush(msgout) == EOF && errno != EPIPE)
perror("Error occurred during writing of a log message");
return (rec->pri <= RPMLOG_CRIT ? RPMLOG_EXIT : 0);
--
1.9.3

22
SOURCES/rpm-4.11.x-chmod.patch

@ -0,0 +1,22 @@ @@ -0,0 +1,22 @@
--- rpm-4.11.1/lib/fsm.c.orig 2014-11-13 13:38:56.742934031 +0100
+++ rpm-4.11.1/lib/fsm.c 2014-11-13 13:42:13.036380024 +0100
@@ -726,12 +726,17 @@
{
FD_t wfd = NULL;
const struct stat * st = &fsm->sb;
- rpm_loff_t left = st->st_size;
+ rpm_loff_t left = rpmfiFSizeIndex(fsmGetFi(fsm), fsm->ix);
const unsigned char * fidigest = NULL;
pgpHashAlgo digestalgo = 0;
int rc = 0;
- wfd = Fopen(fsm->path, "w.ufdio");
+ /* Create the file with 000 permissions. */
+ {
+ mode_t old_umask = umask(0777);
+ wfd = Fopen(fsm->path, "w.ufdio");
+ umask(old_umask);
+ }
if (Ferror(wfd)) {
rc = CPIOERR_OPEN_FAILED;
goto exit;

30
SOURCES/rpm-4.11.x-color-skipping.patch

@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
From 2f31395dcd49459c775caaadefa0513181cd12ff Mon Sep 17 00:00:00 2001
From: Lubos Kardos <lkardos@localhost.localdomain>
Date: Wed, 17 Dec 2014 12:53:30 +0100
Subject: [PATCH] Fix color skipping of multiple files with the same content.

- If we process some file and we find another file with the same path
and the same content and this other file is skipped for color then
the currently being processed file has to be skipped for color too.
(RhBug:1170124)
---
lib/transaction.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/lib/transaction.c b/lib/transaction.c
index 736f64d..2d1432e 100644
--- a/lib/transaction.c
+++ b/lib/transaction.c
@@ -587,6 +587,9 @@ assert(otherFi != NULL);
if (!(oflags & RPMFILE_GHOST)) {
rpmfsSetAction(fs, i, FA_SKIP);
}
+ /* if the other file is color skipped then skip this file too */
+ } else if (oaction == FA_SKIPCOLOR) {
+ rpmfsSetAction(fs, i, FA_SKIPCOLOR);
}
}
--
2.1.0

16
SOURCES/rpm-4.11.x-defattr-permissions.patch

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
--- rpm-4.8.0/build/files.c.defattr-permissions 2015-02-23 10:45:47.043339687 +0100
+++ rpm-4.8.0/build/files.c 2015-02-23 10:53:55.673480702 +0100
@@ -1446,6 +1446,12 @@
if (fl->def.ar.ar_dmodestr) {
fileMode &= S_IFMT;
fileMode |= fl->def.ar.ar_dmode;
+ } else if (fl->def.ar.ar_fmodestr){
+ rpmlog(RPMLOG_WARNING, _("%%defattr doesn't define directory "
+ "mode so file mode defined in %%defattr is used for "
+ "directory: %s\n"), diskPath);
+ fileMode &= S_IFMT;
+ fileMode |= fl->def.ar.ar_fmode;
}
} else if (!S_ISLNK(fileMode) && fl->def.ar.ar_fmodestr) {
fileMode &= S_IFMT;

32
SOURCES/rpm-4.11.x-define-PY_SSIZE_T_CLEAN.patch

@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
From f0a58d1dced6215b7caaa70db17d54834e0cd44e Mon Sep 17 00:00:00 2001
From: Lubos Kardos <lkardos@redhat.com>
Date: Fri, 18 Sep 2015 15:29:25 +0200
Subject: [PATCH] Define PY_SSIZE_T_CLEAN

When PyArg_ParseTupleAndKeywords() is used with format argument "s#"
that means get a string and his length then the length is returned as
as a Py_ssize_t in python3 but as an int in python2, which casues
a problem because rpmfd_write() that uses PyArg_ParseTupleAndKeywords()
expects the length as a Py_ssize_t always. This problem affects big
endian systems with python2 as default. If PY_SSIZE_T_CLEAN is defined
then PyArg_ParseTupleAndKeywords() returns the length as a Py_ssize_t
in both python2 and python3.
---
python/rpmsystem-py.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/python/rpmsystem-py.h b/python/rpmsystem-py.h
index 50e8770..c8423e3 100644
--- a/python/rpmsystem-py.h
+++ b/python/rpmsystem-py.h
@@ -5,6 +5,7 @@
#include <sys/types.h>
#endif
+#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <structmember.h>
--
1.9.3

25
SOURCES/rpm-4.11.x-deprecate-addsign.patch

@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
From 5dd555adbed5dae6a9255bb17074d2b043d0244e Mon Sep 17 00:00:00 2001
From: Lubos Kardos <lkardos@redhat.com>
Date: Fri, 27 Mar 2015 09:57:29 +0100
Subject: [PATCH] Add deprecation warning to description of "--addsign"

---
rpmpopt.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rpmpopt.in b/rpmpopt.in
index fe4f40f..ca95702 100644
--- a/rpmpopt.in
+++ b/rpmpopt.in
@@ -188,7 +188,7 @@ rpmbuild alias --buildpolicy --define '__os_install_post %{_rpmconfigdir}/brp-!#
# Minimally preserve rpmbuild's --sign functionality
rpmbuild alias --sign \
--pipe "grep '.*: .*\.rpm$'|cut -d: -f2|xargs -r rpm --addsign" \
- --POPTdesc=$"generate GPG signature"
+ --POPTdesc=$"generate GPG signature (deprecated, use command rpmsign instead)"
rpmsign alias --key-id --define '_gpg_name !#:+' \
--POPTdesc=$"key id/name to sign with" \
--
2.1.0

27
SOURCES/rpm-4.11.x-dirlink-verify.patch

@ -0,0 +1,27 @@ @@ -0,0 +1,27 @@
commit 3ccd774255b8215733e0bdfdf5a683da9dd10923
Author: Panu Matilainen <pmatilai@redhat.com>
Date: Wed Sep 24 10:31:51 2014 +0300

Handle directory replaced with a symlink to one in verify (RhBug:1101861)
- An unforced installation must not cause verification failures - we
permit directories to be replaced by directory symlinks during
install so we need to do the same in verify too.

diff --git a/lib/verify.c b/lib/verify.c
index eb6f2e1..84e9843 100644
--- a/lib/verify.c
+++ b/lib/verify.c
@@ -96,6 +96,12 @@ int rpmVerifyFile(const rpmts ts, const rpmfi fi,
return 1;
}
+ /* If we expected a directory but got a symlink to one, follow the link */
+ if (S_ISDIR(fmode) && S_ISLNK(sb.st_mode) && stat(fn, &sb) != 0) {
+ *res |= RPMVERIFY_LSTATFAIL;
+ return 1;
+ }
+
/* Links have no mode, other types have no linkto */
if (S_ISLNK(sb.st_mode))
flags &= ~(RPMVERIFY_MODE);

27
SOURCES/rpm-4.11.x-do-not-filter-ld64.patch

@ -0,0 +1,27 @@ @@ -0,0 +1,27 @@
From f6771b6722f0df097f9c61fc1b487f6f0ee402e8 Mon Sep 17 00:00:00 2001
From: Florian Festi <ffesti@redhat.com>
Date: Tue, 30 Jul 2013 16:35:21 +0200
Subject: [PATCH] Do not filter ld64.* and ld64-* provides and requires Fixes
#988373

---
tools/elfdeps.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/elfdeps.c b/tools/elfdeps.c
index 906de10..8679f89 100644
--- a/tools/elfdeps.c
+++ b/tools/elfdeps.c
@@ -52,7 +52,8 @@ static int skipSoname(const char *soname)
if (!strstr(soname, ".so"))
return 1;
- if (rstreqn(soname, "ld.", 3) || rstreqn(soname, "ld-", 3))
+ if (rstreqn(soname, "ld.", 3) || rstreqn(soname, "ld-", 3) ||
+ rstreqn(soname, "ld64.", 3) || rstreqn(soname, "ld64-", 3))
return 0;
if (rstreqn(soname, "lib", 3))
--
1.7.11.7

77
SOURCES/rpm-4.11.x-elem-progress.patch

@ -0,0 +1,77 @@ @@ -0,0 +1,77 @@
From 08473f4ad8d79e6d232832c6863b2848f8a41734 Mon Sep 17 00:00:00 2001
From: Michal Domonkos <mdomonko@redhat.com>
Date: Mon, 7 Dec 2015 17:13:26 +0100
Subject: [PATCH] Add RPMCALLBACK_ELEM_PROGRESS callback type

Currently, there's no callback type that would be issued per each
transaction element. RPMCALLBACK_TRANS_PROGRESS is only issued during
the prepare phase but not when packages are actually installed or
erased. Likewise, RPMCALLBACK_INST_ST* and RPMCALLBACK_UNINST_ST* won't
be issued if an install or erase operation is skipped for some reason (a
script or package upgrade failure).

Having such a callback would allow the Python API consumers to always
know upfront which element is about to be processed, before any other
callbacks are issued. This is important since not every callback type
carries enough data about the subject package; while the INST types
provide the user object passed to a former addInstall call, the UNINST
types only provide the package name (which may not be unique within the
transaction set).

This commit adds such a callback.

(cherry picked from commit 448db68ceb5be3c7171b7ec0ea908d905792dc2f)
---
lib/rpmcallback.h | 1 +
lib/transaction.c | 4 ++++
python/rpmmodule.c | 1 +
3 files changed, 6 insertions(+)

diff --git a/lib/rpmcallback.h b/lib/rpmcallback.h
index b3b05c6c1..b6d434c01 100644
--- a/lib/rpmcallback.h
+++ b/lib/rpmcallback.h
@@ -31,6 +31,7 @@ typedef enum rpmCallbackType_e {
RPMCALLBACK_SCRIPT_START = (1 << 16),
RPMCALLBACK_SCRIPT_STOP = (1 << 17),
RPMCALLBACK_INST_STOP = (1 << 18),
+ RPMCALLBACK_ELEM_PROGRESS = (1 << 19),
} rpmCallbackType;
/**
diff --git a/lib/transaction.c b/lib/transaction.c
index 45c30b5ba..1cd9ca674 100644
--- a/lib/transaction.c
+++ b/lib/transaction.c
@@ -1410,12 +1410,16 @@ exit:
static int rpmtsProcess(rpmts ts)
{
rpmtsi pi; rpmte p;
+ tsMembers tsmem = rpmtsMembers(ts);
int rc = 0;
+ int i = 0;
pi = rpmtsiInit(ts);
while ((p = rpmtsiNext(pi, 0)) != NULL) {
int failed;
+ rpmtsNotify(ts, NULL, RPMCALLBACK_ELEM_PROGRESS, i++,
+ tsmem->orderCount);
rpmlog(RPMLOG_DEBUG, "========== +++ %s %s-%s 0x%x\n",
rpmteNEVR(p), rpmteA(p), rpmteO(p), rpmteColor(p));
diff --git a/python/rpmmodule.c b/python/rpmmodule.c
index 04285a63f..fc8115d30 100644
--- a/python/rpmmodule.c
+++ b/python/rpmmodule.c
@@ -459,6 +459,7 @@ static int initModule(PyObject *m)
REGISTER_ENUM(RPMCALLBACK_SCRIPT_START);
REGISTER_ENUM(RPMCALLBACK_SCRIPT_STOP);
REGISTER_ENUM(RPMCALLBACK_INST_STOP);
+ REGISTER_ENUM(RPMCALLBACK_ELEM_PROGRESS);
REGISTER_ENUM(RPMPROB_BADARCH);
REGISTER_ENUM(RPMPROB_BADOS);
--
2.13.2

87
SOURCES/rpm-4.11.x-export-verifysigs-to-python.patch

@ -0,0 +1,87 @@ @@ -0,0 +1,87 @@
diff -up rpm-4.11.3/lib/rpmchecksig.c.orig rpm-4.11.3/lib/rpmchecksig.c
--- rpm-4.11.3/lib/rpmchecksig.c.orig 2013-11-22 11:31:31.000000000 +0100
+++ rpm-4.11.3/lib/rpmchecksig.c 2017-03-15 18:18:20.688251955 +0100
@@ -242,8 +242,8 @@ static void formatResult(rpmTagVal sigta
free(msg);
}
-static int rpmpkgVerifySigs(rpmKeyring keyring, rpmQueryFlags flags,
- FD_t fd, const char *fn)
+int rpmpkgVerifySigs(rpmKeyring keyring, rpmQueryFlags flags, FD_t fd,
+ const char *fn)
{
char *buf = NULL;
diff -up rpm-4.11.3/lib/rpmcli.h.orig rpm-4.11.3/lib/rpmcli.h
--- rpm-4.11.3/lib/rpmcli.h.orig 2014-02-05 14:04:02.000000000 +0100
+++ rpm-4.11.3/lib/rpmcli.h 2017-03-15 18:18:20.689251950 +0100
@@ -254,6 +254,17 @@ int showVerifyPackage(QVA_t qva, rpmts t
*/
int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd, const char * fn);
+/**
+ * Check package and header signatures.
+ * @param keyring keyring handle
+ * @param flags flags to control what to verify
+ * @param fd package file handle
+ * @param fn package file name
+ * @return 0 on success, 1 on failure
+ */
+int rpmpkgVerifySigs(rpmKeyring keyring, rpmQueryFlags flags, FD_t fd,
+ const char *fn);
+
/** \ingroup rpmcli
* Verify package install.
* @todo hack: RPMQV_ALL can pass char ** arglist = NULL, not char * arg. Union?
diff -up rpm-4.11.3/python/rpmts-py.c.orig rpm-4.11.3/python/rpmts-py.c
--- rpm-4.11.3/python/rpmts-py.c.orig 2014-02-05 14:04:02.000000000 +0100
+++ rpm-4.11.3/python/rpmts-py.c 2017-03-15 18:18:20.689251950 +0100
@@ -7,6 +7,8 @@
#include <rpm/rpmpgp.h>
#include <rpm/rpmdb.h>
#include <rpm/rpmbuild.h>
+#include <rpm/rpmcli.h>
+#include <rpm/rpmkeyring.h>
#include "header-py.h"
#include "rpmds-py.h" /* XXX for rpmdsNew */
@@ -671,6 +672,24 @@ exit:
return mio;
}
+static PyObject *
+rpmts_VerifySigs(rpmtsObject * s, PyObject * args)
+{
+ rpmfdObject *fdo = NULL;
+ char *fn = NULL;
+ rpmQueryFlags flags = (VERIFY_DIGEST|VERIFY_SIGNATURE);
+ int rc = 1;
+
+ if (!PyArg_ParseTuple(args, "O&s|i:VerifySigs", rpmfdFromPyObject, &fdo,
+ &fn, &flags))
+ return NULL;
+
+ rpmKeyring keyring = rpmtsGetKeyring(s->ts, 1);
+ rc = rpmpkgVerifySigs(keyring, flags, rpmfdGetFd(fdo), fn);
+ rpmKeyringFree(keyring);
+ return PyBool_FromLong(rc == 0);
+}
+
static struct PyMethodDef rpmts_methods[] = {
{"addInstall", (PyCFunction) rpmts_AddInstall, METH_VARARGS,
NULL },
@@ -729,6 +748,14 @@ Remove all elements from the transaction
{"dbIndex", (PyCFunction) rpmts_index, METH_VARARGS|METH_KEYWORDS,
"ts.dbIndex(TagN) -> ii\n\
- Create a key iterator for the default transaction rpmdb.\n" },
+ {"_verifySigs", (PyCFunction) rpmts_VerifySigs, METH_VARARGS,
+ "ts._verifySigs(fdno, fn, [flags]) -- Verify package signature\n\n"
+ "Returns True if it verifies, False otherwise.\n\n"
+ "Args:\n"
+ " fdno : file descriptor of the package to verify\n"
+ " fn : package file name (just for logging purposes)\n"
+ " flags : bitfield to control what to verify\n"
+ " (default is rpm.VERIFY_SIGNATURE | rpm.VERIFY_DIGEST)"},
{NULL, NULL} /* sentinel */
};

80
SOURCES/rpm-4.11.x-filter-soname-deps.patch

@ -0,0 +1,80 @@ @@ -0,0 +1,80 @@
commit 73bd9636d0e76a4d255776b7733667198b9ef585
Author: Panu Matilainen <pmatilai@redhat.com>
Date: Mon Jan 7 15:52:43 2013 +0200

Filter ELF dependencies by name
- Instead of vain heuristics on DT_SONAME presence, filter out
irregular sonames from all dependencies: linkable library names generally
must contain ".so" and start with "lib" for the linker to find it at all,
anything else is an exception of one kind or another (the prime exception
of ld.so variants we handle here). This weeds out provides for most
dlopen()'ed modules etc, and filtering both provides and requires
by the same rules means we wont generate requires for things that wont be
provided. Of course this also means we can omit things that are in
DT_NEEDED, but these should be rare exceptions which the new
--no-filter-soname switch is for.

diff --git a/tools/elfdeps.c b/tools/elfdeps.c
index fc9a905..a0db9f7 100644
--- a/tools/elfdeps.c
+++ b/tools/elfdeps.c
@@ -15,6 +15,7 @@
int filter_private = 0;
int soname_only = 0;
int fake_soname = 1;
+int filter_soname = 1;
typedef struct elfInfo_s {
Elf *elf;
@@ -36,6 +37,31 @@ static int skipPrivate(const char *s)
return (filter_private && rstreq(s, "GLIBC_PRIVATE"));
}
+/*
+ * Rough soname sanity filtering: all sane soname's dependencies need to
+ * contain ".so", and normal linkable libraries start with "lib",
+ * everything else is an exception of some sort. The most notable
+ * and common exception is the dynamic linker itself, which we allow
+ * here, the rest can use --no-filter-soname.
+ */
+static int skipSoname(const char *soname)
+{
+ if (filter_soname) {
+ if (!strstr(soname, ".so"))
+ return 1;
+
+ if (rstreqn(soname, "ld.", 3) || rstreqn(soname, "ld-", 3))
+ return 0;
+
+ if (rstreqn(soname, "lib", 3))
+ return 0;
+ else
+ return 1;
+ }
+
+ return 0;
+}
+
static const char *mkmarker(GElf_Ehdr *ehdr)
{
const char *marker = NULL;
@@ -58,6 +84,10 @@ static void addDep(ARGV_t *deps,
const char *soname, const char *ver, const char *marker)
{
char *dep = NULL;
+
+ if (skipSoname(soname))
+ return;
+
if (ver || marker) {
rasprintf(&dep,
"%s(%s)%s", soname, ver ? ver : "", marker ? marker : "");
@@ -293,6 +323,7 @@ int main(int argc, char *argv[])
{ "filter-private", 0, POPT_ARG_VAL, &filter_private, -1, NULL, NULL },
{ "soname-only", 0, POPT_ARG_VAL, &soname_only, -1, NULL, NULL },
{ "no-fake-soname", 0, POPT_ARG_VAL, &fake_soname, 0, NULL, NULL },
+ { "no-filter-soname", 0, POPT_ARG_VAL, &filter_soname, 0, NULL, NULL },
POPT_AUTOHELP
POPT_TABLEEND
};

27
SOURCES/rpm-4.11.x-fix-debuginfo-creation.patch

@ -0,0 +1,27 @@ @@ -0,0 +1,27 @@
From 659614aeb6fffe3b249c12b442bd85129100f73b Mon Sep 17 00:00:00 2001
From: Pascal Terjan <pterjan@gmail.com>
Date: Mon, 16 Feb 2015 13:08:50 +0100
Subject: [PATCH] Fix debuginfo creation for changed file output.

file will print a "warning" that it only processed up to 256 notes.
Fixes: http://rpm.org/ticket/887
---
scripts/find-debuginfo.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/find-debuginfo.sh b/scripts/find-debuginfo.sh
index 57449f7..264fad5 100644
--- a/scripts/find-debuginfo.sh
+++ b/scripts/find-debuginfo.sh
@@ -205,7 +205,7 @@ $strict || strict_error=WARNING
find "$RPM_BUILD_ROOT" ! -path "${debugdir}/*.debug" -type f \
\( -perm -0100 -or -perm -0010 -or -perm -0001 \) \
-print |
-file -N -f - | sed -n -e 's/^\(.*\):[ ]*.*ELF.*, not stripped/\1/p' |
+file -N -f - | sed -n -e 's/^\(.*\):[ ]*.*ELF.*, not stripped.*/\1/p' |
xargs --no-run-if-empty stat -c '%h %D_%i %n' |
while read nlinks inum f; do
get_debugfn "$f"
--
2.1.0

56
SOURCES/rpm-4.11.x-fix-stripping-of-binaries.patch

@ -0,0 +1,56 @@ @@ -0,0 +1,56 @@
From 5b4805df2085b0e7c4f09caad62638c3238b3bc1 Mon Sep 17 00:00:00 2001
From: Florian Festi <ffesti@redhat.com>
Date: Tue, 30 Jun 2015 11:39:21 +0200
Subject: [PATCH] Fix stripping of binaries for changed file output.

file will print a "warning" that it only processed up to 256 notes.

- Related: 659614aeb6fffe3b249c12b442bd85129100f73b
- Related: http://rpm.org/ticket/887
- Related: rhbz#1206312
---
scripts/brp-strip | 2 +-
scripts/brp-strip-comment-note | 2 +-
scripts/brp-strip-shared | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/brp-strip b/scripts/brp-strip
index 2e99d1e..5e64566 100755
--- a/scripts/brp-strip
+++ b/scripts/brp-strip
@@ -15,6 +15,6 @@ esac
for f in `find "$RPM_BUILD_ROOT" -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) -exec file {} \; | \
grep -v "^${RPM_BUILD_ROOT}/\?usr/lib/debug" | \
grep -v ' shared object,' | \
- sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p'`; do
+ sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped.*/\1/p'`; do
$STRIP -g "$f" || :
done
diff --git a/scripts/brp-strip-comment-note b/scripts/brp-strip-comment-note
index 323c041..833ac78 100755
--- a/scripts/brp-strip-comment-note
+++ b/scripts/brp-strip-comment-note
@@ -16,7 +16,7 @@ esac
# for already stripped elf files in the build root
for f in `find "$RPM_BUILD_ROOT" -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) -exec file {} \; | \
grep -v "^${RPM_BUILD_ROOT}/\?usr/lib/debug" | \
- sed -n -e 's/^\(.*\):[ ]*ELF.*, stripped/\1/p'`; do
+ sed -n -e 's/^\(.*\):[ ]*ELF.*, stripped.*/\1/p'`; do
note="-R .note"
if $OBJDUMP -h $f | grep '^[ ]*[0-9]*[ ]*.note[ ]' -A 1 | \
grep ALLOC >/dev/null; then
diff --git a/scripts/brp-strip-shared b/scripts/brp-strip-shared
index e06ee4b..51d10d5 100644
--- a/scripts/brp-strip-shared
+++ b/scripts/brp-strip-shared
@@ -20,6 +20,6 @@ esac
for f in `find "$RPM_BUILD_ROOT" -type f -a -exec file {} \; | \
grep -v "^${RPM_BUILD_ROOT}/\?usr/lib/debug" | \
grep ' shared object,' | \
- sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p'`; do
+ sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped.*/\1/p'`; do
$STRIP --strip-unneeded "$f"
done
--
2.1.0

68
SOURCES/rpm-4.11.x-man-systemd-inhibit.patch

@ -0,0 +1,68 @@ @@ -0,0 +1,68 @@
From 4a2c311bfe21eda9472f52795db1c9f883e6c194 Mon Sep 17 00:00:00 2001
From: Florian Festi <ffesti@redhat.com>
Date: Mon, 4 Jul 2016 17:45:33 +0200
Subject: [PATCH] Add man page for systemd-inhibit plugin

---
doc/Makefile.am | 1 +
doc/rpm-plugin-systemd-inhibit.8 | 36 ++++++++++++++++++++++++++++++++++++
2 files changed, 37 insertions(+)
create mode 100644 doc/rpm-plugin-systemd-inhibit.8

diff --git a/doc/Makefile.am b/doc/Makefile.am
index f7940b9..d2f520d 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -9,6 +9,7 @@ EXTRA_DIST += $(man_man1_DATA)
man_man8dir = $(mandir)/man8
man_man8_DATA = rpm.8 rpmbuild.8 rpmdeps.8 rpmgraph.8 rpm2cpio.8
man_man8_DATA += rpmdb.8 rpmkeys.8 rpmsign.8 rpmspec.8
+man_man8_DATA += rpm-plugin-systemd-inhibit.8
EXTRA_DIST += $(man_man8_DATA)
man_fr_man8dir = $(mandir)/fr/man8
diff --git a/doc/rpm-plugin-systemd-inhibit.8 b/doc/rpm-plugin-systemd-inhibit.8
new file mode 100644
index 0000000..b49e8ef
--- /dev/null
+++ b/doc/rpm-plugin-systemd-inhibit.8
@@ -0,0 +1,36 @@
+.TH "RPM-SYSTEMD-INHIBIT" "8" "14 Apr 2016" "Red Hat, Inc."
+.SH NAME
+rpm-plugin-systemd-inhibit \- Plugin for the RPM Package Manager
+
+.SH Description
+
+This plugin for RPM prevents the system to enter shutdown, sleep or idle
+mode while there is a rpm transaction running to prevent system corruption
+that can occur if the transaction is interrupted by a reboot.
+
+This is achieved by using the inhibit DBUS interface of systemd. The call is
+roughly equivalent to executing
+
+\fBsystemd-inhibit --mode=block --what=idle:sleep:shutdown --who=RPM --why="Transaction running"\fR
+
+See \fBsystemd-inhibit(1)\fR for the details of this mechanism.
+
+It is strongly advised to have the plugin installed on all systemd
+based systems.
+
+.SH Prerequisites
+
+For the plugin to work systemd has to be used as init system and
+though the DBUS system bus must be available. If the plugin cannot access the
+interface it gives a warning but does not stop the transaction.
+
+.SH Configuration
+
+The plugin currently does not have any configuration option other than
+turning it on and off. It can be disabled by commenting out the
+\fI%__transaction_systemd_inhibit\fR macro in main macros file
+(typically located at \fI/usr/lib/rpm/macros\fR) or otherwise change
+the value of the macro.
+
+Another option is to remove the plugin from the system if it is
+packaged in its own sub package.
--
2.5.5

15
SOURCES/rpm-4.11.x-minidebuginfo-ppc64.patch

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
diff -up rpm-4.11.1/scripts/find-debuginfo.sh.minidebug-ppc64 rpm-4.11.1/scripts/find-debuginfo.sh
--- rpm-4.11.1/scripts/find-debuginfo.sh.minidebug-ppc64 2014-01-16 14:05:17.291955782 +0200
+++ rpm-4.11.1/scripts/find-debuginfo.sh 2014-01-16 14:05:56.437285842 +0200
@@ -149,7 +149,10 @@ add_minidebug()
# in the normal symbol table
nm -D "$binary" --format=posix --defined-only | awk '{ print $1 }' | sort > "$dynsyms"
# Extract all the text (i.e. function) symbols from the debuginfo
- nm "$debuginfo" --format=posix --defined-only | awk '{ if ($2 == "T" || $2 == "t") print $1 }' | sort > "$funcsyms"
+ # Use format sysv to make sure we can match against the actual ELF FUNC
+ # symbol type. The binutils nm posix format symbol type chars are
+ # ambigous for architectures that might use function descriptors.
+ nm "$debuginfo" --format=sysv --defined-only | awk -F \| '{ if ($4 ~ "FUNC") print $1 }' | sort > "$funcsyms"
# Keep all the function symbols not already in the dynamic symbol table
comm -13 "$dynsyms" "$funcsyms" > "$keep_symbols"
# Copy the full debuginfo, keeping only a minumal set of symbols and removing some unnecessary sections

89
SOURCES/rpm-4.11.x-move-rename.patch

@ -0,0 +1,89 @@ @@ -0,0 +1,89 @@
From d519580bd638ceb48829ae66557ca3c5941b4a5f Mon Sep 17 00:00:00 2001
From: Florian Festi <ffesti@redhat.com>
Date: Wed, 4 May 2016 14:05:06 +0200
Subject: [PATCH] Set permissions before moving new files to their final place

---
lib/fsm.c | 37 ++++++++++++++++++++-----------------
1 file changed, 20 insertions(+), 17 deletions(-)

diff --git a/lib/fsm.c b/lib/fsm.c
index 1ee7e67..3bb23a4 100644
--- a/lib/fsm.c
+++ b/lib/fsm.c
@@ -621,14 +621,15 @@ static FSM_t fsmFree(FSM_t fsm)
/* Find and set file security context */
static int fsmSetSELabel(struct selabel_handle *sehandle,
- const char *path, mode_t mode)
+ const char *path, const char * nominalpath,
+ mode_t mode)
{
int rc = 0;
#if WITH_SELINUX
if (sehandle) {
security_context_t scon = NULL;
- if (selabel_lookup_raw(sehandle, &scon, path, mode) == 0) {
+ if (selabel_lookup_raw(sehandle, &scon, nominalpath, mode) == 0) {
rc = lsetfilecon(path, scon);
if (_fsm_debug) {
@@ -1215,7 +1216,7 @@ static int fsmMkdirs(rpmfi fi, rpmfs fs, struct selabel_handle *sehandle)
mode_t mode = S_IFDIR | (_dirPerms & 07777);
rc = fsmMkdir(dn, mode);
if (!rc) {
- rc = fsmSetSELabel(sehandle, dn, mode);
+ rc = fsmSetSELabel(sehandle, dn, dn, mode);
rpmlog(RPMLOG_DEBUG,
"%s directory created with perms %04o\n",
@@ -1534,22 +1535,11 @@ static int fsmCommit(FSM_t fsm, int ix)
/* Backup on-disk file if needed. Directories are handled earlier */
if (!S_ISDIR(st->st_mode))
rc = fsmBackup(fsm);
- /* Rename temporary to final file name. */
- if (!S_ISDIR(st->st_mode) && (fsm->suffix || fsm->nsuffix)) {
- char *npath = fsmFsPath(fsm, 0, fsm->nsuffix);
- rc = fsmRename(fsm->path, npath, fsm->mapFlags);
- if (!rc && fsm->nsuffix) {
- char * opath = fsmFsPath(fsm, 0, NULL);
- rpmlog(RPMLOG_WARNING, _("%s created as %s\n"),
- opath, npath);
- free(opath);
- }
- free(fsm->path);
- fsm->path = npath;
- }
/* Set file security context (if enabled) */
if (!rc && !getuid()) {
- rc = fsmSetSELabel(fsm->sehandle, fsm->path, fsm->sb.st_mode);
+ char * opath = fsmFsPath(fsm, 0, NULL);
+ rc = fsmSetSELabel(fsm->sehandle, fsm->path, opath, fsm->sb.st_mode);
+ opath = _free(opath);
}
if (S_ISLNK(st->st_mode)) {
if (!rc && !getuid())
@@ -1571,6 +1561,19 @@ static int fsmCommit(FSM_t fsm, int ix)
rc = fsmSetFCaps(fsm->path, rpmfiFCapsIndex(fi, ix));
}
}
+ /* Rename temporary to final file name. */
+ if (!rc && !S_ISDIR(st->st_mode) && (fsm->suffix || fsm->nsuffix)) {
+ char *npath = fsmFsPath(fsm, 0, fsm->nsuffix);
+ rc = fsmRename(fsm->path, npath, fsm->mapFlags);
+ if (!rc && fsm->nsuffix) {
+ char * opath = fsmFsPath(fsm, 0, NULL);
+ rpmlog(RPMLOG_WARNING, _("%s created as %s\n"),
+ opath, npath);
+ free(opath);
+ }
+ free(fsm->path);
+ fsm->path = npath;
+ }
}
if (rc && fsm->failedFile && *fsm->failedFile == NULL) {
--
2.5.5

111
SOURCES/rpm-4.11.x-multitheaded_xz.patch

@ -0,0 +1,111 @@ @@ -0,0 +1,111 @@
diff --git a/rpmio/rpmio.c b/rpmio/rpmio.c
index cd223e8..f23fc11 100644
--- a/rpmio/rpmio.c
+++ b/rpmio/rpmio.c
@@ -5,6 +5,7 @@
#include "system.h"
#include <stdarg.h>
#include <errno.h>
+#include <ctype.h>
#include <rpm/rpmlog.h>
#include <rpm/rpmmacro.h>
@@ -873,7 +874,12 @@ static const char * getFdErrstr (FD_t fd)
#include <sys/types.h>
#include <inttypes.h>
+#define LZMA_UNSTABLE
#include <lzma.h>
+/* Multithreading support in stable API since xz 5.2.0 */
+#if LZMA_VERSION >= 50010020
+#define HAVE_LZMA_MT
+#endif
#define kBufferSize (1 << 15)
@@ -897,7 +902,10 @@ static LZFILE *lzopen_internal(const char *path, const char *mode, int fd, int x
LZFILE *lzfile;
lzma_ret ret;
lzma_stream init_strm = LZMA_STREAM_INIT;
-
+ uint64_t mem_limit = rpmExpandNumeric("%{_xz_memlimit}");
+#ifdef HAVE_LZMA_MT
+ int threads = 0;
+#endif
for (; *mode; mode++) {
if (*mode == 'w')
encoding = 1;
@@ -905,6 +913,21 @@ static LZFILE *lzopen_internal(const char *path, const char *mode, int fd, int x
encoding = 0;
else if (*mode >= '1' && *mode <= '9')
level = *mode - '0';
+ else if (*mode == 'T') {
+ if (isdigit(*(mode+1))) {
+#ifdef HAVE_LZMA_MT
+ threads = atoi(++mode);
+#endif
+ /* skip past rest of digits in string that atoi()
+ * should've processed
+ * */
+ while(isdigit(*++mode));
+ }
+#ifdef HAVE_LZMA_MT
+ else
+ threads = -1;
+#endif
+ }
}
if (fd != -1)
fp = fdopen(fd, encoding ? "w" : "r");
@@ -924,16 +947,48 @@ static LZFILE *lzopen_internal(const char *path, const char *mode, int fd, int x
lzfile->strm = init_strm;
if (encoding) {
if (xz) {
- ret = lzma_easy_encoder(&lzfile->strm, level, LZMA_CHECK_SHA256);
+#ifdef HAVE_LZMA_MT
+ if (!threads) {
+#endif
+ ret = lzma_easy_encoder(&lzfile->strm, level, LZMA_CHECK_SHA256);
+#ifdef HAVE_LZMA_MT
+ } else {
+ if (threads == -1)
+ threads = sysconf(_SC_NPROCESSORS_ONLN);
+ lzma_mt mt_options = {
+ .flags = 0,
+ .threads = threads,
+ .block_size = 0,
+ .timeout = 0,
+ .preset = level,
+ .filters = NULL,
+ .check = LZMA_CHECK_SHA256 };
+
+ ret = lzma_stream_encoder_mt(&lzfile->strm, &mt_options);
+ }
+#endif
} else {
lzma_options_lzma options;
lzma_lzma_preset(&options, level);
ret = lzma_alone_encoder(&lzfile->strm, &options);
}
- } else { /* lzma_easy_decoder_memusage(level) is not ready yet, use hardcoded limit for now */
- ret = lzma_auto_decoder(&lzfile->strm, 100<<20, 0);
+ } else { /* lzma_easy_decoder_memusage(level) is not ready yet, use hardcoded limit for now */
+ ret = lzma_auto_decoder(&lzfile->strm, mem_limit ? mem_limit : 100<<20, 0);
}
if (ret != LZMA_OK) {
+ switch (ret) {
+ case LZMA_MEM_ERROR:
+ rpmlog(RPMLOG_ERR, "liblzma: Memory allocation failed");
+ break;
+
+ case LZMA_DATA_ERROR:
+ rpmlog(RPMLOG_ERR, "liblzma: File size limits exceeded");
+ break;
+
+ default:
+ rpmlog(RPMLOG_ERR, "liblzma: <Unknown error (%d), possibly a bug", ret);
+ break;
+ }
fclose(fp);
free(lzfile);
return 0;

46
SOURCES/rpm-4.11.x-no-longer-config.patch

@ -0,0 +1,46 @@ @@ -0,0 +1,46 @@
From 3c99b06c7776345cfc3a3d4fd0c59fe671644317 Mon Sep 17 00:00:00 2001
From: Lubos Kardos <lkardos@redhat.com>
Date: Wed, 21 Oct 2015 15:25:47 +0200
Subject: [PATCH] Overwrite a file if it is not marked as config any more.

If a file was marked as config in the previous version of a package but
it is not marked as config in currently being installed version of
the package then backup the old file as .rpmsave and overwrite it with
the new file. (rhbz:1263859)
---
lib/rpmfi.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/lib/rpmfi.c b/lib/rpmfi.c
index 924ff4b..28a697e 100644
--- a/lib/rpmfi.c
+++ b/lib/rpmfi.c
@@ -1040,6 +1040,12 @@ rpmFileAction rpmfilesDecideFate(rpmfiles ofi, int oix,
goto exit; /* file identical in new, replace. */
}
+ /* if new file is no longer config, backup it and replace it */
+ if (!(newFlags & RPMFILE_CONFIG)) {
+ action = FA_SAVE;
+ goto exit;
+ }
+
/* If file can be determined identical in old and new pkg, let it be */
if (newWhat == REG && oalgo == nalgo && odiglen == ndiglen) {
if (odigest && ndigest && memcmp(odigest, ndigest, odiglen) == 0) {
@@ -1071,6 +1077,12 @@ rpmFileAction rpmfilesDecideFate(rpmfiles ofi, int oix,
goto exit; /* unmodified config file, replace. */
}
+ /* if new file is no longer config, backup it and replace it */
+ if (!(newFlags & RPMFILE_CONFIG)) {
+ action = FA_SAVE;
+ goto exit;
+ }
+
/* If link is identical in old and new pkg, let it be */
if (newWhat == LINK && oFLink && nFLink && rstreq(oFLink, nFLink)) {
action = FA_SKIP; /* identical file, don't bother. */
--
2.5.5

32
SOURCES/rpm-4.11.x-parametrized-macro-invocations.patch

@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
From 1bdcd0500865efd3566efd7f951228f69b58e755 Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Wed, 19 Feb 2014 14:16:38 +0200
Subject: [PATCH] Dont eat newlines on parametrized macro invocations
(RhBug:1045723)

- Makes the testcase from commit f082b5baa4dcf9601eeb1e0e520ff06e77dc61c0
succeed. While the old behavior is non-sensical and most likely entirely
unintentional, we're changing a very long-standing behavior here (tested
back to rpm 4.4.x and almost certainly much much older than that) so
its entirely possible people are actually relying on the old
behavior. Lets see what breaks...
---
rpmio/macro.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rpmio/macro.c b/rpmio/macro.c
index e1c2a91..72471a2 100644
--- a/rpmio/macro.c
+++ b/rpmio/macro.c
@@ -764,7 +764,7 @@ grabArgs(MacroBuf mb, const rpmMacroEntry me, const char * se,
exit:
argvFree(argv);
- return *lastc ? lastc + 1 : lastc;
+ return (*lastc == '\0' || *lastc == '\n') ? lastc : lastc + 1;
}
/**
--
2.1.0

30
SOURCES/rpm-4.11.x-perl.req-1.patch

@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
From 4f05fa0e15bcb66d29f89e28829ea43107f6382b Mon Sep 17 00:00:00 2001
From: Lubos Kardos <lkardos@redhat.com>
Date: Mon, 1 Dec 2014 16:04:32 +0100
Subject: [PATCH 1/2] Fix parsing multi-line print statement with unquoted tag

- script perl.req was able to parse only multi-line print statements
with quoted tag e.g. 'print <<"tag"' or "print <<'tag'". Now it can
also parse "print <<tag".
---
scripts/perl.req | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/perl.req b/scripts/perl.req
index 04f822c..e17ad5a 100755
--- a/scripts/perl.req
+++ b/scripts/perl.req
@@ -165,8 +165,8 @@ sub process_file {
#
if ( m/print(\s+|\s+\S+\s+)\<\<(.*)/g ) {
my $tag = $2;
- $tag =~ s/^\s*['"]//; # strip off leading space and quote
- $tag =~ s/["']\s*;\s*$//; # strip off trailing quote and space and semicolon
+ $tag =~ s/^\s*['"]?//; # strip off leading space and quote
+ $tag =~ s/["']?\s*;\s*$//; # strip off trailing quote and space and semicolon
while (<FILE>) {
chomp;
( $_ eq $tag ) && last;
--
2.5.5

41
SOURCES/rpm-4.11.x-perl.req-2.patch

@ -0,0 +1,41 @@ @@ -0,0 +1,41 @@
From 4c621e97776a47c2b4e7f17c1cd2a7961453babf Mon Sep 17 00:00:00 2001
From: Lubos Kardos <lkardos@redhat.com>
Date: Wed, 3 Dec 2014 14:01:14 +0100
Subject: [PATCH 2/2] Ignore "use" or "requires" within multi-line print or
assign statement

- Now script perl.req ignores "use" and "requires" on lines that are
part of printing or assigning multi-line string i. e. string that
hasn't starting and ending quote on the same line.
(RhBug:1024517)
---
scripts/perl.req | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/scripts/perl.req b/scripts/perl.req
index e17ad5a..6e53c91 100755
--- a/scripts/perl.req
+++ b/scripts/perl.req
@@ -174,6 +174,19 @@ sub process_file {
$_ = <FILE>;
}
+ # Skip multiline print and assign statements
+ if ( m/\$\S+\s*=\s*(")([^"\\]|(\\.))*$/ ||
+ m/\$\S+\s*=\s*(')([^'\\]|(\\.))*$/ ||
+ m/print\s+(")([^"\\]|(\\.))*$/ ||
+ m/print\s+(')([^'\\]|(\\.))*$/ ) {
+
+ my $quote = $1;
+ while (<FILE>) {
+ m/^([^\\$quote]|(\\.))*$quote/ && last;
+ }
+ $_ = <FILE>;
+ }
+
if (
# ouch could be in a eval, perhaps we do not want these since we catch
--
2.5.5

37
SOURCES/rpm-4.11.x-perl.req-3.patch

@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
From 1d9a0018f9cde8fc5c59df9af70a2164e672210f Mon Sep 17 00:00:00 2001
From: Lubos Kardos <lkardos@redhat.com>
Date: Wed, 25 Nov 2015 13:49:01 +0100
Subject: [PATCH] Improve perl.req script

This commit 0d5929ba5eabadec49273bb090ba9158dfccc30c tries to ignore
"use" and "require" within multi-line print statements that start with
line like this "print <<EOF" but it incorrectly parses lines in
following format "print <<EOF unless $o" and every "use" or "require"
below this line to the end of file is ignored. That causes that some
requires which was previously found are not found now. This commit
fixes this problem (#1268021).
---
scripts/perl.req | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/perl.req b/scripts/perl.req
index 6e53c91..f1000c8 100755
--- a/scripts/perl.req
+++ b/scripts/perl.req
@@ -163,10 +163,10 @@ sub process_file {
# within a multi-line print statement. So, let's skip over such print
# statements whose content should not be loading modules anyway. -BEF-
#
- if ( m/print(\s+|\s+\S+\s+)\<\<(.*)/g ) {
+ if (m/print(?:\s+|\s+\S+\s+)\<\<\s*(["'`])(.+?)\1/ ||
+ m/print(\s+|\s+\S+\s+)\<\<(\w+)/) {
+
my $tag = $2;
- $tag =~ s/^\s*['"]?//; # strip off leading space and quote
- $tag =~ s/["']?\s*;\s*$//; # strip off trailing quote and space and semicolon
while (<FILE>) {
chomp;
( $_ eq $tag ) && last;
--
2.5.5

32
SOURCES/rpm-4.11.x-perl.req-4.patch

@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
From 6a8754b2153e0e4305ef2bc5a789bfe02f65e889 Mon Sep 17 00:00:00 2001
From: Florian Festi <ffesti@redhat.com>
Date: Tue, 14 Jun 2016 15:01:16 +0200
Subject: [PATCH] perl.req: Skip over multi line return statements See
Rhbz#1275551

---
scripts/perl.req | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/scripts/perl.req b/scripts/perl.req
index f1000c8..7155518 100755
--- a/scripts/perl.req
+++ b/scripts/perl.req
@@ -160,11 +160,12 @@ sub process_file {
#
# The (require|use) match further down in this subroutine will match lines
- # within a multi-line print statement. So, let's skip over such print
+ # within a multi-line print or return statements. So, let's skip over such
# statements whose content should not be loading modules anyway. -BEF-
#
if (m/print(?:\s+|\s+\S+\s+)\<\<\s*(["'`])(.+?)\1/ ||
- m/print(\s+|\s+\S+\s+)\<\<(\w+)/) {
+ m/print(\s+|\s+\S+\s+)\<\<(\w+)/ ||
+ m/return(\s+)\<\<(\w+)/ ) {
my $tag = $2;
while (<FILE>) {
--
2.5.5

39
SOURCES/rpm-4.11.x-perl.req-skip-my-var-block.patch

@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
From 4a9b7f547ce1bb6b0b352d2e29ae4b0d3bddebfb Mon Sep 17 00:00:00 2001
From: Florian Festi <ffesti@redhat.com>
Date: Mon, 13 Mar 2017 11:20:11 +0100
Subject: [PATCH] perl.req: Also skip blocks with my var = <<

Before only
var = <<BLOCK
foo
BLOCK

was skipped.

But

my var = <<BLOCK

is also valid perl and needs to be skipped for dependency scanning.
---
scripts/perl.req | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/perl.req b/scripts/perl.req
index 7155518..52bd301 100755
--- a/scripts/perl.req
+++ b/scripts/perl.req
@@ -104,8 +104,8 @@ sub process_file {
# skip the "= <<" block
- if (m/^\s*\$(?:.*)\s*=\s*<<\s*(["'`])(.+?)\1/ ||
- m/^\s*\$(.*)\s*=\s*<<(\w+)\s*;/) {
+ if (m/^\s*(?:my\s*)?\$(?:.*)\s*=\s*<<\s*(["'`])(.+?)\1/ ||
+ m/^\s*(?:my\s*)?\$(.*)\s*=\s*<<(\w+)\s*;/) {
$tag = $2;
while (<FILE>) {
chomp;
--
2.9.3

25
SOURCES/rpm-4.11.x-python-binding-test-case.patch

@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
From 3c74e34e8d8c5b3db024dbe04a352e807ed2b627 Mon Sep 17 00:00:00 2001
From: Florian Festi <ffesti@redhat.com>
Date: Wed, 23 Sep 2015 11:30:12 +0200
Subject: [PATCH] Fix error handling in rpmio Python binding test case

---
tests/rpmpython.at | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/rpmpython.at b/tests/rpmpython.at
index 949673b..eac31b2 100644
--- a/tests/rpmpython.at
+++ b/tests/rpmpython.at
@@ -53,7 +53,7 @@ for iot in [ 'fpio', 'fdio', 'ufdio', 'gzdio' ]:
fd = rpm.fd(fn, 'r', iot)
rdata = fd.read()
if rdata != data:
- myprint('%s read fail (got %d bytes)' % (iot, len(rdata), rdata))
+ myprint('%s read fail (got %d bytes)\n%s' % (iot, len(rdata), rdata))
# compressed io types can't seek
if iot == 'ufdio':
fd.seek(0)
--
1.9.3

63
SOURCES/rpm-4.11.x-quiet-signing.patch

@ -0,0 +1,63 @@ @@ -0,0 +1,63 @@
From 4a3d73081cb7db6673fa6775fbf5f6655f846241 Mon Sep 17 00:00:00 2001
From: Florian Festi <ffesti@redhat.com>
Date: Mon, 4 Jul 2016 18:34:44 +0200
Subject: [PATCH] Fix rpmbuild --sign --quiet which relies on the output of
rpmbuild

by reproducing the output of the librpmbuild in the rpmbuild tool.
---
rpmbuild.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)

diff --git a/rpmbuild.c b/rpmbuild.c
index 02d2655..aa63f97 100644
--- a/rpmbuild.c
+++ b/rpmbuild.c
@@ -12,6 +12,7 @@
#include <rpm/rpmdb.h>
#include <rpm/rpmps.h>
#include <rpm/rpmts.h>
+#include "build/rpmbuild_internal.h"
#include "lib/signature.h"
#include "cliutils.h"
@@ -517,6 +518,36 @@ static int buildForTarget(rpmts ts, const char * arg, BTA_t ba)
if (rpmSpecBuild(spec, ba)) {
goto exit;
}
+ /* Output generated package files for the --sign alias */
+ if (quiet && rpmcliPipeOutput &&
+ strncmp(rpmcliPipeOutput, "rpm --addsign", 13)) {
+ rpmSetVerbosity(RPMLOG_INFO);
+ if (buildAmount&RPMBUILD_PACKAGESOURCE) {
+ char *fn = rpmGetPath("%{_srcrpmdir}/", spec->sourceRpmName,NULL);
+ rpmlog(RPMLOG_INFO, _("Wrote: %s\n"), fn);
+ fn = _free(fn);
+ }
+ if (buildAmount&RPMBUILD_PACKAGEBINARY) {
+ rpmSpecPkgIter pkgiter = rpmSpecPkgIterInit(spec);
+ for (rpmSpecPkg pkg = rpmSpecPkgIterNext(pkgiter);
+ pkg;
+ pkg = rpmSpecPkgIterNext(pkgiter)) {
+ char *binFormat = rpmGetPath("%{_rpmfilename}", NULL);
+ char *binRpm, *fn;
+ const char *errorString;
+ Header h = rpmSpecPkgHeader(pkg);
+ if (h) {
+ binRpm = headerFormat(h, binFormat, &errorString);
+ fn = rpmGetPath("%{_rpmdir}/", binRpm, NULL);
+ free(binRpm);
+ rpmlog(RPMLOG_INFO, _("Wrote: %s\n"), fn);
+ free(fn);
+ }
+ free(binFormat);
+ }
+ }
+ rpmSetVerbosity(RPMLOG_WARNING);
+ }
if (buildMode == 't')
(void) unlink(specFile);
--
2.5.5

368
SOURCES/rpm-4.11.x-reinstall.patch

@ -0,0 +1,368 @@ @@ -0,0 +1,368 @@
This patchset consists of following upstream commits:
- 1f3164ae6975747e72af383f2d74c27245e6fe36
- fd40d58efa0fbff535f273e5ae5c200d43d28aef
- bfa76529864b9dfb29258f4dedc3fa9de9c5aeca
- 6665503ec6fb6430ecaafb3e318a4730f146efa9
- bf856744f2820a1625ef9428284b5788d18103f3
- c5200145fa08da884ce2c1ed85941363eeae6407
- 80dee39fb1f97ab3927c10bdd13c7c438b5677be

with some changes to make RPM to compile.

diff -uNr rpm-4.11.3/doc/rpm.8 rpm-4.11.3.reinstall/doc/rpm.8
--- rpm-4.11.3/doc/rpm.8 2017-07-12 16:57:41.711722771 +0200
+++ rpm-4.11.3.reinstall/doc/rpm.8 2017-07-12 16:14:26.842680581 +0200
@@ -110,7 +110,7 @@
One of the following basic modes must be selected:
\fBQuery\fR,
\fBVerify\fR,
-\fBInstall/Upgrade/Freshen\fR,
+\fBInstall/Upgrade/Freshen/Reinstall\fR,
\fBUninstall\fR,
\fBSet Owners/Groups\fR,
\fBShow Querytags\fR, and
@@ -206,6 +206,13 @@
This will upgrade packages, but only ones for which an earlier version is
installed.
.PP
+The general form of an rpm reinstall command is
+.PP
+\fBrpm\fR {\fB--reinstall\fR} [\fBinstall-options\fR] \fB\fIPACKAGE_FILE\fB\fR\fI ...\fR
+.PP
+This reinstalls a previously installed package.
+.PP
+.PP
.TP
\fB--allfiles\fR
Installs or upgrades all the missingok files in the package,
diff -uNr rpm-4.11.3/lib/depends.c rpm-4.11.3.reinstall/lib/depends.c
--- rpm-4.11.3/lib/depends.c 2017-07-12 16:57:41.742723041 +0200
+++ rpm-4.11.3.reinstall/lib/depends.c 2017-07-12 16:14:12.203550634 +0200
@@ -54,6 +54,12 @@
#undef HASHTYPE
#undef HTKEYTYPE
+enum addOp_e {
+ RPMTE_INSTALL = 0,
+ RPMTE_UPGRADE = 1,
+ RPMTE_REINSTALL = 2,
+};
+
/**
* Check for supported payload format in header.
* @param h header to check
@@ -126,7 +132,7 @@
}
/* Return rpmdb iterator with removals optionally pruned out */
-static rpmdbMatchIterator rpmtsPrunedIterator(rpmts ts, rpmDbiTagVal tag,
+rpmdbMatchIterator rpmtsPrunedIterator(rpmts ts, rpmDbiTagVal tag,
const char * key, int prune)
{
rpmdbMatchIterator mi = rpmtsInitIterator(ts, tag, key, 0);
@@ -152,22 +158,29 @@
}
/* Add erase elements for older packages of same color (if any). */
-static int addUpgradeErasures(rpmts ts, rpm_color_t tscolor,
+static int addSelfErasures(rpmts ts, rpm_color_t tscolor, int op,
rpmte p, rpm_color_t hcolor, Header h)
{
Header oh;
rpmdbMatchIterator mi = rpmtsInitIterator(ts, RPMDBI_NAME, rpmteN(p), 0);
int rc = 0;
+ int cmp;
while((oh = rpmdbNextIterator(mi)) != NULL) {
/* Ignore colored packages not in our rainbow. */
if (skipColor(tscolor, hcolor, headerGetNumber(oh, RPMTAG_HEADERCOLOR)))
continue;
- /* Skip packages that contain identical NEVR. */
- if (rpmVersionCompare(h, oh) == 0)
+ cmp = rpmVersionCompare(h, oh);
+
+ /* On upgrade, skip packages that contain identical NEVR. */
+ if ((op == RPMTE_UPGRADE) && (cmp == 0))
continue;
+ /* On reinstall, skip packages with differing NEVR. */
+ if ((op == RPMTE_REINSTALL) && (cmp != 0))
+ continue;
+
if (removePackage(ts, oh, p)) {
rc = 1;
break;
@@ -385,8 +398,8 @@
return al;
}
-int rpmtsAddInstallElement(rpmts ts, Header h,
- fnpyKey key, int upgrade, rpmRelocation * relocs)
+static int addPackage(rpmts ts, Header h,
+ fnpyKey key, int op, rpmRelocation * relocs)
{
tsMembers tsmem = rpmtsMembers(ts);
rpm_color_t tscolor = rpmtsColor(ts);
@@ -403,10 +416,10 @@
/* Source packages are never "upgraded" */
if (isSource)
- upgrade = 0;
+ op = RPMTE_INSTALL;
/* Do lazy (readonly?) open of rpm database for upgrades. */
- if (upgrade && rpmtsGetRdb(ts) == NULL && rpmtsGetDBMode(ts) != -1) {
+ if (op != RPMTE_INSTALL && rpmtsGetRdb(ts) == NULL && rpmtsGetDBMode(ts) != -1) {
if ((ec = rpmtsOpenDB(ts, rpmtsGetDBMode(ts))) != 0)
goto exit;
}
@@ -419,7 +432,7 @@
/* Check binary packages for redundancies in the set */
if (!isSource) {
- oc = findPos(ts, tscolor, p, upgrade);
+ oc = findPos(ts, tscolor, p, (op == RPMTE_UPGRADE));
/* If we're replacing a previously added element, free the old one */
if (oc >= 0 && oc < tsmem->orderCount) {
rpmalDel(tsmem->addedPackages, tsmem->order[oc]);
@@ -451,15 +464,33 @@
/* Add erasure elements for old versions and obsoletions on upgrades */
/* XXX TODO: If either of these fails, we'd need to undo all additions */
- if (upgrade) {
- addUpgradeErasures(ts, tscolor, p, rpmteColor(p), h);
+ if (op != RPMTE_INSTALL)
+ addSelfErasures(ts, tscolor, op, p, rpmteColor(p), h);
+ if (op == RPMTE_UPGRADE)
addObsoleteErasures(ts, tscolor, p);
- }
exit:
return ec;
}
+int rpmtsAddInstallElement(rpmts ts, Header h,
+ fnpyKey key, int upgrade, rpmRelocation * relocs)
+{
+ int op = (upgrade == 0) ? RPMTE_INSTALL : RPMTE_UPGRADE;
+ if (rpmtsSetupTransactionPlugins(ts) == RPMRC_FAIL)
+ return 1;
+ return addPackage(ts, h, key, op, relocs);
+}
+
+int rpmtsAddReinstallElement(rpmts ts, Header h, fnpyKey key)
+{
+ if (rpmtsSetupTransactionPlugins(ts) == RPMRC_FAIL)
+ return 1;
+ /* TODO: pull relocations from installed package */
+ /* TODO: should reinstall of non-installed package fail? */
+ return addPackage(ts, h, key, RPMTE_REINSTALL, NULL);
+}
+
int rpmtsAddEraseElement(rpmts ts, Header h, int dboffset)
{
return removePackage(ts, h, NULL);
diff -uNr rpm-4.11.3/lib/poptI.c rpm-4.11.3.reinstall/lib/poptI.c
--- rpm-4.11.3/lib/poptI.c 2013-06-07 09:37:21.000000000 +0200
+++ rpm-4.11.3.reinstall/lib/poptI.c 2017-07-12 16:14:26.842680581 +0200
@@ -247,6 +247,10 @@
&rpmIArgs.installInterfaceFlags, (INSTALL_UPGRADE|INSTALL_INSTALL),
N_("upgrade package(s)"),
N_("<packagefile>+") },
+ { "reinstall", '\0', POPT_BIT_SET,
+ &rpmIArgs.installInterfaceFlags, (INSTALL_REINSTALL|INSTALL_INSTALL),
+ N_("reinstall package(s)"),
+ N_("<packagefile>+") },
POPT_TABLEEND
};
diff -uNr rpm-4.11.3/lib/rpmcli.h rpm-4.11.3.reinstall/lib/rpmcli.h
--- rpm-4.11.3/lib/rpmcli.h 2017-07-12 16:57:41.741723032 +0200
+++ rpm-4.11.3.reinstall/lib/rpmcli.h 2017-07-12 16:14:26.842680581 +0200
@@ -293,7 +293,8 @@
INSTALL_FRESHEN = (1 << 6), /*!< from --freshen */
INSTALL_INSTALL = (1 << 7), /*!< from --install */
INSTALL_ERASE = (1 << 8), /*!< from --erase */
- INSTALL_ALLMATCHES = (1 << 9) /*!< from --allmatches */
+ INSTALL_ALLMATCHES = (1 << 9), /*!< from --allmatches */
+ INSTALL_REINSTALL = (1 << 10), /*!< from --reinstall */
};
typedef rpmFlags rpmInstallFlags;
@@ -354,7 +355,7 @@
};
/** \ingroup rpmcli
- * Install/upgrade/freshen binary rpm package.
+ * Install/upgrade/freshen/reinstall binary rpm package.
* @param ts transaction set
* @param ia mode flags and parameters
* @param fileArgv array of package file names (NULL terminated)
diff -uNr rpm-4.11.3/lib/rpminstall.c rpm-4.11.3.reinstall/lib/rpminstall.c
--- rpm-4.11.3/lib/rpminstall.c 2014-09-05 13:48:07.000000000 +0200
+++ rpm-4.11.3.reinstall/lib/rpminstall.c 2017-07-12 16:14:26.843680590 +0200
@@ -552,7 +552,10 @@
continue;
}
- rc = rpmtsAddInstallElement(ts, h, (fnpyKey)fileName,
+ if (ia->installInterfaceFlags & INSTALL_REINSTALL)
+ rc = rpmtsAddReinstallElement(ts, h, (fnpyKey)fileName);
+ else
+ rc = rpmtsAddInstallElement(ts, h, (fnpyKey)fileName,
(ia->installInterfaceFlags & INSTALL_UPGRADE) != 0,
relocations);
diff -uNr rpm-4.11.3/lib/rpmts.h rpm-4.11.3.reinstall/lib/rpmts.h
--- rpm-4.11.3/lib/rpmts.h 2017-07-12 16:57:41.710722762 +0200
+++ rpm-4.11.3.reinstall/lib/rpmts.h 2017-07-12 16:14:12.203550634 +0200
@@ -544,6 +544,16 @@
rpmRelocation * relocs);
/** \ingroup rpmts
+ * Add package to be reinstalled to transaction set.
+ *
+ * @param ts transaction set
+ * @param h header
+ * @param key package retrieval key (e.g. file name)
+ * @return 0 on success
+ */
+int rpmtsAddReinstallElement(rpmts ts, Header h, const fnpyKey key);
+
+/** \ingroup rpmts
* Add package to be erased to transaction set.
* @param ts transaction set
* @param h header
diff -uNr rpm-4.11.3/lib/rpmts_internal.h rpm-4.11.3.reinstall/lib/rpmts_internal.h
--- rpm-4.11.3/lib/rpmts_internal.h 2014-06-04 11:25:23.000000000 +0200
+++ rpm-4.11.3.reinstall/lib/rpmts_internal.h 2017-07-12 16:44:18.613959252 +0200
@@ -86,6 +86,11 @@
RPM_GNUC_INTERNAL
tsMembers rpmtsMembers(rpmts ts);
+/* Return rpmdb iterator with removals optionally pruned out */
+RPM_GNUC_INTERNAL
+rpmdbMatchIterator rpmtsPrunedIterator(rpmts ts, rpmDbiTagVal tag,
+ const char * key, int prune);
+
RPM_GNUC_INTERNAL
rpmal rpmtsCreateAl(rpmts ts, rpmElementTypes types);
@@ -118,6 +123,9 @@
*/
void rpmtsSELabelFini(rpmts ts, int close_status);
+RPM_GNUC_INTERNAL
+rpmRC rpmtsSetupTransactionPlugins(rpmts ts);
+
#ifdef __cplusplus
}
#endif
diff -uNr rpm-4.11.3/lib/transaction.c rpm-4.11.3.reinstall/lib/transaction.c
--- rpm-4.11.3/lib/transaction.c 2017-07-12 16:57:41.747723085 +0200
+++ rpm-4.11.3.reinstall/lib/transaction.c 2017-07-12 16:43:59.563741144 +0200
@@ -1138,7 +1138,7 @@
if (!(probFilter & RPMPROB_FILTER_REPLACEPKG)) {
Header h;
rpmdbMatchIterator mi;
- mi = rpmtsInitIterator(ts, RPMDBI_NAME, rpmteN(p), 0);
+ mi = rpmtsPrunedIterator(ts, RPMDBI_NAME, rpmteN(p), 1);
rpmdbSetIteratorRE(mi, RPMTAG_EPOCH, RPMMIRE_STRCMP, rpmteE(p));
rpmdbSetIteratorRE(mi, RPMTAG_VERSION, RPMMIRE_STRCMP, rpmteV(p));
rpmdbSetIteratorRE(mi, RPMTAG_RELEASE, RPMMIRE_STRCMP, rpmteR(p));
@@ -1444,7 +1444,7 @@
return rc;
}
-static rpmRC rpmtsSetupTransactionPlugins(rpmts ts)
+rpmRC rpmtsSetupTransactionPlugins(rpmts ts)
{
rpmRC rc = RPMRC_OK;
ARGV_t files = NULL;
diff -uNr rpm-4.11.3/python/rpm/transaction.py rpm-4.11.3.reinstall/python/rpm/transaction.py
--- rpm-4.11.3/python/rpm/transaction.py 2014-02-05 14:04:02.000000000 +0100
+++ rpm-4.11.3.reinstall/python/rpm/transaction.py 2017-07-12 16:14:22.573642686 +0200
@@ -50,7 +50,7 @@
else:
return tuple(keys)
- def addInstall(self, item, key, how="u"):
+ def _f2hdr(self, item):
if isinstance(item, _string_types):
f = open(item)
header = self.hdrFromFdno(f)
@@ -59,6 +59,10 @@
header = item
else:
header = self.hdrFromFdno(item)
+ return header
+
+ def addInstall(self, item, key, how="u"):
+ header = self._f2hdr(item)
if not how in ['u', 'i']:
raise ValueError('how argument must be "u" or "i"')
@@ -67,6 +71,12 @@
if not TransactionSetCore.addInstall(self, header, key, upgrade):
raise rpm.error("adding package to transaction failed")
+ def addReinstall(self, item, key):
+ header = self._f2hdr(item)
+
+ if not TransactionSetCore.addReinstall(self, header, key):
+ raise rpm.error("adding package to transaction failed")
+
def addErase(self, item):
hdrs = []
if isinstance(item, rpm.hdr):
diff -uNr rpm-4.11.3/python/rpmts-py.c rpm-4.11.3.reinstall/python/rpmts-py.c
--- rpm-4.11.3/python/rpmts-py.c 2017-07-12 16:57:41.741723032 +0200
+++ rpm-4.11.3.reinstall/python/rpmts-py.c 2017-07-12 16:14:18.800609194 +0200
@@ -190,6 +190,24 @@
}
static PyObject *
+rpmts_AddReinstall(rpmtsObject * s, PyObject * args)
+{
+ Header h = NULL;
+ PyObject * key;
+ int rc;
+
+ if (!PyArg_ParseTuple(args, "O&O:AddReinstall",
+ hdrFromPyObject, &h, &key))
+ return NULL;
+
+ rc = rpmtsAddReinstallElement(s->ts, h, key);
+ if (key && rc == 0) {
+ PyList_Append(s->keyList, key);
+ }
+ return PyBool_FromLong((rc == 0));
+}
+
+static PyObject *
rpmts_AddErase(rpmtsObject * s, PyObject * args)
{
Header h;
@@ -693,6 +711,8 @@
static struct PyMethodDef rpmts_methods[] = {
{"addInstall", (PyCFunction) rpmts_AddInstall, METH_VARARGS,
NULL },
+ {"addReinstall", (PyCFunction) rpmts_AddReinstall, METH_VARARGS,
+ NULL },
{"addErase", (PyCFunction) rpmts_AddErase, METH_VARARGS|METH_KEYWORDS,
NULL },
{"check", (PyCFunction) rpmts_Check, METH_VARARGS|METH_KEYWORDS,
diff -uNr rpm-4.11.3/rpmqv.c rpm-4.11.3.reinstall/rpmqv.c
--- rpm-4.11.3/rpmqv.c 2012-11-07 13:55:24.000000000 +0100
+++ rpm-4.11.3.reinstall/rpmqv.c 2017-07-12 16:14:26.843680590 +0200
@@ -135,7 +135,8 @@
#ifdef IAM_RPMEIU
if (bigMode == MODE_UNKNOWN || (bigMode & MODES_IE))
{ int iflags = (ia->installInterfaceFlags &
- (INSTALL_UPGRADE|INSTALL_FRESHEN|INSTALL_INSTALL));
+ (INSTALL_UPGRADE|INSTALL_FRESHEN|
+ INSTALL_INSTALL|INSTALL_REINSTALL));
int eflags = (ia->installInterfaceFlags & INSTALL_ERASE);
if (iflags & eflags)

25
SOURCES/rpm-4.11.x-setperms-setugids-mutual-exclusion.patch

@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
From 6013799f80d4dc4fbf5d23cfa0c54ffdee4f95c7 Mon Sep 17 00:00:00 2001
From: jchaloup <jchaloup@redhat.com>
Date: Fri, 13 Jun 2014 12:53:02 +0200
Subject: [PATCH] rpm.8 setperms setugids mutual exclusion

---
doc/rpm.8 | 2 ++
1 file changed, 2 insertions(+)

diff --git a/doc/rpm.8 b/doc/rpm.8
index 31ccceb..c3b79bd 100644
--- a/doc/rpm.8
+++ b/doc/rpm.8
@@ -851,6 +851,8 @@ sets permissions of files in the given package.
.TP
\fBrpm\fR \fB--setugids\fR \fIPACKAGE_NAME\fR
sets user/group ownership of files in the given package.
+.TP
+Options \fB--setperms\fR and \fB--setugids\fR are mutually exclusive.
.SS "FTP/HTTP OPTIONS"
.PP
--
1.9.3

61
SOURCES/rpm-4.11.x-skipattr.patch

@ -0,0 +1,61 @@ @@ -0,0 +1,61 @@
diff --git a/lib/query.c b/lib/query.c
index 6f2d593a7..8a2623241 100644
--- a/lib/query.c
+++ b/lib/query.c
@@ -150,8 +150,8 @@ int showQueryPackage(QVA_t qva, rpmts ts, Header h)
if ((qva->qva_flags & QUERY_FOR_LICENSE) && !(fflags & RPMFILE_LICENSE))
continue;
- /* If not querying %ghost, skip ghost files. */
- if ((qva->qva_fflags & RPMFILE_GHOST) && (fflags & RPMFILE_GHOST))
+ /* Skip on attributes (eg from --noghost) */
+ if (fflags & qva->qva_fflags)
continue;
if (qva->qva_flags & QUERY_FOR_STATE) {
diff --git a/lib/verify.c b/lib/verify.c
index eb6f2e15e..df17a7b01 100644
--- a/lib/verify.c
+++ b/lib/verify.c
@@ -378,10 +378,11 @@ static const char * stateStr(rpmfileState fstate)
* @param ts transaction set
* @param h header to verify
* @param omitMask bits to disable verify checks
- * @param ghosts should ghosts be verified?
+ * @param skipAttr skip files with these attrs (eg %ghost)
* @return 0 no problems, 1 problems found
*/
-static int verifyHeader(rpmts ts, Header h, rpmVerifyAttrs omitMask, int ghosts)
+static int verifyHeader(rpmts ts, Header h, rpmVerifyAttrs omitMask,
+ rpmfileAttrs skipAttrs)
{
rpmVerifyAttrs verifyResult = 0;
int ec = 0; /* assume no problems */
@@ -398,8 +399,8 @@ static int verifyHeader(rpmts ts, Header h, rpmVerifyAttrs omitMask, int ghosts)
char ac;
int rc;
- /* If not verifying %ghost, skip ghost files. */
- if ((fileAttrs & RPMFILE_GHOST) && !ghosts)
+ /* Skip on attributes (eg from --noghost) */
+ if (skipAttrs & fileAttrs)
continue;
rc = rpmVerifyFile(ts, fi, &verifyResult, omitMask);
@@ -494,7 +495,6 @@ static int verifyDependencies(rpmts ts, Header h)
int showVerifyPackage(QVA_t qva, rpmts ts, Header h)
{
rpmVerifyAttrs omitMask = ((qva->qva_flags & VERIFY_ATTRS) ^ VERIFY_ATTRS);
- int ghosts = (qva->qva_fflags & RPMFILE_GHOST);
int ec = 0;
int rc;
@@ -503,7 +503,7 @@ int showVerifyPackage(QVA_t qva, rpmts ts, Header h)
ec = rc;
}
if (qva->qva_flags & VERIFY_FILES) {
- if ((rc = verifyHeader(ts, h, omitMask, ghosts)) != 0)
+ if ((rc = verifyHeader(ts, h, omitMask, qva->qva_fflags)) != 0)
ec = rc;
}
if (qva->qva_flags & VERIFY_SCRIPT) {

43
SOURCES/rpm-4.11.x-sources-to-lua-variables.patch

@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
From 344f938670b8f7400ef177945cef5552783d450f Mon Sep 17 00:00:00 2001
From: Lubos Kardos <lkardos@redhat.com>
Date: Fri, 10 Apr 2015 17:28:17 +0200
Subject: [PATCH] Fix adding of sources to lua variables during recursive
parsing of spec

- Before this fix sources and patches weren't added to lua variables
"sources" and "patches" if they were located in spec file after tag
"BuildArch". Now it works.(rhbz:#1084309)
---
build/parsePreamble.c | 2 +-
build/spec.c | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/build/parsePreamble.c b/build/parsePreamble.c
index 21160cd..521068c 100644
--- a/build/parsePreamble.c
+++ b/build/parsePreamble.c
@@ -308,7 +308,7 @@ static int addSource(rpmSpec spec, Package pkg, const char *field, rpmTagVal tag
addMacro(spec->macros, buf, NULL, p->fullSource, RMIL_SPEC);
free(buf);
#ifdef WITH_LUA
- if (!spec->recursing) {
+ {
rpmlua lua = NULL; /* global state */
const char * what = (flag & RPMBUILD_ISPATCH) ? "patches" : "sources";
rpmluaPushTable(lua, what);
diff --git a/build/spec.c b/build/spec.c
index d06e2c1..1db5d15 100644
--- a/build/spec.c
+++ b/build/spec.c
@@ -239,6 +239,8 @@ rpmSpec newSpec(void)
{
/* make sure patches and sources tables always exist */
rpmlua lua = NULL; /* global state */
+ rpmluaDelVar(lua, "patches");
+ rpmluaDelVar(lua, "sources");
rpmluaPushTable(lua, "patches");
rpmluaPushTable(lua, "sources");
rpmluaPop(lua);
--
2.9.3

657
SOURCES/rpm-4.11.x-systemd-inhibit.patch

@ -0,0 +1,657 @@ @@ -0,0 +1,657 @@
diff --git a/configure.ac b/configure.ac
index 167491e..3bacc1d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -745,6 +745,16 @@ AS_IF([test "$enable_plugins" = yes],[
])
AM_CONDITIONAL(ENABLE_PLUGINS,[test "$enable_plugins" = yes])
+with_dbus=no
+AS_IF([test "$enable_plugins" != no],[
+ PKG_CHECK_MODULES([DBUS],
+ [dbus-1 >= 1.0],
+ [AC_DEFINE(DBUS, 1, [Build with dbus support?]) with_dbus=yes],
+ [with_dbus=no])
+ AC_SUBST(DBUS_CFLAGS)
+ AC_SUBST(DBUS_LIBS)
+])
+AM_CONDITIONAL(DBUS, [test "$with_dbus" = yes])
with_dmalloc=no
AC_ARG_WITH(dmalloc, [AS_HELP_STRING([--with-dmalloc],[build with dmalloc debugging support])])
diff --git a/lib/psm.c b/lib/psm.c
index 8f5376d..e80a90e 100644
--- a/lib/psm.c
+++ b/lib/psm.c
@@ -23,8 +23,11 @@
#include "lib/rpmfi_internal.h" /* XXX replaced/states... */
#include "lib/rpmte_internal.h" /* XXX internal apis */
#include "lib/rpmdb_internal.h" /* rpmdbAdd/Remove */
+#include "lib/rpmts_internal.h" /* ts->plugins */
#include "lib/rpmscript.h"
+#include "lib/rpmplugins.h"
+
#include "debug.h"
typedef enum pkgStage_e {
@@ -421,7 +424,7 @@ static rpmRC runScript(rpmpsm psm, ARGV_const_t prefixes,
rpmswEnter(rpmtsOp(psm->ts, RPMTS_OP_SCRIPTLETS), 0);
rc = rpmScriptRun(script, arg1, arg2, sfd,
- prefixes, warn_only, selinux);
+ prefixes, warn_only, selinux, psm->ts->plugins);
rpmswExit(rpmtsOp(psm->ts, RPMTS_OP_SCRIPTLETS), 0);
/* Map warn-only errors to "notfound" for script stop callback */
@@ -1033,16 +1036,23 @@ rpmRC rpmpsmRun(rpmts ts, rpmte te, pkgGoal goal)
switch (goal) {
case PKG_INSTALL:
case PKG_ERASE:
- op = (goal == PKG_INSTALL) ? RPMTS_OP_INSTALL : RPMTS_OP_ERASE;
- rpmswEnter(rpmtsOp(psm->ts, op), 0);
+ /* Run pre transaction element hook for all plugins */
+ if (rpmpluginsCallPsmPre(ts->plugins, te) != RPMRC_FAIL) {
+
+ op = (goal == PKG_INSTALL) ? RPMTS_OP_INSTALL : RPMTS_OP_ERASE;
+ rpmswEnter(rpmtsOp(psm->ts, op), 0);
- rc = rpmpsmNext(psm, PSM_INIT);
- if (!rc) rc = rpmpsmNext(psm, PSM_PRE);
- if (!rc) rc = rpmpsmNext(psm, PSM_PROCESS);
- if (!rc) rc = rpmpsmNext(psm, PSM_POST);
- (void) rpmpsmNext(psm, PSM_FINI);
+ rc = rpmpsmNext(psm, PSM_INIT);
+ if (!rc) rc = rpmpsmNext(psm, PSM_PRE);
+ if (!rc) rc = rpmpsmNext(psm, PSM_PROCESS);
+ if (!rc) rc = rpmpsmNext(psm, PSM_POST);
+ (void) rpmpsmNext(psm, PSM_FINI);
+
+ rpmswExit(rpmtsOp(psm->ts, op), 0);
+ }
- rpmswExit(rpmtsOp(psm->ts, op), 0);
+ /* Run post transaction element hook for all plugins */
+ rpmpluginsCallPsmPost(ts->plugins, te, rc);
break;
case PKG_PRETRANS:
case PKG_POSTTRANS:
diff --git a/lib/rpmplugins.c b/lib/rpmplugins.c
index 9098aa5..7285f54 100644
--- a/lib/rpmplugins.c
+++ b/lib/rpmplugins.c
@@ -76,16 +76,16 @@ rpmRC rpmpluginsAdd(rpmPlugins plugins, const char *name, const char *path,
return rpmpluginsCallInit(plugins, name, opts);
}
-rpmRC rpmpluginsAddCollectionPlugin(rpmPlugins plugins, const char *name)
+rpmRC rpmpluginsAddPlugin(rpmPlugins plugins, const char *type, const char *name)
{
char *path;
char *options;
rpmRC rc = RPMRC_FAIL;
- path = rpmExpand("%{?__collection_", name, "}", NULL);
+ path = rpmExpand("%{?__", type, "_", name, "}", NULL);
if (!path || rstreq(path, "")) {
- rpmlog(RPMLOG_ERR, _("Failed to expand %%__collection_%s macro\n"),
- name);
+ rpmlog(RPMLOG_ERR, _("Failed to expand %%__%s_%s macro\n"),
+ type, name);
goto exit;
}
@@ -195,3 +195,88 @@ rpmRC rpmpluginsCallCollectionPreRemove(rpmPlugins plugins, const char *name)
RPMPLUGINS_SET_HOOK_FUNC(PLUGINHOOK_COLL_PRE_REMOVE);
return hookFunc();
}
+
+rpmRC rpmpluginsCallTsmPre(rpmPlugins plugins, rpmts ts)
+{
+ rpmRC (*hookFunc)(rpmts);
+ int i;
+ rpmRC rc = RPMRC_OK;
+ const char *name = NULL;
+
+ for (i = 0; i < plugins->count; i++) {
+ name = plugins->names[i];
+ RPMPLUGINS_SET_HOOK_FUNC(PLUGINHOOK_TSM_PRE);
+ if (hookFunc(ts) == RPMRC_FAIL)
+ rc = RPMRC_FAIL;
+ }
+
+ return rc;
+}
+
+rpmRC rpmpluginsCallTsmPost(rpmPlugins plugins, rpmts ts, int res)
+{
+ rpmRC (*hookFunc)(rpmts, int);
+ int i;
+ rpmRC rc = RPMRC_OK;
+ const char *name = NULL;
+
+ for (i = 0; i < plugins->count; i++) {
+ name = plugins->names[i];
+ RPMPLUGINS_SET_HOOK_FUNC(PLUGINHOOK_TSM_POST);
+ if (hookFunc(ts, res) == RPMRC_FAIL)
+ rc = RPMRC_FAIL;
+ }
+
+ return rc;
+}
+
+rpmRC rpmpluginsCallPsmPre(rpmPlugins plugins, rpmte te)
+{
+ rpmRC (*hookFunc)(rpmte);
+ int i;
+ rpmRC rc = RPMRC_OK;
+ const char *name = NULL;
+
+ for (i = 0; i < plugins->count; i++) {
+ name = plugins->names[i];
+ RPMPLUGINS_SET_HOOK_FUNC(PLUGINHOOK_PSM_PRE);
+ if (hookFunc(te) == RPMRC_FAIL)
+ rc = RPMRC_FAIL;
+ }
+
+ return rc;
+}
+
+rpmRC rpmpluginsCallPsmPost(rpmPlugins plugins, rpmte te, int res)
+{
+ rpmRC (*hookFunc)(rpmte, int);
+ int i;
+ rpmRC rc = RPMRC_OK;
+ const char *name = NULL;
+
+ for (i = 0; i < plugins->count; i++) {
+ name = plugins->names[i];
+ RPMPLUGINS_SET_HOOK_FUNC(PLUGINHOOK_PSM_POST);
+ if (hookFunc(te, res) == RPMRC_FAIL)
+ rc = RPMRC_FAIL;
+ }
+
+ return rc;
+}
+
+rpmRC rpmpluginsCallScriptSetup(rpmPlugins plugins, char* path)
+{
+ rpmRC (*hookFunc)(char*);
+ int i;
+ rpmRC rc = RPMRC_OK;
+ const char *name = NULL;
+
+ for (i = 0; i < plugins->count; i++) {
+ name = plugins->names[i];
+ RPMPLUGINS_SET_HOOK_FUNC(PLUGINHOOK_SCRIPT_SETUP);
+ if (hookFunc(path) == RPMRC_FAIL)
+ rc = RPMRC_FAIL;
+ }
+
+ return rc;
+}
diff --git a/lib/rpmplugins.h b/lib/rpmplugins.h
index 7985559..c462eae 100644
--- a/lib/rpmplugins.h
+++ b/lib/rpmplugins.h
@@ -11,11 +11,20 @@ extern "C" {
#define PLUGINHOOK_INIT_FUNC pluginhook_init
#define PLUGINHOOK_CLEANUP_FUNC pluginhook_cleanup
+
#define PLUGINHOOK_OPENTE_FUNC pluginhook_opente
#define PLUGINHOOK_COLL_POST_ADD_FUNC pluginhook_coll_post_add
#define PLUGINHOOK_COLL_POST_ANY_FUNC pluginhook_coll_post_any
#define PLUGINHOOK_COLL_PRE_REMOVE_FUNC pluginhook_coll_pre_remove
+#define PLUGINHOOK_TSM_PRE_FUNC pluginhook_tsm_pre
+#define PLUGINHOOK_TSM_POST_FUNC pluginhook_tsm_post
+
+#define PLUGINHOOK_PSM_PRE_FUNC pluginhook_psm_pre
+#define PLUGINHOOK_PSM_POST_FUNC pluginhook_psm_post
+
+#define PLUGINHOOK_SCRIPT_SETUP_FUNC pluginhook_script_setup
+
enum rpmPluginHook_e {
PLUGINHOOK_NONE = 0,
PLUGINHOOK_INIT = 1 << 0,
@@ -23,7 +32,12 @@ enum rpmPluginHook_e {
PLUGINHOOK_OPENTE = 1 << 2,
PLUGINHOOK_COLL_POST_ADD = 1 << 3,
PLUGINHOOK_COLL_POST_ANY = 1 << 4,
- PLUGINHOOK_COLL_PRE_REMOVE = 1 << 5
+ PLUGINHOOK_COLL_PRE_REMOVE = 1 << 5,
+ PLUGINHOOK_TSM_PRE = 1 << 6,
+ PLUGINHOOK_TSM_POST = 1 << 7,
+ PLUGINHOOK_PSM_PRE = 1 << 8,
+ PLUGINHOOK_PSM_POST = 1 << 9,
+ PLUGINHOOK_SCRIPT_SETUP = 1 << 10
};
typedef rpmFlags rpmPluginHook;
@@ -53,12 +67,13 @@ rpmPlugins rpmpluginsFree(rpmPlugins plugins);
rpmRC rpmpluginsAdd(rpmPlugins plugins, const char *name, const char *path, const char *opts);
/** \ingroup rpmplugins
- * Add and open a collection plugin
+ * Add and open a rpm plugin
* @param plugins plugins structure to add a collection plugin to
- * @param name name of collection to open
+ * @param type type of plugin
+ * @param name name of plugin
* @return RPMRC_OK on success, RPMRC_FAIL otherwise
*/
-rpmRC rpmpluginsAddCollectionPlugin(rpmPlugins plugins, const char *name);
+rpmRC rpmpluginsAddPlugin(rpmPlugins plugins, const char *type, const char *name);
/** \ingroup rpmplugins
* Determine if a plugin has been added already
@@ -119,6 +134,48 @@ rpmRC rpmpluginsCallCollectionPostAny(rpmPlugins plugins, const char *name);
*/
rpmRC rpmpluginsCallCollectionPreRemove(rpmPlugins plugins, const char *name);
+/** \ingroup rpmplugins
+ * Call the pre transaction plugin hook
+ * @param plugins plugins structure
+ * @param ts processed transaction
+ * @return RPMRC_OK on success, RPMRC_FAIL otherwise
+ */
+rpmRC rpmpluginsCallTsmPre(rpmPlugins plugins, rpmts ts);
+
+/** \ingroup rpmplugins
+ * Call the post transaction plugin hook
+ * @param plugins plugins structure
+ * @param ts processed transaction
+ * @param res transaction result code
+ * @return RPMRC_OK on success, RPMRC_FAIL otherwise
+ */
+rpmRC rpmpluginsCallTsmPost(rpmPlugins plugins, rpmts ts, int res);
+
+/** \ingroup rpmplugins
+ * Call the pre transaction element plugin hook
+ * @param plugins plugins structure
+ * @param te processed transaction element
+ * @return RPMRC_OK on success, RPMRC_FAIL otherwise
+ */
+rpmRC rpmpluginsCallPsmPre(rpmPlugins plugins, rpmte te);
+
+/** \ingroup rpmplugins
+ * Call the post transaction element plugin hook
+ * @param plugins plugins structure
+ * @param te processed transaction element
+ * @param res transaction element result code
+ * @return RPMRC_OK on success, RPMRC_FAIL otherwise
+ */
+rpmRC rpmpluginsCallPsmPost(rpmPlugins plugins, rpmte te, int res);
+
+/** \ingroup rpmplugins
+ * Call the script setup plugin hook
+ * @param plugins plugins structure
+ * @param path script path
+ * @return RPMRC_OK on success, RPMRC_FAIL otherwise
+ */
+rpmRC rpmpluginsCallScriptSetup(rpmPlugins plugins, char* path);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/rpmscript.c b/lib/rpmscript.c
index 57c24c6..f8c5fc7 100644
--- a/lib/rpmscript.c
+++ b/lib/rpmscript.c
@@ -14,6 +14,8 @@
#include "rpmio/rpmlua.h"
#include "lib/rpmscript.h"
+#include "lib/rpmplugins.h" /* rpm plugins hooks */
+
#include "debug.h"
struct rpmScript_s {
@@ -91,7 +93,7 @@ static rpmRC runLuaScript(int selinux, ARGV_const_t prefixes,
static const char * const SCRIPT_PATH = "PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin";
-static void doScriptExec(int selinux, ARGV_const_t argv, ARGV_const_t prefixes,
+static void doScriptExec(rpmPlugins plugins, int selinux, ARGV_const_t argv, ARGV_const_t prefixes,
FD_t scriptFd, FD_t out)
{
int pipes[2];
@@ -169,7 +171,10 @@ static void doScriptExec(int selinux, ARGV_const_t argv, ARGV_const_t prefixes,
}
if (xx == 0) {
- xx = execv(argv[0], argv);
+ /* Run script setup hook for all plugins */
+ if (rpmpluginsCallScriptSetup(plugins, argv[0]) != RPMRC_FAIL) {
+ xx = execv(argv[0], argv);
+ }
}
}
_exit(127); /* exit 127 for compatibility with bash(1) */
@@ -202,7 +207,7 @@ exit:
/**
* Run an external script.
*/
-static rpmRC runExtScript(int selinux, ARGV_const_t prefixes,
+static rpmRC runExtScript(rpmPlugins plugins, int selinux, ARGV_const_t prefixes,
const char *sname, rpmlogLvl lvl, FD_t scriptFd,
ARGV_t * argvp, const char *script, int arg1, int arg2)
{
@@ -258,7 +263,7 @@ static rpmRC runExtScript(int selinux, ARGV_const_t prefixes,
} else if (pid == 0) {/* Child */
rpmlog(RPMLOG_DEBUG, "%s: execv(%s) pid %d\n",
sname, *argvp[0], (unsigned)getpid());
- doScriptExec(selinux, *argvp, prefixes, scriptFd, out);
+ doScriptExec(plugins, selinux, *argvp, prefixes, scriptFd, out);
}
do {
@@ -297,7 +302,7 @@ exit:
}
rpmRC rpmScriptRun(rpmScript script, int arg1, int arg2, FD_t scriptFd,
- ARGV_const_t prefixes, int warn_only, int selinux)
+ ARGV_const_t prefixes, int warn_only, int selinux, rpmPlugins plugins)
{
ARGV_t args = NULL;
rpmlogLvl lvl = warn_only ? RPMLOG_WARNING : RPMLOG_ERR;
@@ -315,7 +320,7 @@ rpmRC rpmScriptRun(rpmScript script, int arg1, int arg2, FD_t scriptFd,
if (rstreq(args[0], "<lua>")) {
rc = runLuaScript(selinux, prefixes, script->descr, lvl, scriptFd, &args, script->body, arg1, arg2);
} else {
- rc = runExtScript(selinux, prefixes, script->descr, lvl, scriptFd, &args, script->body, arg1, arg2);
+ rc = runExtScript(plugins, selinux, prefixes, script->descr, lvl, scriptFd, &args, script->body, arg1, arg2);
}
argvFree(args);
diff --git a/lib/rpmscript.h b/lib/rpmscript.h
index 7d584bc..852735b 100644
--- a/lib/rpmscript.h
+++ b/lib/rpmscript.h
@@ -29,7 +29,7 @@ rpmScript rpmScriptFree(rpmScript script);
RPM_GNUC_INTERNAL
rpmRC rpmScriptRun(rpmScript script, int arg1, int arg2, FD_t scriptFd,
- ARGV_const_t prefixes, int warn_only, int selinux);
+ ARGV_const_t prefixes, int warn_only, int selinux, rpmPlugins plugins);
RPM_GNUC_INTERNAL
rpmTagVal rpmScriptTag(rpmScript script);
diff --git a/lib/rpmte.c b/lib/rpmte.c
index 87fb391..9fc5522 100644
--- a/lib/rpmte.c
+++ b/lib/rpmte.c
@@ -889,7 +889,7 @@ rpmRC rpmteSetupCollectionPlugins(rpmte te)
rpmteOpen(te, 0);
for (; colls && *colls; colls++) {
if (!rpmpluginsPluginAdded(plugins, *colls)) {
- rc = rpmpluginsAddCollectionPlugin(plugins, *colls);
+ rc = rpmpluginsAddPlugin(plugins, "collection", *colls);
if (rc != RPMRC_OK) {
break;
}
diff --git a/lib/transaction.c b/lib/transaction.c
index 45c30b5..08a5643 100644
--- a/lib/transaction.c
+++ b/lib/transaction.c
@@ -22,6 +22,8 @@
#include "lib/rpmts_internal.h"
#include "rpmio/rpmhook.h"
+#include "lib/rpmplugins.h"
+
/* XXX FIXME: merge with existing (broken?) tests in system.h */
/* portability fiddles */
#if STATFS_IN_SYS_STATVFS
@@ -1435,12 +1437,43 @@ static int rpmtsProcess(rpmts ts)
return rc;
}
+static rpmRC rpmtsSetupTransactionPlugins(rpmts ts)
+{
+ rpmRC rc = RPMRC_OK;
+ char *plugins = NULL, *plugin = NULL;
+ const char *delims = ",";
+
+ plugins = rpmExpand("%{?__transaction_plugins}", NULL);
+ if (!plugins || rstreq(plugins, "")) {
+ goto exit;
+ }
+
+ plugin = strtok(plugins, delims);
+ while(plugin != NULL) {
+ rpmlog(RPMLOG_DEBUG, "plugin is %s\n", plugin);
+ if (!rpmpluginsPluginAdded(ts->plugins, (const char*)plugin)) {
+ if (rpmpluginsAddPlugin(ts->plugins, "transaction",
+ (const char*)plugin) == RPMRC_FAIL) {
+ /* any configured plugin failing to load is a failure */
+ rc = RPMRC_FAIL;
+ }
+ }
+ plugin = strtok(NULL, delims);
+ }
+
+exit:
+ free(plugins);
+ return rc;
+}
+
int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
{
int rc = -1; /* assume failure */
tsMembers tsmem = rpmtsMembers(ts);
rpmlock lock = NULL;
rpmps tsprobs = NULL;
+ int TsmPreDone = 0; /* TsmPre hook hasn't been called */
+
/* Force default 022 umask during transaction for consistent results */
mode_t oldmask = umask(022);
@@ -1462,11 +1495,21 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
goto exit;
}
+ if (rpmtsSetupTransactionPlugins(ts) == RPMRC_FAIL) {
+ goto exit;
+ }
+
rpmtsSetupCollections(ts);
/* Check package set for problems */
tsprobs = checkProblems(ts);
+ /* Run pre transaction hook for all plugins */
+ TsmPreDone = 1;
+ if (rpmpluginsCallTsmPre(ts->plugins, ts) == RPMRC_FAIL) {
+ goto exit;
+ }
+
/* Run pre-transaction scripts, but only if there are no known
* problems up to this point and not disabled otherwise. */
if (!((rpmtsFlags(ts) & (RPMTRANS_FLAG_BUILD_PROBS|RPMTRANS_FLAG_NOPRE))
@@ -1511,6 +1554,10 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
}
exit:
+ /* Run post transaction hook for all plugins */
+ if (TsmPreDone) /* If TsmPre hook has been called, call the TsmPost hook */
+ rpmpluginsCallTsmPost(ts->plugins, ts, rc);
+
/* Finish up... */
(void) umask(oldmask);
(void) rpmtsFinish(ts);
diff --git a/macros.in b/macros.in
index 3aaebcd..fb030b5 100644
--- a/macros.in
+++ b/macros.in
@@ -1032,6 +1032,9 @@ done \
%__collection_sepolicy %{__plugindir}/sepolicy.so
%__collection_sepolicy_flags 1
+# Transaction plugin macros
+%__transaction_systemd_inhibit %{__plugindir}/systemd_inhibit.so
+
#------------------------------------------------------------------------------
# Macros for further automated spec %setup and patch application
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index a9c962c..0c0a410 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -24,3 +24,10 @@ sepolicy_la_LIBADD = $(top_builddir)/lib/librpm.la $(top_builddir)/rpmio/librpmi
plugins_LTLIBRARIES += sepolicy.la
endif
+
+if DBUS
+systemd_inhibit_la_SOURCES = systemd_inhibit.c
+systemd_inhibit_la_CPPFLAGS = $(AM_CPPFLAGS) @DBUS_CFLAGS@
+systemd_inhibit_la_LIBADD = $(top_builddir)/lib/librpm.la $(top_builddir)/rpmio/librpmio.la @DBUS_LIBS@
+plugins_LTLIBRARIES += systemd_inhibit.la
+endif
diff --git a/plugins/plugin.h b/plugins/plugin.h
index 5156f93..ad4171a 100644
--- a/plugins/plugin.h
+++ b/plugins/plugin.h
@@ -7,9 +7,23 @@
#include "lib/rpmplugins.h"
#include "lib/rpmchroot.h"
+/* general plugin hooks */
rpmRC PLUGINHOOK_INIT_FUNC(rpmts ts, const char * name, const char * opts);
rpmRC PLUGINHOOK_CLEANUP_FUNC(void);
+
+/* collection plugin hooks */
rpmRC PLUGINHOOK_OPENTE_FUNC(rpmte te);
rpmRC PLUGINHOOK_COLL_POST_ANY_FUNC(void);
rpmRC PLUGINHOOK_COLL_POST_ADD_FUNC(void);
rpmRC PLUGINHOOK_COLL_PRE_REMOVE_FUNC(void);
+
+/* per transaction plugin hooks */
+rpmRC PLUGINHOOK_TSM_PRE_FUNC(rpmts ts);
+rpmRC PLUGINHOOK_TSM_POST_FUNC(rpmts ts, int res);
+
+/* per transaction element plugin hooks */
+rpmRC PLUGINHOOK_PSM_PRE_FUNC(rpmte te);
+rpmRC PLUGINHOOK_PSM_POST_FUNC(rpmte te, int res);
+
+/*per script plugin hooks */
+rpmRC PLUGINHOOK_SCRIPT_SETUP_FUNC(char* path);
diff --git a/plugins/systemd_inhibit.c b/plugins/systemd_inhibit.c
new file mode 100644
index 0000000..e990bec
--- /dev/null
+++ b/plugins/systemd_inhibit.c
@@ -0,0 +1,111 @@
+#include <dbus/dbus.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <rpm/rpmlog.h>
+#include <rpm/rpmts.h>
+#include "plugin.h"
+
+rpmPluginHook PLUGIN_HOOKS = (
+ PLUGINHOOK_INIT |
+ PLUGINHOOK_CLEANUP |
+ PLUGINHOOK_TSM_PRE |
+ PLUGINHOOK_TSM_POST
+);
+
+static int lock_fd = -1;
+
+rpmRC PLUGINHOOK_INIT_FUNC(rpmts ts, const char *name, const char *opts)
+{
+ struct stat st;
+
+ if (lstat("/run/systemd/system/", &st) == 0) {
+ if (S_ISDIR(st.st_mode)) {
+ return RPMRC_OK;
+ }
+ }
+
+ return RPMRC_NOTFOUND;
+}
+
+rpmRC PLUGINHOOK_CLEANUP_FUNC(void)
+{
+ return RPMRC_OK;
+}
+
+static int inhibit(void)
+{
+ DBusError err;
+ DBusConnection *bus = NULL;
+ DBusMessage *msg = NULL;
+ DBusMessage *reply = NULL;
+ int fd = -1;
+
+ dbus_error_init(&err);
+ bus = dbus_bus_get_private(DBUS_BUS_SYSTEM, &err);
+
+ if (bus) {
+ msg = dbus_message_new_method_call("org.freedesktop.login1",
+ "/org/freedesktop/login1",
+ "org.freedesktop.login1.Manager",
+ "Inhibit");
+ }
+
+ if (msg) {
+ const char *what = "shutdown";
+ const char *mode = "block";
+ const char *who = "RPM";
+ const char *reason = "Transaction running";
+
+ dbus_message_append_args(msg,
+ DBUS_TYPE_STRING, &what,
+ DBUS_TYPE_STRING, &who,
+ DBUS_TYPE_STRING, &reason,
+ DBUS_TYPE_STRING, &mode,
+ DBUS_TYPE_INVALID);
+
+ reply = dbus_connection_send_with_reply_and_block(bus, msg, -1, &err);
+ dbus_message_unref(msg);
+ }
+
+ if (reply) {
+ dbus_message_get_args(reply, &err,
+ DBUS_TYPE_UNIX_FD, &fd,
+ DBUS_TYPE_INVALID);
+ dbus_message_unref(reply);
+ }
+
+ if (dbus_error_is_set(&err))
+ dbus_error_free(&err);
+ if (bus)
+ dbus_connection_close(bus);
+
+ return fd;
+}
+
+rpmRC PLUGINHOOK_TSM_PRE_FUNC(rpmts ts)
+{
+ if (rpmtsFlags(ts) & (RPMTRANS_FLAG_TEST|RPMTRANS_FLAG_BUILD_PROBS))
+ return RPMRC_OK;
+
+ lock_fd = inhibit();
+
+ if (lock_fd < 0) {
+ rpmlog(RPMLOG_WARNING,
+ "Unable to get systemd shutdown inhibition lock\n");
+ } else {
+ rpmlog(RPMLOG_DEBUG, "System shutdown blocked (fd %d)\n", lock_fd);
+ }
+
+ return RPMRC_OK;
+}
+
+rpmRC PLUGINHOOK_TSM_POST_FUNC(rpmts ts, int res)
+{
+ if (lock_fd >= 0) {
+ close(lock_fd);
+ lock_fd = -1;
+ rpmlog(RPMLOG_DEBUG, "System shutdown unblocked\n");
+ }
+ return RPMRC_OK;
+}

96
SOURCES/rpm-4.11.x-verify-data-range.patch

@ -0,0 +1,96 @@ @@ -0,0 +1,96 @@
Adjusted lib/package.c section to apply, and 4.11.x requires the
same change in lib/signature.c as well.

From 89dce2b91d7d73a1e225461a7392c3d6d7a30a95 Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Wed, 19 Oct 2016 14:48:08 +0300
Subject: [PATCH] Verify data is within range and does not overlap in
headerVerifyInfo()

Checking whether data start offset is within header data area is of no use
whatsoever if the entire chunk doesn't fit. Validate the entire data
fits within range and that it does not overlap, however with string
types we can only check the array size is sane but we cant check the
actual content.

Adjust the upper limit for region trailer in headerVerifyRegion() so
it fits the new rules, but in reality calling headerVerifyInfo() for
the region tags is rather pointless since they're so different.

Partial fix for RhBug:1373107.
---
lib/header.c | 21 ++++++++++++++++-----
lib/package.c | 2 +-
2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/lib/header.c b/lib/header.c
index 7f7c115..cac5c94 100644
--- a/lib/header.c
+++ b/lib/header.c
@@ -196,7 +196,8 @@ int headerVerifyInfo(int il, int dl, const void * pev, void * iv, int negate)
{
entryInfo pe = (entryInfo) pev;
entryInfo info = iv;
- int i;
+ int i, tsize;
+ int32_t end = 0;
for (i = 0; i < il; i++) {
info->tag = ntohl(pe[i].tag);
@@ -206,16 +207,26 @@ int headerVerifyInfo(int il, int dl, const void * pev, void * iv, int negate)
info->offset = -info->offset;
info->count = ntohl(pe[i].count);
+ /* Previous data must not overlap */
+ if (end > info->offset)
+ return i;
+
if (hdrchkType(info->type))
return i;
if (hdrchkAlign(info->type, info->offset))
return i;
- if (hdrchkRange(dl, info->offset))
- return i;
- if (hdrchkData(info->count))
- return i;
+ /* For string types we can only check the array size is sane */
+ tsize = typeSizes[info->type];
+ if (tsize < 1)
+ tsize = 1;
+
+ /* Verify the data actually fits */
+ end = info->offset + (info->count * tsize);
+ if (hdrchkRange(dl, end))
+ return i;
}
+
return -1;
}

diff --git a/lib/package.c b/lib/package.c
index b6bea09..bb83163 100644
--- a/lib/package.c
+++ b/lib/package.c
@@ -339,7 +339,7 @@ static rpmRC headerVerify(rpmKeyring keyring, rpmVSFlags vsflags,
(void) memcpy(&info, regionEnd, REGION_TAG_COUNT);
regionEnd += REGION_TAG_COUNT;
- if (headerVerifyInfo(1, il * sizeof(*pe), &info, &entry.info, 1) != -1 ||
+ if (headerVerifyInfo(1, il * sizeof(*pe) + REGION_TAG_COUNT, &info, &entry.info, 1) != -1 ||
!(entry.info.tag == RPMTAG_HEADERIMMUTABLE
&& entry.info.type == REGION_TAG_TYPE
&& entry.info.count == REGION_TAG_COUNT))
diff --git a/lib/signature.c b/lib/signature.c
index d8017dc..ddf2eb8 100644
--- a/lib/signature.c
+++ b/lib/signature.c
@@ -165,7 +165,7 @@ rpmRC rpmReadSignature(FD_t fd, Header * sighp, sigType sig_type, char ** msg)
}
dataEnd += REGION_TAG_COUNT;
- xx = headerVerifyInfo(1, il * sizeof(*pe), &info, &entry.info, 1);
+ xx = headerVerifyInfo(1, il * sizeof(*pe) + REGION_TAG_COUNT, &info, &entry.info, 1);
if (xx != -1 ||
!((entry.info.tag == RPMTAG_HEADERSIGNATURES || entry.info.tag == RPMTAG_HEADERIMAGE)
&& entry.info.type == REGION_TAG_TYPE

102
SOURCES/rpm-4.11.x-weakdep-tags.patch

@ -0,0 +1,102 @@ @@ -0,0 +1,102 @@
diff -up rpm-4.11.3/build/pack.c.weakdep-tags rpm-4.11.3/build/pack.c
--- rpm-4.11.3/build/pack.c.weakdep-tags 2017-11-13 16:46:28.552714717 +0200
+++ rpm-4.11.3/build/pack.c 2017-11-13 16:47:44.942681784 +0200
@@ -228,8 +228,6 @@ static rpmTagVal depevrtags[] = {
RPMTAG_CONFLICTVERSION,
RPMTAG_ORDERVERSION,
RPMTAG_TRIGGERVERSION,
- RPMTAG_SUGGESTSVERSION,
- RPMTAG_ENHANCESVERSION,
0
};
diff -up rpm-4.11.3/lib/rpmtag.h.weakdep-tags rpm-4.11.3/lib/rpmtag.h
--- rpm-4.11.3/lib/rpmtag.h.weakdep-tags 2017-11-02 12:21:38.248264213 +0200
+++ rpm-4.11.3/lib/rpmtag.h 2017-11-02 12:24:16.159193622 +0200
@@ -217,14 +217,14 @@ typedef enum rpmTag_e {
RPMTAG_PRETRANSPROG = 1153, /* s[] */
RPMTAG_POSTTRANSPROG = 1154, /* s[] */
RPMTAG_DISTTAG = 1155, /* s */
- RPMTAG_SUGGESTSNAME = 1156, /* s[] extension (unimplemented) */
-#define RPMTAG_SUGGESTS RPMTAG_SUGGESTSNAME /* s[] (unimplemented) */
- RPMTAG_SUGGESTSVERSION = 1157, /* s[] extension (unimplemented) */
- RPMTAG_SUGGESTSFLAGS = 1158, /* i[] extension (unimplemented) */
- RPMTAG_ENHANCESNAME = 1159, /* s[] extension placeholder (unimplemented) */
-#define RPMTAG_ENHANCES RPMTAG_ENHANCESNAME /* s[] (unimplemented) */
- RPMTAG_ENHANCESVERSION = 1160, /* s[] extension placeholder (unimplemented) */
- RPMTAG_ENHANCESFLAGS = 1161, /* i[] extension placeholder (unimplemented) */
+ RPMTAG_OLDSUGGESTSNAME = 1156, /* s[] extension (unimplemented) */
+#define RPMTAG_OLDSUGGESTS RPMTAG_OLDSUGGESTSNAME /* s[] (unimplemented) */
+ RPMTAG_OLDSUGGESTSVERSION = 1157, /* s[] extension (unimplemented) */
+ RPMTAG_OLDSUGGESTSFLAGS = 1158, /* i[] extension (unimplemented) */
+ RPMTAG_OLDENHANCESNAME = 1159, /* s[] extension placeholder (unimplemented) */
+#define RPMTAG_OLDENHANCES RPMTAG_OLDENHANCESNAME /* s[] (unimplemented) */
+ RPMTAG_OLDENHANCESVERSION = 1160, /* s[] extension placeholder (unimplemented) */
+ RPMTAG_OLDENHANCESFLAGS = 1161, /* i[] extension placeholder (unimplemented) */
RPMTAG_PRIORITY = 1162, /* i[] extension placeholder (unimplemented) */
RPMTAG_CVSID = 1163, /* s (unimplemented) */
#define RPMTAG_SVNID RPMTAG_CVSID /* s (unimplemented) */
@@ -307,6 +307,22 @@ typedef enum rpmTag_e {
RPMTAG_OBSOLETENEVRS = 5043, /* s[] extension */
RPMTAG_CONFLICTNEVRS = 5044, /* s[] extension */
RPMTAG_FILENLINKS = 5045, /* i[] extension */
+ RPMTAG_RECOMMENDNAME = 5046, /* s[] */
+#define RPMTAG_RECOMMENDS RPMTAG_RECOMMENDNAME /* s[] */
+ RPMTAG_RECOMMENDVERSION = 5047, /* s[] */
+ RPMTAG_RECOMMENDFLAGS = 5048, /* i[] */
+ RPMTAG_SUGGESTNAME = 5049, /* s[] */
+#define RPMTAG_SUGGESTS RPMTAG_SUGGESTNAME /* s[] */
+ RPMTAG_SUGGESTVERSION = 5050, /* s[] extension */
+ RPMTAG_SUGGESTFLAGS = 5051, /* i[] extension */
+ RPMTAG_SUPPLEMENTNAME = 5052, /* s[] */
+#define RPMTAG_SUPPLEMENTS RPMTAG_SUPPLEMENTNAME /* s[] */
+ RPMTAG_SUPPLEMENTVERSION = 5053, /* s[] */
+ RPMTAG_SUPPLEMENTFLAGS = 5054, /* i[] */
+ RPMTAG_ENHANCENAME = 5055, /* s[] */
+#define RPMTAG_ENHANCES RPMTAG_ENHANCENAME /* s[] */
+ RPMTAG_ENHANCEVERSION = 5056, /* s[] */
+ RPMTAG_ENHANCEFLAGS = 5057, /* i[] */
RPMTAG_FIRSTFREE_TAG /*!< internal */
} rpmTag;
diff -up rpm-4.11.3/tests/rpmgeneral.at.weakdep-tags rpm-4.11.3/tests/rpmgeneral.at
--- rpm-4.11.3/tests/rpmgeneral.at.weakdep-tags 2012-11-07 14:55:24.000000000 +0200
+++ rpm-4.11.3/tests/rpmgeneral.at 2017-11-02 12:21:38.248264213 +0200
@@ -79,6 +79,10 @@ DISTTAG
DISTURL
DSAHEADER
E
+ENHANCEFLAGS
+ENHANCENAME
+ENHANCES
+ENHANCEVERSION
EPOCH
EPOCHNUM
EVR
@@ -199,6 +203,10 @@ PROVIDES
PROVIDEVERSION
PUBKEYS
R
+RECOMMENDFLAGS
+RECOMMENDNAME
+RECOMMENDS
+RECOMMENDVERSION
RECONTEXTS
RELEASE
REMOVETID
@@ -219,7 +227,15 @@ SOURCE
SOURCEPACKAGE
SOURCEPKGID
SOURCERPM
+SUGGESTFLAGS
+SUGGESTNAME
+SUGGESTS
+SUGGESTVERSION
SUMMARY
+SUPPLEMENTFLAGS
+SUPPLEMENTNAME
+SUPPLEMENTS
+SUPPLEMENTVERSION
TRIGGERCONDS
TRIGGERFLAGS
TRIGGERINDEX

33
SOURCES/rpm-4.13.x-Implement-noconfig-query.patch

@ -0,0 +1,33 @@ @@ -0,0 +1,33 @@
--- current/lib/poptQV.c.noconfig 2017-10-10 16:36:22.671332271 +0200
+++ current/lib/poptQV.c 2017-10-10 16:40:44.735808086 +0200
@@ -185,6 +185,9 @@
{ "noghost", '\0', POPT_BIT_CLR|POPT_ARGFLAG_DOC_HIDDEN,
&rpmQVKArgs.qva_fflags, RPMFILE_GHOST,
N_("skip %%ghost files"), NULL },
+ { "noconfig", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
+ &rpmQVKArgs.qva_fflags, RPMFILE_CONFIG,
+ N_("skip %%config files"), NULL },
{ "qf", '\0', POPT_ARG_STRING | POPT_ARGFLAG_DOC_HIDDEN, 0,
POPT_QUERYFORMAT, NULL, NULL },
--- current/doc/rpm.8.noconfig 2017-10-10 16:36:22.671332271 +0200
+++ current/doc/rpm.8 2017-10-10 17:04:28.537393197 +0200
@@ -76,7 +76,7 @@
[\fB--nodigest\fR] [\fB--nosignature\fR]
[\fB--nolinkto\fR] [\fB--nofiledigest\fR] [\fB--nosize\fR] [\fB--nouser\fR]
[\fB--nogroup\fR] [\fB--nomtime\fR] [\fB--nomode\fR] [\fB--nordev\fR]
- [\fB--nocaps\fR]
+ [\fB--nocaps\fR] [\fB--noconfig\fR]
.SS "install-options"
.PP
@@ -673,6 +673,9 @@
\fB--nofiles\fR
Don't verify any attributes of package files.
.TP
+\fB--noconfig\fR
+Don't verify config files.
+.TP
\fB--noscripts\fR
Don't execute the \fB%verifyscript\fR scriptlet (if any).
.TP

11
SOURCES/rpm-4.13.x-Make-the-stftime-buffer-big-enuff.patch

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
--- current/lib/formats.orig 2017-10-09 16:02:37.884785158 +0200
+++ current/lib/formats.c 2017-10-09 16:03:20.640862788 +0200
@@ -101,7 +101,7 @@
val = xstrdup(_("(not a number)"));
} else {
struct tm * tstruct;
- char buf[50];
+ char buf[1024];
time_t dateint = rpmtdGetNumber(td);
tstruct = localtime(&dateint);

86
SOURCES/rpm-4.13.x-RPMCALLBACK_ELEM_PROGRESS-available-header.patch

@ -0,0 +1,86 @@ @@ -0,0 +1,86 @@
Move RPMCALLBACK_ELEM_PROGRESS to rpmteProcess to have header available

The header of the rpmte is only available after rpmteOpen().
Added num param to rpmteProcess to be able to signal the progress to the
callback.

(cherry picked from commit 124ed29259b05fdf574d5e3e145bc1201b24ae4d)
---
diff -uNr rpm-4.11.3.orig/lib/rpmte.c rpm-4.11.3/lib/rpmte.c
--- rpm-4.11.3.orig/lib/rpmte.c 2017-08-23 15:39:18.195927789 +0200
+++ rpm-4.11.3/lib/rpmte.c 2017-08-23 15:40:12.857349575 +0200
@@ -939,7 +939,7 @@
return rc;
}
-int rpmteProcess(rpmte te, pkgGoal goal)
+int rpmteProcess(rpmte te, pkgGoal goal, int num)
{
/* Only install/erase resets pkg file info */
int scriptstage = (goal != PKG_INSTALL && goal != PKG_ERASE);
@@ -959,6 +959,11 @@
}
if (rpmteOpen(te, reset_fi)) {
+ if (!scriptstage) {
+ rpmtsNotify(te->ts, te, RPMCALLBACK_ELEM_PROGRESS, num,
+ rpmtsMembers(te->ts)->orderCount);
+ }
+
failed = rpmpsmRun(te->ts, te, goal);
rpmteClose(te, reset_fi);
}
diff -uNr rpm-4.11.3.orig/lib/rpmte_internal.h rpm-4.11.3/lib/rpmte_internal.h
--- rpm-4.11.3.orig/lib/rpmte_internal.h 2013-11-22 11:31:31.000000000 +0100
+++ rpm-4.11.3/lib/rpmte_internal.h 2017-08-23 15:40:24.654440605 +0200
@@ -56,7 +56,7 @@
FD_t rpmtePayload(rpmte te);
RPM_GNUC_INTERNAL
-int rpmteProcess(rpmte te, pkgGoal goal);
+int rpmteProcess(rpmte te, pkgGoal goal, int num);
RPM_GNUC_INTERNAL
void rpmteAddProblem(rpmte te, rpmProblemType type,
diff -uNr rpm-4.11.3.orig/lib/transaction.c rpm-4.11.3/lib/transaction.c
--- rpm-4.11.3.orig/lib/transaction.c 2017-08-23 15:39:18.257928268 +0200
+++ rpm-4.11.3/lib/transaction.c 2017-08-23 15:42:24.986369126 +0200
@@ -1170,10 +1170,11 @@
static int runTransScripts(rpmts ts, pkgGoal goal)
{
int rc = 0;
+ int i = 0;
rpmte p;
rpmtsi pi = rpmtsiInit(ts);
while ((p = rpmtsiNext(pi, TR_ADDED)) != NULL) {
- rc += rpmteProcess(p, goal);
+ rc += rpmteProcess(p, goal, i++);
}
rpmtsiFree(pi);
return rc;
@@ -1415,7 +1416,6 @@
static int rpmtsProcess(rpmts ts)
{
rpmtsi pi; rpmte p;
- tsMembers tsmem = rpmtsMembers(ts);
int rc = 0;
int i = 0;
@@ -1423,8 +1423,6 @@
while ((p = rpmtsiNext(pi, 0)) != NULL) {
int failed;
- rpmtsNotify(ts, NULL, RPMCALLBACK_ELEM_PROGRESS, i++,
- tsmem->orderCount);
rpmlog(RPMLOG_DEBUG, "========== +++ %s %s-%s 0x%x\n",
rpmteNEVR(p), rpmteA(p), rpmteO(p), rpmteColor(p));
@@ -1432,7 +1430,7 @@
rpmtsSELabelInit(ts, 0);
}
- failed = rpmteProcess(p, rpmteType(p));
+ failed = rpmteProcess(p, rpmteType(p), i++);
if (failed) {
rpmlog(RPMLOG_ERR, "%s: %s %s\n", rpmteNEVRA(p),
rpmteTypeString(p), failed > 1 ? _("skipped") : _("failed"));

59
SOURCES/rpm-4.13.x-increase_header_size.patch

@ -0,0 +1,59 @@ @@ -0,0 +1,59 @@
From 89e6317c75b494905590903fadbfdc3c8d31e2b8 Mon Sep 17 00:00:00 2001
From: Stefan Berger <stefanb@us.ibm.com>
Date: Fri, 29 Apr 2016 07:09:49 -0400
Subject: [PATCH] Extend header size to 256MB due to file signatures

Extend the header size to 256MB in case an RPM has a lot of files
and the file signatures do not fit within the current limit of 16MB.

An example for an RPM with many files is kcbench-data-4.0. It contains
more than 52000 files. With each signature with a 2048 bit key requiring
256 bytes plus a preamble, its representation in text from, and other
overhead, the size of the header (index length and data length) exceeds
32Mb.

If this particular RPM's files have been signed using this patch, older
versions of the rpm tool will report the header being too large. So this
failure is expected then.

By setting the limit to 256MB we create a lot of room for the future.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
---
lib/header.c | 2 +-
lib/header_internal.h | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/header.c b/lib/header.c
index 81f2038..7f7c115 100644
--- a/lib/header.c
+++ b/lib/header.c
@@ -99,7 +99,7 @@ struct headerToken_s {
/** \ingroup header
* Maximum no. of bytes permitted in a header.
*/
-static const size_t headerMaxbytes = (32*1024*1024);
+static const size_t headerMaxbytes = (256*1024*1024);
#define INDEX_MALLOC_SIZE 8
diff --git a/lib/header_internal.h b/lib/header_internal.h
index bbe2097..aed3977 100644
--- a/lib/header_internal.h
+++ b/lib/header_internal.h
@@ -45,9 +45,10 @@ struct indexEntry_s {
/**
* Sanity check on data size and/or offset and/or count.
- * This check imposes a limit of 16 MB, more than enough.
+ * This check imposes a limit of 256 MB -- file signatures
+ * may require a lot of space in the header.
*/
-#define HEADER_DATA_MAX 0x00ffffff
+#define HEADER_DATA_MAX 0x0fffffff
#define hdrchkData(_nbytes) ((_nbytes) & (~HEADER_DATA_MAX))
/**
--
2.9.5

106
SOURCES/rpm-4.13.x-writable-tmp-dir.patch

@ -0,0 +1,106 @@ @@ -0,0 +1,106 @@
commit c707ab26362e795d3f9dba4eb87dc7ed99a28bcb
Author: Robin Lee <cheeselee@fedoraproject.org>
Date: Sat Apr 8 21:21:39 2017 +0800

Fix non-standard inherented modes of directories in debuginfo
In case that binary compiled from source generated in /tmp, a
/usr/src/debug/tmp directory will be created with the same mode as
/tmp, a.k.a 777, which should be avoided.
Fixes: rhbz#641022

diff --git a/scripts/find-debuginfo.sh b/scripts/find-debuginfo.sh
old mode 100644
new mode 100755
index 547dbd9..6f38e19
--- a/scripts/find-debuginfo.sh
+++ b/scripts/find-debuginfo.sh
@@ -396,9 +396,10 @@
mkdir -p "${RPM_BUILD_ROOT}/usr/src/debug"
LC_ALL=C sort -z -u "$SOURCEFILE" | grep -E -v -z '(<internal>|<built-in>)$' |
(cd "$RPM_BUILD_DIR"; cpio -pd0mL "${RPM_BUILD_ROOT}/usr/src/debug")
- # stupid cpio creates new directories in mode 0700, fixup
+ # stupid cpio creates new directories in mode 0700,
+ # and non-standard modes may be inherented from original directories, fixup
find "${RPM_BUILD_ROOT}/usr/src/debug" -type d -print0 |
- xargs --no-run-if-empty -0 chmod a+rx
+ xargs --no-run-if-empty -0 chmod 0755
fi
if [ -d "${RPM_BUILD_ROOT}/usr/lib" -o -d "${RPM_BUILD_ROOT}/usr/src" ]; then

commit e795899780337dea751d85db8f381eff3fe75275
Author: Mark Wielaard <mark@klomp.org>
Date: Fri Apr 21 17:33:26 2017 +0200

debugedit: Only output comp_dir under build dir (once).
The fix for rhbz#444310 (commit c1a5eb - Include empty CU current dirs)
was a little greedy. It would also include comp_dirs outside the build
root. Those are unnecessary and we don't have a good way to store them.
Such dirs (e.g. /tmp) would then show up at the root of /usr/src/debug.
Fix this by including only comp_dirs under base_dir. Also only output
all dirs once (during phase zero) and don't output empty dirs (which
was harmless but would produce a warning from cpio).
This still includes all empty dirs from the original rhbz#444310
nodir testcase and it is an alternative fix for rhbz#641022
(commit c707ab).
Both fixes are necessary in case of an unexpected mode for a directory
actually in the build root that we want to include in the source list.
Signed-off-by: Mark Wielaard <mark@klomp.org>

diff --git a/tools/debugedit.c b/tools/debugedit.c
index 8444e03..bf11513 100644
--- a/tools/debugedit.c
+++ b/tools/debugedit.c
@@ -926,27 +926,27 @@
/* Ensure the CU current directory will exist even if only empty. Source
filenames possibly located in its parent directories refer relatively to
it and the debugger (GDB) cannot safely optimize out the missing
- CU current dir subdirectories. */
- if (comp_dir && list_file_fd != -1)
+ CU current dir subdirectories. Only do this once in phase one. And
+ only do this for dirs under our build/base_dir. Don't output the
+ empty string (in case the comp_dir == base_dir). */
+ if (phase == 0 && base_dir && comp_dir && list_file_fd != -1)
{
- char *p;
- size_t size;
- if (base_dir && has_prefix (comp_dir, base_dir))
- p = comp_dir + strlen (base_dir);
- else if (dest_dir && has_prefix (comp_dir, dest_dir))
- p = comp_dir + strlen (dest_dir);
- else
- p = comp_dir;
-
- size = strlen (p) + 1;
- while (size > 0)
+ if (has_prefix (comp_dir, base_dir))
{
- ssize_t ret = write (list_file_fd, p, size);
- if (ret == -1)
- break;
- size -= ret;
- p += ret;
+ char *p = comp_dir + strlen (base_dir);
+ if (p[0] != '\0')
+ {
+ size_t size = strlen (p) + 1;
+ while (size > 0)
+ {
+ ssize_t ret = write (list_file_fd, p, size);
+ if (ret == -1)
+ break;
+ size -= ret;
+ p += ret;
+ }
+ }
}
}

44
SOURCES/rpm-4.14.x-Add-justdb-to-the-erase-man.patch

@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
From 7ebf34fc1b0b7b3fb149761fee01a92859b1a69e Mon Sep 17 00:00:00 2001
From: Florian Festi <ffesti@redhat.com>
Date: Mon, 18 Apr 2016 15:59:18 +0200
Subject: [PATCH] Add --justdb to the erase section of the man page, too

---
doc/rpm.8 | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/doc/rpm.8 b/doc/rpm.8
index 2eb5ca5..ccd2e1e 100644
--- a/doc/rpm.8
+++ b/doc/rpm.8
@@ -37,7 +37,7 @@ rpm \- RPM Package Manager
-\fBrpm\fR {\fB-e|--erase\fR} [\fB--allmatches\fR] [\fB--nodeps\fR] [\fB--noscripts\fR]
+\fBrpm\fR {\fB-e|--erase\fR} [\fB--allmatches\fR] [\fB--justdb] [\fB--nodeps\fR] [\fB--noscripts\fR]
[\fB--notriggers\fR] [\fB--test\fR] \fB\fIPACKAGE_NAME\fB\fR\fI\ ...\fR
.SS "MISCELLANEOUS:"
@@ -377,7 +377,7 @@ potential conflicts.
The general form of an rpm erase command is
.PP
-\fBrpm\fR {\fB-e|--erase\fR} [\fB--allmatches\fR] [\fB--nodeps\fR] [\fB--noscripts\fR] [\fB--notriggers\fR] [\fB--test\fR] \fB\fIPACKAGE_NAME\fB\fR\fI ...\fR
+\fBrpm\fR {\fB-e|--erase\fR} [\fB--allmatches\fR] [\fB--justdb] [\fB--nodeps\fR] [\fB--noscripts\fR] [\fB--notriggers\fR] [\fB--test\fR] \fB\fIPACKAGE_NAME\fB\fR\fI ...\fR
.PP
The following options may also be used:
@@ -388,6 +388,9 @@ Remove all versions of the package which match
error is issued if \fIPACKAGE_NAME\fR
matches multiple packages.
.TP
+\fB--justdb\fR
+Update only the database, not the filesystem.
+.TP
\fB--nodeps\fR
Don't check dependencies before uninstalling the packages.
.TP
--
2.5.5

61
SOURCES/rpm-4.6.0-niagara.patch

@ -0,0 +1,61 @@ @@ -0,0 +1,61 @@
diff -up rpm-4.9.1.3/lib/rpmrc.c.niagara rpm-4.9.1.3/lib/rpmrc.c
--- rpm-4.9.1.3/lib/rpmrc.c.niagara 2012-04-19 17:06:23.130595223 +0200
+++ rpm-4.9.1.3/lib/rpmrc.c 2012-04-19 17:06:23.134739249 +0200
@@ -718,6 +718,31 @@ exit:
return rc;
}
+#if defined(__linux__) && defined(__sparc__)
+static int is_sun4v()
+{
+ char buffer[4096], *p;
+ int fd = open("/proc/cpuinfo", O_RDONLY);
+ if (read(fd, &buffer, sizeof(buffer) - 1) == -1) {
+ rpmlog(RPMLOG_WARNING, _("read(/proc/cpuinfo) failed\n"));
+ close(fd);
+ return 0;
+ }
+ close(fd);
+
+ p = strstr(buffer, "type");
+ p = strtok(p, "\n");
+ p = strstr(p, "sun");
+ if (p == NULL) {
+ rpmlog(RPMLOG_WARNING, _("/proc/cpuinfo has no 'type' line\n"));
+ return 0;
+ } else if (strcmp(p, "sun4v") == 0) {
+ return 1;
+ }
+ return 0;
+}
+#endif
+
# if defined(__linux__) && defined(__i386__)
#include <setjmp.h>
@@ -1178,6 +1203,13 @@ static void defaultMachine(const char **
personality(oldpers);
}
}
+ if (is_sun4v()){
+ if (strcmp(un.machine, "sparcv9") == 0 || strcmp(un.machine, "sparc") == 0 ) {
+ strcpy(un.machine, "sparcv9v");
+ } else if (strcmp(un.machine, "sparc64") == 0 ) {
+ strcpy(un.machine, "sparc64v");
+ }
+ }
# endif /* sparc*-linux */
# if defined(__linux__) && defined(__powerpc__)
diff -up rpm-4.9.1.3/rpmrc.in.niagara rpm-4.9.1.3/rpmrc.in
--- rpm-4.9.1.3/rpmrc.in.niagara 2012-04-19 17:06:23.131476769 +0200
+++ rpm-4.9.1.3/rpmrc.in 2012-04-19 17:06:23.135738996 +0200
@@ -316,7 +316,7 @@ arch_compat: sun4c: sparc
arch_compat: sun4d: sparc
arch_compat: sun4m: sparc
arch_compat: sun4u: sparc64
-arch_compat: sparc64v: sparc64
+arch_compat: sparc64v: sparc64 sparcv9v
arch_compat: sparc64: sparcv9
arch_compat: sparcv9v: sparcv9
arch_compat: sparcv9: sparcv8

14
SOURCES/rpm-4.7.1-geode-i686.patch

@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
diff --git a/rpmrc.in b/rpmrc.in
index 4a6cca9..d62ddaf 100644
--- a/rpmrc.in
+++ b/rpmrc.in
@@ -281,7 +281,7 @@ arch_compat: alphaev5: alpha
arch_compat: alpha: axp noarch
arch_compat: athlon: i686
-arch_compat: geode: i586
+arch_compat: geode: i686
arch_compat: pentium4: pentium3
arch_compat: pentium3: i686
arch_compat: i686: i586

39
SOURCES/rpm-4.8.0-ignore-multiline2.patch

@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
From 4c621e97776a47c2b4e7f17c1cd2a7961453babf Mon Sep 17 00:00:00 2001
From: Lubos Kardos <lkardos@redhat.com>
Date: Wed, 3 Dec 2014 14:01:14 +0100
Subject: [PATCH] Ignore "use" or "requires" within multi-line print or assign
statement

- Now script perl.req ignores "use" and "requires" on lines that are
part of printing or assigning multi-line string i. e. string that
hasn't starting and ending quote on the same line.
(RhBug:1024517)
---
scripts/perl.req | 13 +++++++++++++
1 file changed, 13 insertions(+)

--- rpm-4.8.0/scripts/perl.req.ignore-multiline2
+++ rpm-4.8.0/scripts/perl.req
@@ -174,6 +174,19 @@ sub process_file {
$_ = <FILE>;
}
+ # Skip multiline print and assign statements
+ if ( m/\$\S+\s*=\s*(")([^"\\]|(\\.))*$/ ||
+ m/\$\S+\s*=\s*(')([^'\\]|(\\.))*$/ ||
+ m/print\s+(")([^"\\]|(\\.))*$/ ||
+ m/print\s+(')([^'\\]|(\\.))*$/ ) {
+
+ my $quote = $1;
+ while (<FILE>) {
+ m/^([^\\$quote]|(\\.))*$quote/ && last;
+ }
+ $_ = <FILE>;
+ }
+
if (
# ouch could be in a eval, perhaps we do not want these since we catch
--
1.9.3

12
SOURCES/rpm-4.8.1-use-gpg2.patch

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
diff -up rpm-4.8.1/macros.in.gpg2 rpm-4.8.1/macros.in
--- rpm-4.8.0/macros.in.gpg2 2011-01-17 12:17:38.000000000 +0200
+++ rpm-4.8.0/macros.in 2011-01-17 12:17:59.000000000 +0200
@@ -40,7 +40,7 @@
%__cp @__CP@
%__cpio @__CPIO@
%__file @__FILE@
-%__gpg @__GPG@
+%__gpg %{_bindir}/gpg2
%__grep @__GREP@
%__gzip @__GZIP@
%__id @__ID@

20
SOURCES/rpm-4.8.x-error-in-log.patch

@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
--- rpm-4.8.0/rpmio/rpmlog.c.error-in-log 2015-02-23 13:18:29.696116399 +0100
+++ rpm-4.8.0/rpmio/rpmlog.c 2015-02-23 13:28:19.630394971 +0100
@@ -127,10 +127,14 @@
break;
}
- (void) fputs(rpmlogLevelPrefix(rec->pri), msgout);
+ if (fputs(rpmlogLevelPrefix(rec->pri), msgout) == EOF)
+ perror("Error occurred during writing of a log message");
- (void) fputs(rec->message, msgout);
- (void) fflush(msgout);
+ if (fputs(rec->message, msgout) == EOF)
+ perror("Error occurred during writing of a log message");
+
+ if (fflush(msgout) == EOF)
+ perror("Error occurred during writing of a log message");
return (rec->pri <= RPMLOG_CRIT ? RPMLOG_EXIT : 0);
}

83
SOURCES/rpm-4.9.0-armhfp-logic.patch

@ -0,0 +1,83 @@ @@ -0,0 +1,83 @@
diff -up rpm-4.11.1/lib/rpmrc.c.armhfp-logic rpm-4.11.1/lib/rpmrc.c
--- rpm-4.11.1/lib/rpmrc.c.armhfp-logic 2013-10-01 14:59:12.841041726 +0300
+++ rpm-4.11.1/lib/rpmrc.c 2013-10-01 14:59:12.856041684 +0300
@@ -733,6 +733,56 @@ static int is_sun4v()
}
#endif
+#if defined(__linux__) && defined(__arm__)
+static int has_neon()
+{
+ char buffer[4096], *p;
+ int fd = open("/proc/cpuinfo", O_RDONLY);
+ if (read(fd, &buffer, sizeof(buffer) - 1) == -1) {
+ rpmlog(RPMLOG_WARNING, _("read(/proc/cpuinfo) failed\n"));
+ close(fd);
+ return 0;
+ }
+ close(fd);
+
+ p = strstr(buffer, "Features");
+ p = strtok(p, "\n");
+ p = strstr(p, "neon");
+ p = strtok(p, " ");
+ if (p == NULL) {
+ rpmlog(RPMLOG_WARNING, _("/proc/cpuinfo has no 'Features' line\n"));
+ return 0;
+ } else if (strcmp(p, "neon") == 0) {
+ return 1;
+ }
+ return 0;
+}
+
+static int has_hfp()
+{
+ char buffer[4096], *p;
+ int fd = open("/proc/cpuinfo", O_RDONLY);
+ if (read(fd, &buffer, sizeof(buffer) - 1) == -1) {
+ rpmlog(RPMLOG_WARNING, _("read(/proc/cpuinfo) failed\n"));
+ close(fd);
+ return 0;
+ }
+ close(fd);
+
+ p = strstr(buffer, "Features");
+ p = strtok(p, "\n");
+ p = strstr(p, "vfpv3");
+ p = strtok(p, " ");
+ if (p == NULL) {
+ rpmlog(RPMLOG_WARNING, _("/proc/cpuinfo has no 'Features' line\n"));
+ return 0;
+ } else if (strcmp(p, "vfpv3") == 0) {
+ return 1;
+ }
+ return 0;
+}
+#endif
+
# if defined(__linux__) && defined(__i386__)
#include <setjmp.h>
@@ -1136,6 +1186,22 @@ static void defaultMachine(const char **
# endif /* __ORDER_BIG_ENDIAN__ */
# endif /* ppc64*-linux */
+# if defined(__linux__) && defined(__arm__)
+ {
+ if (strcmp(un.machine, "armv7l") == 0 ) {
+ if (has_neon() && has_hfp())
+ strcpy(un.machine, "armv7hnl");
+ else if (has_hfp())
+ strcpy(un.machine, "armv7hl");
+ } else if (strcmp(un.machine, "armv6l") == 0 ) {
+ if (has_neon() && has_hfp())
+ strcpy(un.machine, "armv6hnl");
+ else if (has_hfp())
+ strcpy(un.machine, "armv6hl");
+ }
+ }
+# endif /* arm*-linux */
+
# if defined(__GNUC__) && defined(__alpha__)
{
unsigned long amask, implver;

15
SOURCES/rpm-4.9.1.1-ld-flags.patch

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
diff -up rpm-4.9.1.1/macros.in.jx rpm-4.9.1.1/macros.in
--- rpm-4.9.1.1/macros.in.jx 2011-08-03 16:19:05.000000000 -0400
+++ rpm-4.9.1.1/macros.in 2011-08-08 09:41:52.981064316 -0400
@@ -674,9 +674,10 @@ print (t)\
RPM_SOURCE_DIR=\"%{u2p:%{_sourcedir}}\"\
RPM_BUILD_DIR=\"%{u2p:%{_builddir}}\"\
RPM_OPT_FLAGS=\"%{optflags}\"\
+ RPM_LD_FLAGS=\"%{?__global_ldflags}\"\
RPM_ARCH=\"%{_arch}\"\
RPM_OS=\"%{_os}\"\
- export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\
+ export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_LD_FLAGS RPM_ARCH RPM_OS\
RPM_DOC_DIR=\"%{_docdir}\"\
export RPM_DOC_DIR\
RPM_PACKAGE_NAME=\"%{name}\"\

67
SOURCES/rpm-4.9.90-armhfp.patch

@ -0,0 +1,67 @@ @@ -0,0 +1,67 @@
diff -uNr rpm-4.9.0-orig//macros.in rpm-4.9.0/macros.in
--- rpm-4.9.0-orig//macros.in 2011-08-05 12:23:04.000000000 -0500
+++ rpm-4.9.0/macros.in 2011-08-05 12:25:13.000000000 -0500
@@ -1032,7 +1032,7 @@
#------------------------------------------------------------------------------
# arch macro for all supported ARM processors
-%arm armv3l armv4b armv4l armv4tl armv5tel armv5tejl armv6l armv7l
+%arm armv3l armv4b armv4l armv4tl armv5tel armv5tejl armv6l armv7l armv7hl armv7hnl
#------------------------------------------------------------------------------
# arch macro for all supported Sparc processors
diff -uNr rpm-4.9.0-orig//rpmrc.in rpm-4.9.0/rpmrc.in
--- rpm-4.9.0-orig//rpmrc.in 2011-08-05 12:23:04.000000000 -0500
+++ rpm-4.9.0/rpmrc.in 2011-08-05 12:26:34.000000000 -0500
@@ -66,8 +66,10 @@
optflags: armv5tejl -O2 -g -march=armv5te
optflags: armv6l -O2 -g -march=armv6
optflags: armv7l -O2 -g -march=armv7
+optflags: armv7hl -O2 -g -march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16
+optflags: armv7hnl -O2 -g -march=armv7-a -mfloat-abi=hard -mfpu=neon
optflags: m68k -O2 -g -fomit-frame-pointer
optflags: atarist -O2 -g -fomit-frame-pointer
optflags: atariste -O2 -g -fomit-frame-pointer
@@ -140,6 +142,8 @@
arch_canon: armv5tejl: armv5tejl 12
arch_canon: armv6l: armv6l 12
arch_canon: armv7l: armv7l 12
+arch_canon: armv7hl: armv7hl 12
+arch_canon: armv7hnl: armv7hnl 12
arch_canon: m68kmint: m68kmint 13
arch_canon: atarist: m68kmint 13
@@ -248,8 +252,10 @@
buildarchtranslate: armv5tejl: armv5tejl
buildarchtranslate: armv6l: armv6l
buildarchtranslate: armv7l: armv7l
+buildarchtranslate: armv7hl: armv7hl
+buildarchtranslate: armv7hnl: armv7hnl
buildarchtranslate: m68k: m68k
buildarchtranslate: atarist: m68kmint
buildarchtranslate: atariste: m68kmint
@@ -336,8 +342,10 @@
arch_compat: armv4tl: armv4l
arch_compat: armv4l: armv3l
arch_compat: armv3l: noarch
+arch_compat: armv7hnl: armv7hl
+arch_compat: armv7hl: noarch
arch_compat: m68k: noarch
arch_compat: atarist: m68kmint noarch
arch_compat: atariste: m68kmint noarch
@@ -441,6 +449,9 @@
buildarch_compat: armv4l: armv3l
buildarch_compat: armv3l: noarch
+buildarch_compat: armv7hnl: armv7hl
+buildarch_compat: armv7hl: noarch
+
buildarch_compat: hppa2.0: hppa1.2
buildarch_compat: hppa1.2: hppa1.1
buildarch_compat: hppa1.1: hppa1.0

78
SOURCES/rpm-4.9.90-fedora-specspo.patch

@ -0,0 +1,78 @@ @@ -0,0 +1,78 @@
diff --git a/lib/tagexts.c b/lib/tagexts.c
index dc0e0fb..e0a5d1f 100644
--- a/lib/tagexts.c
+++ b/lib/tagexts.c
@@ -478,59 +478,29 @@ static const char * const _macro_i18ndomains = "%{?_i18ndomains}";
*/
static int i18nTag(Header h, rpmTag tag, rpmtd td, headerGetFlags hgflags)
{
- int rc;
+ int rc = headerGet(h, tag, td, HEADERGET_ALLOC);
#if defined(ENABLE_NLS)
- char * dstring = rpmExpand(_macro_i18ndomains, NULL);
-
- td->type = RPM_STRING_TYPE;
- td->data = NULL;
- td->count = 0;
-
- if (dstring && *dstring) {
- char *domain, *de;
- const char * langval;
- char * msgkey;
- const char * msgid;
-
- rasprintf(&msgkey, "%s(%s)", headerGetString(h, RPMTAG_NAME),
- rpmTagGetName(tag));
-
- /* change to en_US for msgkey -> msgid resolution */
- langval = getenv(language);
- (void) setenv(language, "en_US", 1);
- ++_nl_msg_cat_cntr;
+ if (rc) {
+ char *de, *dstring = rpmExpand(_macro_i18ndomains, NULL);
+ const char *domain;
- msgid = NULL;
for (domain = dstring; domain != NULL; domain = de) {
+ const char *msgid = td->data;
+ const char *msg = NULL;
+
de = strchr(domain, ':');
if (de) *de++ = '\0';
- msgid = dgettext(domain, msgkey);
- if (msgid != msgkey) break;
- }
-
- /* restore previous environment for msgid -> msgstr resolution */
- if (langval)
- (void) setenv(language, langval, 1);
- else
- unsetenv(language);
- ++_nl_msg_cat_cntr;
-
- if (domain && msgid) {
- td->data = dgettext(domain, msgid);
- td->data = xstrdup(td->data); /* XXX xstrdup has side effects. */
- td->count = 1;
- td->flags = RPMTD_ALLOCED;
+ msg = dgettext(domain, td->data);
+ if (msg != msgid) {
+ free(td->data);
+ td->data = xstrdup(msg);
+ break;
+ }
}
- dstring = _free(dstring);
- free(msgkey);
- if (td->data)
- return 1;
+ free(dstring);
}
-
- free(dstring);
#endif
- rc = headerGet(h, tag, td, HEADERGET_ALLOC);
return rc;
}

12
SOURCES/rpm-4.9.90-no-man-dirs.patch

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
diff -up rpm-4.9.90.git11486/scripts/find-lang.sh.no-man-dirs rpm-4.9.90.git11486/scripts/find-lang.sh
--- rpm-4.9.90.git11486/scripts/find-lang.sh.no-man-dirs 2012-03-07 11:31:10.000000000 +0200
+++ rpm-4.9.90.git11486/scripts/find-lang.sh 2012-03-07 15:11:57.465801075 +0200
@@ -181,7 +181,7 @@ s:%lang(C) ::
find "$TOP_DIR" -type d|sed '
s:'"$TOP_DIR"'::
'"$ALL_NAME$MAN"'s:\(.*/man/\([^/_]\+\).*/man[a-z0-9]\+/\)::
-'"$ALL_NAME$MAN"'s:\(.*/man/\([^/_]\+\).*/man[a-z0-9]\+$\):%lang(\2) \1*:
+'"$ALL_NAME$MAN"'s:\(.*/man/\([^/_]\+\).*/man[a-z0-9]\+$\):%lang(\2) \1/*:
s:^\([^%].*\)::
s:%lang(C) ::
/^$/d' >> $MO_NAME

1570
SPECS/rpm.spec

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save