From ddaaa7846706be073573c09155b4cd7b21db29f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Val=C3=AD=C4=8Dek?= Date: Fri, 5 Aug 2022 23:12:52 +0200 Subject: [PATCH] Remove obsolette code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Václav Valíček --- old/checker/detector-lib-cfg | 29 -------------- old/checker/detector-lib-general | 33 ---------------- old/checker/detector-lib-git | 51 ------------------------ old/dockerbin/run-mirror-update | 2 +- old/src/mirror-main-repo | 17 -------- old/src/submodule-describe | 66 -------------------------------- 6 files changed, 1 insertion(+), 197 deletions(-) delete mode 100644 old/checker/detector-lib-cfg delete mode 100644 old/checker/detector-lib-general delete mode 100644 old/checker/detector-lib-git delete mode 100755 old/src/submodule-describe diff --git a/old/checker/detector-lib-cfg b/old/checker/detector-lib-cfg deleted file mode 100644 index d29b6e6..0000000 --- a/old/checker/detector-lib-cfg +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - - -# check if varriable is set -[ -n "$CONFIG_DIR" ] || die "ConfigDir is not set - exit!" - - -function detectorRunCapable(){ - if [ -f $CONFIG_DIR/detector.cfg ] - then - return 0 - else - return 1 - fi -} - -function detectorLoadConfig(){ - # load config - source $CONFIG_DIR/detector.cfg - - # create cache dirs - DET_DIR=$CCLONE_CACHE/detector - DET_TAGS=$DET_DIR/tags - DET_BRANCHES=$DET_DIR/branches - [ -d $DET_TAGS ] || mkdir -p $DET_TAGS - [ -d $DET_BRANCHES ] || mkdir -p $DET_BRANCHES -} - - diff --git a/old/checker/detector-lib-general b/old/checker/detector-lib-general deleted file mode 100644 index 4d05cc6..0000000 --- a/old/checker/detector-lib-general +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -function detectorTryInit(){ - # repo dir - dir=$1 - history=$DET_DIR/detectorExecuted - - if ! [ -f $history ] - then - echo "Initializing detector cache" - # initialize seed - git --git-dir $dir log --all --format="%H" > $history - fi -} - -function detectorCheckCommit(){ - sha=$1 - history=$DET_DIR/detectorExecuted - [ -f $history ] || touch $history - - if grep -q $sha $history - then - return 1 - else - return 0 - fi -} - -function detectorSaveCommit(){ - sha=$1 - history=$DET_DIR/detectorExecuted - echo $sha >> $history -} diff --git a/old/checker/detector-lib-git b/old/checker/detector-lib-git deleted file mode 100644 index bb1980d..0000000 --- a/old/checker/detector-lib-git +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash - - -function detectorSum(){ - local dir=$1 - [ -f $dir/FETCH_HEAD ] || touch $dir/FETCH_HEAD - # use md5sum - it is in busybox - cat $dir/FETCH_HEAD | md5sum | cut -f1 -d' ' -} - -function detectorSumPersist(){ - detectorSum $1 > $CCLONE_CACHE/detectorSum -} - -function detectorCheckFetchHead(){ - # check if repo fetch_head changed, if so, return 1 - local dir=$1 - - [ -f $CCLONE_CACHE/detectorSum ] || touch $CCLONE_CACHE/detectorSum - - newSum=$(detectorSum $dir) - oldSum=$(cat $CCLONE_CACHE/detectorSum) - - if [ "x$oldSum" = "x$newSum" ] - then - return 0 - else - return 1 - fi -} - - -function gitListTags(){ - local dir=$1 - git --git-dir="$dir" tag -l | cat -} - -function gitListBranches(){ - local dir=$1 - git --git-dir="$dir" for-each-ref --format='%(refname:short)' refs/heads/ -} - - -function gitPrefBranches(){ - local dir=$1 - gitListBranches $1 | grep master || true - gitListBranches $1 | grep upstream || true - gitListBranches $1 | sort | grep -vE 'master|upstream' -} - - diff --git a/old/dockerbin/run-mirror-update b/old/dockerbin/run-mirror-update index f45d4da..c264950 100755 --- a/old/dockerbin/run-mirror-update +++ b/old/dockerbin/run-mirror-update @@ -1,4 +1,4 @@ -#!/bin/bash +i#!/bin/bash set -euo pipefail IFS=$'\n\t' diff --git a/old/src/mirror-main-repo b/old/src/mirror-main-repo index c599131..75fc536 100755 --- a/old/src/mirror-main-repo +++ b/old/src/mirror-main-repo @@ -5,20 +5,3 @@ # # Usage: # mirror-main-repo - - -# Unofficial strict mode -set -euo pipefail -IFS=$'\n\t' - -source $(dirname $(realpath $0))/gen-mirror-path - -function updateOrCreate(){ - # implemented in RepoTool -} - -function getLastCommit(){ - # replaced by git_tool repo hash -} - -updateOrCreate $1 \ No newline at end of file diff --git a/old/src/submodule-describe b/old/src/submodule-describe deleted file mode 100755 index 76a937d..0000000 --- a/old/src/submodule-describe +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash -# -# Describe submodules in repository, optionally per commit -# -# Usage: -# submodule-describe [] -# -# Output: -# -# -# -# everything separated with tabs - -# Safe mode -set -euo pipefail -IFS=$'\n\t' - -# get config file for specific commit -function getConfigFile() { - git --no-pager show $commit:.gitmodules -} - -# parse submodule file from file -function parseSectionNames(){ - git config -f $1 --list --name-only | grep '^submodule.' | cut -d. -f2 | sort | uniq -} - -# generate line for single submodule -function generateDescription(){ - cfgFile=$1 - section=$2 - - path=$(git config -f $cfgFile --get submodule.$section.path) - url=$(git config -f $cfgFile --get submodule.$section.url) - hash=$(git ls-tree -l $commit -- $path | cut -d' ' -f3) - - printf "%s\t%s\t%s\n" $hash $path $url -} - - - - -# Grab varriables -repodir=$1 -commit=${2:-HEAD} - -# Go to repo directory -oldPwd=$(pwd) -cd $repodir - -# Are there any submodules registered? -test 0 -eq `git ls-tree $commit -- .gitmodules | wc -l` && exit 0 - -tmpfile=$(mktemp) - -getConfigFile $repodir $commit > $tmpfile -for section in $(parseSectionNames $tmpfile) -do - generateDescription $tmpfile $section -done - - -# Cleanup -rm $tmpfile -# Go back home -cd $oldPwd