Compare commits
No commits in common. 'c8' and 'c9' have entirely different histories.
@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
# If using normal root, avoid changing anything.
|
||||||
|
if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Defined as %py_reproducible_pyc_path macro and passed here as
|
||||||
|
# the first command-line argument
|
||||||
|
path_to_fix=$1
|
||||||
|
|
||||||
|
# First, check that the parser is available:
|
||||||
|
if [ ! -x /usr/bin/marshalparser ]; then
|
||||||
|
echo "ERROR: If %py_reproducible_pyc_path is defined, you have to also BuildRequire: /usr/bin/marshalparser !"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
find "$path_to_fix" -type f -name "*.pyc" | xargs /usr/bin/marshalparser --fix --overwrite
|
@ -1,20 +0,0 @@
|
|||||||
#! /bin/bash -f
|
|
||||||
|
|
||||||
## A counterpart of brp-kmod-set-exec-bits that restores original kmod
|
|
||||||
## file permissions
|
|
||||||
|
|
||||||
# If using normal root, avoid changing anything.
|
|
||||||
[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] || exit 0
|
|
||||||
|
|
||||||
# Checking for required programs
|
|
||||||
which chmod >/dev/null || exit 0
|
|
||||||
|
|
||||||
[ -r "$RPM_BUILD_ROOT/kmod-permissions.list" ] || exit 0
|
|
||||||
|
|
||||||
while read perm path; do
|
|
||||||
[ -n "$perm" ] || continue
|
|
||||||
|
|
||||||
chmod "$perm" "$RPM_BUILD_ROOT/$path"
|
|
||||||
done < "$RPM_BUILD_ROOT/kmod-permissions.list"
|
|
||||||
|
|
||||||
rm -f "$RPM_BUILD_ROOT/kmod-permissions.list"
|
|
@ -1,14 +0,0 @@
|
|||||||
#! /bin/bash -fx
|
|
||||||
|
|
||||||
## A hack for making brp-strip taking into account kmod files
|
|
||||||
|
|
||||||
# If using normal root, avoid changing anything.
|
|
||||||
[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] || exit 0
|
|
||||||
|
|
||||||
# Checking for required programs
|
|
||||||
which find chmod >/dev/null || exit 0
|
|
||||||
|
|
||||||
find "$RPM_BUILD_ROOT" \
|
|
||||||
-name '*.ko' \
|
|
||||||
-printf '%#m %P\n' \
|
|
||||||
-exec chmod u+x '{}' \; > "$RPM_BUILD_ROOT/kmod-permissions.list"
|
|
@ -0,0 +1,52 @@
|
|||||||
|
#!/usr/bin/bash -eu
|
||||||
|
|
||||||
|
|
||||||
|
if [ -z "$RPM_BUILD_ROOT" ] || [ "$RPM_BUILD_ROOT" = "/" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
CLANG_FLAGS=$@
|
||||||
|
NCPUS=${RPM_BUILD_NCPUS:-1}
|
||||||
|
|
||||||
|
check_convert_bitcode () {
|
||||||
|
local file_name=$(realpath ${1})
|
||||||
|
local file_type=$(file ${file_name})
|
||||||
|
|
||||||
|
shift
|
||||||
|
CLANG_FLAGS="$@"
|
||||||
|
|
||||||
|
if [[ "${file_type}" == *"LLVM IR bitcode"* ]]; then
|
||||||
|
# Check the output of llvm-strings for the command line, which is in the LLVM bitcode because
|
||||||
|
# we pass -frecord-gcc-switches.
|
||||||
|
# Check for a line that has "-flto" after (or without) "-fno-lto".
|
||||||
|
llvm-strings ${file_name} | while read line ; do
|
||||||
|
flto=$(echo $line | grep -o -b -e -flto | tail -n 1 | cut -d : -f 1)
|
||||||
|
fnolto=$(echo $line | grep -o -b -e -fno-lto | tail -n 1 | cut -d : -f 1)
|
||||||
|
|
||||||
|
if test -n "$flto" && { test -z "$fnolto" || test "$flto" -gt "$fnolto"; } ; then
|
||||||
|
echo "Compiling LLVM bitcode file ${file_name}."
|
||||||
|
clang ${CLANG_FLAGS} -fno-lto -Wno-unused-command-line-argument \
|
||||||
|
-x ir ${file_name} -c -o ${file_name}
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
elif [[ "${file_type}" == *"current ar archive"* ]]; then
|
||||||
|
echo "Unpacking ar archive ${file_name} to check for LLVM bitcode components."
|
||||||
|
# create archive stage for objects
|
||||||
|
local archive_stage=$(mktemp -d)
|
||||||
|
local archive=${file_name}
|
||||||
|
pushd ${archive_stage}
|
||||||
|
ar x ${archive}
|
||||||
|
for archived_file in $(find -not -type d); do
|
||||||
|
check_convert_bitcode ${archived_file} ${CLANG_FLAGS}
|
||||||
|
echo "Repacking ${archived_file} into ${archive}."
|
||||||
|
ar r ${archive} ${archived_file}
|
||||||
|
done
|
||||||
|
popd
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "Checking for LLVM bitcode artifacts"
|
||||||
|
export -f check_convert_bitcode
|
||||||
|
find "$RPM_BUILD_ROOT" -type f -name "*.[ao]" -print0 | \
|
||||||
|
xargs -0 -r -n1 -P$NCPUS sh -c "check_convert_bitcode \$@ $CLANG_FLAGS" ARG0
|
@ -0,0 +1,141 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
errors_terminate=$2
|
||||||
|
|
||||||
|
# Usage of %_python_bytecompile_extra is not allowed anymore
|
||||||
|
# See: https://fedoraproject.org/wiki/Changes/No_more_automagic_Python_bytecompilation_phase_3
|
||||||
|
# Therefore $1 ($default_python) is not needed and is invoked with "" by default.
|
||||||
|
# $default_python stays in the arguments for backward compatibility and $extra for the following check:
|
||||||
|
extra=$3
|
||||||
|
if [ 0$extra -eq 1 ]; then
|
||||||
|
echo -e "%_python_bytecompile_extra is discontinued, use %py_byte_compile instead.\nSee: https://fedoraproject.org/wiki/Changes/No_more_automagic_Python_bytecompilation_phase_3" >/dev/stderr
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If using normal root, avoid changing anything.
|
||||||
|
if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Figure out how deep we need to descend. We could pick an insanely high
|
||||||
|
# number and hope it's enough, but somewhere, somebody's sure to run into it.
|
||||||
|
depth=`(find "$RPM_BUILD_ROOT" -type f -name "*.py" -print0 ; echo /) | \
|
||||||
|
xargs -0 -n 1 dirname | sed 's,[^/],,g' | sort -u | tail -n 1 | wc -c`
|
||||||
|
if [ -z "$depth" -o "$depth" -le "1" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# This function now implements Python byte-compilation in three different ways:
|
||||||
|
# Python >= 3.4 and < 3.9 uses a new module compileall2 - https://github.com/fedora-python/compileall2
|
||||||
|
# Python < 3.4 (inc. Python 2) uses compileall module from stdlib with some hacks
|
||||||
|
# When we drop support for Python 2, we'd be able to use all compileall2 features like:
|
||||||
|
# - -s and -p options to manipulate with a path baked into pyc files instead of $real_libdir
|
||||||
|
# - -o 0 -o 1 to produce multiple files in one run - each with a different optimization level - instead of $options
|
||||||
|
# - removed useless $depth - both compileall and compileall2 are limited by sys.getrecursionlimit()
|
||||||
|
# These changes will make this script much simpler
|
||||||
|
# In Python >= 3.9, compileall2 was merged back to standard library (compileall) so we can use it directly again.
|
||||||
|
function python_bytecompile()
|
||||||
|
{
|
||||||
|
local options=$1
|
||||||
|
local python_binary=$2
|
||||||
|
local exclude=$3
|
||||||
|
local python_libdir=$4
|
||||||
|
local depth=$5 # Not used for Python >= 3.4
|
||||||
|
local real_libdir=$6 # Not used for Python >= 3.4
|
||||||
|
|
||||||
|
python_version=$($python_binary -c "import sys; sys.stdout.write('{0.major}{0.minor}'.format(sys.version_info))")
|
||||||
|
|
||||||
|
#
|
||||||
|
# Python 3.9 and higher
|
||||||
|
#
|
||||||
|
if [ "$python_version" -ge 39 ]; then
|
||||||
|
|
||||||
|
[ ! -z $exclude ] && exclude="-x '$exclude'"
|
||||||
|
# -q disables verbose output
|
||||||
|
# -f forces the process to overwrite existing compiled files
|
||||||
|
# -x excludes paths defined by regex
|
||||||
|
# -e excludes symbolic links pointing outside the build root
|
||||||
|
# -x and -e together implements the same functionality as the Filter class below
|
||||||
|
# -s strips $RPM_BUILD_ROOT from the path
|
||||||
|
# -p prepends the leading slash to the path to make it absolute
|
||||||
|
$python_binary -B $options -m compileall -q -f $exclude -s $RPM_BUILD_ROOT -p / -e $RPM_BUILD_ROOT $python_libdir
|
||||||
|
|
||||||
|
#
|
||||||
|
# Python 3.4 and higher
|
||||||
|
#
|
||||||
|
elif [ "$python_version" -ge 34 ]; then
|
||||||
|
|
||||||
|
[ ! -z $exclude ] && exclude="-x '$exclude'"
|
||||||
|
# /usr/lib/rpm/redhat/ contains compileall2 Python module
|
||||||
|
# -q disables verbose output
|
||||||
|
# -f forces the process to overwrite existing compiled files
|
||||||
|
# -x excludes paths defined by regex
|
||||||
|
# -e excludes symbolic links pointing outside the build root
|
||||||
|
# -x and -e together implements the same functionality as the Filter class below
|
||||||
|
# -s strips $RPM_BUILD_ROOT from the path
|
||||||
|
# -p prepends the leading slash to the path to make it absolute
|
||||||
|
PYTHONPATH=/usr/lib/rpm/redhat/ $python_binary -B $options -m compileall2 -q -f $exclude -s $RPM_BUILD_ROOT -p / -e $RPM_BUILD_ROOT $python_libdir
|
||||||
|
else
|
||||||
|
#
|
||||||
|
# Python 3.3 and lower (incl. Python 2)
|
||||||
|
#
|
||||||
|
|
||||||
|
cat << EOF | $python_binary $options
|
||||||
|
import compileall, sys, os, re
|
||||||
|
|
||||||
|
python_libdir = "$python_libdir"
|
||||||
|
depth = $depth
|
||||||
|
real_libdir = "$real_libdir"
|
||||||
|
build_root = "$RPM_BUILD_ROOT"
|
||||||
|
exclude = r"$exclude"
|
||||||
|
|
||||||
|
class Filter:
|
||||||
|
def search(self, path):
|
||||||
|
ret = not os.path.realpath(path).startswith(build_root)
|
||||||
|
if exclude:
|
||||||
|
ret = ret or re.search(exclude, path)
|
||||||
|
return ret
|
||||||
|
|
||||||
|
sys.exit(not compileall.compile_dir(python_libdir, depth, real_libdir, force=1, rx=Filter(), quiet=1))
|
||||||
|
EOF
|
||||||
|
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# .pyc/.pyo files embed a "magic" value, identifying the ABI version of Python
|
||||||
|
# bytecode that they are for.
|
||||||
|
#
|
||||||
|
# The files below RPM_BUILD_ROOT could be targeting multiple versions of
|
||||||
|
# python (e.g. a single build that emits several subpackages e.g. a
|
||||||
|
# python26-foo subpackage, a python31-foo subpackage etc)
|
||||||
|
#
|
||||||
|
# Support this by assuming that below each /usr/lib/python$VERSION/, all
|
||||||
|
# .pyc/.pyo files are to be compiled for /usr/bin/python$VERSION.
|
||||||
|
#
|
||||||
|
# For example, below /usr/lib/python2.6/, we're targeting /usr/bin/python2.6
|
||||||
|
# and below /usr/lib/python3.1/, we're targeting /usr/bin/python3.1
|
||||||
|
|
||||||
|
# Disable Python hash seed randomization
|
||||||
|
# This should help with byte-compilation reproducibility: https://bugzilla.redhat.com/show_bug.cgi?id=1686078
|
||||||
|
export PYTHONHASHSEED=0
|
||||||
|
|
||||||
|
shopt -s nullglob
|
||||||
|
for python_libdir in `find "$RPM_BUILD_ROOT" -type d|grep -E "/(usr|app)/lib(64)?/python[0-9]\.[0-9]+$"`;
|
||||||
|
do
|
||||||
|
python_binary=$(basename $python_libdir)
|
||||||
|
real_libdir=${python_libdir/$RPM_BUILD_ROOT/}
|
||||||
|
echo "Bytecompiling .py files below $python_libdir using $python_binary"
|
||||||
|
|
||||||
|
# Generate normal (.pyc) byte-compiled files.
|
||||||
|
python_bytecompile "" "$python_binary" "" "$python_libdir" "$depth" "$real_libdir"
|
||||||
|
if [ $? -ne 0 -a 0$errors_terminate -ne 0 ]; then
|
||||||
|
# One or more of the files had a syntax error
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Generate optimized (.pyo) byte-compiled files.
|
||||||
|
python_bytecompile "-O" "$python_binary" "" "$python_libdir" "$depth" "$real_libdir"
|
||||||
|
if [ $? -ne 0 -a 0$errors_terminate -ne 0 ]; then
|
||||||
|
# One or more of the files had a syntax error
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
@ -0,0 +1,17 @@
|
|||||||
|
#!/usr/bin/sh
|
||||||
|
# If using normal root, avoid changing anything.
|
||||||
|
if [ -z "$RPM_BUILD_ROOT" ] || [ "$RPM_BUILD_ROOT" = "/" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
STRIP=${1:-strip}
|
||||||
|
NCPUS=${RPM_BUILD_NCPUS:-1}
|
||||||
|
|
||||||
|
case `uname -a` in
|
||||||
|
Darwin*) exit 0 ;;
|
||||||
|
*) ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Strip ELF binaries
|
||||||
|
find "$RPM_BUILD_ROOT" -type f -name '*.[ao]' \! -regex "$RPM_BUILD_ROOT/*usr/lib/debug.*" -print0 | \
|
||||||
|
eu-elfclassify --not-program --not-library --not-linux-kernel-module --stdin0 --print0 | xargs -0 -r -P$NCPUS -n32 sh -c "$STRIP -p -R .gnu.lto_* -R .gnu.debuglto_* -N __gnu_lto_v1 \"\$@\"" ARG0
|
@ -1,48 +0,0 @@
|
|||||||
#! /bin/bash
|
|
||||||
|
|
||||||
IFS=$'\n'
|
|
||||||
|
|
||||||
for module in $(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz)?$'); do
|
|
||||||
tmpfile=""
|
|
||||||
if [ "x${module%.ko}" = "x${module}" ]; then
|
|
||||||
tmpfile=$(mktemp -t ${0##*/}.XXXXXX.ko)
|
|
||||||
proc_bin=
|
|
||||||
case "${module##*.}" in
|
|
||||||
xz)
|
|
||||||
proc_bin=xz
|
|
||||||
;;
|
|
||||||
bz2)
|
|
||||||
proc_bin=bzip2
|
|
||||||
;;
|
|
||||||
gz)
|
|
||||||
proc_bin=gzip
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
[ -n "$proc_bin" ] || continue
|
|
||||||
|
|
||||||
"$proc_bin" -d -c - < "$module" > "$tmpfile" || continue
|
|
||||||
module="$tmpfile"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -n $(nm $module | sed -r -ne 's:^0*([0-9a-f]+) A __crc_(.+):0x\1 \2:p') ]]; then
|
|
||||||
nm $module \
|
|
||||||
| sed -r -ne 's:^0*([0-9a-f]+) A __crc_(.+):0x\1 \2:p' \
|
|
||||||
| awk --non-decimal-data '{printf("ksym(%s) = 0x%08x\n", $2, $1)}' \
|
|
||||||
| LC_ALL=C sort -u
|
|
||||||
else
|
|
||||||
ELFRODATA=$(readelf -R .rodata $module | awk '/0x/{printf $2$3$4$5}')
|
|
||||||
if [[ -n $(readelf -h $module | grep "little endian") ]]; then
|
|
||||||
RODATA=$(echo $ELFRODATA | sed 's/\(..\)\(..\)\(..\)\(..\)/\4\3\2\1/g')
|
|
||||||
else
|
|
||||||
RODATA=$ELFRODATA
|
|
||||||
fi
|
|
||||||
for sym in $(nm $module | sed -r -ne 's:^0*([0-9a-f]+) R __crc_(.+):0x\1 \2:p'); do
|
|
||||||
echo $sym $RODATA
|
|
||||||
done \
|
|
||||||
| awk --non-decimal-data '{printf("ksym(%s) = 0x%08s\n", $2, substr($3,($1*2)+1,8))}' \
|
|
||||||
| LC_ALL=C sort -u
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ -z "$tmpfile" ] || rm -f -- "$tmpfile"
|
|
||||||
done
|
|
@ -1,155 +0,0 @@
|
|||||||
#! /bin/bash
|
|
||||||
#
|
|
||||||
# This script is called during external module building to create dependencies
|
|
||||||
# both upon the RHEL kernel, and on additional external modules. Symbols that
|
|
||||||
# cannot be reconciled against those provided by the kernel are assumed to be
|
|
||||||
# provided by an external module and "ksym" replaces th regular "kernel" dep.
|
|
||||||
|
|
||||||
IFS=$'\n'
|
|
||||||
|
|
||||||
# Extract all of the symbols provided by this module.
|
|
||||||
all_provides() {
|
|
||||||
for module in "$@"; do
|
|
||||||
tmpfile=""
|
|
||||||
if [ "x${module%.ko}" = "x${module}" ]; then
|
|
||||||
tmpfile=$(mktemp -t ${0##*/}.XXXXXX.ko)
|
|
||||||
proc_bin=
|
|
||||||
case "${module##*.}" in
|
|
||||||
xz)
|
|
||||||
proc_bin=xz
|
|
||||||
;;
|
|
||||||
bz2)
|
|
||||||
proc_bin=bzip2
|
|
||||||
;;
|
|
||||||
gz)
|
|
||||||
proc_bin=gzip
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
[ -n "$proc_bin" ] || continue
|
|
||||||
|
|
||||||
"$proc_bin" -d -c - < "$module" > "$tmpfile" || continue
|
|
||||||
module="$tmpfile"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -n $(nm "$module" | sed -r -ne 's:^0*([0-9a-f]+) A __crc_(.+):0x\1 \2:p') ]]; then
|
|
||||||
nm "$module" \
|
|
||||||
| sed -r -ne 's:^0*([0-9a-f]+) A __crc_(.+):0x\1 \2:p' \
|
|
||||||
| awk --non-decimal-data '{printf("%s:0x%08x\n", $2, $1)}'
|
|
||||||
else
|
|
||||||
ELFRODATA=$(readelf -R .rodata "$module" | awk '/0x/{printf $2$3$4$5}')
|
|
||||||
if [[ -n $(readelf -h "$module" | grep "little endian") ]]; then
|
|
||||||
RODATA=$(echo $ELFRODATA | sed 's/\(..\)\(..\)\(..\)\(..\)/\4\3\2\1/g')
|
|
||||||
else
|
|
||||||
RODATA=$ELFRODATA
|
|
||||||
fi
|
|
||||||
for sym in $(nm "$module" | sed -r -ne 's:^0*([0-9a-f]+) R __crc_(.+):0x\1 \2:p'); do
|
|
||||||
echo $sym $RODATA
|
|
||||||
done \
|
|
||||||
| awk --non-decimal-data '{printf("%s:0x%08s\n", $2, substr($3,($1*2)+1,8))}'
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ -z "$tmpfile" ] || rm -f -- "$tmpfile"
|
|
||||||
done \
|
|
||||||
| LC_ALL=C sort -k1,1 -u
|
|
||||||
}
|
|
||||||
|
|
||||||
# Extract all of the requirements of this module.
|
|
||||||
all_requires() {
|
|
||||||
for module in "$@"; do
|
|
||||||
set -- $(/sbin/modinfo -F vermagic "$module" | sed -e 's: .*::' -e q)
|
|
||||||
/sbin/modprobe --dump-modversions "$module" \
|
|
||||||
| awk --non-decimal-data '
|
|
||||||
BEGIN { FS = "\t" ; OFS = "\t" }
|
|
||||||
{printf("%s:0x%08x\n", $2, $1)}' \
|
|
||||||
| sed -r -e 's:$:\t'"$1"':'
|
|
||||||
done \
|
|
||||||
| LC_ALL=C sort -k1,1 -u
|
|
||||||
}
|
|
||||||
|
|
||||||
# Filter out requirements fulfilled by the module itself.
|
|
||||||
mod_requires() {
|
|
||||||
LC_ALL=C join -t $'\t' -j 1 -v 1 \
|
|
||||||
<(all_requires "$@") \
|
|
||||||
<(all_provides "$@") \
|
|
||||||
| LC_ALL=C sort -k1,1 -u
|
|
||||||
}
|
|
||||||
|
|
||||||
if ! [ -e /sbin/modinfo -a -e /sbin/modprobe ]; then
|
|
||||||
cat > /dev/null
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
check_kabi() {
|
|
||||||
arch=$(uname -m)
|
|
||||||
kabi_file="/lib/modules/kabi-current/kabi_whitelist_$arch"
|
|
||||||
|
|
||||||
# If not installed, output a warning and return (continue)
|
|
||||||
if [ ! -f "$kabi_file" ]; then
|
|
||||||
echo "" >&2
|
|
||||||
echo "********************************************************************************" >&2
|
|
||||||
echo "*********************** KERNEL ABI COMPATIBILITY WARNING ***********************" >&2
|
|
||||||
echo "********************************************************************************" >&2
|
|
||||||
echo "The kernel ABI reference files (provided by "kabi-whitelists") were not found." >&2
|
|
||||||
echo "No compatibility check was performed. Please install the kABI reference files" >&2
|
|
||||||
echo "and rebuild if you would like to verify compatibility with kernel ABI." >&2
|
|
||||||
echo "" >&2
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
unset non_kabi
|
|
||||||
for symbol in "$@"; do
|
|
||||||
if ! egrep "^[[:space:]]$symbol\$" $kabi_file >/dev/null; then
|
|
||||||
non_kabi=("${non_kabi[@]}" "$symbol")
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ${#non_kabi[@]} -gt 0 ]; then
|
|
||||||
echo "" >&2
|
|
||||||
echo "********************************************************************************" >&2
|
|
||||||
echo "*********************** KERNEL ABI COMPATIBILITY WARNING ***********************" >&2
|
|
||||||
echo "********************************************************************************" >&2
|
|
||||||
echo "The following kernel symbols are not guaranteed to remain compatible with" >&2
|
|
||||||
echo "future kernel updates to this RHEL release:" >&2
|
|
||||||
echo "" >&2
|
|
||||||
for symbol in "${non_kabi[@]}"; do
|
|
||||||
printf "\t$symbol\n" >&2
|
|
||||||
done
|
|
||||||
echo "" >&2
|
|
||||||
echo "Red Hat recommends that you consider using only official kernel ABI symbols" >&2
|
|
||||||
echo "where possible. Requests for additions to the kernel ABI can be filed with" >&2
|
|
||||||
echo "your partner or customer representative (component: driver-update-program)." >&2
|
|
||||||
echo "" >&2
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
modules=($(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz)?$'))
|
|
||||||
if [ ${#modules[@]} -gt 0 ]; then
|
|
||||||
kernel=$(/sbin/modinfo -F vermagic "${modules[0]}" | sed -e 's: .*::' -e q)
|
|
||||||
|
|
||||||
# get all that kernel provides
|
|
||||||
symvers=$(mktemp -t ${0##*/}.XXXXX)
|
|
||||||
|
|
||||||
cat /usr/src/kernels/$kernel/Module.symvers | awk '
|
|
||||||
BEGIN { FS = "\t" ; OFS = "\t" }
|
|
||||||
{ print $2 ":" $1 }
|
|
||||||
' \
|
|
||||||
| sed -r -e 's:$:\t'"$kernel"':' \
|
|
||||||
| LC_ALL=C sort -k1,1 -u > $symvers
|
|
||||||
|
|
||||||
# Symbols matching with the kernel get a "kernel" dependency
|
|
||||||
mod_req=$(mktemp -t mod_req.XXXXX)
|
|
||||||
mod_requires "${modules[@]}" > "$mod_req"
|
|
||||||
LC_ALL=C join -t $'\t' -j 1 $symvers "$mod_req" | LC_ALL=C sort -u \
|
|
||||||
| awk 'BEGIN { FS = "[\t:]" ; OFS = "\t" } { print "kernel(" $1 ") = " $2 }'
|
|
||||||
|
|
||||||
# Symbols from elsewhere get a "ksym" dependency
|
|
||||||
LC_ALL=C join -t $'\t' -j 1 -v 2 $symvers "$mod_req" | LC_ALL=C sort -u \
|
|
||||||
| awk 'BEGIN { FS = "[\t:]" ; OFS = "\t" } { print "ksym(" $1 ") = " $2 }'
|
|
||||||
|
|
||||||
# Check kABI if the kabi-whitelists package is installed
|
|
||||||
# Do this last so we can try to output this error at the end
|
|
||||||
kabi_check_symbols=($(LC_ALL=C join -t $'\t' -j 1 $symvers "$mod_req" | LC_ALL=C sort -u \
|
|
||||||
| awk 'BEGIN { FS = "[\t:]" ; OFS = "\t" } { print $1 }'))
|
|
||||||
check_kabi "${kabi_check_symbols[@]}"
|
|
||||||
fi
|
|
@ -1,14 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# firmware.prov - Automatically extract any and all firmware dependencies from
|
|
||||||
# kernel object (.ko) files and add to RPM deps.
|
|
||||||
|
|
||||||
IFS=$'\n'
|
|
||||||
|
|
||||||
for module in $(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz)?$') $*;
|
|
||||||
do
|
|
||||||
for firmware in `/sbin/modinfo -F firmware $module`;
|
|
||||||
do
|
|
||||||
echo "firmware($firmware)"
|
|
||||||
done
|
|
||||||
done
|
|
@ -0,0 +1,312 @@
|
|||||||
|
-- Lua code used by macros.forge and derivatives
|
||||||
|
|
||||||
|
-- Computes the suffix of a version string, removing vprefix if it matches
|
||||||
|
-- For example with vprefix 1.2.3: 1.2.3.rc2 → .rc2 but 1.2.30 → 1.2.30 not 0
|
||||||
|
local function getversionsuffix(vstring,vprefix)
|
||||||
|
if (string.sub(vstring, 1, #vprefix) == vprefix) and
|
||||||
|
(not string.match(string.sub(vstring, #vprefix + 1), "^%.?%d")) then
|
||||||
|
return string.sub(vstring, #vprefix + 1)
|
||||||
|
else
|
||||||
|
return vstring
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Check if an identified url is sane
|
||||||
|
local function checkforgeurl(url, id, silent)
|
||||||
|
local checkedurl = nil
|
||||||
|
local checkedid = nil
|
||||||
|
local urlpatterns = {
|
||||||
|
gitlab = {
|
||||||
|
pattern = 'https://[^/]+/[^/]+/[^/#?]+',
|
||||||
|
description = 'https://(…[-.])gitlab[-.]…/owner/repo'},
|
||||||
|
pagure = {
|
||||||
|
pattern = 'https://[^/]+/[^/#?]+',
|
||||||
|
description = 'https://pagure.io/repo'},
|
||||||
|
pagure_ns = {
|
||||||
|
pattern = 'https://[^/]+/[^/]+/[^/#?]+',
|
||||||
|
description = 'https://pagure.io/namespace/repo'},
|
||||||
|
pagure_fork = {
|
||||||
|
pattern = 'https://[^/]+/fork/[^/]+/[^/#?]+',
|
||||||
|
description = 'https://pagure.io/fork/owner/repo'},
|
||||||
|
pagure_ns_fork = {
|
||||||
|
pattern = 'https://[^/]+/fork/[^/]+/[^/]+/[^/#?]+',
|
||||||
|
description = 'https://pagure.io/fork/owner/namespace/repo'},
|
||||||
|
["gitea.com"] = {
|
||||||
|
pattern = 'https://[^/]+/[^/]+/[^/#?]+',
|
||||||
|
description = 'https://gitea.com/owner/repo'},
|
||||||
|
github = {
|
||||||
|
pattern = 'https://[^/]+/[^/]+/[^/#?]+',
|
||||||
|
description = 'https://(…[-.])github[-.]…/owner/repo'},
|
||||||
|
["code.googlesource.com"] = {
|
||||||
|
pattern = 'https://code.googlesource.com/[^#?]*[^/#?]+',
|
||||||
|
description = 'https://code.googlesource.com/…/repo'},
|
||||||
|
["bitbucket.org"] = {
|
||||||
|
pattern = 'https://[^/]+/[^/]+/[^/#?]+',
|
||||||
|
description = 'https://bitbucket.org/owner/repo'}}
|
||||||
|
if (urlpatterns[id] ~= nil) then
|
||||||
|
checkedurl = string.match(url,urlpatterns[id]["pattern"])
|
||||||
|
if (checkedurl == nil) then
|
||||||
|
if not silent then
|
||||||
|
rpm.expand("%{error:" .. id .. " URLs must match " .. urlpatterns[id]["description"] .. " !}")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
checkedid = id
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return checkedurl, checkedid
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Check if an url matches a known forge
|
||||||
|
local function idforge(url, silent)
|
||||||
|
local forgeurl = nil
|
||||||
|
local forge = nil
|
||||||
|
if (url ~= "") then
|
||||||
|
forge = string.match(url, "^[^:]+://([^/]+)/")
|
||||||
|
if (forge == nil) then
|
||||||
|
if not silent then
|
||||||
|
rpm.expand("%{error:URLs must include a protocol such as https:// and a path starting with / !}")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if (forge == "pagure.io") then
|
||||||
|
if string.match(url, "[^:]+://pagure.io/fork/[^/]+/[^/]+/[^/]+") then
|
||||||
|
forge = "pagure_ns_fork"
|
||||||
|
elseif string.match(url, "[^:]+://pagure.io/fork/[^/]+/[^/]+") then
|
||||||
|
forge = "pagure_fork"
|
||||||
|
elseif string.match(url, "[^:]+://pagure.io/[^/]+/[^/]+") then
|
||||||
|
forge = "pagure_ns"
|
||||||
|
elseif string.match(url, "[^:]+://pagure.io/[^/]+") then
|
||||||
|
forge = "pagure"
|
||||||
|
end
|
||||||
|
elseif (string.match(forge, "^gitlab[%.-]") or string.match(forge, "[%.-]gitlab[%.]")) then
|
||||||
|
forge = "gitlab"
|
||||||
|
elseif (string.match(forge, "^github[%.-]") or string.match(forge, "[%.-]github[%.]")) then
|
||||||
|
forge = "github"
|
||||||
|
end
|
||||||
|
forgeurl, forge = checkforgeurl(url, forge, silent)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return forgeurl, forge
|
||||||
|
end
|
||||||
|
|
||||||
|
-- The forgemeta macro main processing function
|
||||||
|
-- See the documentation in the macros.forge file for argument description
|
||||||
|
-- Also called directly by gometa
|
||||||
|
local function meta(suffix, verbose, informative, silent)
|
||||||
|
local fedora = require "fedora.common"
|
||||||
|
local ismain = (suffix == "") or (suffix == "0")
|
||||||
|
if ismain then
|
||||||
|
fedora.zalias({"forgeurl", "forgesource", "forgesetupargs",
|
||||||
|
"archivename", "archiveext", "archiveurl",
|
||||||
|
"topdir", "extractdir", "repo", "owner", "namespace",
|
||||||
|
"scm", "tag", "commit", "shortcommit", "branch", "version",
|
||||||
|
"date", "distprefix"}, verbose)
|
||||||
|
end
|
||||||
|
local variables = {
|
||||||
|
default = {
|
||||||
|
scm = "git",
|
||||||
|
archiveext = "tar.bz2",
|
||||||
|
repo = '%{lua:print(string.match(rpm.expand("%{forgeurl' .. suffix .. '}"), "^[^:]+://[^/]+/[^/]+/([^/?#]+)"))}',
|
||||||
|
archivename = "%{repo" .. suffix .. "}-%{ref" .. suffix .. "}",
|
||||||
|
topdir = "%{archivename" .. suffix .. "}" },
|
||||||
|
gitlab = {
|
||||||
|
archiveurl = "%{forgeurl" .. suffix .. "}/-/archive/%{ref" .. suffix .. "}/%{archivename" .. suffix .. "}.%{archiveext" .. suffix .. "}" },
|
||||||
|
pagure = {
|
||||||
|
archiveext = "tar.gz",
|
||||||
|
repo = '%{lua:print(string.match(rpm.expand("%{forgeurl' .. suffix .. '}"), "^[^:]+://[^/]+/([^/?#]+)"))}',
|
||||||
|
archiveurl = "%{forgeurl" .. suffix .. "}/archive/%{ref" .. suffix .. "}/%{archivename" .. suffix .. "}.%{archiveext" .. suffix .. "}" },
|
||||||
|
pagure_ns = {
|
||||||
|
archiveext = "tar.gz",
|
||||||
|
namespace = '%{lua:print(string.match(rpm.expand("%{forgeurl' .. suffix .. '}"), "^[^:]+://[^/]+/([^/]+)/[^/?#]+"))}',
|
||||||
|
repo = '%{lua:print(string.match(rpm.expand("%{forgeurl' .. suffix .. '}"), "^[^:]+://[^/]+/[^/]+/([^/?#]+)"))}',
|
||||||
|
archivename = "%{namespace" .. suffix .. "}-%{repo" .. suffix .. "}-%{ref" .. suffix .. "}",
|
||||||
|
archiveurl = "%{forgeurl" .. suffix .. "}/archive/%{ref" .. suffix .. "}/%{archivename" .. suffix .. "}.%{archiveext" .. suffix .. "}" },
|
||||||
|
pagure_fork = {
|
||||||
|
archiveext = "tar.gz",
|
||||||
|
owner = '%{lua:print(string.match(rpm.expand("%{forgeurl' .. suffix .. '}"), "https://[^/]+/fork/([^/]+)/[^/?#]+"))}',
|
||||||
|
repo = '%{lua:print(string.match(rpm.expand("%{forgeurl' .. suffix .. '}"), "https://[^/]+/fork/[^/]+/([^/?#]+)"))}',
|
||||||
|
archivename = "%{owner" .. suffix .. "}-%{repo" .. suffix .. "}-%{ref" .. suffix .. "}",
|
||||||
|
archiveurl = "%{forgeurl" .. suffix .. "}/archive/%{ref" .. suffix .. "}/%{archivename" .. suffix .. "}.%{archiveext" .. suffix .. "}" },
|
||||||
|
pagure_ns_fork = {
|
||||||
|
owner = '%{lua:print(string.match(rpm.expand("%{forgeurl' .. suffix .. '}"), "https://[^/]+/fork/([^/]+)/[^/]+/[^/?#]+"))}',
|
||||||
|
namespace = '%{lua:print(string.match(rpm.expand("%{forgeurl' .. suffix .. '}"), "https://[^/]+/fork/[^/]+/([^/]+)/[^/?#]+")}',
|
||||||
|
repo = '%{lua:print(string.match(rpm.expand("%{forgeurl' .. suffix .. '}"), "https://[^/]+/fork/[^/]+/[^/]+/([^/?#]+)")}',
|
||||||
|
archivename = "%{owner" .. suffix .. "}-%{namespace" .. suffix .. "}-%{repo" .. suffix .. "}-%{ref" .. suffix .. "}",
|
||||||
|
archiveurl = "%{forgeurl" .. suffix .. "}/archive/%{ref" .. suffix .. "}/%{archivename" .. suffix .. "}.%{archiveext" .. suffix .. "}" },
|
||||||
|
["gitea.com"] = {
|
||||||
|
archiveext = "tar.gz",
|
||||||
|
archivename = "%{fileref" .. suffix .. "}",
|
||||||
|
archiveurl = "%{forgeurl" .. suffix .. "}/archive/%{ref" .. suffix .. "}.%{archiveext" .. suffix .. "}",
|
||||||
|
topdir = "%{repo}" },
|
||||||
|
github = {
|
||||||
|
archiveext = "tar.gz",
|
||||||
|
archivename = "%{repo" .. suffix .. "}-%{fileref" .. suffix .. "}",
|
||||||
|
archiveurl = "%{forgeurl" .. suffix .. "}/archive/%{ref" .. suffix .. "}/%{archivename" .. suffix .. "}.%{archiveext" .. suffix .. "}" },
|
||||||
|
["code.googlesource.com"] = {
|
||||||
|
archiveext = "tar.gz",
|
||||||
|
repo = '%{lua:print(string.match(rpm.expand("%{forgeurl' .. suffix .. '}"), "^[^:]+://.+/([^/?#]+)"))}',
|
||||||
|
archiveurl = "%{forgeurl" .. suffix .. "}/+archive/%{ref" .. suffix .. "}.%{archiveext" .. suffix .. "}",
|
||||||
|
topdir = "" },
|
||||||
|
["bitbucket.org"] = {
|
||||||
|
shortcommit = '%{lua:print(string.sub(rpm.expand("%{commit' .. suffix .. '}"), 1, 12))}',
|
||||||
|
owner = '%{lua:print(string.match(rpm.expand("%{forgeurl' .. suffix .. '}"), "^[^:]+://[^/]+/([^/?#]+)"))}',
|
||||||
|
archivename = "%{owner" .. suffix .. "}-%{repo" .. suffix .. "}-%{shortcommit" .. suffix .. "}",
|
||||||
|
archiveurl = "%{forgeurl" .. suffix .. "}/get/%{ref" .. suffix .. "}.%{archiveext" .. suffix .. "}" } }
|
||||||
|
-- Packaging a moving branch is quite a bad idea, but since at least Gitlab
|
||||||
|
-- will treat branches and tags the same way better support branches explicitly
|
||||||
|
-- than have packagers hijack %{tag} to download branch states
|
||||||
|
local spec = {}
|
||||||
|
for _, v in ipairs({'forgeurl','tag','commit','branch','version'}) do
|
||||||
|
spec[v] = rpm.expand("%{?" .. v .. suffix .. "}")
|
||||||
|
end
|
||||||
|
-- Compute the reference of the object to fetch
|
||||||
|
local isrelease = false
|
||||||
|
if (spec["tag"] ~= "") then ref = "%{?tag" .. suffix .. "}"
|
||||||
|
elseif (spec["commit"] ~= "") then ref = "%{?commit" .. suffix .. "}"
|
||||||
|
elseif (spec["branch"] ~= "") then ref = "%{?branch" .. suffix .. "}"
|
||||||
|
else ref = "%{?version" .. suffix .. "}"
|
||||||
|
isrelease = true
|
||||||
|
end
|
||||||
|
if (rpm.expand(ref) == "") then
|
||||||
|
if (suffix == "") then
|
||||||
|
rpm.expand("%{error:You need to define Version:, %{commit} or %{tag} before the macro invocation !}")
|
||||||
|
else
|
||||||
|
rpm.expand("%{error:You need to define %{version" .. suffix .. "}, %{commit" .. suffix .. "} or %{tag" .. suffix .. "} before the macro invocation !}")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local forgeurl = spec["forgeurl"]
|
||||||
|
-- For backwards compatibility only
|
||||||
|
local expliciturl = rpm.expand("%{?-u*}")
|
||||||
|
if (expliciturl ~= "") then
|
||||||
|
rpm.expand("%{warn:-u use in %%forgemeta is deprecated, use -z instead to select a separate set of rpm variables!}")
|
||||||
|
forgeurl = expliciturl
|
||||||
|
end
|
||||||
|
local forge
|
||||||
|
forgeurl, forge = idforge(forgeurl, silent)
|
||||||
|
if (forge ~= nil) then
|
||||||
|
fedora.explicitset("forgeurl" .. suffix, forgeurl, verbose)
|
||||||
|
-- Custom processing of quirky forges that can not be handled with simple variables
|
||||||
|
if (forge == "github") then
|
||||||
|
-- Workaround the way GitHub injects "v"s before some version strings (but not all!)
|
||||||
|
-- To package one of the minority of sane GitHub projects that do not munge their version
|
||||||
|
-- strings set tag to %{version} in your spec
|
||||||
|
local fileref = ref
|
||||||
|
if (ref == "%{?version" .. suffix .. "}") then
|
||||||
|
ref = "v" .. ref
|
||||||
|
elseif (fileref ~= "%{?commit" .. suffix .. "}") and
|
||||||
|
string.match(rpm.expand(fileref), "^v[%d]") then
|
||||||
|
fileref = string.gsub(rpm.expand(fileref), "^v", "")
|
||||||
|
elseif (string.match(rpm.expand(fileref), "/")) then
|
||||||
|
fileref = string.gsub(rpm.expand(fileref), "/", "-")
|
||||||
|
end
|
||||||
|
fedora.safeset("fileref" .. suffix, fileref, verbose)
|
||||||
|
elseif (forge == "gitea.com") then
|
||||||
|
-- Workaround the way gitea mangles /s in ref names
|
||||||
|
local fileref = ref
|
||||||
|
fileref = string.gsub(rpm.expand(fileref), "/", "-")
|
||||||
|
fedora.safeset("fileref" .. suffix, fileref, verbose)
|
||||||
|
elseif (forge == "code.googlesource.com") then
|
||||||
|
if (ref == "%{?version" .. suffix .. "}") then
|
||||||
|
ref = "v" .. ref
|
||||||
|
end
|
||||||
|
elseif (forge == "bitbucket.org") then
|
||||||
|
if (spec["commit"] == "") then
|
||||||
|
rpm.expand("%{error:All BitBucket URLs require commit value knowledge: you need to define %{commit}!}")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
fedora.safeset("ref" .. suffix, ref, verbose)
|
||||||
|
-- Mass setting of the remaining variables
|
||||||
|
for k,v in pairs(variables[forge]) do
|
||||||
|
fedora.safeset(k .. suffix, variables[forge][k], verbose)
|
||||||
|
end
|
||||||
|
for k,v in pairs(variables["default"]) do
|
||||||
|
if (variables[forge][k] == nil) then
|
||||||
|
fedora.safeset(k .. suffix, variables["default"][k], verbose)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- Generic rules
|
||||||
|
for _, v in ipairs({'archiveurl','archivename','archiveext','topdir'}) do
|
||||||
|
spec[v] = rpm.expand("%{?" .. v .. suffix .. "}")
|
||||||
|
end
|
||||||
|
-- Source URL processing (computing the forgesource spec variable)
|
||||||
|
local forgesource = "%{archiveurl" .. suffix .. "}"
|
||||||
|
if (string.match(spec["archiveurl"], "/([^/]+)$") ~= spec["archivename"] .. "." .. spec["archiveext"]) then
|
||||||
|
forgesource = "%{?archiveurl" .. suffix .. "}#/%{?archivename" .. suffix .. "}.%{archiveext" .. suffix .. "}"
|
||||||
|
end
|
||||||
|
fedora.safeset("forgesource" .. suffix, forgesource, verbose)
|
||||||
|
-- Setup processing (computing the forgesetup and extractdir variables)
|
||||||
|
local forgesetupargs = "-n %{extractdir" .. suffix .. "}"
|
||||||
|
local extractdir = "%{topdir" .. suffix .. "}"
|
||||||
|
if (spec["topdir"] == "") then
|
||||||
|
forgesetupargs = "-c " .. forgesetupargs
|
||||||
|
extractdir = "%{archivename" .. suffix .. "}"
|
||||||
|
end
|
||||||
|
if not ismain then
|
||||||
|
if (spec["topdir"] ~= "") then
|
||||||
|
forgesetupargs = "-T -D -b " .. suffix .. " " .. forgesetupargs
|
||||||
|
else
|
||||||
|
forgesetupargs = "-T -D -a " .. suffix .. " " .. forgesetupargs
|
||||||
|
end
|
||||||
|
end
|
||||||
|
fedora.safeset("forgesetupargs" .. suffix, forgesetupargs, verbose)
|
||||||
|
fedora.safeset("extractdir" .. suffix, extractdir, verbose)
|
||||||
|
-- dist processing (computing the correct prefix for snapshots)
|
||||||
|
local distprefix = ""
|
||||||
|
if not isrelease then
|
||||||
|
distprefix = string.lower(rpm.expand(ref))
|
||||||
|
if (ref == "%{?commit" .. suffix .. "}") then
|
||||||
|
distprefix = string.sub(distprefix, 1, 7)
|
||||||
|
elseif (ref ~= "%{?branch" .. suffix .. "}") then
|
||||||
|
distprefix = string.gsub(distprefix, "[%p%s]+", ".")
|
||||||
|
distprefix = string.gsub(distprefix, "^" .. string.lower(rpm.expand("%{?repo}")) .. "%.?", "")
|
||||||
|
local v = string.gsub(rpm.expand("%{version}"), "[%p%s]+", ".")
|
||||||
|
for _, p in ipairs({'','v','v.','version','version.','tags.v', 'tags.v.'}) do
|
||||||
|
distprefix = getversionsuffix(distprefix, p .. v)
|
||||||
|
end
|
||||||
|
distprefix = string.gsub(distprefix, "^%.", "")
|
||||||
|
end
|
||||||
|
if (distprefix ~= "") then
|
||||||
|
distprefix = "%{scm" .. suffix .. "}" .. distprefix
|
||||||
|
date = rpm.expand("%{?date" .. suffix .. "}")
|
||||||
|
if (date ~= "") then
|
||||||
|
distprefix = date .. distprefix
|
||||||
|
else
|
||||||
|
distprefix = "%([ -r %{_sourcedir}/%{archivename" .. suffix .. "}.%{archiveext" .. suffix .. "} ] && date +%Y%m%d -u -r %{_sourcedir}/%{archivename" .. suffix .. "}.%{archiveext" .. suffix .. "})" .. distprefix
|
||||||
|
end
|
||||||
|
distprefix = "." .. distprefix
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if (spec["version"] ~= "") and
|
||||||
|
(spec["version"] ~= "0") and
|
||||||
|
(spec["version"] ~= rpm.expand("%{?version}")) then
|
||||||
|
distprefix = ".%{version" .. suffix .. "}" .. distprefix
|
||||||
|
end
|
||||||
|
if (rpm.expand(distprefix) ~= "") then
|
||||||
|
if not ismain then
|
||||||
|
distprefix = string.gsub(distprefix, "^%.", ".s")
|
||||||
|
end
|
||||||
|
fedora.safeset ("distprefix" .. suffix, distprefix, verbose)
|
||||||
|
end
|
||||||
|
if ismain then
|
||||||
|
fedora.zalias({"forgeurl", "forgesource", "forgesetupargs",
|
||||||
|
"archivename", "archiveext", "archiveurl",
|
||||||
|
"topdir", "extractdir", "repo", "owner", "namespace",
|
||||||
|
"scm", "shortcommit", "distprefix"}, verbose)
|
||||||
|
end
|
||||||
|
-- Final spec variable summary if the macro was called with -i
|
||||||
|
if informative then
|
||||||
|
rpm.expand("%{echo:Packaging variables read or set by %%forgemeta}")
|
||||||
|
fedora.echovars({"forgeurl", "forgesource", "forgesetupargs",
|
||||||
|
"archivename", "archiveext", "archiveurl",
|
||||||
|
"topdir", "extractdir", "repo", "owner", "namespace",
|
||||||
|
"scm", "tag", "commit", "shortcommit", "branch", "version",
|
||||||
|
"date", "distprefix"}, suffix)
|
||||||
|
fedora.echovars({"dist"},"")
|
||||||
|
rpm.expand("%{echo: (snapshot date is either manually supplied or computed once %%{_sourcedir}/%%{archivename" .. suffix .. "}.%%{archiveext" .. suffix .. "} is available)}")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
meta = meta,
|
||||||
|
}
|
||||||
|
|
@ -1,2 +0,0 @@
|
|||||||
%__kabi_provides %{_rpmconfigdir}/kabi.sh
|
|
||||||
%__kabi_path ^(/boot/symvers-.*|/lib/modules/[1-9].*/symvers)\.gz$
|
|
@ -1,13 +0,0 @@
|
|||||||
#!/bin/bash +x
|
|
||||||
#
|
|
||||||
# kabi.sh - Automatically extract any kernel symbol checksum from the
|
|
||||||
# symvers file and add to RPM deps. This is used to move the
|
|
||||||
# checksum checking from modprobe to rpm install for 3rd party
|
|
||||||
# modules (so they can fail during install and not at load).
|
|
||||||
|
|
||||||
IFS=$'\n'
|
|
||||||
|
|
||||||
for symvers in $(grep -E '(/boot/symvers-.*|/lib/modules/[1-9].*/symvers)\.gz') "$@";
|
|
||||||
do
|
|
||||||
zcat $symvers | awk ' {print "kernel(" $2 ") = " $1 }'
|
|
||||||
done
|
|
@ -1,2 +0,0 @@
|
|||||||
%__kmod_provides %{_rpmconfigdir}/kmod.prov
|
|
||||||
%__kmod_path ^/lib/modules/.*$
|
|
@ -1,28 +0,0 @@
|
|||||||
#!/bin/sh +x
|
|
||||||
# Kernel build can have many thousands of modules.
|
|
||||||
# kmod.prov is run for every one of them.
|
|
||||||
# Try to make this script run as fast as we can.
|
|
||||||
# For example, use shell string ops instead of external programs
|
|
||||||
# where possible.
|
|
||||||
|
|
||||||
IFS=$'\n'
|
|
||||||
|
|
||||||
read -r fname || exit
|
|
||||||
|
|
||||||
# Only process files from .../lib/modules/... subtree
|
|
||||||
[ "${fname#*/lib/modules/*}" != "$fname" ] || exit 0
|
|
||||||
|
|
||||||
kmod=${fname##*/} # like basename, but faster
|
|
||||||
|
|
||||||
if [ "$kmod" = "modules.builtin" ]; then
|
|
||||||
for j in $(cat -- "$fname"); do
|
|
||||||
echo "kmod(${j##*/})"
|
|
||||||
done
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
kmod=${kmod%.gz}
|
|
||||||
kmod=${kmod%.xz}
|
|
||||||
if [ "${kmod%.ko}" != "$kmod" ]; then
|
|
||||||
echo "kmod($kmod)"
|
|
||||||
fi
|
|
@ -1,349 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# kmodtool - Helper script for building kernel module RPMs
|
|
||||||
# An original version appeared in Fedora. This version is
|
|
||||||
# generally called only by the %kernel_module_package RPM macro
|
|
||||||
# during the process of building Driver Update Packages (which
|
|
||||||
# are also known as "kmods" in the Fedora community).
|
|
||||||
#
|
|
||||||
# Copyright (c) 2003-2010 Ville Skyttä <ville.skytta@iki.fi>,
|
|
||||||
# Thorsten Leemhuis <fedora@leemhuis.info>
|
|
||||||
# Jon Masters <jcm@redhat.com>
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
# a copy of this software and associated documentation files (the
|
|
||||||
# "Software"), to deal in the Software without restriction, including
|
|
||||||
# without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
# permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
# the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be
|
|
||||||
# included in all copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
# Changelog:
|
|
||||||
#
|
|
||||||
# 2010/07/28 - Add fixes for filelists in line with LF standard
|
|
||||||
# - Remove now defunct "framepointer" kernel variant
|
|
||||||
# - Change version to "rhel6-rh2" as a consequence.
|
|
||||||
#
|
|
||||||
# 2010/01/10 - Simplified for RHEL6. We are working on upstream
|
|
||||||
# moving to a newer format and in any case do not
|
|
||||||
# need to retain support for really old systems.
|
|
||||||
|
|
||||||
shopt -s extglob
|
|
||||||
|
|
||||||
myprog="kmodtool"
|
|
||||||
myver="0.10.10_rhel8"
|
|
||||||
knownvariants=@(debug|kdump|zfcpdump)
|
|
||||||
kmod_name=
|
|
||||||
kver=
|
|
||||||
verrel=
|
|
||||||
variant=
|
|
||||||
|
|
||||||
get_verrel ()
|
|
||||||
{
|
|
||||||
verrel=${1:-$(uname -r)}
|
|
||||||
verrel=${verrel/%[.+]$knownvariants/}
|
|
||||||
}
|
|
||||||
|
|
||||||
print_verrel ()
|
|
||||||
{
|
|
||||||
get_verrel "$@"
|
|
||||||
echo "${verrel}"
|
|
||||||
}
|
|
||||||
|
|
||||||
get_variant ()
|
|
||||||
{
|
|
||||||
get_verrel "$@"
|
|
||||||
variant=${1:-$(uname -r)}
|
|
||||||
variant=${variant/#$verrel?(.+)/}
|
|
||||||
variant=${variant:-'""'}
|
|
||||||
}
|
|
||||||
|
|
||||||
print_variant ()
|
|
||||||
{
|
|
||||||
get_variant $@
|
|
||||||
echo "${variant}"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Detect flavor separator character. We have to do that due to
|
|
||||||
# a systemd-tailored patch for kernel spec[1][2] introduced in Fedora and then
|
|
||||||
# imported in RHEL 8 that broke all OOT kmod infrastructure for the flavored
|
|
||||||
# kernels.
|
|
||||||
#
|
|
||||||
# [1] https://lists.fedoraproject.org/pipermail/kernel/2013-June/004262.html
|
|
||||||
# [2] https://src.fedoraproject.org/rpms/kernel/c/faf25207dc86666a611c45ae3ffaf385c170bd2a
|
|
||||||
#
|
|
||||||
# $1 - kver
|
|
||||||
# $2 - variant
|
|
||||||
get_variant_char ()
|
|
||||||
{
|
|
||||||
variant="$2"
|
|
||||||
[ "$variant" != "default" ] || variant=""
|
|
||||||
|
|
||||||
get_verrel "$1"
|
|
||||||
|
|
||||||
variant_char=""
|
|
||||||
[ -n "$variant" ] || return 0
|
|
||||||
|
|
||||||
# We expect that the flavored kernel is already installed in the buildroot
|
|
||||||
variant_char="+"
|
|
||||||
[ -e "/usr/src/kernels/${verrel}+${variant}" ] && return 0
|
|
||||||
|
|
||||||
variant_char="."
|
|
||||||
}
|
|
||||||
|
|
||||||
print_variant_char ()
|
|
||||||
{
|
|
||||||
get_variant_char "$@"
|
|
||||||
echo "${variant_char}"
|
|
||||||
}
|
|
||||||
|
|
||||||
print_kernel_source ()
|
|
||||||
{
|
|
||||||
get_variant_char "$@"
|
|
||||||
echo "/usr/src/kernels/${verrel}${variant_char}${variant}"
|
|
||||||
}
|
|
||||||
|
|
||||||
get_filelist() {
|
|
||||||
local IFS=$'\n'
|
|
||||||
filelist=($(cat))
|
|
||||||
|
|
||||||
if [ ${#filelist[@]} -gt 0 ];
|
|
||||||
then
|
|
||||||
for ((n = 0; n < ${#filelist[@]}; n++));
|
|
||||||
do
|
|
||||||
line="${filelist[n]}"
|
|
||||||
line=$(echo "$line" \
|
|
||||||
| sed -e "s/%verrel/$verrel/g" \
|
|
||||||
| sed -e "s/%variant/$variant/g" \
|
|
||||||
| sed -e "s/%dashvariant/$dashvariant/g" \
|
|
||||||
| sed -e "s/%dotvariant/$dotvariant/g" \
|
|
||||||
| sed -e "s/\+%1/$dotvariant/g" \
|
|
||||||
| sed -e "s/\.%1/$dotvariant/g" \
|
|
||||||
| sed -e "s/\-%1/$dotvariant/g" \
|
|
||||||
| sed -e "s/%2/$verrel/g")
|
|
||||||
echo "$line"
|
|
||||||
done
|
|
||||||
else
|
|
||||||
echo "%defattr(644,root,root,755)"
|
|
||||||
echo "/lib/modules/${verrel}${dotvariant}"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
get_rpmtemplate ()
|
|
||||||
{
|
|
||||||
local variant="${1}"
|
|
||||||
|
|
||||||
get_variant_char "${verrel}" "${variant}"
|
|
||||||
|
|
||||||
local dashvariant="${variant:+-${variant}}"
|
|
||||||
local dotvariant="${variant:+${variant_char}${variant}}"
|
|
||||||
|
|
||||||
echo "%package -n kmod-${kmod_name}${dashvariant}"
|
|
||||||
|
|
||||||
if [ -z "$kmod_provides_summary" ]; then
|
|
||||||
echo "Summary: ${kmod_name} kernel module(s)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$kmod_provides_group" ]; then
|
|
||||||
echo "Group: System Environment/Kernel"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -z "$kmod_version" ]; then
|
|
||||||
echo "Version: %{kmod_version}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -z "$kmod_release" ]; then
|
|
||||||
echo "Release: %{kmod_release}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Turn of the internal dep generator so we will use the kmod scripts.
|
|
||||||
echo "%global _use_internal_dependency_generator 0"
|
|
||||||
|
|
||||||
cat <<EOF
|
|
||||||
Provides: kernel-modules >= ${verrel}${dotvariant}
|
|
||||||
Provides: kernel${dashvariant}-modules >= ${verrel}
|
|
||||||
Provides: ${kmod_name}-kmod = %{?epoch:%{epoch}:}%{version}-%{release}
|
|
||||||
Requires(post): /usr/sbin/depmod
|
|
||||||
Requires(postun): /usr/sbin/depmod
|
|
||||||
Requires(post): /usr/sbin/weak-modules
|
|
||||||
Requires(postun): /usr/sbin/weak-modules
|
|
||||||
EOF
|
|
||||||
|
|
||||||
if [ "yes" != "$nobuildreqs" ]
|
|
||||||
then
|
|
||||||
cat <<EOF
|
|
||||||
BuildRequires: kernel${dashvariant}-devel
|
|
||||||
BuildRequires: kernel-abi-whitelists
|
|
||||||
BuildRequires: redhat-rpm-config kernel-rpm-macros
|
|
||||||
BuildRequires: elfutils-libelf-devel kmod
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "" != "$override_preamble" ]
|
|
||||||
then
|
|
||||||
cat "$override_preamble"
|
|
||||||
fi
|
|
||||||
|
|
||||||
cat <<EOF
|
|
||||||
%description -n kmod-${kmod_name}${dashvariant}
|
|
||||||
This package provides the ${kmod_name} kernel modules built for
|
|
||||||
the Linux kernel ${verrel}${dotvariant} for the %{_target_cpu}
|
|
||||||
family of processors.
|
|
||||||
EOF
|
|
||||||
|
|
||||||
##############################################################################
|
|
||||||
## The following are not part of this script directly, they are scripts ##
|
|
||||||
## that will be executed by RPM during various stages of package processing ##
|
|
||||||
##############################################################################
|
|
||||||
|
|
||||||
cat <<EOF
|
|
||||||
%post -n kmod-${kmod_name}${dashvariant}
|
|
||||||
if [ -e "/boot/System.map-${verrel}${dotvariant}" ]; then
|
|
||||||
/usr/sbin/depmod -aeF "/boot/System.map-${verrel}${dotvariant}" "${verrel}${dotvariant}" > /dev/null || :
|
|
||||||
fi
|
|
||||||
|
|
||||||
modules=( \$(find /lib/modules/${verrel}${dotvariant}/extra/${kmod_name} | grep '\.ko$') )
|
|
||||||
if [ -x "/usr/sbin/weak-modules" ]; then
|
|
||||||
printf '%s\n' "\${modules[@]}" \
|
|
||||||
| /usr/sbin/weak-modules --add-modules
|
|
||||||
fi
|
|
||||||
EOF
|
|
||||||
|
|
||||||
cat <<EOF
|
|
||||||
%preun -n kmod-${kmod_name}${dashvariant}
|
|
||||||
rpm -ql kmod-${kmod_name}${dashvariant}-%{kmod_version}-%{kmod_release}.$(arch) | grep '\.ko$' > /var/run/rpm-kmod-${kmod_name}${dashvariant}-modules
|
|
||||||
EOF
|
|
||||||
|
|
||||||
cat <<EOF
|
|
||||||
%postun -n kmod-${kmod_name}${dashvariant}
|
|
||||||
if [ -e "/boot/System.map-${verrel}${dotvariant}" ]; then
|
|
||||||
/usr/sbin/depmod -aeF "/boot/System.map-${verrel}${dotvariant}" "${verrel}${dotvariant}" > /dev/null || :
|
|
||||||
fi
|
|
||||||
|
|
||||||
modules=( \$(cat /var/run/rpm-kmod-${kmod_name}${dashvariant}-modules) )
|
|
||||||
rm /var/run/rpm-kmod-${kmod_name}${dashvariant}-modules
|
|
||||||
if [ -x "/usr/sbin/weak-modules" ]; then
|
|
||||||
printf '%s\n' "\${modules[@]}" \
|
|
||||||
| /usr/sbin/weak-modules --remove-modules
|
|
||||||
fi
|
|
||||||
EOF
|
|
||||||
|
|
||||||
echo "%files -n kmod-${kmod_name}${dashvariant}"
|
|
||||||
|
|
||||||
if [ "" == "$override_filelist" ];
|
|
||||||
then
|
|
||||||
echo "%defattr(644,root,root,755)"
|
|
||||||
echo "/lib/modules/${verrel}${dotvariant}"
|
|
||||||
else
|
|
||||||
cat "$override_filelist" | get_filelist
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
print_rpmtemplate ()
|
|
||||||
{
|
|
||||||
kmod_name="${1}"
|
|
||||||
shift
|
|
||||||
kver="${1}"
|
|
||||||
get_verrel "${1}"
|
|
||||||
shift
|
|
||||||
if [ -z "${kmod_name}" ] ; then
|
|
||||||
echo "Please provide the kmodule-name as first parameter." >&2
|
|
||||||
exit 2
|
|
||||||
elif [ -z "${kver}" ] ; then
|
|
||||||
echo "Please provide the kver as second parameter." >&2
|
|
||||||
exit 2
|
|
||||||
elif [ -z "${verrel}" ] ; then
|
|
||||||
echo "Couldn't find out the verrel." >&2
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
for variant in "$@" ; do
|
|
||||||
if [ "default" == "$variant" ];
|
|
||||||
then
|
|
||||||
get_rpmtemplate ""
|
|
||||||
else
|
|
||||||
get_rpmtemplate "${variant}"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
usage ()
|
|
||||||
{
|
|
||||||
cat <<EOF
|
|
||||||
You called: ${invocation}
|
|
||||||
|
|
||||||
Usage: ${myprog} <command> <option>+
|
|
||||||
Commands:
|
|
||||||
verrel <uname>
|
|
||||||
- Get "base" version-release.
|
|
||||||
variant <uname>
|
|
||||||
- Get variant from uname.
|
|
||||||
variant_char <uname> <variant>
|
|
||||||
- Get kernel variant separator character.
|
|
||||||
kernel_source <uname> <variant>
|
|
||||||
- Get path to kernel source directory.
|
|
||||||
rpmtemplate <mainpgkname> <uname> <variants>
|
|
||||||
- Return a template for use in a source RPM
|
|
||||||
version
|
|
||||||
- Output version number and exit.
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
invocation="$(basename ${0}) $@"
|
|
||||||
while [ "${1}" ] ; do
|
|
||||||
case "${1}" in
|
|
||||||
verrel)
|
|
||||||
shift
|
|
||||||
print_verrel "$@"
|
|
||||||
exit $?
|
|
||||||
;;
|
|
||||||
variant)
|
|
||||||
shift
|
|
||||||
print_variant "$@"
|
|
||||||
exit $?
|
|
||||||
;;
|
|
||||||
variant_char)
|
|
||||||
shift
|
|
||||||
print_variant_char "$@"
|
|
||||||
exit $?
|
|
||||||
;;
|
|
||||||
kernel_source)
|
|
||||||
shift
|
|
||||||
print_kernel_source "$@"
|
|
||||||
exit $?
|
|
||||||
;;
|
|
||||||
rpmtemplate)
|
|
||||||
shift
|
|
||||||
print_rpmtemplate "$@"
|
|
||||||
exit $?
|
|
||||||
;;
|
|
||||||
version)
|
|
||||||
echo "${myprog} ${myver}"
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Error: Unknown option '${1}'." >&2
|
|
||||||
usage >&2
|
|
||||||
exit 2
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
# Local variables:
|
|
||||||
# mode: sh
|
|
||||||
# sh-indentation: 2
|
|
||||||
# indent-tabs-mode: nil
|
|
||||||
# End:
|
|
||||||
# ex: ts=2 sw=2 et
|
|
@ -1,3 +0,0 @@
|
|||||||
# kernel_arches lists what arches the full kernel is built for.
|
|
||||||
|
|
||||||
%kernel_arches x86_64 s390x ppc64le aarch64 %{arm}
|
|
@ -1,97 +0,0 @@
|
|||||||
# Use these macros to differentiate between RH and other KMP implementation(s).
|
|
||||||
%global redhat_kernel_module_package 1
|
|
||||||
%global kernel_module_package_release 1
|
|
||||||
|
|
||||||
%global redhat_kmp_has_post_hooks 1
|
|
||||||
|
|
||||||
%__brp_kmod_set_exec_bit /usr/lib/rpm/redhat/brp-kmod-set-exec-bit
|
|
||||||
%__brp_kmod_restore_perms /usr/lib/rpm/redhat/brp-kmod-restore-perms
|
|
||||||
|
|
||||||
%__kmod_brps_added 0
|
|
||||||
|
|
||||||
%__find_provides /usr/lib/rpm/redhat/find-provides
|
|
||||||
%__find_requires /usr/lib/rpm/redhat/find-requires
|
|
||||||
|
|
||||||
#kernel_module_package [ -n name ] [ -v version ] [ -r release ] [ -s script ]
|
|
||||||
# [ -f filelist] [ -x ] [ -p preamble ] flavor flavor ...
|
|
||||||
|
|
||||||
%kernel_module_package_buildreqs %global kmodtool_generate_buildreqs 1 \
|
|
||||||
kernel-devel kernel-abi-whitelists redhat-rpm-config kernel-rpm-macros elfutils-libelf-devel kmod
|
|
||||||
|
|
||||||
%kernel_module_package(n:v:r:s:f:xp:) %{expand:%( \
|
|
||||||
## An ugly hack: we want kmods to be processed by find-debuginfo,
|
|
||||||
## but it processes only files with executable permission set.
|
|
||||||
## It is important now since, as of now, if debuginfo package
|
|
||||||
## is enabled (and it is enabled), there's an RPM build error
|
|
||||||
## as a result of lack of ether absence or emptiness of
|
|
||||||
## debugsourcefiles.list (which is likely a bug in RPM, but it looks
|
|
||||||
## like that there's no obvious fix and apparently no one have
|
|
||||||
## any issues with this).
|
|
||||||
## In order to minimise intrusiveness, usually (in Red Hat-built kmod
|
|
||||||
## RPMs) *.ko files just have executable permission being set as a part
|
|
||||||
## of %build section. There are two caveats with kmp, however:
|
|
||||||
## * We have no control over %build section itself (and it wasn't
|
|
||||||
## required previously)
|
|
||||||
## * Changing the criteria used in find-debuginfo.sh/brp-strip
|
|
||||||
## for selecting files that have to undergo debug section separation
|
|
||||||
## may introduce regression.
|
|
||||||
## As a result, we insert additional hooks in __spec_install_post
|
|
||||||
## (__brp_kmod_set_exec_bit in the beginning and
|
|
||||||
## __brp_kmod_restore_perms in the end) that (temporarily) set
|
|
||||||
## executable permission for *.ko files so find-debuginfo.sh will pick
|
|
||||||
## them up.
|
|
||||||
## Unfortunately, __spec_install_post's body is copied here since
|
|
||||||
## we want that __debug_package macro expansion has been performed
|
|
||||||
## lazily and it looks like RPM has no ability to provide a body
|
|
||||||
## of a macro verbatim.
|
|
||||||
if [ 0 = "%{__kmod_brps_added}" ]; then \
|
|
||||||
echo "%%global __spec_install_post \\\\" \
|
|
||||||
echo " %%{?__brp_kmod_set_exec_bit} \\\\" \
|
|
||||||
echo " %%%%{?__debug_package:%%%%{__debug_install_post}} \\\\" \
|
|
||||||
echo " %%{__arch_install_post} \\\\" \
|
|
||||||
echo " %%{__os_install_post} \\\\" \
|
|
||||||
echo " %%{?__brp_kmod_pre_sign_process} \\\\" \
|
|
||||||
echo " %%{?__brp_kmod_sign} \\\\" \
|
|
||||||
echo " %%{?__brp_kmod_post_sign_process} \\\\" \
|
|
||||||
echo " %%{?__brp_kmod_compress} \\\\" \
|
|
||||||
echo " %%{?__brp_kmod_post_compress_process} \\\\" \
|
|
||||||
echo " %%{?__brp_kmod_restore_perms} \\\\" \
|
|
||||||
echo "%%{nil}" \
|
|
||||||
fi \
|
|
||||||
%global __kmod_brps_added 1 \
|
|
||||||
%global kmodtool %{-s*}%{!-s:/usr/lib/rpm/redhat/kmodtool} \
|
|
||||||
%global kmod_version %{-v*}%{!-v:%{version}} \
|
|
||||||
%global kmod_release %{-r*}%{!-r:%{release}} \
|
|
||||||
%global latest_kernel %({ rpm -q --qf '%%{VERSION}-%%{RELEASE}.%%{ARCH}\\\\n' `rpm -qa | egrep "^kernel(-rt|-aarch64)?-devel" | /usr/lib/rpm/redhat/rpmsort -r | head -n 1`; echo '%%%%{nil}'; } | head -n 1) \
|
|
||||||
%{!?kernel_version:%{expand:%%global kernel_version %{latest_kernel}}} \
|
|
||||||
%global kverrel %(%{kmodtool} verrel %{?kernel_version} 2>/dev/null) \
|
|
||||||
flavors="default" \
|
|
||||||
if [ -z "%*" ]; then \
|
|
||||||
flavors_to_build=$flavors \
|
|
||||||
elif [ -z "%{-x}" ]; then \
|
|
||||||
flavors_to_build="%*" \
|
|
||||||
else \
|
|
||||||
flavors_to_build=" $flavors "\
|
|
||||||
for i in %* \
|
|
||||||
do \
|
|
||||||
flavors_to_build=${flavors_to_build//$i /}
|
|
||||||
done \
|
|
||||||
fi \
|
|
||||||
echo "%%global flavors_to_build ${flavors_to_build:-%%nil}" \
|
|
||||||
echo "%%global kernel_source() \\\$([ default = \"%%%%{1}\" ] && echo \"/usr/src/kernels//%%%%kverrel\" || %{kmodtool} kernel_source \"%%%%{kverrel}\" \"%%%%{1}\" 2>/dev/null || { ls -Ud \"/usr/src/kernels///%%%%{kverrel}\"[.+]\"%%%%{1}\" | sort -V | tail -n 1; } || echo \"/usr/src/kernels////%%%%kverrel.%%%%1\")" \
|
|
||||||
echo "%%global kernel_module_package_moddir() extra" \
|
|
||||||
if [ ! -z "%{-f*}" ] \
|
|
||||||
then \
|
|
||||||
filelist="%{-f*}" \
|
|
||||||
fi \
|
|
||||||
if [ ! -z "%{-p*}" ] \
|
|
||||||
then \
|
|
||||||
preamble="%{-p*}" \
|
|
||||||
fi \
|
|
||||||
nobuildreqs="yes" \
|
|
||||||
if [ "x%{kmodtool_generate_buildreqs}" != "x1" ] \
|
|
||||||
then \
|
|
||||||
nobuildreqs="no" \
|
|
||||||
fi \
|
|
||||||
override_filelist="$filelist" override_preamble="$preamble" nobuildreqs="$nobuildreqs" kmod_version=%kmod_version kmod_release=%kmod_release %{kmodtool} rpmtemplate %{-n*}%{!-n:%name} %{kverrel} $flavors_to_build 2>/dev/null \
|
|
||||||
)}
|
|
@ -1,2 +1,2 @@
|
|||||||
# arches that ldc builds on
|
# arches that ldc builds on
|
||||||
%ldc_arches %{ix86} x86_64 %{arm} %{power64}
|
%ldc_arches %{ix86} x86_64 %{arm} aarch64
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
# valgrind_arches lists what arches Valgrind works on
|
# valgrind_arches lists what arches Valgrind works on
|
||||||
|
|
||||||
%valgrind_arches %{ix86} x86_64 ppc ppc64 ppc64le armv7hl aarch64 s390x
|
%valgrind_arches %{ix86} x86_64 ppc ppc64 ppc64le s390x armv7hl aarch64
|
||||||
|
@ -1,78 +0,0 @@
|
|||||||
#! /bin/bash -efu
|
|
||||||
|
|
||||||
# heavily based upon find-suggests.ksyms by Andreas Gruenbacher <agruen@suse.de>.
|
|
||||||
# with modifications by Michael Brown <Michael_E_Brown@dell.com>
|
|
||||||
#
|
|
||||||
# -- added module versioning info to modalias() symbols
|
|
||||||
# -- removed code which inspects spec files.
|
|
||||||
|
|
||||||
IFS=$'\n'
|
|
||||||
|
|
||||||
#
|
|
||||||
# Initially, dont generate modalias() lines for kernel package. This needs
|
|
||||||
# additional discussion. Would like to eventually add them for
|
|
||||||
# completeness, so that we can determine when drivers are folded into
|
|
||||||
# mainline kernel.
|
|
||||||
#
|
|
||||||
is_kernel_package=""
|
|
||||||
case "${1:-}" in
|
|
||||||
kernel-module-*) ;; # Fedora kernel module package names start with
|
|
||||||
# kernel-module.
|
|
||||||
kernel*) is_kernel_package=1 ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if ! [ -z "$is_kernel_package" ]; then
|
|
||||||
cat > /dev/null
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check for presence of the commands used
|
|
||||||
which /sbin/modinfo >/dev/null || exit 0
|
|
||||||
which sed >/dev/null || exit 0
|
|
||||||
which sort >/dev/null || exit 0
|
|
||||||
|
|
||||||
print_modaliases() {
|
|
||||||
declare class=$1 variants=$2 pos=$3
|
|
||||||
if [ -n "$variants" ]; then
|
|
||||||
echo "${class:0:pos}[$variants]${class:pos+1}"
|
|
||||||
else
|
|
||||||
[ -z "$class" ] || echo "$class"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
combine_modaliases() {
|
|
||||||
declare tag class variants="" pos="" n
|
|
||||||
read class
|
|
||||||
while read tag; do
|
|
||||||
for ((n=0; n<${#class}; n++)); do
|
|
||||||
if [ "*" != "${class:n:1}" -a \
|
|
||||||
"${class:0:n}" = "${tag:0:n}" -a \
|
|
||||||
"${class:n+1}" = "${tag:n+1}" ] &&
|
|
||||||
( [ -z "$pos" ] || [ $n = $pos ] ); then
|
|
||||||
variants="${variants:-${class:n:1}}${tag:n:1}"
|
|
||||||
pos=$n
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if [ $n -eq ${#class} ]; then
|
|
||||||
print_modaliases "$class" "$variants" "$pos"
|
|
||||||
variants=
|
|
||||||
pos=
|
|
||||||
class=$tag
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
print_modaliases "$class" "$variants" "$pos"
|
|
||||||
}
|
|
||||||
|
|
||||||
for module in $(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz)?$') "$@"; do
|
|
||||||
# | head -n1 because some modules have *two* version tags. *cough*b44*cough*
|
|
||||||
modver=$(/sbin/modinfo -F version "$module"| head -n1)
|
|
||||||
modver=${modver//[^0-9a-zA-Z._]/_}
|
|
||||||
# only add version tag if it has a version
|
|
||||||
[ -z "$modver" ] || modver=" = $modver"
|
|
||||||
|
|
||||||
/sbin/modinfo -F alias "$module" \
|
|
||||||
| sed -nre "s,[^][0-9a-zA-Z._:*?/-],_,g; s,(.+),modalias(\\1)$modver,p"
|
|
||||||
done \
|
|
||||||
| sort -u \
|
|
||||||
| combine_modaliases
|
|
@ -0,0 +1 @@
|
|||||||
|
-fPIE
|
@ -1,76 +0,0 @@
|
|||||||
#! /usr/bin/perl -w
|
|
||||||
|
|
||||||
# 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 2
|
|
||||||
# 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, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
|
||||||
# USA.
|
|
||||||
|
|
||||||
use Getopt::Long qw(:config gnu_getopt);
|
|
||||||
|
|
||||||
sub rpm_cmp_versions {
|
|
||||||
my ($evr1, $evr2) = @_;
|
|
||||||
|
|
||||||
sub _rpm_cmp {
|
|
||||||
my ($s1, $s2) = @_;
|
|
||||||
|
|
||||||
return defined $s1 <=> defined $s2
|
|
||||||
unless defined $s1 && defined $s2;
|
|
||||||
|
|
||||||
my ($r, $x1, $x2);
|
|
||||||
do {
|
|
||||||
$s1 =~ s/^[^a-zA-Z0-9]+//;
|
|
||||||
$s2 =~ s/^[^a-zA-Z0-9]+//;
|
|
||||||
if ($s1 =~ /^\d/ || $s2 =~ /^\d/) {
|
|
||||||
$s1 =~ s/^0*(\d*)//; $x1 = $1;
|
|
||||||
$s2 =~ s/^0*(\d*)//; $x2 = $1;
|
|
||||||
$r = length $x1 <=> length $x2 || $x1 cmp $x2;
|
|
||||||
} else {
|
|
||||||
$s1 =~ s/^([a-zA-Z]*)//; $x1 = $1;
|
|
||||||
$s2 =~ s/^([a-zA-Z]*)//; $x2 = $1;
|
|
||||||
return 0
|
|
||||||
if $x1 eq '' && $x2 eq '';
|
|
||||||
$r = $x1 cmp $x2;
|
|
||||||
}
|
|
||||||
} until $r;
|
|
||||||
return $r;
|
|
||||||
}
|
|
||||||
|
|
||||||
my ($e1, $v1, $r1) = $evr1 =~ /^(?:(\d*):)?(.*?)(?:-([^-]*))?$/;
|
|
||||||
my ($e2, $v2, $r2) = $evr2 =~ /^(?:(\d*):)?(.*?)(?:-([^-]*))?$/;
|
|
||||||
my $r = _rpm_cmp($e1 || 0, $e2 || 0);
|
|
||||||
$r = _rpm_cmp($v1, $v2)
|
|
||||||
unless $r;
|
|
||||||
$r = _rpm_cmp($r1, $r2)
|
|
||||||
unless $r;
|
|
||||||
return $r;
|
|
||||||
}
|
|
||||||
|
|
||||||
my $reorder = sub { return @_ };
|
|
||||||
my $key = 0;
|
|
||||||
|
|
||||||
GetOptions ("r|reverse" => sub { $reorder = sub { return reverse @_ } },
|
|
||||||
"k|key=i" => \$key)
|
|
||||||
or do {
|
|
||||||
print STDERR "Usage\n";
|
|
||||||
exit 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
if ($key == 0) {
|
|
||||||
# Sort by entire lines
|
|
||||||
map { print } &$reorder(sort { rpm_cmp_versions($a, $b) } <>);
|
|
||||||
} else {
|
|
||||||
# Sort by field $key
|
|
||||||
my @data = map { [(split)[$key-1], $_] } <>;
|
|
||||||
map { print } &$reorder(map { $_->[1] }
|
|
||||||
sort { rpm_cmp_versions($a->[0], $b->[0]) } @data);
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
#! /bin/sh
|
|
||||||
|
|
||||||
# Create a table of all symbol sets defined in all /boot/symsets*.tar.gz
|
|
||||||
# files.
|
|
||||||
#
|
|
||||||
# Format:
|
|
||||||
# kernelrelease/modver/symbol <tab> symset <tab> symset_hash
|
|
||||||
#
|
|
||||||
# This table is needed for computing the appropriate Requires: tags for
|
|
||||||
# kernel module packages.
|
|
||||||
|
|
||||||
tmpdir=$(mktemp -t -d ${0##*/}.XXXXXX)
|
|
||||||
trap "cd / ; rm -rf $tmpdir" EXIT
|
|
||||||
cd $tmpdir
|
|
||||||
|
|
||||||
shopt -s nullglob
|
|
||||||
for symsets in /boot/symsets-*.tar.gz; do
|
|
||||||
zcat $symsets \
|
|
||||||
| tar xf -
|
|
||||||
done
|
|
||||||
|
|
||||||
for symsets in /usr/src/kernels/*/symsets-*.tar.gz; do
|
|
||||||
zcat $symsets \
|
|
||||||
| tar xf -
|
|
||||||
done
|
|
||||||
|
|
||||||
for symsets in *; do
|
|
||||||
krel=${symsets#symsets-}
|
|
||||||
for symset in $symsets/*; do
|
|
||||||
class=${symset##*/} ; class=${class%.*}
|
|
||||||
hash=${symset##*.}
|
|
||||||
awk '
|
|
||||||
BEGIN { FS = "\t" ; OFS = "\t" }
|
|
||||||
{ sub(/0x0*/, "", $1)
|
|
||||||
print krel "/" $1 "/" $2, class, hash }
|
|
||||||
' krel="$krel" class="$class" hash="$hash" $symset
|
|
||||||
done
|
|
||||||
done
|
|
||||||
|
|
||||||
# vim:shiftwidth=4 softtabstop=4
|
|
Loading…
Reference in new issue