diff --git a/.gitignore b/.gitignore index dc103a8..e69de29 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +0,0 @@ -/gts-annobin-plugin-select.sh -/README -/sudo.sh diff --git a/SOURCES/README b/SOURCES/README new file mode 100644 index 0000000..23adf6c --- /dev/null +++ b/SOURCES/README @@ -0,0 +1,29 @@ +Package %{scl_name} is the main package for Red Hat GCC +Toolset 14. By installing the %{scl_name} package, you will get +the working set of packages that are included in Red Hat GCC +Toolset 14, which includes development and debugging tools. + +Usage: scl enable %{scl} + +Red Hat GCC Toolset allows you to build and execute applications +which are not located in the filesystem root hierarchy, but are +stored in an alternative location, which is %{_scl_root} in case +of the %{scl_name} collection. + +Examples: +scl enable %{scl_name} 'command --arg' + Run a specific command with the argument --arg within the %{scl_name} + Red Hat GCC Toolset environment. + +scl enable %{scl_name} 'gcc' + Run GCC from the %{scl_name} Red Hat GCC Toolset. + +scl enable %{scl_name} 'bash' + Run an interactive shell wherein the %{scl_name} software collection + is enabled. + +scl enable %{scl_name} 'man gcc' + Show man pages for the gcc command, which is a part of the + %{scl_name} Red Hat GCC Toolset. + +Report bugs to . diff --git a/SOURCES/gts-annobin-plugin-select.sh b/SOURCES/gts-annobin-plugin-select.sh new file mode 100644 index 0000000..8beac82 --- /dev/null +++ b/SOURCES/gts-annobin-plugin-select.sh @@ -0,0 +1,226 @@ +#!/usr/bin/sh +# This is a script to switch the symlinks in a GTS gcc's plugin +# directory so that they select either the GTS-annobin provided +# plugin or the GTS-gcc provided plugin. + +# Author: Nick Clifton +# Copyright (c) 2021-2022 Red Hat. +# +# This 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, or (at your +# option) any later version. + +# It 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. +# +# Usage: +# gts-annobin-plugin-select scl_root +# + +# Set this variable to non-zero to enable the generation of debugging +# messages. +debug=0 + +if test "x$1" = "x" ; +then + if [ $debug -eq 1 ] + then + echo " gts-annobin-plugin-select: Must provide a root directory" + fi + exit 1 +else + scl_root=$1 +fi + +# This script is similar to the redhat-annobin-plugin-select.sh script which +# is part of the redhat-rpm-config package. That scripts decides between two +# versions of the annobin plugin for the system compiler and stores it choice +# in a symlink in the /usr/lib/rpm/redhat directory. The choice eventually +# resolves into the system gcc attempting to load either a plugin called +# annobin.so or a plugin called gcc-annobin.so. + +# In a GTS environment the choice made by redhat-annobin-plugin-select.sh +# might not be appropriate (or even possible). The choice cannot be changed +# because the system compilation environment must remain instact. So instead +# the GTS versions of gcc and annobin install plugins called gts-annobin.so +# and gts-gcc-annobin.so (into the GTS gcc's plugin directory) and this script +# creates a pair of symlinks called annobin.so and gcc-annobin.so. In this +# way the decision made by redhat-annobin-plugin-select.sh is overridden +# without affecting any system files. + +# We cannot be sure that this script will run inside a GTS enabled shell, +# so we have to use absolute paths. +gts_gcc=$scl_root/usr/bin/gcc + +if [ ! -x $gts_gcc ] +then + if [ $debug -eq 1 ] + then + echo " gts-annobin-plugin-select: Could not find gcc. Expected: $gts_gcc" + fi + exit 0 +fi + +# This is where the annobin package stores the information on the version +# of gcc that built the annobin plugin. +aver=`$gts_gcc --print-file-name=plugin`/annobin-plugin-version-info + +# This is where the gcc package stores its version information. +gver=`$gts_gcc --print-file-name=rpmver` + +aplugin=`$gts_gcc --print-file-name=plugin`/gts-annobin.so.0.0.0 +gplugin=`$gts_gcc --print-file-name=plugin`/gts-gcc-annobin.so.0.0.0 + +install_annobin_version=0 +install_gcc_version=0 + +if [ -f $aplugin ] +then + if [ -f $gplugin ] + then + if [ $debug -eq 1 ] + then + echo " gts-annobin-plugin-select: Both plugins exist, checking version information" + fi + + if [ -f $gver ] + then + if [ -f $aver ] + then + if [ $debug -eq 1 ] + then + echo " gts-annobin-plugin-select: Both plugin version files exist - comparing..." + fi + + # Get the first line from the version info files. This is just in + # case there are extra lines in the files. + avers=`head --lines=1 $aver` + gvers=`head --lines=1 $gver` + + if [ $debug -eq 1 ] + then + echo " gts-annobin-plugin-select: Annobin plugin built by gcc $avers" + echo " gts-annobin-plugin-select: GCC plugin built by gcc $gvers" + fi + + # If both plugins were built by the same version of gcc then select + # the one from the annobin package (in case it is built from newer + # sources). If the plugin builder versions differ, select the gcc + # built version instead. This assumes that the gcc built version + # always matches the installed gcc, which should be true. + if [ $avers = $gvers ] + then + if [ $debug -eq 1 ] + then + echo " gts-annobin-plugin-select: Both plugins built by the same compiler - using annobin-built plugin" + fi + install_annobin_version=1 + else + if [ $debug -eq 1 ] + then + echo " gts-annobin-plugin-select: Versions differ - using gcc-built plugin" + fi + install_gcc_version=1 + fi + else + if [ $debug -eq 1 ] + then + echo " gts-annobin-plugin-select: Annobin version file does not exist, using gcc-built plugin" + fi + install_gcc_version=1 + fi + else + if [ -f $aver ] + then + # FIXME: This is suspicious. If the installed GCC does not supports plugins + # then enabling the annobin plugin will not work. + if [ $debug -eq 1 ] + then + echo " gts-annobin-plugin-select: GCC plugin version file does not exist, using annobin-built plugin" + fi + install_annobin_version=1 + else + if [ $debug -eq 1 ] + then + echo " gts-annobin-plugin-select: Neither version file exists - playing safe and using gcc-built plugin" + echo " gts-annobin-plugin-select: Note: expected to find $aver and/or $gver" + fi + install_gcc_version=1 + fi + fi + else + if [ $debug -eq 1 ] + then + echo " gts-annobin-plugin-select: Only the annobin plugin exists - using that" + fi + install_annobin_version=1 + fi +else + if [ -f $gplugin ] + then + if [ $debug -eq 1 ] + then + echo " gts-annobin-plugin-select: Only the gcc plugin exists - using that" + fi + install_gcc_version=1 + else + aplugin=`$gts_gcc --print-file-name=plugin`/annobin.so.0.0.0 + + if [ -f $aplugin ] + then + if [ $debug -eq 1 ] + then + echo " gts-annobin-plugin-select: Original annobin plugin exists - renaming" + echo " gts-annobin-plugin-select: Using renamed original annobin plugin" + fi + pushd `$gts_gcc --print-file-name=plugin` > /dev/null + mv annobin.so.0.0.0 gts-annobin.so.0.0.0 + popd > /dev/null + install_annobin_version=1 + else + if [ $debug -eq 1 ] + then + echo " gts-annobin-plugin-select: Neither plugin exists - playing safe and not changing anything" + echo " gts-annobin-plugin-select: Note: expected to find $aplugin and/or $gplugin" + fi + fi + fi +fi + +if [ $install_annobin_version -eq 1 ] +then + if [ $debug -eq 1 ] + then + echo " gts-annobin-plugin-select: Setting symlinks for the annobin version of the plugin" + fi + pushd `$gts_gcc --print-file-name=plugin` > /dev/null + rm -f gcc-annobin.so.0.0.0 annobin.so.0.0.0 gcc-annobin.so annobin.so + ln -s gts-annobin.so.0.0.0 annobin.so + ln -s gts-annobin.so.0.0.0 gcc-annobin.so + ln -s gts-annobin.so.0.0.0 annobin.so.0.0.0 + ln -s gts-annobin.so.0.0.0 gcc-annobin.so.0.0.0 + popd > /dev/null + +else if [ $install_gcc_version -eq 1 ] +then + if [ $debug -eq 1 ] + then + echo " gts-annobin-plugin-select: Setting symlinks for the gcc version of the plugin" + fi + pushd `$gts_gcc --print-file-name=plugin` > /dev/null + rm -f gcc-annobin.so.0.0.0 annobin.so.0.0.0 gcc-annobin.so annobin.so + ln -s gts-gcc-annobin.so.0.0.0 annobin.so + ln -s gts-gcc-annobin.so.0.0.0 gcc-annobin.so + ln -s gts-gcc-annobin.so.0.0.0 annobin.so.0.0.0 + ln -s gts-gcc-annobin.so.0.0.0 gcc-annobin.so.0.0.0 + popd > /dev/null +else + if [ $debug -eq 1 ] + then + echo " gts-annobin-plugin-select: NOT CHANGING SYMLINKS" + fi +fi +fi diff --git a/SOURCES/sudo.sh b/SOURCES/sudo.sh new file mode 100644 index 0000000..7feaa8f --- /dev/null +++ b/SOURCES/sudo.sh @@ -0,0 +1,41 @@ +#! /bin/bash + +# Emulate /usr/bin/sudo, so that SCL environment variables +# are passed through via an /bin/env wrapper. +# Includes work by Andy Fong + +cmd_started=false +is_option_param_next=false +for arg in "$@" +do + case "$arg" in + *\'*) + arg= ;; + esac + if [ "$cmd_started" = true ]; then + cmd_options="$cmd_options '$arg'" + elif [ "$is_option_param_next" = true ]; then + sudo_options="$sudo_options $arg" + is_option_param_next=false + elif [[ $arg == -* ]]; then + sudo_options="$sudo_options $arg" + case "$arg" in + # all the options that take a parameter + "-g" | "-h" | "-p" | "-u" | "-U" | "-C" | "-s" | "-r" | "-t" | "-T") + is_option_param_next=true + ;; + "--") + cmd_started=true + ;; + esac + elif [[ $arg == *=* ]]; then + sudo_options="$sudo_options $arg" + else + cmd_options="$cmd_options '$arg'" + cmd_started=true + fi +done +if [ "$sudo_options" == "" ]; then + sudo_options="-E" +fi +exec /usr/bin/sudo $sudo_options env LD_LIBRARY_PATH=$LD_LIBRARY_PATH PATH=$PATH scl enable %{scl} "$cmd_options" diff --git a/gcc-toolset-14.spec b/SPECS/gcc-toolset-14.spec similarity index 97% rename from gcc-toolset-14.spec rename to SPECS/gcc-toolset-14.spec index bb3f85c..5fbff3e 100644 --- a/gcc-toolset-14.spec +++ b/SPECS/gcc-toolset-14.spec @@ -8,7 +8,7 @@ BuildRequires: scl-utils-build Summary: Package that installs %scl Name: %scl_name Version: 14.0 -Release: 1%{?dist} +Release: 0%{?dist} License: GPLv2+ Group: Applications/File BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -19,9 +19,7 @@ Source2: gts-annobin-plugin-select.sh Requires: %{scl_prefix}runtime Requires: %{scl_prefix}gcc %{scl_prefix}gcc-c++ %{scl_prefix}gcc-gfortran Requires: %{scl_prefix}binutils -%if 0%{?rhel} <= 8 Requires: %{scl_prefix}gdb -%endif Requires: %{scl_prefix}dwz Requires: %{scl_prefix}annobin-plugin-gcc Obsoletes: %{name} < %{version}-%{release} @@ -191,11 +189,8 @@ if [ $1 = 0 ]; then fi %changelog -* Wed Aug 14 2024 Marek Polacek - 14.0-1 -- don't require gdb on RHEL9 (RHEL-54245) - * Mon Apr 29 2024 Marek Polacek - 14.0-0 -- update to GTS 14 (RHEL-34748) +- update to GTS 14 (RHEL-34596) * Thu Aug 3 2023 Marek Polacek - 13.0-2 - require GTS 13 packages (#2217520) diff --git a/gating.yaml b/gating.yaml deleted file mode 100644 index 8a619e4..0000000 --- a/gating.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- !Policy -product_versions: - - rhel-9 -decision_context: osci_compose_gate -rules: - - !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional} - - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} diff --git a/sources b/sources deleted file mode 100644 index a79a382..0000000 --- a/sources +++ /dev/null @@ -1,3 +0,0 @@ -SHA512 (gts-annobin-plugin-select.sh) = f5e5f4dc054bdd09c6d185bc3c671376ff8b825c8fa3f2969e25e10358405aa105f74154c63b6dc025cbe7e09eb24693664048685aaf481cc2a65d12ad9476b8 -SHA512 (README) = a4ed9ea6bb2cdc32cc908cdaf56faf6a813712c2b807a31e286a5fa2faead5285be025363b66d699e30afe34213c66421b76321ef0ca7b57e5e3c5610d32c3c8 -SHA512 (sudo.sh) = 1378412b39b31f1f76b9d7b9fce5ea679e764a2fd85804fbc3b9ce1c8b5e9b1694be854b4407d1b5dba229763127c9cc64bc09bdf87b384c93536b97d001520d diff --git a/tests/gts-smoketest/PURPOSE b/tests/gts-smoketest/PURPOSE deleted file mode 100644 index bdf2003..0000000 --- a/tests/gts-smoketest/PURPOSE +++ /dev/null @@ -1,3 +0,0 @@ -Test Name: gts-smoketest -Author: -Short Description: Check the metapackage installability diff --git a/tests/gts-smoketest/runtest.sh b/tests/gts-smoketest/runtest.sh deleted file mode 100755 index 53e9d18..0000000 --- a/tests/gts-smoketest/runtest.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -set -e -set -x - -# This is a metapackage. It's main purpose is to pull other packages -# into play via the rpm deps. -rpm -q gcc-toolset-14 -echo -echo RESULT: PASS diff --git a/tests/tests.yml b/tests/tests.yml deleted file mode 100644 index 9dc0e12..0000000 --- a/tests/tests.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- -- hosts: localhost - roles: - - role: standard-test-basic - tags: - - classic - tests: - - gts-smoketest - required_packages: - - scl-utils