Hi GCC community,

I need to have ability to point to custom repository in gcc_release script. 
This small patch 1) does add a parameter "-g" to add custom repository to 
gcc_release , 2) does add a line to download prerequisites before building GCC 
(download_prerequisites) which is not present in gcc_release right now.

I tested the script on x86_64 Linux. 

    Adding GIT_CUSTOMREPO parameters to gcc_release script.
            * maintainer-scripts/gcc_release


Best wishes,
Navid.
From 730fef2cfd589b58e5f16ae765518754af3766b8 Mon Sep 17 00:00:00 2001
From: Navid Rahimi <navidrah...@microsoft.com>
Date: Wed, 30 Mar 2022 10:34:24 -0700
Subject: [PATCH] Adding GIT_CUSTOMREPO parameters to gcc_release script. 
 * maintainer-scripts/gcc_release

---
 maintainer-scripts/gcc_release | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/maintainer-scripts/gcc_release b/maintainer-scripts/gcc_release
index 2456908d716..20ded30723d 100755
--- a/maintainer-scripts/gcc_release
+++ b/maintainer-scripts/gcc_release
@@ -79,6 +79,7 @@ Options:
   -t tag               Tag to mark the release in git.
   -u username          Username for upload operations.
   -b local-git-repo    Local git repository to speed up cloning.
+  -g custom-repo-link  Link to custom git repository.
 EOF
     exit 1
 }
@@ -113,9 +114,9 @@ build_sources() {
         error "Could not check out release sources"
   fi
 
-  # If this is a final release, make sure that the ChangeLogs
+  # If this is a final release and it is not custom repository, make sure that the ChangeLogs
   # and version strings are updated.
-  if [ ${FINAL} -ne 0 ]; then
+  if [ ${FINAL} -ne 0 ] && [ -z $GIT_CUSTOMREPO ]; then
     inform "Updating ChangeLogs and version files"
 
     grep -q "gcc-${RELEASE_MAJOR}/index.html gcc-${RELEASE_MAJOR}/changes.html" \
@@ -266,6 +267,7 @@ EOF
 	'' | 0* | *[!0-9]*) num_cpus=1;;
       esac
     fi
+    contrib/download_prerequisites
     contrib/gcc_build -d ${SOURCE_DIRECTORY} -o ${OBJECT_DIRECTORY} \
       -c "--enable-generated-files-in-srcdir --disable-multilib" \
       -m "-j$num_cpus" build || \
@@ -538,7 +540,8 @@ GIT_SERVER="gcc.gnu.org"
 GIT_REPOSITORY="/git/gcc.git"
 # The username to use when connecting to the server.
 GIT_USERNAME="${USER}"
-
+# Link to custom repo.
+GIT_CUSTOMREPO=""
 # 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.
@@ -623,13 +626,14 @@ TAR="${TAR:-tar}"
 ########################################################################
 
 # Parse the options.
-while getopts "d:fr:u:t:p:s:lb:" ARG; do
+while getopts "d:fr:u:t:p:g:s:lb" ARG; do
     case $ARG in
     d)    DESTINATION="${OPTARG}";;
     r)    RELEASE="${OPTARG}";;
     t)    TAG="${OPTARG}";;
     u)    GIT_USERNAME="${OPTARG}";;
     f)    FINAL=1;;
+    g)    GIT_CUSTOMREPO="${OPTARG}";;
     s)    SNAPSHOT=1
           BRANCH=${OPTARG%:*}
           GITBRANCH=${OPTARG#*:}
@@ -728,7 +732,9 @@ WORKING_DIRECTORY="${DESTINATION}/gcc-${RELEASE}"
 SOURCE_DIRECTORY="${WORKING_DIRECTORY}/gcc-${RELEASE}"
 
 # Set up GITROOT.
-if [ $LOCAL -eq 0 ]; then
+if [ -n $GIT_CUSTOMREPO ]; then
+    GITROOT=${GIT_CUSTOMREPO}
+elif [ $LOCAL -eq 0 ]; then
     GITROOT="git+ssh://${GIT_USERNAME}@${GIT_SERVER}${GIT_REPOSITORY}"
 else
     GITROOT="/git/gcc.git"
-- 
2.25.1

Reply via email to