Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Williams2016-04-25 20:18:55 +0000
committerDavid Williams2016-04-25 20:18:55 +0000
commitdfeaa967879a2132ab98dfc05bd8d8c0d6867d3b (patch)
tree24da7dd048c46749dd7fd4360977d5b4982491a6 /production/miscToolsAndNotes/misc
parent8c73859f8e2f17374df41fbad78b69709f6fabcc (diff)
downloadeclipse.platform.releng.aggregator-dfeaa967879a2132ab98dfc05bd8d8c0d6867d3b.tar.gz
eclipse.platform.releng.aggregator-dfeaa967879a2132ab98dfc05bd8d8c0d6867d3b.tar.xz
eclipse.platform.releng.aggregator-dfeaa967879a2132ab98dfc05bd8d8c0d6867d3b.zip
[releng] Misc cleanup and clarification
Diffstat (limited to 'production/miscToolsAndNotes/misc')
-rwxr-xr-xproduction/miscToolsAndNotes/misc/checkForErrorExit.sh29
-rwxr-xr-xproduction/miscToolsAndNotes/misc/makeBranch.sh84
-rwxr-xr-xproduction/miscToolsAndNotes/misc/querySystem.sh55
-rwxr-xr-xproduction/miscToolsAndNotes/misc/renameBuild.sh249
-rwxr-xr-xproduction/miscToolsAndNotes/misc/wgetFresh.sh53
5 files changed, 470 insertions, 0 deletions
diff --git a/production/miscToolsAndNotes/misc/checkForErrorExit.sh b/production/miscToolsAndNotes/misc/checkForErrorExit.sh
new file mode 100755
index 00000000..06cbdfa6
--- /dev/null
+++ b/production/miscToolsAndNotes/misc/checkForErrorExit.sh
@@ -0,0 +1,29 @@
+
+# TODO: an enhanced version was put directly in 'wgetFreshSDKdir.sh'
+# Should check if this is used anywhere, and delete, if not.
+
+function checkForErrorExit ()
+{
+ # arg 1 must be return code, $?
+ # arg 2 (remaining line) can be message to print before exiting due to non-zero exit code
+ exitCode=$1
+ shift
+ message="$*"
+ if [ -z "${exitCode}" ]
+ then
+ echo "PROGRAM ERROR: checkForErrorExit called with no arguments"
+ exit 1
+ fi
+ if [ -z "${message}" ]
+ then
+ echo "WARNING: checkForErrorExit called without message"
+ message="(Calling program provided no message)"
+ fi
+ if [ "${exitCode}" -ne "0" ]
+ then
+ echo
+ echo " ERROR. exit code: ${exitCode} ${message}"
+ echo
+ exit "${exitCode}"
+ fi
+}
diff --git a/production/miscToolsAndNotes/misc/makeBranch.sh b/production/miscToolsAndNotes/misc/makeBranch.sh
new file mode 100755
index 00000000..842bd438
--- /dev/null
+++ b/production/miscToolsAndNotes/misc/makeBranch.sh
@@ -0,0 +1,84 @@
+#!/usr/bin/env bash
+
+# Utility script to semi-automate creation of a branch using committer shell (or, e4Build id)
+
+#project=simrel
+project=platform
+#project=jdt
+
+#reponame=eclipse.platform.team
+#reponame=eclipse.jdt.debug
+#reponame=eclipse.platform.releng
+#reponame=org.eclipse.simrel.build
+reponame=eclipse.platform.releng.maps
+
+startTag=R4_2_2
+#startTag=JunoSR0
+#startTag=R4_2
+#startTag=R3_8
+branchName=R4_2_2_maintenance_patches
+#branchName=R4_2_maintenance
+#branchName=R3_8_maintenance
+
+source checkForErrorExit.sh
+
+repoprojectroot=/gitroot/$project
+gitreponame=$reponame.git
+repo=${repoprojectroot}/${gitreponame}
+
+printf "\n\t%s" "Creating branch $branchName from $startTag "
+printf "\n\t%s\n\n" " for repo $repo "
+
+temprepoarea=/shared/eclipse/temp/mkbranch
+mkdir -p $temprepoarea
+checkForErrorExit $? "Could not create temprepoarea!?: $temprepoarea"
+cd $temprepoarea
+checkForErrorExit $? "Could not cd to temprepoarea!?: $temprepoarea"
+
+git clone $repo
+checkForErrorExit $? "Could not create clone repo: $repo"
+
+
+cd $reponame
+checkForErrorExit $? "Could not cd to reponame: $reponame"
+
+git checkout master
+checkForErrorExit $? "Error during initial checkout of master"
+
+git fetch
+checkForErrorExit $? "Error during fetch"
+
+git checkout -b $branchName $startTag
+checkForErrorExit $? "Could not create local branch ($branchName) from tag ($startTag)"
+
+# The part above could be done by anyone. The following code is where committer access is required
+# (which is accomplished by using e4Build id for the general case).
+
+# note: using cd here is where executing this whole thing from a committer shell on server is handy
+cd $repo
+checkForErrorExit $? "Could not cd to repo: $repo"
+
+git config hooks.allowcreatenottopicbranch true
+checkForErrorExit $? "Could not change config hook"
+
+cd -
+checkForErrorExit $? "Could not cd back to local repo"
+
+git push origin $branchName
+checkForErrorExit $? "Could not push branch to origin"
+
+cd $repo
+checkForErrorExit $? "Could not cd to repo: $repo"
+
+git config --unset hooks.allowcreatenottopicbranch
+checkForErrorExit $? "Could not unset config hook"
+
+# simple cleanup ...
+#rm -fr $temprepoarea
+#checkForErrorExit $? "Error while removing temp repo"
+
+printf "\n\t%s" "Completed creating branch $branchName from $startTag "
+printf "\n\t%s\n\n" " for repo $repo "
+
+exit 0
+
diff --git a/production/miscToolsAndNotes/misc/querySystem.sh b/production/miscToolsAndNotes/misc/querySystem.sh
new file mode 100755
index 00000000..aaba3679
--- /dev/null
+++ b/production/miscToolsAndNotes/misc/querySystem.sh
@@ -0,0 +1,55 @@
+
+#!/usr/bin/env bash
+
+# of special interest, though most won't be defined
+echo "\$WINDOWMANAGER: $WINDOWMANAGER"
+echo "\$WINDOW_MANAGER: $WINDOW_MANAGER"
+echo "\$DESKTOP_SESSION: $DESKTOP_SESSION"
+echo "\$XDG_CURRENT_DESKTOP: $XDG_CURRENT_DESKTOP"
+echo "\$GDMSESSION: $GDMSESSION"
+
+echo "uname -a"
+uname -a
+echo
+echo "lsb_release -a"
+lsb_release -a
+echo
+echo "cat /etc/lsb-release"
+cat /etc/lsb-release
+echo
+echo "cat /etc/SuSE-release"
+cat /etc/SuSE-release
+echo
+echo "rpm -q cairo"
+rpm -q cairo
+echo
+echo "rpm -q gtk2"
+rpm -q gtk2
+echo
+echo "rpm -q glibc"
+rpm -q glibc
+echo
+echo "rpm -q pango"
+rpm -q pango
+echo
+echo "rpm -q glib2"
+rpm -q glib2
+echo
+
+echo
+echo "Check if any window managers are running (xfwm|twm|metacity|beryl|fluxbox|compiz):"
+ps -ef | egrep -i "xfwm|twm|metacity|beryl|fluxbox|compiz" | grep -v egrep
+echo
+echo
+# unity|mint|gnome|kde|xfce|ion|wmii|dwm (was original list, but matched too much,
+# espeically "ion' I suppose.
+echo "Check for popular desktop environments (gnome or kde):"
+ps -ef | egrep -i "gnome|kde" | grep -v egrep
+
+echo
+echo " == all env variables == "
+printenv
+echo
+echo
+# we always end with "success" even though some commands may "fail"
+exit 0
diff --git a/production/miscToolsAndNotes/misc/renameBuild.sh b/production/miscToolsAndNotes/misc/renameBuild.sh
new file mode 100755
index 00000000..f0ac6858
--- /dev/null
+++ b/production/miscToolsAndNotes/misc/renameBuild.sh
@@ -0,0 +1,249 @@
+#!/usr/bin/env bash
+
+# Important: it is assumed this script is ran from the directory
+# that is the parent of the directory to rename
+
+# CAUTION: this is hard coded for going from "I" build to "S" build.
+# Needs adjustment for "R" build.
+
+# its assumed oldname is old name of directory and buildId, such as I20120503-1800
+# newdirname is new name for directory, such as S-3.8M7-201205031800 and
+# newlabel is the new "short name" of the deliverables, such as 3.8M7
+
+if [[ $# != 3 && $# != 4 ]]
+then
+ # usage:
+ scriptname=$(basename $0)
+ printf "\n\t%s\n" "This script, $scriptname requires three (optionally four) arguments, in order: "
+ printf "\t\t%s\t%s\n" "oldname" "(e.g. I20120503-1800) "
+ printf "\t\t%s\t%s\n" "newdirname" "(e.g. S-3.8M7-201205031800) "
+ printf "\t\t%s\t%s\n" "newlabel" "(e.g. 3.8M7 or 4.2M7 or KeplerM3) "
+ printf "\t\t%s\t%s\n" "dirname" "Optional, this is used when the rename should be done on a directory other than 'oldName', such as for INDEX_ONLY update."
+ printf "\t%s\n" "for example,"
+ printf "\t%s\n\n" "./$scriptname I20120503-1800 S-3.8M7-201205031800 3.8M7 [S-3.8M7-201205031800]"
+ exit 1
+else
+ oldname=$1
+ newdirname=$2
+ newlabel=$3
+ dirname=$4
+ if [[ -z "${dirname}" ]]
+ then
+ dirname=$oldname
+ fi
+ printf "\n\tInput to renameBuild.sh:\n"
+ printf "\t\toldname: ${oldname}\n"
+ printf "\t\tnewdirname: ${newdirname}\n"
+ printf "\t\tnewlabel: ${newlabel}\n"
+ printf "\t\tdirname: ${dirname}\n\n\n"
+fi
+
+
+function renamefile ()
+{
+ # file name is input parameter
+ # if the file name ends in gif, do not rename (due to performance analysis gifs).
+ if [[ ! $1 =~ .*\.gif ]]
+ then
+ if [[ $1 =~ (.*)($oldname)(.*) ]]
+ then
+ echo "changing $1 to ${BASH_REMATCH[1]}$newlabel${BASH_REMATCH[3]}"
+ #TODO Could check here, if already equal, and if so, do not try "mv", though doubt it hurts
+ # anything, it clutters log with confusing messages during "INDEX_ONLY" update.
+ # BUT, some files might have to be updated, so we can not just skip.
+ mv "$1" "${BASH_REMATCH[1]}$newlabel${BASH_REMATCH[3]}"
+ fi
+ fi
+}
+
+
+if [[ "${oldname}" == "${dirname}" ]]
+then
+ echo "Renaming build $oldname to $newdirname with $newlabel"
+else
+ echo "Renaming build $oldname to $newdirname with $newlabel but working in directory ${dirname}"
+fi
+
+# be sure to do "long string" first, since "sort string" will also
+# match it.
+# https://bugs.eclipse.org/bugs/show_bug.cgi?id=435671#7
+
+# specific "replaces" to make sure checksums URLs are correct for equinox
+fromString="EQ_BUILD_DIR_SEG = \"${oldname}\""
+toString="EQ_BUILD_DIR_SEG = \"${EQUINOX_DL_DROP_DIR_SEGMENT}\""
+replaceDirCommand="s!${fromString}!${toString}!g"
+echo "replaceDirCommand: $replaceDirCommand"
+perl -w -pi -e "${replaceDirCommand}" ${dirname}/buildproperties.*
+
+# specific "replace" to make sure checksums URLs are correct for eclipse
+fromString="BUILD_DIR_SEG = \"${oldname}\""
+toString="BUILD_DIR_SEG = \"${ECLIPSE_DL_DROP_DIR_SEGMENT}\""
+replaceDirCommand="s!${fromString}!${toString}!g"
+echo "replaceDirCommand: $replaceDirCommand"
+perl -w -pi -e "${replaceDirCommand}" ${dirname}/buildproperties.*
+
+fromString=$oldname
+toString=$newlabel
+replaceCommand="s!${fromString}!${toString}!g"
+
+# As far as is known, the "directory name" only comes into play in
+# the various "buildproperties.*" files, so that's all we'll replace, for now.
+# In most files, it's a "relative" location so newdirname should not be needed.
+# We assume if "oldName" is surrounded by path separators ('/') it needs whole directory
+# name, not just "label".
+# See https://bugs.eclipse.org/bugs/show_bug.cgi?id=414739
+replaceDirCommand="s!/${fromString}/!/${newdirname}/!g"
+perl -w -pi -e ${replaceDirCommand} ${dirname}/buildproperties.*
+
+# not all these file types may exist, we include all the commonly used ones, though,
+# just in case future changes to site files started to have them. There is no harm, per se,
+# if the perl command fails.
+# TODO: could add some "smarts" here to see if all was as expected before making changes.
+perl -w -pi -e ${replaceCommand} ${dirname}/*.php
+perl -w -pi -e ${replaceCommand} ${dirname}/*.html
+perl -w -pi -e ${replaceCommand} ${dirname}/*.xml 2>/dev/null
+perl -w -pi -e ${replaceCommand} ${dirname}/checksum/*
+
+# TODO: need to make this part of case statement, to handle
+# Integration --> Stable
+# Integration --> Release Candidate
+# Integration --> Release
+# These are for cases where used in headers, titles, etc.
+# TODO: final "fall through" case should be based on matching
+# new label with digits only, such as "4.3" ... not sure
+# if this would work for Equinox "Kepler" or "Kepler Released Build"?
+OLD_BUILD_TYPE=${oldname:0:1}
+if [[ $OLD_BUILD_TYPE == "I" ]]
+then
+ oldString="Integration Build"
+elif [[ $OLD_BUILD_TYPE == "M" ]]
+then
+ oldString="Maintenance Build"
+else
+ oldString="Unexpected OLD_BUILD_TYPE: $OLD_BUILD_TYPE"
+fi
+
+if [[ "${newlabel}" =~ .*RC.* ]]
+then
+ newString="Release Candidate Build"
+elif [[ "${newlabel}" =~ .*R.* ]]
+then
+ newString="Release Build"
+elif [[ "${newlabel}" =~ .*M.* ]]
+then
+ newString="Stable Build"
+else
+ # releases have labels such as 4.4 or 4.3.1 (or KeplerSR1) so former
+ # won't match any of the above.
+ # TODO: put in sanity check to match known release patterns
+ # of digits and periods, else bail.
+ newString="Release Build"
+fi
+
+echo -e "\n\tReplacing ${oldString} with ${newString} in ${oldname}/*.php\n"
+
+replaceBuildNameCommand="s!${oldString}!${newString}!g"
+# quotes are critical here, since strings contain spaces!
+perl -w -pi -e "${replaceBuildNameCommand}" ${dirname}/*.php
+
+# some special cases, for the buildproperties.php file
+# Note, we do php only, since that's what we need, and if we did want
+# to rebuild, say using buildproperties.shsource, would be best to work
+# from original values. Less sure what to do with Ant properties,
+# buildproperties.properties ... but, we'll decide when needed.
+# TODO: New label doesn't have "R" in it ... just, for example, "4.3".
+# for now, we'll "fall through" to "R", if doesn't match anything else,
+# but this won't work well if/when we add others, such as X or T for test
+# builds.
+
+if [[ $OLD_BUILD_TYPE == "I" ]]
+then
+ oldString="BUILD_TYPE = \"I\""
+elif [[ $OLD_BUILD_TYPE == "M" ]]
+then
+ oldString="BUILD_TYPE = \"M\""
+else
+ oldString="Unexpected OLD_BUILD_TYPE: $OLD_BUILD_TYPE"
+fi
+
+if [[ "${newlabel}" =~ .*RC.* && $OLD_BUILD_TYPE == "I" ]]
+then
+ newString="BUILD_TYPE = \"S\""
+elif [[ "${newlabel}" =~ .*RC.* && $OLD_BUILD_TYPE == "M" ]]
+then
+ newString="BUILD_TYPE = \"M\""
+elif [[ "${newlabel}" =~ .*R.* ]]
+then
+ newString="BUILD_TYPE = \"R\""
+elif [[ "${newlabel}" =~ .*M.* ]]
+then
+ newString="BUILD_TYPE = \"S\""
+else
+ # see previous comment on forms of "releases" (4.3.1, 4.2, Kepler, KeplerSR1, etc.)
+ newString="BUILD_TYPE = \"R\""
+fi
+
+replaceBuildNameCommand="s!${oldString}!${newString}!g"
+# quotes are critical here, since strings contain spaces!
+perl -w -pi -e "${replaceBuildNameCommand}" ${dirname}/buildproperties.php
+
+# We only ever promote "I" or "M" builds, so this ends with sanity check.
+if [[ $OLD_BUILD_TYPE == "I" ]]
+then
+ oldString="BUILD_TYPE_NAME = \"Integration\""
+elif [[ $OLD_BUILD_TYPE == "M" ]]
+then
+ oldString="BUILD_TYPE_NAME = \"Maintenance\""
+else
+ oldString="BUILD_TYPE_NAME = \"Unknown OLD_BUILD_TYPE, $OLD_BUILD_TYPE\""
+fi
+
+if [[ "${newlabel}" =~ .*RC.* ]]
+then
+ newString="BUILD_TYPE_NAME = \"Release Candidate\""
+elif [[ "${newlabel}" =~ .*R.* ]]
+then
+ newString="BUILD_TYPE_NAME = \"Release\""
+elif [[ "${newlabel}" =~ .*M.* ]]
+then
+ newString="BUILD_TYPE_NAME = \"Stable\""
+else
+ newString="BUILD_TYPE_NAME = \"Release\""
+fi
+
+echo -e "\n\tReplacing ${oldString} with ${newString} in ${dirname}/buildproperties.php\n"
+
+replaceBuildNameCommand="s!${oldString}!${newString}!g"
+# quotes are critical here, since strings might contain spaces!
+perl -w -pi -e "${replaceBuildNameCommand}" ${dirname}/buildproperties.php
+
+# One special case for promoted builds, is the "FAILED" icons are
+# changed to "OK", since all unit tests accounted for, if not fixed.
+oldString="FAIL.gif"
+newString="OK.gif"
+replaceBuildNameCommand="s!${oldString}!${newString}!g"
+# quotes are critical here, since strings might contain spaces!
+perl -w -pi -e "${replaceBuildNameCommand}" ${dirname}/index.php
+
+# If the names are equal, then we must be doing an "index only" update, and no need to
+# to 'move'
+if [[ ! "${dirname}" == "${newdirname}" ]]
+then
+ echo -e "\n\n\tMove old directory, $oldname, to new directory, $newdirname.\n\n"
+ # move directory before file renames
+ mv $oldname $newdirname
+fi
+# We (currently) rename files under current directory, and in 'checksums'.
+# No need to go deeper (currently) and can be harm, since we do have a copy of
+# 'repository' in there (so things things with same name as build directory, such
+# as branding bundles? and /repository/binaries get renamed too, if we go too deep.
+# Even though we should not need that copy of 'repository' any longer, we might,
+# some day?
+echo -e "\n\n\tRename files in new directory, ./${newdirname}, to new name.\n\n"
+nFiles=$(find ./${newdirname} -mindepth 1 -maxdepth 2 -name "*${oldname}*" -print | wc -l)
+echo -e "\n\t $nFiles files found to rename.\n"
+
+for file in $(find ./${newdirname} -mindepth 1 -maxdepth 2 -name "*${oldname}*" -print)
+do
+ renamefile $file
+done
diff --git a/production/miscToolsAndNotes/misc/wgetFresh.sh b/production/miscToolsAndNotes/misc/wgetFresh.sh
new file mode 100755
index 00000000..e29345bf
--- /dev/null
+++ b/production/miscToolsAndNotes/misc/wgetFresh.sh
@@ -0,0 +1,53 @@
+#!/usr/bin/env bash
+
+# gets a fresh copy of utility scripts
+
+# this localBuildProperties.shsource file is to ease local builds to override some variables.
+# It should not be used for production builds.
+source localBuildProperties.shsource 2>/dev/null
+
+export GIT_HOST=${GIT_HOST:-"git.eclipse.org"}
+
+# codifying the branch (or tag) to use, so it can be set/chagned in one place
+initScriptTag="h=master"
+
+# to use a tag instead of branch, would be tag=X, such as
+# tag=vI20120417-0700, or in full form
+# http://git.eclipse.org/c/platform/eclipse.platform.releng.eclipsebuilder.git/plain/scripts/wgetFresh.sh?tag=vI20120417-0700
+
+source checkForErrorExit.sh
+
+gitfile=makeBranch.sh
+wget --no-verbose -O ${gitfile} http://${GIT_HOST}/c/platform/eclipse.platform.releng.eclipsebuilder.git/plain/scripts/sdk/${gitfile}?$initScriptTag 2>&1;
+checkForErrorExit $? "could not wget file: ${gitfile}"
+gitfile=renameBuild.sh
+wget --no-verbose -O ${gitfile} http://${GIT_HOST}/c/platform/eclipse.platform.releng.eclipsebuilder.git/plain/scripts/sdk/${gitfile}?$initScriptTag 2>&1;
+checkForErrorExit $? "could not wget file: ${gitfile}"
+gitfile=checkForErrorExit.sh
+wget --no-verbose -O ${gitfile} http://${GIT_HOST}/c/platform/eclipse.platform.releng.eclipsebuilder.git/plain/scripts/sdk/${gitfile}?$initScriptTag 2>&1;
+checkForErrorExit $? "could not wget file: ${gitfile}"
+
+# get this script itself (would have to run twice to make use changes, naturally)
+# and has trouble "writing over itself" so we put in a file with 'NEW' suffix
+# but will remove it if no differences found.
+# and a command line like the following works well
+
+wget --no-verbose -O wgetFresh.NEW.sh http://${GIT_HOST}/c/platform/eclipse.platform.releng.eclipsebuilder.git/plain/scripts/sdk/wgetFresh.sh?$initScriptTag 2>&1;
+
+differs=`diff wgetFresh.NEW.sh wgetFresh.sh`
+
+if [ -z "${differs}" ]
+then
+ # 'new' not different from existing, so remove 'new' one
+ rm wgetFresh.NEW.sh
+else
+ echo " "
+ echo " wgetFresh.sh has changed. Compare with and consider replacing with wgetFresh.NEW.sh"
+ echo " "
+ echo "differences: ${differs}"
+ echo " "
+fi
+
+chmod ug+x *.sh
+chmod o-rwx *.sh
+

Back to the top