From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7840) id E375A3835839; Fri, 22 Jul 2022 00:08:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E375A3835839 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Eugene Rozenfeld To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/microsoft/heads/main)] Adding a custom version of gcc_release script (github/scripts/gcc_release). This custom gcc_release X-Act-Checkin: gcc X-Git-Author: Navid Rahimi X-Git-Refname: refs/vendors/microsoft/heads/main X-Git-Oldrev: e5c7c2104388505cc294541a89d7c9a33bf2d6a3 X-Git-Newrev: ee124932e1351c66717995e2caeb408c647a3ff1 Message-Id: <20220722000855.E375A3835839@sourceware.org> Date: Fri, 22 Jul 2022 00:08:55 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jul 2022 00:08:56 -0000 https://gcc.gnu.org/g:ee124932e1351c66717995e2caeb408c647a3ff1 commit ee124932e1351c66717995e2caeb408c647a3ff1 Author: Navid Rahimi Date: Mon Jun 13 21:56:30 2022 -0700 Adding a custom version of gcc_release script (github/scripts/gcc_release). This custom gcc_release script supports building tar.xz files on Github Action containers. Improvement for Microsoft internal release and adding Github Action pipeline for generating tarball and (prototype) rpm files. * .github/scripts/gcc_release * .github/workflows/package-source-tarball.yaml * .github/workflows/package-rpm.yaml * .github/scripts/configure-gcc.sh Diff: --- .github/Mariner/specs/11.2.1/gcc.specs | 386 +++++++++++++ .github/actions/build-tarball/action.yaml | 89 +++ .github/scripts/configure-gcc.sh | 2 +- .github/scripts/gcc_release | 799 ++++++++++++++++++++++++++ .github/workflows/package-rpm.yaml | 95 +++ .github/workflows/package-source-tarball.yaml | 72 +++ .github/workflows/package.yaml | 51 -- 7 files changed, 1442 insertions(+), 52 deletions(-) diff --git a/.github/Mariner/specs/11.2.1/gcc.specs b/.github/Mariner/specs/11.2.1/gcc.specs new file mode 100644 index 00000000000..bd6e8a346bb --- /dev/null +++ b/.github/Mariner/specs/11.2.1/gcc.specs @@ -0,0 +1,386 @@ +%global security_hardening nofortify +%define _use_internal_dependency_generator 0 +Summary: Contains the GNU compiler collection +Name: gcc +Version: 11.2.1 +Release: 2%{?dist} +License: GPLv2+ +Vendor: Microsoft Corporation +Distribution: Mariner +Group: Development/Tools +URL: https://gcc.gnu.org/ +Source0: ~/output_dir/gcc-%{version}/gcc-%{version}.tar.xz +Requires: gcc-c++ = %{version}-%{release} +Requires: gmp +Requires: libgcc-atomic = %{version}-%{release} +Requires: libgcc-devel = %{version}-%{release} +Requires: libgomp-devel = %{version}-%{release} +Requires: libmpc +Requires: libstdc++-devel = %{version}-%{release} +Provides: cpp = %{version}-%{release} +Provides: gcc-plugin-devel = %{version}-%{release} +Provides: libasan = %{version}-%{release} +Provides: libasan%{?_isa} = %{version}-%{release} +Provides: libasan-static = %{version}-%{release} +Provides: libasan-static%{?_isa} = %{version}-%{release} +Provides: liblsan = %{version}-%{release} +Provides: liblsan%{?_isa} = %{version}-%{release} +Provides: liblsan-static = %{version}-%{release} +Provides: liblsan-static%{?_isa} = %{version}-%{release} +Provides: libtsan = %{version}-%{release} +Provides: libtsan%{?_isa} = %{version}-%{release} +Provides: libtsan-static = %{version}-%{release} +Provides: libtsan-static%{?_isa} = %{version}-%{release} +Provides: libubsan = %{version}-%{release} +Provides: libubsan%{?_isa} = %{version}-%{release} +Provides: libubsan-static = %{version}-%{release} +Provides: libubsan-static%{?_isa} = %{version}-%{release} +Provides: libquadmath = %{version}-%{release} +Provides: libquadmath-devel = %{version}-%{release} +Provides: libquadmath-devel%{?_isa} = %{version}-%{release} +#%if %{with_check} +#BuildRequires: autogen +#BuildRequires: dejagnu +#%endif + +%description +The GCC package contains the GNU compiler collection, +which includes the C and C++ compilers. + +%package -n gfortran +Summary: GNU Fortran compiler. +Group: Development/Tools +Requires: gcc = %{version}-%{release} +Provides: gcc-gfortran = %{version}-%{release} + +%description -n gfortran +The gfortran package contains GNU Fortran compiler. + +%package -n libgcc +Summary: GNU C Library +Group: System Environment/Libraries + +%description -n libgcc +The libgcc package contains GCC shared libraries for gcc. + +%package -n libgcc-atomic +Summary: GNU C Library for atomic counter updates +Group: System Environment/Libraries +Requires: libgcc = %{version}-%{release} +Provides: libatomic = %{version}-%{release} + +%description -n libgcc-atomic +The libgcc package contains GCC shared libraries for atomic counter updates. + +%package -n libgcc-devel +Summary: GNU C Library +Group: Development/Libraries +Requires: libgcc = %{version}-%{release} + +%description -n libgcc-devel +The libgcc package contains GCC shared libraries for gcc . +This package contains development headers and static library for libgcc. + +%package c++ +Summary: C++ support for GCC +Group: System Environment/Libraries +Requires: gcc = %{version}-%{release} +Requires: libstdc++-devel = %{version}-%{release} +Provides: gcc-g++ = %{version}-%{release} +Provides: g++ = %{version}-%{release} + +%description c++ +This package adds C++ support to the GNU Compiler Collection. +It includes support for most of the current C++ specification, +including templates and exception handling. + +%package -n libstdc++ +Summary: GNU C Library +Group: System Environment/Libraries +Requires: libgcc = %{version}-%{release} + +%description -n libstdc++ +This package contains the GCC Standard C++ Library v3, an ongoing project to implement the ISO/IEC 14882:1998 Standard C++ library. + +%package -n libstdc++-devel +Summary: GNU C Library +Group: Development/Libraries +Requires: libstdc++ = %{version}-%{release} +Provides: libstdc++-static = %{version}-%{release} + +%description -n libstdc++-devel +This is the GNU implementation of the standard C++ libraries. +This package includes the headers files and libraries needed for C++ development. + +%package -n libgomp +Summary: GNU C Library +Group: System Environment/Libraries + +%description -n libgomp +An implementation of OpenMP for the C, C++, and Fortran 95 compilers in the GNU Compiler Collection. + +%package -n libgomp-devel +Summary: Development headers and static library for libgomp +Group: Development/Libraries +Requires: libgomp = %{version}-%{release} + +%description -n libgomp-devel +An implementation of OpenMP for the C, C++, and Fortran 95 compilers in the GNU Compiler Collection. +This package contains development headers and static library for libgomp + +%prep +%setup -q +# disable no-pie for gcc binaries +sed -i '/^NO_PIE_CFLAGS = /s/@NO_PIE_CFLAGS@//' gcc/Makefile.in + +%build +CFLAGS="`echo " %{build_cflags} " | sed 's/-Werror=format-security/-Wno-error=format-security/'`" +CXXFLAGS="`echo " %{build_cxxflags} " | sed 's/-Werror=format-security/-Wno-error=format-security/'`" +FCFLAGS="`echo " %{build_fflags} " | sed 's/-Werror=format-security/-Wno-error=format-security/'`" +export CFLAGS +export CXXFLAGS +export FCFLAGS + +SED=sed \ +%configure \ + --enable-shared \ + --enable-threads=posix \ + --enable-__cxa_atexit \ + --enable-clocale=gnu \ + --enable-languages=c,c++,fortran \ + --disable-multilib \ + --disable-bootstrap \ + --enable-linker-build-id \ + --enable-plugin \ + --enable-default-pie \ + --with-system-zlib +make %{?_smp_mflags} + +%install +make %{?_smp_mflags} DESTDIR=%{buildroot} install +install -vdm 755 %{buildroot}/%{_libdir} +ln -sv %{_bindir}/cpp %{buildroot}/%{_libdir} +ln -sv gcc %{buildroot}%{_bindir}/cc +install -vdm 755 %{buildroot}%{_datarootdir}/gdb/auto-load%{_libdir} +mv -v %{buildroot}%{_lib64dir}/*gdb.py %{buildroot}%{_datarootdir}/gdb/auto-load%{_libdir} +chmod 755 %{buildroot}/%{_lib64dir}/libgcc_s.so.1 +rm -rf %{buildroot}%{_infodir} +#%find_lang %{name} --all-name + +%check +ulimit -s 32768 +# disable PCH tests is ASLR is on (due to bug in pch) +test `cat /proc/sys/kernel/randomize_va_space` -ne 0 && rm gcc/testsuite/gcc.dg/pch/pch.exp +# disable security hardening for tests +rm -f $(dirname $(gcc -print-libgcc-file-name))/../specs +# run only gcc tests +make %{?_smp_mflags} check-gcc +# Only 1 FAIL is OK +[ `grep ^FAIL testsuite/gcc/gcc.sum | wc -l` -ne 1 -o `grep ^XPASS testsuite/gcc/gcc.sum | wc -l` -ne 0 ] && exit 1 ||: +[ `grep "^FAIL: gcc.dg/cpp/trad/include.c (test for excess errors)" testsuite/gcc/gcc.sum | wc -l` -ne 1 ] && exit 1 ||: + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%files +%defattr(-,root,root) +%license COPYING +%{_libdir}/cpp +# Executables +%exclude %{_bindir}/*gfortran +%exclude %{_bindir}/*c++ +%exclude %{_bindir}/*g++ +%{_bindir}/* +# Libraries +%{_lib64dir}/* +%exclude %{_libexecdir}/gcc/%{_arch}-%{_host_vendor}-linux-gnu/%{version}/f951 +%exclude %{_libexecdir}/gcc/%{_arch}-%{_host_vendor}-linux-gnu/%{version}/cc1plus +%{_libdir}/gcc/* +# Library executables +%{_libexecdir}/gcc/* +# Man pages +%{_mandir}/man1/gcov.1.gz +%{_mandir}/man1/gcov-dump.1.gz +%{_mandir}/man1/gcov-tool.1.gz +%{_mandir}/man1/gcc.1.gz +%{_mandir}/man1/g++.1.gz +%{_mandir}/man1/cpp.1.gz +%{_mandir}/man1/lto-dump.1.gz +%{_mandir}/man7/*.gz +%{_datadir}/gdb/* + +%exclude %{_lib64dir}/libgcc* +%exclude %{_lib64dir}/libstdc++* +%exclude %{_lib64dir}/libsupc++* +%exclude %{_lib64dir}/libgomp* + +%files -n gfortran +%defattr(-,root,root) +%{_bindir}/*gfortran +%{_mandir}/man1/gfortran.1.gz +%{_libexecdir}/gcc/%{_arch}-%{_host_vendor}-linux-gnu/%{version}/f951 + +%files -n libgcc +%defattr(-,root,root) +%{_lib64dir}/libgcc_s.so.* + +%files -n libgcc-atomic +%defattr(-,root,root) +%{_lib64dir}/libatomic.so* + +%files -n libgcc-devel +%defattr(-,root,root) +%{_lib64dir}/libgcc_s.so +%{_lib64dir}/libcc1.* + +%files c++ +%defattr(-,root,root) +%{_bindir}/*c++ +%{_bindir}/*g++ +%{_libexecdir}/gcc/%{_arch}-%{_host_vendor}-linux-gnu/%{version}/cc1plus + +%files -n libstdc++ +%defattr(-,root,root) +%{_lib64dir}/libstdc++.so.* +%dir %{_datarootdir}/gcc-%{version}/python/libstdcxx +%{_datarootdir}/gcc-%{version}/python/libstdcxx/* + +%files -n libstdc++-devel +%defattr(-,root,root) +%{_lib64dir}/libstdc++.so +%{_lib64dir}/libstdc++.la +%{_lib64dir}/libstdc++.a +%{_lib64dir}/libstdc++fs.a +%{_lib64dir}/libsupc++.a +%{_lib64dir}/libsupc++.la + +%{_includedir}/c++/* + +%files -n libgomp +%defattr(-,root,root) +%{_lib64dir}/libgomp*.so.* + +%files -n libgomp-devel +%defattr(-,root,root) +%{_lib64dir}/libgomp.a +%{_lib64dir}/libgomp.la +%{_lib64dir}/libgomp.so +%{_lib64dir}/libgomp.spec + +%changelog +* Tue Jan 25 2022 Thomas Crain - 11.2.0-2 +- Add provides for libasan, liblsan, libtsan, and libubsan (and their static counterparts) to the main package +- Remove CVE-2019-15847 nopatch file (not relevant to our version of GCC) + +* Mon Oct 18 2021 Andrew Phelps - 11.2.0-1 +- Update to version 11.2.0 + +* Fri Feb 05 2021 Joe Schmitt - 9.1.0-11 +- Replace incorrect %%{_lib} usage with %%{_libdir} + +* Fri Jan 08 2021 Ruying Chen - 9.1.0-10 +- Provide libquadmath and libquadmath-devel. + +* Tue Nov 03 2020 Joe Schmitt - 9.1.0-9 +- Provide gcc-plugin-devel. + +* Mon Sep 28 2020 Ruying Chen 9.1.0-8 +- Split gcc-c++ subpackage. +- Provide cpp, gcc-gfortran, libatomic, and listdc++-static. + +* Thu Sep 10 2020 Thomas Crain - 9.1.0-7 +- Ignore CVE-2019-15847, as it applies to an unsupported ISA + +* Mon Jul 06 2020 Henry Beberman - 9.1.0-6 +- Comment out with_check BuildRequires to break circular dependency in build graph. + +* Thu Jun 11 2020 Henry Beberman - 9.1.0-5 +- Disable -Werror=format-security to build with hardened cflags + +* Sat May 09 2020 Nick Samson - 9.1.0-4 +- Added %%license line automatically + +* Thu Apr 30 2020 Emre Girgin - 9.1.0-3 +- Renaming mpc to libmpc + +* Thu Apr 09 2020 Emre Girgin - 9.1.0-2 +- Add the "--enable-default-pie" flag in order to enforce ASLR-enabled binaries. + +* Tue Mar 17 2020 Andrew Phelps - 9.1.0-1 +- Update to version 9.1.0. License verified. Add libstdc++fs.a + +* Tue Jan 21 2020 Andrew Phelps - 7.3.0-6 +- Fixing build issues for multiple architectures + +* Tue Sep 03 2019 Mateusz Malisz - 7.3.0-5 +- Initial CBL-Mariner import from Photon (license: Apache2). + +* Fri Nov 02 2018 Alexey Makhalov - 7.3.0-4 +- Use nofortify security_hardening instead of sed hacking +- Use %configure + +* Wed Sep 19 2018 Alexey Makhalov - 7.3.0-3 +- Fix compilation issue for glibc-2.28 + +* Thu Aug 30 2018 Keerthana K - 7.3.0-2 +- Packaging .a files (libstdc++-static files). + +* Wed Aug 01 2018 Srivatsa S. Bhat - 7.3.0-1 +- Update to version 7.3.0 to get retpoline support. + +* Tue Nov 14 2017 Alexey Makhalov - 6.3.0-7 +- Aarch64 support + +* Mon Oct 02 2017 Alexey Makhalov - 6.3.0-6 +- Added smp_mflags for parallel build + +* Mon Sep 25 2017 Alexey Makhalov - 6.3.0-5 +- Enable elfdeps for libgcc_s to generate libgcc_s.so.1(*)(64bit) provides + +* Mon Aug 28 2017 Alexey Makhalov - 6.3.0-4 +- Fix makecheck + +* Tue Aug 15 2017 Alexey Makhalov - 6.3.0-3 +- Fix compilation issue for glibc-2.26 + +* Tue Aug 15 2017 Alexey Makhalov - 6.3.0-2 +- Improve make check + +* Thu Mar 9 2017 Alexey Makhalov - 6.3.0-1 +- Update version to 6.3 + +* Thu Mar 02 2017 Xiaolin Li - 5.3.0-6 +- Enabled fortran. + +* Wed Feb 22 2017 Alexey Makhalov - 5.3.0-5 +- Added new plugin entry point: PLUGIN_TYPE_CAST (.patch) + +* Thu Sep 8 2016 Alexey Makhalov - 5.3.0-4 +- Enable plugins and linker build id. + +* Tue May 24 2016 Priyesh Padmavilasom - 5.3.0-3 +- GA - Bump release of all rpms + +* Tue May 17 2016 Anish Swaminathan - 5.3.0-2 +- Change package dependencies + +* Mon Mar 28 2016 Alexey Makhalov - 5.3.0-1 +- Update version to 5.3 + +* Tue Nov 10 2015 Xiaolin Li - 4.8.2-6 +- Handled locale files with macro find_lang + +* Mon Nov 02 2015 Vinay Kulkarni - 4.8.2-5 +- Put libatomic.so into its own package. + +* Wed May 20 2015 Touseef Liaqat - 4.8.2-4 +- Updated group. + +* Mon May 18 2015 Touseef Liaqat - 4.8.2-3 +- Update according to UsrMove. + +* Fri May 15 2015 Divya Thaluru - 4.8.2-2 +- Packaging .la files + +* Tue Apr 01 2014 baho-utot - 4.8.2-1 +- Initial build. First version diff --git a/.github/actions/build-tarball/action.yaml b/.github/actions/build-tarball/action.yaml new file mode 100644 index 00000000000..3949c37b7f7 --- /dev/null +++ b/.github/actions/build-tarball/action.yaml @@ -0,0 +1,89 @@ +# Composite yaml to rebase to upstream gcc master + +# Copyright (c) Microsoft Corporation. + +# MIT License + +# 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. +name: "build-tarball" +description: "Build tar.xz release of gcc" +runs: + using: "composite" + steps: + + # This step will set an environment variable for branch name. + # e.g. branch_name=releases/gcc-11 + - name: Set Environment Variable For Branch Name + shell: bash + run: echo "branch_name=${{ github.head_ref || github.ref_name }}" >> $GITHUB_ENV + + # This step will set an environment variable for release name. + # e.g. release_version=11.2.1 + - name: Set Environment Variable For Release Version + shell: bash + working-directory: ./gcc + run: echo "release_version=$(git show origin/${{ env.branch_name }}:gcc/BASE-VER)" >> $GITHUB_ENV + + # This is only to fix a bug in CBL-Mariner build procedure. + # Eventually we will be able to delete this step. + - name: Create Include Dir # to fix building GCC gfortran bug in Mariner + run: | + mkdir -p /usr/lib/gfortran/modules + shell: bash + + # Update the package manager. + - name: TDNF Update + run: | + unset HOME && tdnf update -y + shell: bash + + # Enable mariner-repos-extended repo. + # In newer versions of CBL-Mariner, you have to enable this repo to install libdwarf and a few other packages. + - name: TDNF Install mariner-repos-extended + run: | + unset HOME && tdnf install -y mariner-repos-extended + shell: bash + + # Install required packages. These packages are required to build gcc and create a RPM. + - name: Install Required Packages + run: | + unset HOME && tdnf install glibc-devel file dejagnu texinfo build-essential rpm-build git ca-certificates wget flex bison gdb gawk libgomp-devel gfortran libgomp lapack libdwarf make sudo autoconf automake libstdc++ libstdc++-devel sed gmp-devel mpfr-devel libmpc-devel lynx -y + shell: bash + + # In our fork of gcc_release script, gcc_release clones the repository locally. + # Because of that we need the release branch we are building to be available locally. + - name: Enable Release Branch Locally + working-directory: ./gcc + run: | + git fetch origin ${{ env.branch_name }}:${{ env.branch_name }} + shell: bash + + # This is just running gcc_relase script with bare minimum flags. + # The flags are : + # -f : build is final (don't append "snapshot" to the end of tar.xz files). + # -r : release version. + # -l : it runs locally (do not fork from a repository). + # -c : clone the target branch locally. + # -d : destination directory for gcc-$(release_version).tar.xz. + # for more information about the flags, take a look at the commit pushing gcc_release to .github/scripts/gcc_release + # WARNING: This is going to take a long long time. Go get a coffee, watch a tv show and/or sleep. + - name: Run gcc_release Script + working-directory: ./gcc + run: ./.github/scripts/gcc_release -f -r ${{ env.release_version }} -c -l -d ~/ sources tarfiles + shell: sh diff --git a/.github/scripts/configure-gcc.sh b/.github/scripts/configure-gcc.sh index a21b2a4b21f..69434f8a7bd 100755 --- a/.github/scripts/configure-gcc.sh +++ b/.github/scripts/configure-gcc.sh @@ -23,7 +23,7 @@ sudo apt update # Install gcc 7 and g++ 7 -sudo apt-get install gcc-7 g++-7 g++-7-multilib libstdc++-7-doc binutils-doc build-essential cpp-doc gcc-7-doc libstdc++6-7-dbg lib32stdc++6-7-dbg libx32stdc++6-7-dbg make autoconf automake libtool flex bison gdb gawk gcc-doc gfortran libgfortran3 libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan4-dbg liblsan0-dbg libtsan0-dbg libubsan0-dbg libcilkrts5-dbg libmpx2-dbg libquadmath0-dbg glibc-doc python -y +sudo apt-get install gcc-7 g++-7 g++-7-multilib libstdc++-7-doc binutils-doc build-essential cpp-doc gcc-7-doc libstdc++6-7-dbg lib32stdc++6-7-dbg libx32stdc++6-7-dbg make autoconf automake libtool flex bison gdb gawk gcc-doc gfortran libgfortran3 libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan4-dbg liblsan0-dbg libtsan0-dbg libubsan0-dbg libcilkrts5-dbg libmpx2-dbg libquadmath0-dbg glibc-doc python lynx -y # Redirect gcc and g++ to the installed versions sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 diff --git a/.github/scripts/gcc_release b/.github/scripts/gcc_release new file mode 100755 index 00000000000..428b439c8f9 --- /dev/null +++ b/.github/scripts/gcc_release @@ -0,0 +1,799 @@ +#! /bin/sh + +######################################################################## +# +# File: gcc_release +# Author: Jeffrey Law, Bernd Schmidt, Mark Mitchell +# Date: 2001-05-25 +# +# Contents: +# Script to create a GCC release. +# +# Copyright (c) 2001-2020 Free Software Foundation. +# +# This file is part of GCC. +# +# GCC 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, or (at your option) +# any later version. +# +# GCC 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 GCC; see the file COPYING3. If not see +# . +# +######################################################################## + +######################################################################## +# Notes +######################################################################## + +# Here is an example usage of this script, to create a GCC 3.0.2 +# prerelease: +# +# gcc_release -r 3.0.2 +# +# This script will automatically use the head of the release branch +# to generate the release. + +######################################################################## +# Functions +######################################################################## + +# Issue the error message given by $@ and exit with a non-zero +# exit code. + +error() { + echo "gcc_release: error: $@" + exit 1 +} + +# Issue the informational message given by $@. + +inform() { + echo "gcc_release: $@" +} + +# Issue a usage message explaining how to use this script. + +usage() { +cat < NEWS ||\ + error "Could not regenerate NEWS files" + + grep -q "no releases of GCC ${RELEASE_MAJOR} have yet been made" NEWS &&\ + error "gcc-${RELEASE_MAJOR}/index.html has not been updated yet" + + grep -q "GCC ${RELEASE_MAJOR} has not been released yet" NEWS &&\ + error "gcc-${RELEASE_MAJOR}/changes.html has not been updated yet" + + thisindex="http:\/\/gcc.gnu.org\/gcc-${RELEASE_MAJOR}\/index.html" + thischanges="http:\/\/gcc.gnu.org\/gcc-${RELEASE_MAJOR}\/changes.html" + previndex="http:\/\/gcc.gnu.org\/gcc-`expr ${RELEASE_MAJOR} - 1`\/index.html" + sed -n -e "/^${thisindex}/,/^${thischanges}/p" NEWS |\ + sed -n -e "/Release History/,/References and Acknowledgments/p" |\ + grep -q "^[[:blank:]]*GCC ${RELEASE_MAJOR}.${RELEASE_MINOR}" ||\ + error "GCC ${RELEASE_MAJOR}.${RELEASE_MINOR} not mentioned "\ + "in gcc-${RELEASE_MAJOR}/index.html" + + sed -n -e "/^${thischanges}/,/^${previndex}/p" NEWS |\ + grep -q "^[[:blank:]]*GCC ${RELEASE_MAJOR}.${RELEASE_MINOR}" ||\ + error "GCC ${RELEASE_MAJOR}.${RELEASE_MINOR} not mentioned "\ + "in gcc-${RELEASE_MAJOR}/changes.html" + + rm -f NEWS + + commit_files="" + for x in `changedir ${SOURCE_DIRECTORY} && \ + find . -name ChangeLog`; do + # Update this ChangeLog file only if it does not yet contain the + # entry we are going to add. (This is a safety net for repeated + # runs of this script for the same release.) + if ! grep "GCC ${RELEASE} released." ${SOURCE_DIRECTORY}/${x} > /dev/null ; then + cat - ${SOURCE_DIRECTORY}/${x} > ${SOURCE_DIRECTORY}/${x}.new < BASE-VER) || \ + error "Could not update BASE-VER" + commit_files="${commit_files} gcc/BASE-VER" + else + error "Release number ${RELEASE} does not immediately follow BASE-VER" + fi + fi + (changedir ${SOURCE_DIRECTORY}/gcc && \ + : > DEV-PHASE) || \ + error "Could not update DEV-PHASE" + commit_files="${commit_files} gcc/DEV-PHASE" + + (changedir ${SOURCE_DIRECTORY} && \ + ${GIT} commit -q -m 'Update ChangeLog and version files for release' ${commit_files} && \ + ${GIT} push) || \ + error "Could not commit ChangeLog and version file updates" + + # Make sure we tag the sources for a final release. + TAG="releases/gcc-${RELEASE}" + fi + + # Tag the sources. + if [ -n "${TAG}" ]; then + inform "Tagging sources as ${TAG}" + # We don't want to overwrite an existing tag. So, if the tag + # already exists, issue an error message; the release manager can + # manually remove the tag if appropriate. + if (changedir ${SOURCE_DIRECTORY} && \ + ${GIT} rev-parse "refs/tags/${TAG}" > /dev/null 2>&1); then + error "Tag ${TAG} already exists" + fi + (changedir ${SOURCE_DIRECTORY} && \ + ${GIT} tag -s -m "GCC ${RELEASE} release" "${TAG}" && \ + ${GIT} push origin tag "${TAG}") || \ + error "Could not tag sources" + GITBRANCH=${TAG} + fi + + GITREV=`cd ${SOURCE_DIRECTORY} && ${GIT} rev-parse HEAD` + inform "Sources are commit ${GITREV}" + + # Make sure there are no uncommitted changes in the sources. + status=${WORKING_DIRECTORY}/gitstatus.$$ + (changedir ${SOURCE_DIRECTORY} && \ + ${GIT} status --porcelain --ignored > "$status") || \ + error "Could not get source directory status" + if [ -s "$status" ]; then + cat "$status" + error "Source directory has unexpected changes" + fi + rm "$status" + + # Remove .git from the sources. + rm -rf "${SOURCE_DIRECTORY}/.git" || \ + error "Could not remove .git from sources" + + # Run gcc_update on them to set up the timestamps nicely, and (re)write + # the LAST_UPDATED file containing the git tag/revision used. + changedir "gcc-${RELEASE}" + contrib/gcc_update --touch + echo "Obtained from git: ${GITBRANCH} revision ${GITREV}" > LAST_UPDATED + + # For a prerelease or real release, we need to generate additional + # files not present in git. + changedir "${SOURCE_DIRECTORY}" + if [ $SNAPSHOT -ne 1 ]; then + # Generate the documentation. + inform "Building install docs" + SOURCEDIR=${SOURCE_DIRECTORY}/gcc/doc + DESTDIR=${SOURCE_DIRECTORY}/INSTALL + export SOURCEDIR + export DESTDIR + ${SOURCE_DIRECTORY}/gcc/doc/install.texi2html + + # Regenerate the NEWS file. + contrib/gennews > NEWS || \ + error "Could not regenerate NEWS files" + + # Now, we must build the compiler in order to create any generated + # files that are supposed to go in the source directory. This is + # also a good sanity check to make sure that the release builds + # on at least one platform. + inform "Building compiler" + OBJECT_DIRECTORY=../objdir + num_cpus=1 + if type -p getconf 2>/dev/null; then + num_cpus=`getconf _NPROCESSORS_ONLN 2>/dev/null` + case "$num_cpus" in + '' | 0* | *[!0-9]*) num_cpus=1;; + esac + fi + contrib/gcc_build -d ${SOURCE_DIRECTORY} -o ${OBJECT_DIRECTORY} \ + -c "--enable-generated-files-in-srcdir --disable-multilib" \ + -m "-j$num_cpus" build || \ + error "Could not rebuild GCC" + fi + + # Move message catalogs to source directory. + mv ../objdir/gcc/po/*.gmo gcc/po/ + [ -f libcpp/po/cpplib.pot ] && mv ../objdir/libcpp/po/*.gmo libcpp/po/ + + # Create a "MD5SUMS" file to use for checking the validity of the release. + echo \ +"# This file contains the MD5 checksums of the files in the +# gcc-"${RELEASE}".tar.xz tarball. +# +# Besides verifying that all files in the tarball were correctly expanded, +# it also can be used to determine if any files have changed since the +# tarball was expanded or to verify that a patchfile was correctly applied. +# +# Suggested usage: +# md5sum -c MD5SUMS | grep -v \"OK$\" +#" > MD5SUMS + + find . -type f | + sed -e 's:^\./::' -e '/MD5SUMS/d' | + sort | + xargs md5sum >>MD5SUMS +} + +# Build a single tarfile. The first argument is the name of the tarfile +# to build, without any suffixes. They will be added automatically. The +# rest of the arguments are files or directories to include, and possibly +# other arguments to tar. + +build_tarfile() { + # Get the name of the destination tar file. + TARFILE="$1.tar.xz" + shift + + # Build the tar file itself. + (${TAR} cf - "$@" | ${XZ} > ${TARFILE}) || \ + error "Could not build tarfile" + FILE_LIST="${FILE_LIST} ${TARFILE}" +} + +# Build the various tar files for the release. + +build_tarfiles() { + inform "Building tarfiles" + + changedir "${WORKING_DIRECTORY}" + + # The GNU Coding Standards specify that all files should + # world readable. + chmod -R a+r ${SOURCE_DIRECTORY} + # And that all directories have mode 755. + find ${SOURCE_DIRECTORY} -type d -exec chmod 755 {} \; + + # Build one huge tarfile for the entire distribution. + build_tarfile gcc-${RELEASE} `basename ${SOURCE_DIRECTORY}` +} + +# Build .gz files. +build_gzip() { + for f in ${FILE_LIST}; do + target=${f%.xz}.gz + (${XZ} -d -c $f | ${GZIP} > ${target}) || error "Could not create ${target}" + done +} + +# Build diffs against an old release. +build_diffs() { + old_dir=${1%/*} + old_file=${1##*/} + case "$old_file" in + *.tar.xz) old_vers=${old_file%.tar.xz};; + *) old_vers=${old_file%.tar.bz2};; + esac + old_vers=${old_vers#gcc-} + inform "Building diffs against version $old_vers" + for f in gcc; do + if [ -e ${old_dir}/${f}-${old_vers}.tar.xz ]; then + old_tar=${old_dir}/${f}-${old_vers}.tar.xz + else + old_tar=${old_dir}/${f}-${old_vers}.tar.bz2 + fi + new_tar=${WORKING_DIRECTORY}/${f}-${RELEASE}.tar.xz + if [ ! -e $old_tar ]; then + inform "$old_tar not found; not generating diff file" + elif [ ! -e $new_tar ]; then + inform "$new_tar not found; not generating diff file" + else + build_diff $old_tar gcc-${old_vers} $new_tar gcc-${RELEASE} \ + ${f}-${old_vers}-${RELEASE}.diff.xz + fi + done +} + +# Build an individual diff. +build_diff() { + changedir "${WORKING_DIRECTORY}" + tmpdir=gccdiff.$$ + mkdir $tmpdir || error "Could not create directory $tmpdir" + changedir $tmpdir + case "$1" in + *.tar.bz2) + (${BZIP2} -d -c $1 | ${TAR} xf - ) || error "Could not unpack $1 for diffs" + ;; + *.tar.xz) + (${XZ} -d -c $1 | ${TAR} xf - ) || error "Could not unpack $1 for diffs" + ;; + esac + (${XZ} -d -c $3 | ${TAR} xf - ) || error "Could not unpack $3 for diffs" + ${DIFF} $2 $4 > ../${5%.xz} + if [ $? -eq 2 ]; then + error "Trouble making diffs from $1 to $3" + fi + ${XZ} ../${5%.xz} || error "Could not generate ../$5" + changedir .. + rm -rf $tmpdir + FILE_LIST="${FILE_LIST} $5" +} + +# Upload the files to the FTP server. +upload_files() { + inform "Uploading files" + + changedir "${WORKING_DIRECTORY}" + + # Make sure the directory exists on the server. + if [ $LOCAL -eq 0 ]; then + ${SSH} -l ${GCC_USERNAME} ${GCC_HOSTNAME} \ + mkdir -m 755 -p "${FTP_PATH}/diffs" + UPLOAD_PATH="${GCC_USERNAME}@${GCC_HOSTNAME}:${FTP_PATH}" + else + mkdir -p "${FTP_PATH}/diffs" \ + || error "Could not create \`${FTP_PATH}'" + UPLOAD_PATH=${FTP_PATH} + fi + + # Then copy files to their respective (sub)directories. + for x in gcc*.gz gcc*.xz; do + if [ -e ${x} ]; then + # Make sure the file will be readable on the server. + chmod a+r ${x} + # Copy it. + case ${x} in + *.diff.*) + SUBDIR="diffs/"; + ;; + *) + SUBDIR=""; + esac + ${SCP} ${x} ${UPLOAD_PATH}/${SUBDIR} \ + || error "Could not upload ${x}" + fi + done +} + +# Print description if snapshot exists. +snapshot_print() { + if [ -e ${RELEASE}/$1 ]; then + hash=`openssl sha256 ${RELEASE}/$1 | sed -e 's#(.*)##' -e 's# *= *#=#'` + hash2=`openssl sha1 ${RELEASE}/$1 | sed -e 's#(.*)##' -e 's# *= *#=#'` + + printf " %-37s%s\n\n %s\n %s\n\n" "$1" "$2" "$hash" "$hash2" \ + >> ${SNAPSHOT_README} + + echo " $1" >> ${SNAPSHOT_INDEX} + echo " $2" >> ${SNAPSHOT_INDEX} + fi +} + +# Announce a snapshot, both on the web and via mail. +announce_snapshot() { + inform "Updating links and READMEs on the FTP server" + + TEXT_DATE=`date --date=$DATE +%B\ %d,\ %Y` + SNAPSHOT_README=${RELEASE}/README + SNAPSHOT_INDEX=${RELEASE}/index.html + + changedir "${SNAPSHOTS_DIR}" + echo \ +"Snapshot gcc-"${RELEASE}" is now available on + https://gcc.gnu.org/pub/gcc/snapshots/"${RELEASE}"/ +and on various mirrors, see http://gcc.gnu.org/mirrors.html for details. + +This snapshot has been generated from the GCC "${BRANCH}" git branch +with the following options: "git://gcc.gnu.org/git/gcc.git branch ${GITBRANCH} revision ${GITREV}" + +You'll find: +" > ${SNAPSHOT_README} + + echo \ +" + + +GCC "${RELEASE}" Snapshot + + + +

