From a8e239acb42d7da9e8b6f4e3b603485ec830346d Mon Sep 17 00:00:00 2001 From: tigro Date: Wed, 5 Jun 2024 12:17:14 +0300 Subject: [PATCH] import buildsys-build-msvsphere-1-0.8.el9 --- .buildsys-build-msvsphere.metadata | 0 SOURCES/buildsys-build-msvsphere-README | 1 + ...dsys-build-msvsphere-kerneldevpkgs-current | 1 + .../buildsys-build-msvsphere-list-kernels.sh | 303 ++++++++++++++++++ SPECS/buildsys-build-rpmfusion.spec | 83 +++++ 5 files changed, 388 insertions(+) create mode 100644 .buildsys-build-msvsphere.metadata create mode 100644 SOURCES/buildsys-build-msvsphere-README create mode 100644 SOURCES/buildsys-build-msvsphere-kerneldevpkgs-current create mode 100755 SOURCES/buildsys-build-msvsphere-list-kernels.sh create mode 100644 SPECS/buildsys-build-rpmfusion.spec diff --git a/.buildsys-build-msvsphere.metadata b/.buildsys-build-msvsphere.metadata new file mode 100644 index 0000000..e69de29 diff --git a/SOURCES/buildsys-build-msvsphere-README b/SOURCES/buildsys-build-msvsphere-README new file mode 100644 index 0000000..096c8ab --- /dev/null +++ b/SOURCES/buildsys-build-msvsphere-README @@ -0,0 +1 @@ +This is a metapackage without payload used by the buildsystem diff --git a/SOURCES/buildsys-build-msvsphere-kerneldevpkgs-current b/SOURCES/buildsys-build-msvsphere-kerneldevpkgs-current new file mode 100644 index 0000000..7834ee5 --- /dev/null +++ b/SOURCES/buildsys-build-msvsphere-kerneldevpkgs-current @@ -0,0 +1 @@ +5.14.0-427.13.1.el9_4 diff --git a/SOURCES/buildsys-build-msvsphere-list-kernels.sh b/SOURCES/buildsys-build-msvsphere-list-kernels.sh new file mode 100755 index 0000000..f9634b6 --- /dev/null +++ b/SOURCES/buildsys-build-msvsphere-list-kernels.sh @@ -0,0 +1,303 @@ +#!/bin/bash +# +# buildsys-build-list-kernels.sh - Helper script for building kernel module RPMs for Fedora +# +# Copyright (c) 2007 Thorsten Leemhuis +# 2012 Nicolas Chauvet +# +# 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. +# + +shopt -s extglob + +myver="0.2.1" +repo=msvsphere +myprog="buildsys-build-${repo}-kerneldevpkgs" +supported_targetarchs="i686 x86_64 ppc ppc64 ppc64le ppc64p7 aarch64 armv5tel armv7l armv7hl s390x" +#This has changed in Fedora >= 20 +variant_sep="+" +if [[ -e ./buildsys-build-${repo}-kerneldevpkgs-current ]]; then + prefix=./buildsys-build-${repo}- +else + prefix=/usr/share/buildsys-build-${repo}/ +fi + + +requires= +filterfile= +target=$(uname -m) +#show_kernels="current" + +bb_list_kernels_default() +{ + echo ${1} +} + +bb_list_kernels_i686() +{ + bb_list_kernels_default ${1} + echo ${1}PAE +} + +bb_list_kernels_x86_64() +{ + bb_list_kernels_default ${1} +} + +bb_list_kernels_ppc() +{ + bb_list_kernels_default ${1} + echo ${1}smp +} + +bb_list_kernels_ppc64() +{ + bb_list_kernels_default ${1} +} + +bb_list_kernels_ppc64le() +{ + bb_list_kernels_default ${1} +} + +bb_list_kernels_ppc64p7() +{ + bb_list_kernels_default ${1} +} + + +bb_list_kernels_armv5tel() +{ + bb_list_kernels_default ${1} +} + +bb_list_kernels_armv7l() +{ + bb_list_kernels_default ${1} +} + +bb_list_kernels_armv7hl() +{ + bb_list_kernels_default ${1} + echo ${1}lpae +} + +bb_list_kernels_aarch64() +{ + bb_list_kernels_default ${1} +} + +bb_list_kernels_s390x() +{ + bb_list_kernels_default ${1} +} + +bb_list_kernels_sparc64() +{ + bb_list_kernels_default ${1} +} + + +print_kernels () +{ + local this_target=${1} + local this_grepoptions= + local this_command= + local this_kernellistfiles="${prefix}kerneldevpkgs-current" + + # error out if not defined + if (( $(stat -c%s "${this_kernellistfiles}") <= 1 )); then + echo "(no kernels defined)" + return 1 + fi + + # go + bb_list_kernels_${this_target} $(cat ${this_kernellistfiles}) | while read this_kernel; do + this_kernel_verrel=${this_kernel%%$kernels_known_variants} + this_kernel_variant=${this_kernel##$this_kernel_verrel} + + if [[ "${requires}" ]] || [[ "${buildrequires}" ]]; then + if echo ${this_kernel} | grep -- 'default' &> /dev/null; then + if [[ "${requires}" ]]; then + echo "Requires: kernel${this_kernel_variant:+-${this_kernel_variant}}-devel%{_isa}" + fi + + if [[ "${buildrequires}" ]]; then + echo "BuildRequires: kernel${this_kernel_variant:+-${this_kernel_variant}}-devel%{_isa}" + fi + else + if [[ "${requires}" ]]; then + echo "Requires: kernel-devel-uname-r = ${this_kernel_verrel}.${this_target}${this_kernel_variant:+${variant_sep}${this_kernel_variant}}" + fi + + if [[ "${buildrequires}" ]]; then + echo "BuildRequires: kernel-devel-uname-r = ${this_kernel_verrel}.${this_target}${this_kernel_variant:+${variant_sep}${this_kernel_variant}}" + fi + fi + else + if echo ${this_kernel} | grep -- 'default' &> /dev/null; then + # fixme: there are better/reliable ways to get the latest version, but this should do in the + # buildsys, the only place where this normally is used; hardcoding the variants is also not ideal + if [[ "${this_kernel_variant}" ]]; then + # non-standard-kernel + local real_version="$(ls -1r /usr/src/kernels/ | grep -v -e "${this_kernel_variant}PAE$" | head -n1)" + real_version=${real_version%%.$kernels_known_variants} + else + # standard kernel + local real_version="$(ls -1r /usr/src/kernels/ | grep -v -e "PAE$" -e "smp$" | head -n1)" + fi + if [[ "${real_version}" ]]; then + echo ${real_version}${this_kernel_variant:+.${this_kernel_variant}} + else + # should we fail here? + echo unknown.${this_target}${this_kernel_variant:+.${this_kernel_variant}} + fi + else + echo ${this_kernel_verrel}.${this_target}${this_kernel_variant:+${variant_sep}${this_kernel_variant}} + fi + fi + done +} + +print_requires () +{ + local this_kernel_verrel + local this_kernel_variant + + for this_arch in ${supported_targetarchs}; do + echo $'\n'"%ifarch ${this_arch}" + print_kernels ${this_arch} + echo "%endif" + done +} + +myprog_help () +{ + echo "Usage: $(basename ${0}) [OPTIONS]" + echo $'\n'"Prints a list of all avilable kernel-devel packages in the buildsys, as"$'\n'"defined by the buildsys-buildkmods-all package." + echo $'\n'"Available options:" +# echo " --filterfile -- filter the results with grep --file " +# echo " --current -- only list current up2date kernels" +# echo " --newest -- only list newly released kernels" + echo " --requires -- print list as requires with ifarch section for"$'\n'" further use in a RPM spec file package header" + echo " --prefix -- look for the data files in " + echo " --target -- target-arch (ignored if --requires is used)" + echo $'\n'"Supported target archs: ${supported_targetarchs}" +} + +while [ "${1}" ] ; do + case "${1}" in + --prefix) + shift + if [[ ! "${1}" ]] ; then + echo "Error: Please provide a prefix where to find data-files together with --prefix" >&2 + exit 2 + fi + prefix="${1}" + shift + ;; +# not used anymore: + --filterfile) + shift +# if [[ ! "${1}" ]] ; then +# echo "Error: Please provide path to a filter-file together with --filterfile" >&2 +# exit 2 +# elif [[ ! -e "${1}" ]]; then +# echo "Error: Filterfile ${1} not found" >&2 +# exit 2 +# fi +# filterfile="${1}" + shift + ;; + --target) + shift + if [[ ! "${1}" ]] ; then + echo "Error: Please provide one of the supported targets together with --target" >&2 + exit 2 + fi + + for this_arch in ${supported_targetarchs}; do + if [[ "${this_arch}" = "${1}" ]]; then + target="${1}" + shift + break + fi + done + + if [[ ! "${target}" ]]; then + echo "Error: ${1} is not a supported target" >&2 + exit 2 + fi + ;; + --requires) + shift + requires="true" + ;; + --buildrequires) + shift + buildrequires="true" + ;; +# not used anymore: + --current) + shift +# show_kernels="current" + ;; +# not used anymore: + --newest) + shift +# show_kernels="newest" + ;; + --help) + myprog_help + exit 0 + ;; + --version) + echo "${myprog} ${myver}" + exit 0 + ;; + *) + echo "Error: Unknown option '${1}'."$'\n' >&2 + myprog_help >&2 + exit 2 + ;; + esac +done + +# more init after parsing command line parameters +if [[ -e ./kmodtool-kernel-variants ]] ; then + kernels_known_variants="$(cat ./kmodtool-kernel-variants)" +elif [[ -e /usr/share/kmodtool/kernel-variants ]] ; then + kernels_known_variants="$(cat /usr/share/kmodtool/kernel-variants)" +else + echo "Could not find /usr/share/kmodtool/kernel-variants (required)" >&2 + exit 2 +fi +# sanity check to make sure it's really filled +if [[ ! "${kernels_known_variants}" ]] ; then + echo "could not determine known kernel variants" + exit 2 +fi + +# go +if [[ "${requires}" ]] || [[ "${buildrequires}" ]] ; then + print_requires +else + print_kernels ${target} +fi diff --git a/SPECS/buildsys-build-rpmfusion.spec b/SPECS/buildsys-build-rpmfusion.spec new file mode 100644 index 0000000..a2d066a --- /dev/null +++ b/SPECS/buildsys-build-rpmfusion.spec @@ -0,0 +1,83 @@ +%define repo msvsphere + +Name: buildsys-build-%{repo} +Version: 1 +Release: 0.8%{?dist} +Summary: Tools and files used by the %{repo} buildsys + +License: MIT +URL: http://rpmfusion.org + +Source2: %{name}-list-kernels.sh +Source5: %{name}-README +Source11: %{name}-kerneldevpkgs-current + +# provide this to avoid a error when generating akmods packages +Provides: buildsys-build-rpmfusion-kerneldevpkgs-akmod-%{_target_cpu} + +# unneeded +%define debug_package %{nil} + +%description +This package contains tools and lists of recent kernels that get used when +building kmod-packages. + +%package kerneldevpkgs-current +Summary: Meta-package to get all current kernel-devel packages into the buildroot +Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} +Provides: %{name}-kerneldevpkgs-%{_target_cpu} = %{?epoch:%{epoch}:}%{version}-%{release} +Provides: %{name}-kerneldevpkgs-current-%{_target_cpu} = %{?epoch:%{epoch}:}%{version}-%{release} +Provides: %{name}-kerneldevpkgs-newest-%{_target_cpu} = %{?epoch:%{epoch}:}%{version}-%{release} + +Requires: %{_bindir}/kmodtool +BuildRequires: %{_bindir}/kmodtool + +# we use our own magic here to safe ourself to cut'n'paste the BR +%{expand:%(bash %{SOURCE2} --current --requires --prefix %{_sourcedir}/%{name}- 2>/dev/null)} + +%description kerneldevpkgs-current +This is a meta-package used by the buildsystem to track the kernel-devel +packages for all current up-to-date kernels into the buildroot to build +kmods against them. + +%files kerneldevpkgs-current +%doc .tmp/current/README + +%prep +# for debugging purposes output the stuff we use during the rpm generation +bash %{SOURCE2} --current --requires --prefix %{_sourcedir}/%{name}- +sleep 2 + + +%build +echo nothing to build + + +%install +rm -rf $RPM_BUILD_ROOT .tmp/ +mkdir -p $RPM_BUILD_ROOT/%{_datadir}/%{name} $RPM_BUILD_ROOT/%{_bindir} .tmp/newest .tmp/current + +# install the stuff we need +install -p -m 0755 %{SOURCE2} $RPM_BUILD_ROOT/%{_bindir}/%{name}-kerneldevpkgs +install -p -m 0644 %{SOURCE5} .tmp/current/README +ln -s kerneldevpkgs-current $RPM_BUILD_ROOT/%{_datadir}/%{name}/kerneldevpkgs-newest +install -p -m 0644 %{SOURCE11} $RPM_BUILD_ROOT/%{_datadir}/%{name}/kerneldevpkgs-current + + +# adjust default-path +sed -i 's|^default_prefix=.*|default_prefix=%{_datadir}/%{name}/|' \ + $RPM_BUILD_ROOT/%{_bindir}/%{name}-kerneldevpkgs + + +%files +%{_bindir}/* +%{_datadir}/%{name}/ + + + +%changelog +* Wed Jun 05 2024 Arkady L. Shane - 1-0.8 +- Rebuilt for MSVSphere 9.4 + +* Tue Jun 04 2024 Leonid Kanter +- initial build for kernel 5.14.0-427.el9_4