From 09bb47f637726953e73bc62dc75e3ca4a0a05ef7 Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Mon, 15 Dec 2025 10:57:32 -0500 Subject: [PATCH] Remove obsolete/unused scripts Signed-off-by: Hugo Villeneuve --- scripts/Makefile.am | 14 +-- scripts/distro-backup | 13 --- scripts/git-hg-sub-import | 123 ----------------------- scripts/git-hg-sub-update | 72 ------------- scripts/git-project-clone.sh | 96 ------------------ scripts/git-project-fetch.sh | 49 --------- scripts/git-project-gitk.sh | 43 -------- scripts/git-project-list.sh | 45 --------- scripts/git-project-tag.sh | 37 ------- scripts/git-project-update.sh | 40 -------- scripts/hg-format-patch | 82 --------------- scripts/hg-update-subrepos | 44 -------- scripts/hv-git-functions.sh | 150 ---------------------------- scripts/hv-hg-functions.sh | 183 ---------------------------------- scripts/replace-gpl-header.sh | 102 ------------------- 15 files changed, 1 insertion(+), 1092 deletions(-) delete mode 100755 scripts/distro-backup delete mode 100755 scripts/git-hg-sub-import delete mode 100755 scripts/git-hg-sub-update delete mode 100755 scripts/git-project-clone.sh delete mode 100755 scripts/git-project-fetch.sh delete mode 100755 scripts/git-project-gitk.sh delete mode 100755 scripts/git-project-list.sh delete mode 100755 scripts/git-project-tag.sh delete mode 100755 scripts/git-project-update.sh delete mode 100755 scripts/hg-format-patch delete mode 100755 scripts/hg-update-subrepos delete mode 100644 scripts/hv-git-functions.sh delete mode 100644 scripts/hv-hg-functions.sh delete mode 100755 scripts/replace-gpl-header.sh diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 07ce625..5df8414 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -6,7 +6,6 @@ dist_bin_SCRIPTS = \ cd-erase cd-copy media-write \ cgrep \ pstopdf \ - distro-backup \ dos2unix \ fix-avi \ gztobz2 tarbz2 \ @@ -32,17 +31,7 @@ dist_bin_SCRIPTS = \ hvk-dt.sh \ hvk-select.sh \ hvk-x86.sh \ - hv-hg-functions.sh \ - hg-format-patch hg-update-subrepos \ - git-hg-sub-import git-hg-sub-update \ git-repos-update-clean \ - hv-git-functions.sh \ - git-project-fetch.sh \ - git-project-list.sh \ - git-project-update.sh \ - git-project-clone.sh \ - git-project-tag.sh \ - git-project-gitk.sh \ source-code-stats \ reindent-allman.sh \ reindent-linux.sh \ @@ -60,8 +49,7 @@ skel_DATA = \ # we want these in the dist tarball # (for scripts that we don't want to install but want to distribute) -EXTRA_DIST = \ - replace-gpl-header.sh +#EXTRA_DIST = ... CLEANFILES = *~ diff --git a/scripts/distro-backup b/scripts/distro-backup deleted file mode 100755 index 006ab2b..0000000 --- a/scripts/distro-backup +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -# linux HV backup - -export MEDIA_DEV="/dev/dvd" -export MEDIA_DIR="/media/dvd" - -export BKP_TMP_DIR=/mnt/video/tmp -BKP_FILES_LIST="/bin /boot /dev /etc /home /lib /opt /root /sbin /var /usr" - -media-write ${BKP_FILES_LIST} - -exit $? diff --git a/scripts/git-hg-sub-import b/scripts/git-hg-sub-import deleted file mode 100755 index 0180d4f..0000000 --- a/scripts/git-hg-sub-import +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/bash -set -o errexit - -SCRIPT="`readlink -e $0`" -SCRIPTPATH=$(dirname ${SCRIPT}) -source ${SCRIPTPATH}/hv-hg-functions.sh - -# for use with git-remote-hg: -# http://felipec.wordpress.com/2012/11/13/git-remote-hg-bzr-2/ - -# Uncomment to have verbose debug output -#debug=1 - -print_usage() -{ - echo "$(basename $0) -- HG subrepository importer for git-remote-hg" - echo "Usage: $(basename $0) [OPTIONS...]" -} - -if [ "x${1}" = "x--help" ]; then - print_usage - exit 1 -fi - -if [ ! -f .hgsub ]; then - echo "No Mercurial subrepositories found" - exit 1 -fi - -if [ ! -f .gitignore ]; then - # We do not want to track .gitignore itself - echo ".gitignore" > .gitignore -fi - -asm=$(cat .git/config | grep "hg::" | sed "s/.*url = hg::\(.*\)/\1/") -hg_parse_projrc ${asm} - -hg_parse_subpaths - -HGSUB_TMP="/tmp/$(basename $0).hgsub-$$.tmp" - -# Create temporary copy to replace backslashes with slashes. -cat .hgsub | sed 's/\\/\//g' > ${HGSUB_TMP} - -# Read lines from .hgsub -while read sub; do - # Remove CR (DOS) - sub="${sub//$'\r'/}" - - if [ "${sub}" != "" ]; then - # Get subrepository URL - src="${sub//*= /}" - - # Replace using Mercurial subpaths substitutions (either projrc or from hgrc) - src=$(apply_substitutions ${src}) - - # Original name - repo=$(basename "${src}") - srcpath=$(dirname "${src}") - - # Get subrepository local alias or label - dest="${sub// =*}" - - # Get project ID (example: S0289) - id=$(echo ${sub} | sed "s/.*\(S[0-9][0-9][0-9][0-9]\).*/\1/") - - # Get revision of subrepository (remove CR from .hgsubstate) - rev=$(cat .hgsubstate | tr -d '\r' | grep "${id}" | sed "s/ .*//") - - if [ -n "${debug}" ]; then - echo "repo: ${repo}" - echo " path: ${srcpath}" - echo " id: ${id}" - echo " local: ${dest}" - echo " rev: ${rev}" - fi - - if [ ! -d "${dest}" ]; then - subrepo_find_branch "${src}" ${id} ${rev} - - # git-remote-hg seems to replace - # "BRANCH - NAME" - # with - # "BRANCH___-___NAME" - branch="${branch// /___}" - - if [ -n "${debug}" ]; then - echo "branch: ${branch}" - fi - - git clone "hg::${src}" "${dest}" - - cd "${dest}" - - if [ -x ${HOME}/scripts/git-set-local-author.sh ]; then - # Make sure commits have correct author for LSI - ${HOME}/scripts/git-set-local-author.sh - fi - - if [ "x${branch}" != "xdefault" ]; then - # Make tracking branch - git checkout -f "branches/${branch}" - - # Adjusting git tree to specific commit specified in - # .hgsubstate: - # The SHA from hg and git are not the same, therefore, we must - # find the commit sequence in hg and map this - # to a hash in git using the ${num} variable: - git_rev=$(git log --oneline | sed -n "${num}p" | awk '{print $1}') - git reset --hard ${git_rev} - fi - - cd .. - - if ! grep -q "${dest}" .gitignore ; then - # Ignore subrepo in top-level git repository - echo "${dest}" >> .gitignore - fi - fi - fi -done < ${HGSUB_TMP} - -rm ${HGSUB_TMP} diff --git a/scripts/git-hg-sub-update b/scripts/git-hg-sub-update deleted file mode 100755 index c381546..0000000 --- a/scripts/git-hg-sub-update +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash -set -o errexit - -SCRIPT="`readlink -e $0`" -SCRIPTPATH=$(dirname ${SCRIPT}) -source ${SCRIPTPATH}/hv-hg-functions.sh - -# for use with git-remote-hg: -# http://felipec.wordpress.com/2012/11/13/git-remote-hg-bzr-2/ - -# Uncomment to have verbose debug output -#debug=1 - -print_usage() -{ - echo "$(basename $0) -- HG subrepository importer for git-remote-hg" - echo "Usage: $(basename $0) [OPTIONS...]" -} - -if [ "x${1}" = "x--help" ]; then - print_usage - exit 1 -fi - -if [ ! -f .hgsub ]; then - echo "No Mercurial subrepositories found" - exit 1 -fi - -if [ ! -f .gitignore ]; then - # We do not want to track .gitignore itself - echo ".gitignore" > .gitignore -fi - -hg_subpaths_config - -# Read lines from .hgsub -while read sub; do - # Remove CR (DOS) - sub="${sub//$'\r'/}" - - if [ "${sub}" != "" ]; then - # Get subrepository URL - src="${sub//*= /}" - - # Replace using subpaths extension content - src=${src/${sp_src}/${sp_dst}} - - # Get subrepository local alias or label - dest="${sub// =*}" - - # Get project ID (example: S0289) - id=$(echo ${sub} | sed "s/.*\(S[0-9][0-9][0-9][0-9]\).*/\1/") - - # Get revision of subrepository (remove CR from .hgsubstate) - rev=$(cat .hgsubstate | tr -d '\r' | grep "${id}" | sed "s/ .*//") - - if [ -n "${debug}" ]; then - echo "repo: ${src}" - echo " id: ${id}" - echo " rev: ${rev}" - echo " src: ${src}" - echo " dest: ${dest}" - fi - - pushd "${dest}" 1> /dev/null - echo "============================" - echo "subrepo: ${dest}" - git pull - popd 1> /dev/null - fi -done < .hgsub diff --git a/scripts/git-project-clone.sh b/scripts/git-project-clone.sh deleted file mode 100755 index 44d0eba..0000000 --- a/scripts/git-project-clone.sh +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/bash - -SCRIPT="`readlink -e $0`" -SCRIPTPATH=$(dirname ${SCRIPT}) -source ${SCRIPTPATH}/hv-git-functions.sh - -# Uncomment to have verbose debug output -##debug=1 - -print_usage() -{ - echo "$(basename $0) -- GIT clone branch for multiple subrepositories" - echo "Usage: $(basename $0) [OPTIONS...] BRANCH_FROM BRANCH_NEW" -} - -if [ "x${1}" = "x--help" ]; then - print_usage - exit 1 -fi - -if [ ${#} -ne 2 ]; then - echo "Missing arguments" - print_usage - exit 1 -fi - -hv_git_validate_subrepos_list - -branch_from=${1} -branch_new=${2} -rc=0 - -clone_repo() -{ - if [ ${#} -ne 1 ]; then - echo "Missing repository name" - exit 1 - fi - - local r=${1} - - echo -n "Repo ${r}: " - - pushd "${r}" 1> /dev/null - - b=${branch_new} - exists=$(git show-ref refs/heads/${b}) - if [ -n "$exists" ]; then - # Switch to existing branch - vco -q ${b} 1> /dev/null - echo "${b} (already created)" - else - # Create branch only if it doesn't already exist - vco -q -b ${b} 1> /dev/null - - if [ ${?} -ne 0 ]; then - echo "Error creating new branch: ${b}" - rc=1 - else - echo "${b}" - fi - fi - - popd 1> /dev/null -} - -# First, try to update all subrepos to BRANCH_FROM - -for r in ./ $(hv_git_get_subrepos_list); do - # Make sure directory exists - if [ ! -d "${r}" ]; then - echo "Missing repos ${r}, skipping" - continue - fi - - hv_git_checkout ${r} ${branch_from} - if [ ${?} -ne 0 ]; then - echo "Error switching to ${branch_from} in repos ${r}" - exit 1 - fi -done - -# Then clone repo - -for r in ./ $(hv_git_get_subrepos_list); do - # Make sure directory exists - if [ ! -d "${r}" ]; then - echo "Missing repos ${r}, skipping" - continue - fi - - clone_repo ${r} - rc=${?} -done - -exit ${rc} diff --git a/scripts/git-project-fetch.sh b/scripts/git-project-fetch.sh deleted file mode 100755 index 8c17043..0000000 --- a/scripts/git-project-fetch.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -SCRIPT="`readlink -e $0`" -SCRIPTPATH=$(dirname ${SCRIPT}) -source ${SCRIPTPATH}/hv-git-functions.sh - -print_usage() -{ - echo "$(basename $0) -- GIT remote update for multiple subrepositories" - echo "Usage: $(basename $0) [OPTIONS...]" -} - -if [ "x${1}" = "x--help" ]; then - print_usage - exit 1 -fi - -hv_git_validate_subrepos_list - -remote_update_repo() -{ - if [ ${#} -ne 1 ]; then - echo "Missing repository name" - exit 1 - fi - - local r=${1} - - echo "Repo ${r}:" - - pushd "${r}" 1> /dev/null - git fetch --all --prune 1> /dev/null - vco master - git pull --ff-only - vco latest - git pull --ff-only - popd 1> /dev/null -} - -for r in ./ $(hv_git_get_subrepos_list); do - # Make sure directory exists - if [ ! -d "${r}" ]; then - echo "Missing repos ${r}, skipping" - continue - fi - - remote_update_repo ${r} - rc=${?} -done diff --git a/scripts/git-project-gitk.sh b/scripts/git-project-gitk.sh deleted file mode 100755 index be1b8a0..0000000 --- a/scripts/git-project-gitk.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -SCRIPT="`readlink -e $0`" -SCRIPTPATH=$(dirname ${SCRIPT}) -source ${SCRIPTPATH}/hv-git-functions.sh - -print_usage() -{ - echo "$(basename $0) -- Start gitk for each subrepository" - echo "Usage: $(basename $0) [OPTIONS...]" -} - -if [ "x${1}" = "x--help" ]; then - print_usage - exit 1 -fi - -if [ ${#} -ne 0 ]; then - echo "Unsupported argument(s)" - print_usage - exit 1 -fi - -hv_git_validate_subrepos_list - -branch=${1} -rc=0 - -for r in ./ $(hv_git_get_subrepos_list); do - # Make sure directory exists - if [ ! -d "${r}" ]; then - echo "Skipping missing repos ${r}" - continue - fi - - pushd ${r} 1> /dev/null - # Use absolute path to prevent using an alias - /usr/bin/gitk --all & - popd 1> /dev/null - rc=${?} -done - -exit ${rc} diff --git a/scripts/git-project-list.sh b/scripts/git-project-list.sh deleted file mode 100755 index 7480026..0000000 --- a/scripts/git-project-list.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash - -SCRIPT="`readlink -e $0`" -SCRIPTPATH=$(dirname ${SCRIPT}) -source ${SCRIPTPATH}/hv-git-functions.sh - -print_usage() -{ - echo "$(basename $0) -- List last SHA for each repo" - echo "Usage: $(basename $0) [OPTIONS...]" -} - -if [ "x${1}" = "x--help" ]; then - print_usage - exit 1 -fi - -hv_git_validate_subrepos_list - -list_revisions() -{ - if [ ${#} -ne 1 ]; then - echo "Missing repository name" - exit 1 - fi - - local r=${1} - - pushd "${r}" 1> /dev/null - local sha=$(git log --abbrev=10 --pretty='format:%h %s' HEAD~1..HEAD) - - local line=' ' - printf "%s %s %s\n" ${r} "${line:${#r}}" "${sha}" - popd 1> /dev/null -} - -for r in ./ $(hv_git_get_subrepos_list); do - # Make sure directory exists - if [ ! -d "${r}" ]; then - echo "Missing repos ${r}, skipping" - continue - fi - - list_revisions ${r} -done diff --git a/scripts/git-project-tag.sh b/scripts/git-project-tag.sh deleted file mode 100755 index 3cf7673..0000000 --- a/scripts/git-project-tag.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -SCRIPT="`readlink -e $0`" -SCRIPTPATH=$(dirname ${SCRIPT}) -source ${SCRIPTPATH}/hv-git-functions.sh - -print_usage() -{ - echo "$(basename $0) -- Create tag from branch" - echo "Usage: $(basename $0) [OPTIONS...] BRANCH TAG" -} - -if [ "x${1}" = "x--help" ]; then - print_usage - exit 1 -fi - -if [ ${#} -ne 2 ]; then - echo "Missing arguments" - print_usage - exit 1 -fi - -hv_git_validate_subrepos_list - -branch_name=${1} -tag_name=${2} - -for r in ./ $(hv_git_get_subrepos_list); do - # Make sure directory exists - if [ ! -d "${r}" ]; then - echo "${SCRIPT}: missing repos ${r}, skipping" - continue - fi - - hv_git_tag_from_branch ${r} ${branch_name} ${tag_name} -done diff --git a/scripts/git-project-update.sh b/scripts/git-project-update.sh deleted file mode 100755 index 6b6895f..0000000 --- a/scripts/git-project-update.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -SCRIPT="`readlink -e $0`" -SCRIPTPATH=$(dirname ${SCRIPT}) -source ${SCRIPTPATH}/hv-git-functions.sh - -print_usage() -{ - echo "$(basename $0) -- GIT update to branch for multiple subrepositories" - echo "Usage: $(basename $0) [OPTIONS...] BRANCH" -} - -if [ "x${1}" = "x--help" ]; then - print_usage - exit 1 -fi - -if [ ${#} -ne 1 ]; then - echo "Missing BRANCH argument" - print_usage - exit 1 -fi - -hv_git_validate_subrepos_list - -branch=${1} -rc=0 - -for r in ./ $(hv_git_get_subrepos_list); do - # Make sure directory exists - if [ ! -d "${r}" ]; then - echo "Skipping missing repos ${r}" - continue - fi - - hv_git_checkout ${r} ${branch} - rc=${?} -done - -exit ${rc} diff --git a/scripts/hg-format-patch b/scripts/hg-format-patch deleted file mode 100755 index 9202c5b..0000000 --- a/scripts/hg-format-patch +++ /dev/null @@ -1,82 +0,0 @@ -#!/bin/bash - -VCS_SUPPORTED="Mercurial" - -# Optional prefix before patch name -PATCH_NAME_PREFIX="" - -# Default revision if not specified -REVS=tip - -print_usage() -{ - echo "$(basename $0) -- git format-patch equivalent for Mercurial" - echo "Usage: $(basename $0) [OPTIONS...]" - echo - echo "Options:" - echo " -h display this help and exit" - echo " -r [a..b] or [a-b] or [a:b]: sequence of revisions" - echo " [a,b,c]: specific revisions list" - echo " [a]: single revision" - echo " if not specified, default is tip" -} - -while getopts "hr:" flag ;do - case ${flag} in - h) - print_usage - exit 0 - ;; - r) - REVS=${OPTARG} - ;; - ?) - echo "${PROG_NAME}: Invalid option: ${OPTARG}." - echo "Try \`${PROG_NAME} --help' for more information." - exit 1 - ;; - esac -done -shift `expr "${OPTIND}" - 1` - -# `$#' now represents the number of arguments after the options. -# `$1' is the first argument, etc. -if [ $# -ne 0 ]; then - echo "${PROG_NAME}: Too many arguments." - echo "Try \`${PROG_NAME} --help' for more information." - exit 1 -fi - -if echo ${REVS} | grep -F -q ':'; then - SEP_CHAR=":" -elif echo ${REVS} | grep -F -q '-'; then - SEP_CHAR="-" -elif echo ${REVS} | grep -F -q '..'; then - SEP_CHAR="\.\." -elif echo ${REVS} | grep -F -q ','; then - SEQ="${REVS//,/ }" -fi - -if [ -z "${SEQ}" ]; then - if [ -n "${SEP_CHAR}" ]; then - START=$(echo ${REVS} | sed "s/\(.*\)${SEP_CHAR}.*/\1/") - END=$(echo ${REVS} | sed "s/.*${SEP_CHAR}\(.*\)/\1/") - fi - - if [ -z "${START}" ]; then - SEQ=${REVS} - else - SEQ=$(seq ${START} ${END}) - fi -fi - -if hg status 1> /dev/null 2>&1; then - for r in ${SEQ}; do - NAME=${PATCH_NAME_PREFIX}${r}.patch - echo [PATCH] ${NAME} - hg export -r ${r} > ${NAME} - done -else - echo "Not a ${VCS_SUPPORTED} repository" - exit 1 -fi diff --git a/scripts/hg-update-subrepos b/scripts/hg-update-subrepos deleted file mode 100755 index d42b321..0000000 --- a/scripts/hg-update-subrepos +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -set -o errexit - -# Uncomment to have verbose debug output -debug=1 - -print_usage() -{ - echo "$(basename $0) -- Update HG subrepositories to latest version" - echo "Usage: $(basename $0) [OPTIONS...]" -} - -if [ "x${1}" = "x--help" ]; then - print_usage - exit 1 -fi - -if [ ! -f .hgsub ]; then - echo "No Mercurial subrepositories found" - exit 1 -fi - -# Arg 1: repository path -update_repos() -{ - local repo="${1}" - - pushd "${repo}" - hg pull - hg update - popd -} - -# Tabarnacle d'espaces à marde!!! -OIFS="$IFS" -IFS=$'\n' -for d in $(find . -maxdepth 1 -type d \( \ - -name . -o \ - -name S\* -o \ - -name _S\* \ - \) ); do - update_repos "${d}" -done -IFS="$OIFS" diff --git a/scripts/hv-git-functions.sh b/scripts/hv-git-functions.sh deleted file mode 100644 index 29c6cc2..0000000 --- a/scripts/hv-git-functions.sh +++ /dev/null @@ -1,150 +0,0 @@ -#!/bin/bash - -# Uncomment to have verbose debug output -#hv_git_debug=1 - -SUBREPOS_LIST=.gitsubrepos - -hv_git_validate_subrepos_list() -{ - if [ ! -f ${SUBREPOS_LIST} ]; then - echo "${FUNCNAME}: missing subrepos file list: ${SUBREPOS_LIST}" - print_usage - exit 1 - fi - - # Read list of repositories from file named .gitsubrepos - while IFS=$'\n' read r ; do - [[ "${r}" =~ \#.* ]] && continue # Skip comment lines - [ -z ${r} ] && continue # Skip enmpty lines - - # If repo directory is absent, it is ok. - # If repo directory is present, make sure it is a GIT repo - if [ -d "${r}" ]; then - if [ ! -d "${r}/.git" ]; then - echo "${FUNCNAME}: not a GIT repository: ${r}" - echo "BOZO=<${r}/.git>" - exit 1 - fi - fi - done < ${SUBREPOS_LIST} - - return 0 -} - -hv_git_get_subrepos_list() -{ - local list="" - local r="" - local IFS="" - - # Read list of repositories from file named .gitsubrepos - while IFS=$'\n' read r ; do - [[ "${r}" =~ \#.* ]] && continue # Skip comment lines - [ -z ${r} ] && continue # Skip enmpty lines - - # Add to list only if directory is present, and if it is a valid - # GIT repo - if [ -d "${r}/.git" ]; then - list="${list} ${r}" - fi - done < ${SUBREPOS_LIST} - - echo "${list}" -} - -# Arg 1: repository -# Arg 2: branch to checkout (or tag) -hv_git_checkout() -{ - if [ ${#} -ne 2 ]; then - echo "${FUNCNAME}: missing arguments" - exit 1 - fi - - local rc=0 - local r=${1} - local b=${2} - - echo -n "Repo ${r}: " - - pushd "${r}" 1> /dev/null - - exists=$(git rev-parse -q --verify ${b}) - if [ -n "${exists}" ]; then - vco -q ${b} 1> /dev/null - - if [ ${?} -ne 0 ]; then - rc=1 - echo "${b} (error)" - else - echo "${b}" - fi - else - echo "${b} (not found)" - rc=1 - fi - - popd 1> /dev/null - - return ${rc} -} - -# Create a new tag in repo -# Arg 1: repository -# Arg 2: branch from which to create tag -# Arg 3: new tag name -hv_git_tag_from_branch() -{ - if [ ${#} -ne 3 ]; then - echo "${FUNCNAME}: missing arguments" - exit 1 - fi - - local rc=0 - local sha="" - local r=${1} - local b=${2} - local tag=${3} - - echo -n "Repo ${r}: " - - pushd "${r}" 1> /dev/null - - sha=$(git show-ref refs/heads/${b} | awk '{print $1}') - if [ -n "${sha}" ]; then - git tag ${tag} ${sha} 1> /dev/null - rc=${?} - - if [ ${rc} -ne 0 ]; then - echo "${tag} (error)" - else - echo "${tag}" - git push --tags - fi - else - echo "${FUNCNAME}: branch \"${b}\" not found" - rc=1 - fi - - popd 1> /dev/null - - return ${rc} -} - -# Encore utile? -# Arg1: repository -hv_git_get_head_sha() -{ - if [ ${#} -ne 1 ]; then - echo "Missing repository name" - exit 1 - fi - - local r=${1} - - pushd "${r}" 1> /dev/null - local sha=$(git log --pretty='format:%H' HEAD~1..HEAD) - echo "${sha}" - popd 1> /dev/null -} diff --git a/scripts/hv-hg-functions.sh b/scripts/hv-hg-functions.sh deleted file mode 100644 index 9b01ece..0000000 --- a/scripts/hv-hg-functions.sh +++ /dev/null @@ -1,183 +0,0 @@ -#!/bin/bash - -# Global variable: dest -display_subrepo_name() -{ - COLOR_BLUE='\033[1;34m' - COLOR_NORMAL='\033[0m' - - echo -en "${COLOR_BLUE}" - echo "${dest}" - echo -en "${COLOR_NORMAL}" -} - -PROJRC_COUNT=0 -SUBPATHS_COUNT=0 - -# We parse the projrc file in the assembly (on the server), to check -# for any projrc substitutions. -# -# Arg 1: repository (path and name) -# -# Return the substitution key/values in arrays: -# PROJRC_KEY -# PROJRC_VAL -# PROJRC_COUNT will be greater than zero if any substitutions were found. -hg_parse_projrc() { - if [ ${#} -lt 1 ]; then - echo "Missing repository name" - fi - - # Repo name can have spaces in it, hence the use of ${*} - local repo="${*}" - - if [ -f "${repo}/.hg/projrc" ]; then - - TMPF="/tmp/$(basename $0).projrc-$$.tmp" - - # Create temporary copy to replace backslashes with slashes. - # Make sure to only replace path backslashes, not backslashes for - # quoting spaces. - # \\[^ ] Match a backslash, not followed by a space - cat "${repo}/.hg/projrc" | sed 's/\\\([^ ]\)/\/\1/g' > ${TMPF} - - while read p; do - if echo ${p} | grep -q "\s=\s"; then - local key=$(echo ${p} | sed 's/^\(.*\) = .*/\1/') - local val=$(echo ${p} | sed 's/.* = \(.*\)/\1/') - - PROJRC_KEY[${PROJRC_COUNT}]="${key}" - PROJRC_VAL[${PROJRC_COUNT}]="${val}" - - if [ -n "${debug}" ]; then - echo "Parsing PROJRC entry: ${p}" - echo " key: ${key}" - echo " val: ${val}" - fi - - PROJRC_COUNT=$((PROJRC_COUNT + 1)) - fi - done < ${TMPF} - - rm ${TMPF} - fi -} - -# git-remote-hg doesn't work with Mercurial subpaths extension, -# so use it manually. -# -# TODO: Replace this function with hg_parse_subpaths() and -# apply_substitutions(). -hg_subpaths_config() -{ - subpaths=$(hg showconfig | grep "subpaths") - - if [ -n "${subpaths}" ]; then - sp_src=${subpaths//subpaths./} - sp_src=${sp_src//=*/} - sp_src=${sp_src//\\/} # Remove windows separator (LSI) - sp_dst=${subpaths//*=/} - - if [ -n "${debug}" ]; then - echo "sp_src = $sp_src" - echo "sp_dst = $sp_dst" - fi - fi -} - -# We parse the Mercurial configuration, to check -# for any SUBPATHS substitutions. -# -# Return the substitution key/values in arrays: -# SUBPATHS_KEY -# SUBPATHS_VAL -# SUBPATHS_COUNT will be greater than zero if any substitutions were found. -hg_parse_subpaths() -{ - subpaths=$(hg showconfig subpaths) - - if [ -n "${subpaths}" ]; then - for p in ${subpaths}; do - local key=$(echo ${p} | sed 's/^subpaths\.\(.*\)=.*/\1/') - local val=$(echo ${p} | sed 's/.*=\(.*\)/\1/') - - # Replace '\\' with '/' - key=${key//\\\\/\/} - # ^^ replace multiple times - - val=${val//\\\\/\/} - - SUBPATHS_KEY[${SUBPATHS_COUNT}]="${key}" - SUBPATHS_VAL[${SUBPATHS_COUNT}]="${val}" - - if [ -n "${debug}" ]; then - echo "Parsing SUBPATHS entry: ${p}" - echo " key: ${key}" - echo " val: ${val}" - fi - - SUBPATHS_COUNT=$((SUBPATHS_COUNT + 1)) - done - fi -} - -# Replace the given path with either entries from PROJRC or SUBPATHS -# Arg 1: path -apply_substitutions() -{ - # Repo name can have spaces in it, hence the use of ${*} - local path="${*}" - - if [ ${PROJRC_COUNT} -ne 0 ]; then - for s in $(seq 0 $((${PROJRC_COUNT} - 1))); do - local pattern=${PROJRC_KEY[${s}]} - local replacement=${PROJRC_VAL[${s}]} - - path=${path/${pattern}/${replacement}} - done - fi - - if [ ${SUBPATHS_COUNT} -ne 0 ]; then - for s in $(seq 0 $((${SUBPATHS_COUNT} - 1))); do - local pattern=${SUBPATHS_KEY[${s}]} - local replacement=${SUBPATHS_VAL[${s}]} - - path=${path/${pattern}/${replacement}} - done - fi - - echo "${path}" -} - -# Map a revision to a branch name in HG subrepository -# Use hg log (in original repo) to get branch name corresponding to that -# revision. -# -# Arg 1: subrepository URL -# Arg 2: id -# Arg 3: revision -subrepo_find_branch() -{ - local src="${1}" - local id="${2}" - local rev="${3}" - - pushd "${src}" 1> /dev/null - - branch=$(hg log -r ${rev} | grep "branch:" | sed "s/branch:\ *//") - - if [ -z "${branch}" ]; then - # If "branch:" is null, this indicate we are on the default branch - branch=default - fi - - num=$(hg log --branch "${branch}" --template '{node}\n' | \ - grep -n ${rev} | awk -F ':' '{print $1}') - - if [ -n "${debug}" ]; then - echo " branch: ${branch}" - echo " num: ${num}" - fi - - popd 1> /dev/null -} diff --git a/scripts/replace-gpl-header.sh b/scripts/replace-gpl-header.sh deleted file mode 100755 index 6668666..0000000 --- a/scripts/replace-gpl-header.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/bash - -# Uncomment to test -#PATCH_OPTS="--dry-run" - -GPLPATCH=/tmp/gpl.patch - -# The patch was created with: -# $> diff -Nar -u1 a/file b/file > gpl.patch -create_patch1() -{ - cat > ${GPLPATCH} << EOF ---- a/file 2014-03-22 00:46:49.000000000 -0400 -+++ b/file 2014-03-23 14:19:51.000000000 -0400 -@@ -5,15 +5,3 @@ - * -- * This program 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 of the License, or -- * (at your option) any later version. -- * -- * This program 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 this program; if not, write to the Free Software -- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ * This file is released under the GPLv2 - */ -EOF -} - -create_patch2() -{ - cat > ${GPLPATCH} << EOF ---- a/file 2014-03-22 00:46:49.000000000 -0400 -+++ b/file 2014-03-23 14:19:51.000000000 -0400 -@@ -5,15 +5,3 @@ - * -- * This program is free software; you can redistribute it and/or modify -- * it under the terms of the GNU Lesser General Public License as published by -- * the Free Software Foundation; either version 2.1 of the License, or -- * (at your option) any later version. -- * -- * This program 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 Lesser General Public License for more details. -- * -- * You should have received a copy of the GNU Lesser General Public License -- * along with this program; if not, write to the Free Software -- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ * This file is released under the GPLv2 - */ -EOF -} - -create_patch3() -{ - cat > ${GPLPATCH} << EOF ---- a/file 2014-03-22 00:46:49.000000000 -0400 -+++ b/file 2014-03-23 14:19:51.000000000 -0400 -@@ -5,15 +5,3 @@ - * -- * This program 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 of the License, or -- * (at your option) any later version. -- * -- * This program 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 this program; if not, write to the Free Software -- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -+ * This file is released under the GPLv2 - */ -EOF -} - -for f in *.c *.h; do - if cat ${f} | grep -q " MA 02139" ; then - create_patch1 - elif cat ${f} | grep -q " MA 02111-1307" ; then - create_patch2 - elif cat ${f} | grep -q " MA 02110-1301" ; then - create_patch3 - else - echo "GPL header not found in ${f}, skipping" - continue - fi - - sed -i -e "s@/file@/${f}@g" ${GPLPATCH} - - patch ${PATCH_OPTS} -Np1 -i ${GPLPATCH} - - rm ${GPLPATCH} -done -- 2.20.1