GCC "${RELEASE}" Snapshot

+ +

The GCC Project makes +periodic snapshots of the GCC source tree available to the public +for testing purposes.

+ +

If you are planning to download and use one of our snapshots, then +we highly recommend you join the GCC developers list. Details for +how to sign up can be found on the GCC project home page.

+ +

This snapshot has been generated from the GCC "${BRANCH}" git branch +with the following options: "git://gcc.gnu.org/git/gcc.git branch ${GITBRANCH} revision ${GITREV}"

+ +" > ${SNAPSHOT_INDEX} + + snapshot_print gcc-${RELEASE}.tar.xz "Complete GCC" + + echo \ +"Diffs from "${BRANCH}"-"${LAST_DATE}" are available in the diffs/ subdirectory. + +When a particular snapshot is ready for public consumption the LATEST-"${BRANCH}" +link is updated and a message is sent to the gcc list. Please do not use +a snapshot before it has been announced that way." >> ${SNAPSHOT_README} + + echo \ +"
+

Diffs from "${BRANCH}"-"${LAST_DATE}" are available in the +diffs/ subdirectory.

+ +

When a particular snapshot is ready for public consumption the LATEST-"${BRANCH}" +link is updated and a message is sent to the gcc list. Please do not use +a snapshot before it has been announced that way.

+ +
+ +
+gcc@gcc.gnu.org +
+Last modified "${TEXT_DATE}" +
+ + +" >> ${SNAPSHOT_INDEX} + + rm -f LATEST-${BRANCH} + ln -s ${RELEASE} LATEST-${BRANCH} + + inform "Sending mail" + + export QMAILHOST=gcc.gnu.org + mail -s "gcc-${RELEASE} is now available" gcc@gcc.gnu.org < ${SNAPSHOT_README} +} + +######################################################################## +# Initialization +######################################################################## + +LC_ALL=C +export LC_ALL + +# Today's date. +DATE=`date "+%Y%m%d"` +LONG_DATE=`date "+%Y-%m-%d"` + +GIT=${GIT:-git} +# The server containing the GCC repository. +GIT_SERVER="gcc.gnu.org" +# The path to the repository on that server. +GIT_REPOSITORY="/git/gcc.git" +# The username to use when connecting to the server. +GIT_USERNAME="${USER}" +# Flag to specify use of local git repository. +GIT_LOCALPATH=0 +# The machine to which files will be uploaded. +GCC_HOSTNAME="gcc.gnu.org" +# The name of the account on the machine to which files are uploaded. +GCC_USERNAME="gccadmin" +# The directory in which the files will be placed (do not use ~user syntax). +FTP_PATH=/var/ftp/pub/gcc +# The directory in which snapshots will be placed. +SNAPSHOTS_DIR=${FTP_PATH}/snapshots + +# The major number for the release. For release `3.0.2' this would be +# `3' +RELEASE_MAJOR="" +# The minor number for the release. For release `3.0.2' this would be +# `0'. +RELEASE_MINOR="" +# The revision number for the release. For release `3.0.2' this would +# be `2'. +RELEASE_REVISION="" +# The complete name of the release. +RELEASE="" + +# The name of the branch from which the release should be made, in a +# user-friendly form. +BRANCH="" + +# The name of the branch from which the release should be made, as used +# for our version control system. +GITBRANCH="" + +# The tag to apply to the sources used for the release. +TAG="" + +# The old tarballs from which to generate diffs. +OLD_TARS="" + +# Local gcc git checkout to speed up git cloning. +GIT_REFERENCE="" + +# The directory that will be used to construct the release. The +# release itself will be placed in a subdirectory of this directory. +DESTINATION=${HOME} +# The subdirectory. +WORKING_DIRECTORY="" +# The directory that will contain the GCC sources. +SOURCE_DIRECTORY="" +# PATH To GCC Repository containing this script while running +GCCPATH=$(cd "$(dirname "$0")" && pwd)/../../ + +# Non-zero if this is the final release, rather than a prerelease. +FINAL=0 + +# Non-zero if we are building a snapshot, and don't build gcc or +# include generated files. +SNAPSHOT=0 + +# Non-zero if we are running locally on gcc.gnu.org, and use local CVS +# and copy directly to the FTP directory. +LOCAL=0 + +# Major operation modes. +MODE_GZIP=0 +MODE_DIFFS=0 +MODE_SOURCES=0 +MODE_TARFILES=0 +MODE_UPLOAD=0 + +# List of archive files generated; used to create .gz files from .xz. +FILE_LIST="" + +# Programs we use. + +BZIP2="${BZIP2:-bzip2}" +XZ="${XZ:-xz --best}" +CVS="${CVS:-cvs -f -Q -z9}" +DIFF="${DIFF:-diff -Nrcpad}" +ENV="${ENV:-env}" +GZIP="${GZIP:-gzip --best}" +SCP="${SCP:-scp -p}" +SSH="${SSH:-ssh}" +TAR="${TAR:-tar}" + +######################################################################## +# Command Line Processing +######################################################################## + +# Parse the options. +while getopts "d:fr:u:t:p:s:lb:c" ARG; do + case $ARG in + d) DESTINATION="${OPTARG}";; + r) RELEASE="${OPTARG}";; + t) TAG="${OPTARG}";; + u) GIT_USERNAME="${OPTARG}";; + f) FINAL=1;; + s) SNAPSHOT=1 + BRANCH=${OPTARG%:*} + GITBRANCH=${OPTARG#*:} + ;; + l) LOCAL=1 + SCP=cp + PATH=~:/usr/local/bin:$PATH;; + p) OLD_TARS="${OLD_TARS} ${OPTARG}" + if [ ! -f ${OPTARG} ]; then + error "-p argument must name a tarball" + fi;; + b) GIT_REFERENCE="${OPTARG}";; + c) GIT_LOCALPATH=1;; + \?) usage;; + esac +done +shift `expr ${OPTIND} - 1` + +# Handle the major modes. +while [ $# -ne 0 ]; do + case $1 in + diffs) MODE_DIFFS=1;; + gzip) MODE_GZIP=1;; + sources) MODE_SOURCES=1;; + tarfiles) MODE_TARFILES=1;; + upload) MODE_UPLOAD=1;; + all) MODE_SOURCES=1; MODE_TARFILES=1; MODE_DIFFS=1; MODE_UPLOAD=1; + if [ $SNAPSHOT -ne 1 ]; then + # Only for releases and pre-releases. + MODE_GZIP=1; + fi + ;; + *) error "Unknown mode $1";; + esac + shift +done + +# Perform consistency checking. +if [ ${LOCAL} -eq 0 ] && [ -z ${GIT_USERNAME} ]; then + error "No username specified" +fi + +if [ ! -d ${DESTINATION} ]; then + error "\`${DESTINATION}' is not a directory" +fi + +if [ $SNAPSHOT -eq 0 ]; then + if [ -z ${RELEASE} ]; then + error "No release number specified" + fi + + # Compute the major and minor release numbers. + RELEASE_MAJOR=`echo $RELEASE | awk --assign FS=. '{ print $1; }'` + RELEASE_MINOR=`echo $RELEASE | awk --assign FS=. '{ print $2; }'` + RELEASE_REVISION=`echo $RELEASE | awk --assign FS=. '{ print $3; }'` + + if [ -z "${RELEASE_MAJOR}" ] || [ -z "${RELEASE_MINOR}" ]; then + error "Release number \`${RELEASE}' is invalid" + fi + + # Compute the full name of the release. + if [ -z "${RELEASE_REVISION}" ]; then + RELEASE="${RELEASE_MAJOR}.${RELEASE_MINOR}" + else + RELEASE="${RELEASE_MAJOR}.${RELEASE_MINOR}.${RELEASE_REVISION}" + fi + + # Compute the name of the branch, which is based solely on the major + # release number. + GITBRANCH="releases/gcc-${RELEASE_MAJOR}" + + # If this is not a final release, set various parameters accordingly. + if [ ${FINAL} -ne 1 ]; then + RELEASE="${RELEASE}-RC-${DATE}" + FTP_PATH="${SNAPSHOTS_DIR}/${RELEASE}" + else + FTP_PATH="${FTP_PATH}/releases/gcc-${RELEASE}/" + fi +else + RELEASE=${BRANCH}-${DATE} + FTP_PATH="${FTP_PATH}/snapshots/${RELEASE}" + + # If diffs are requested when building locally on gcc.gnu.org, we (usually) + # know what the last snapshot date was and take the corresponding tarballs, + # unless the user specified tarballs explicitly. + if [ $MODE_DIFFS -ne 0 ] && [ $LOCAL -ne 0 ] && [ -z "${OLD_TARS}" ]; then + LAST_DATE=`cat ~/.snapshot_date-${BRANCH}` + OLD_TARS=${SNAPSHOTS_DIR}/${BRANCH}-${LAST_DATE}/gcc-${BRANCH}-${LAST_DATE}.tar.bz2 + if [ ! -e $OLD_TARS ]; then + OLD_TARS=${SNAPSHOTS_DIR}/${BRANCH}-${LAST_DATE}/gcc-${BRANCH}-${LAST_DATE}.tar.xz + fi + fi +fi + +# Compute the name of the WORKING_DIRECTORY and the SOURCE_DIRECTORY. +WORKING_DIRECTORY="${DESTINATION}/gcc-${RELEASE}" +SOURCE_DIRECTORY="${WORKING_DIRECTORY}/gcc-${RELEASE}" + +# Set up GITROOT. +if [ $LOCAL -eq 0 ]; then + GITROOT="git+ssh://${GIT_USERNAME}@${GIT_SERVER}${GIT_REPOSITORY}" +else + GITROOT="/git/gcc.git" +fi +export GITROOT + +######################################################################## +# Main Program +######################################################################## + +# Set the timezone to UTC +TZ="UTC0" +export TZ + +# Build the source directory. + +if [ $MODE_SOURCES -ne 0 ]; then + build_sources +fi + +# Build the tar files. + +if [ $MODE_TARFILES -ne 0 ]; then + build_tarfiles +fi + +# Build diffs + +if [ $MODE_DIFFS -ne 0 ]; then + # Possibly build diffs. + if [ -n "$OLD_TARS" ]; then + for old_tar in $OLD_TARS; do + build_diffs $old_tar + done + fi +fi + +# Build gzip files +if [ $MODE_GZIP -ne 0 ]; then + build_gzip +fi + +# Upload them to the FTP server. +if [ $MODE_UPLOAD -ne 0 ]; then + upload_files + + # For snapshots, make some further updates. + if [ $SNAPSHOT -ne 0 ] && [ $LOCAL -ne 0 ]; then + announce_snapshot + + # Update snapshot date file. + changedir ~ + echo $DATE > .snapshot_date-${BRANCH} + + # Remove working directory + rm -rf ${WORKING_DIRECTORY} + fi +fi diff --git a/.github/workflows/package-rpm.yaml b/.github/workflows/package-rpm.yaml new file mode 100644 index 00000000000..1e667eb4b2c --- /dev/null +++ b/.github/workflows/package-rpm.yaml @@ -0,0 +1,95 @@ +# Copyright (c) Microsoft Corporation. + +# MIT License + +# 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. + +name: package-rpm + +# Disable for now since packaging needs to run after the build. +# Run this workflow on every new commit +# For the time being, we are only running this workflow manually. +on: + # We use the push and pull_request events instead of the workflow_run event + # so that this workflow will show up during the PR + push: + branches: + - "releases/**" + pull_request: + branches: + - "releases/**" + workflow_dispatch: + +jobs: + package: + container: cblmariner2preview.azurecr.io/base/core:2.0 + runs-on: ubuntu-18.04 + steps: + + # We need to install a minimum number of packages to run the workflow: git and ca-certificates. + # We need to checkout the repository, and to checkout the repository we need git, since + # by default CBL-Mariner 2.0 image does not have git running. + - name: Install Minimal Required Packages + run: unset HOME && tdnf install git ca-certificates -y + shell: bash + + # Clone the GCC repository to path gcc. + - name: Checkout GCC Repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 + submodules: recursive + lfs: false + path: gcc + + # Run composite job to generate gcc tar.xz files. + - name: Run Composite Job To Build Tarball + uses: ./gcc/.github/actions/build-tarball + + # Before running a complete build, check whether we have the .spec file to build for this version. + # If this fails, it means we don't have .spec file for ${{ env.release_version }} version. + # The file should be present in .github/Mariner/specs/${{ env.release_version }} directory inside gcc source tree. + - name: Check the SPEC File Does Exist in GCC Source Tree + working-directory: ./gcc + run: test -f .github/Mariner/specs/${{ env.release_version }}/gcc.specs + shell: bash + + # Copy gcc-${{ env.release_version }}.tar.xz to /usr/src/mariner/SOURCES/ + # /usr/src/mariner/SOURCES/ is a hardcoded path for rpmbuild in CBL-Mariner + # to look for tar.xz files when starts building packages. + - name: Copy GCC + run: mkdir -p /usr/src/mariner/SOURCES/ && cp ~/gcc-${{ env.release_version }}/gcc-${{ env.release_version }}.tar.xz /usr/src/mariner/SOURCES/ + shell: bash + + # Build RPM + # Simple rpmbuild command which will build GCC based on the spec file available in our repo. + # The flags are bare minimum, and we are forcing rpmbuild to build everything. + - name: Build RPM + working-directory: ./gcc + run: rpmbuild -bb --rebuild --clean --verbose --nocheck .github/Mariner/specs/11.2.1/gcc.specs + shell: bash + + # Upload gcc-${{ env.release_version }}-rpms folder to the Github Action artifact storage. + # The variable ${{ env.release_version }} will be set by ./gcc/.github/actions/build-tarball job. + - name: Upload GCC RPM + uses: actions/upload-artifact@v2 + with: + name: gcc-${{ env.release_version }}-rpms + path: /usr/src/mariner/RPMS/x86_64/ + if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` diff --git a/.github/workflows/package-source-tarball.yaml b/.github/workflows/package-source-tarball.yaml new file mode 100644 index 00000000000..cad53faff3e --- /dev/null +++ b/.github/workflows/package-source-tarball.yaml @@ -0,0 +1,72 @@ +# Copyright (c) Microsoft Corporation. + +# MIT License + +# 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. + +name: package-source-tarball + +# Disable for now since packaging needs to run after the build. +# Run this workflow on every new commit +# For the time being, we are only running this workflow manually. +on: + # We use the push and pull_request events instead of the workflow_run event + # so that this workflow will show up during the PR + push: + branches: + - "releases/**" + pull_request: + branches: + - "releases/**" + workflow_dispatch: + +jobs: + package: + container: cblmariner2preview.azurecr.io/base/core:2.0 + runs-on: ubuntu-18.04 + steps: + + # We need to install a minimum number of packages to run the workflow: git and ca-certificates. + # We need to checkout the repository, and to checkout the repository we need git, since + # by default CBL-Mariner 2.0 image does not have git running. + - name: Install Minimal Required Packages + run: unset HOME && tdnf install git ca-certificates -y + shell: bash + + # Clone the GCC repository to path gcc. + - name: Checkout GCC Repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 + submodules: recursive + lfs: false + path: gcc + + # Run composite job to generate gcc tar.xz files. + - name: Run Composite Job To Build Tarball + uses: ./gcc/.github/actions/build-tarball + + # Upload gcc-${{ env.release_version }}.tar.xz file to the Github Action artifact storage. + # The variable ${{ env.release_version }} will be set by ./gcc/.github/actions/build-tarball job. + - name: Upload GCC tar.xz + uses: actions/upload-artifact@v2 + with: + name: gcc-${{ env.release_version }}.tar.xz + path: ~/gcc-${{ env.release_version }}/gcc-${{ env.release_version }}.tar.xz + if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` diff --git a/.github/workflows/package.yaml b/.github/workflows/package.yaml deleted file mode 100644 index ea84918cc4e..00000000000 --- a/.github/workflows/package.yaml +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright (c) Microsoft Corporation. - -# MIT License - -# 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. - -name: package-gcc - -# Disable for now since packaging needs to run after the build. -# Run this workflow on every new commit -# on: [push] - -jobs: - package: - runs-on: ubuntu-18.04 - steps: - - name: checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - submodules: recursive - lfs: true - - # This name step is needed for the Mariner build system because they look for the gcc-9.1.0 after the file is untarred - - name: Rename gcc folder to gcc-9.1.0 - run: mv gcc gcc-9.1.0 - - - name: Package sources into tar - run: XZ_OPT=-e9T0 tar -cJf gcc-9.1.0.tar.xz gcc-9.1.0 - shell: bash - - name: upload artifact - uses: actions/upload-artifact@v2 - with: - name: gccTar - path: gcc-9.1.0.tar.xz