-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfix_repos.sh
executable file
·68 lines (56 loc) · 1.63 KB
/
fix_repos.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
# 1 - options: software, data-experiment, workflows
# 2 - options: replace, reset, diff, push, status
# 3 - (optional) package name(s)
# 4 - (optional) commit message
## replace - Run replacement script and bump package 'z' version
## reset - revert the package changes to most recent commit
## diff - see changes with git diff
## push - push changes to git.bioc
pkg_type=$1
CMD=$2
PKGS=$3
CMT_MSG=$4
if [ -z "${CMT_MSG// }" ]; then
CMT_MSG="additional updates from BiocInstaller to BiocManager"
fi
. ./utils/setBIOC.sh
LIST_FILE="${pkg_type}_BiocInstaller_biocLite_PKGS.txt"
EXCLUDE=( BiocInstaller AnnotationHub AnnotationHubData BiocCheck )
cd $BIOC
# GIST_FOLDER clone
# git clone [email protected]:$GIST_FOLDER.git
if [ -z "${PKGS// }" ]; then
readarray -t PKGS < $BIOC/$GIST_FOLDER/$LIST_FILE
fi
for dex in ${EXCLUDE[@]}
do
PKGS=("${PKGS[@]/$dex}")
done
for i in ${PKGS[@]}
do
cd $BIOC/git.bioconductor.org/$pkg_type/$i
echo "Working on package: $i..."
if [ "$CMD" == "replace" ]; then
$BIOC/utils/replace_alt_keywords.sh
retVal=$?
if [ $retVal -ne 0 ]; then
$BIOC/utils/version_bump.sh
fi
elif [ "$CMD" == "reset" ]; then
echo " Resetting changes to $i"
git checkout -- .
elif [ "$CMD" == "push" ]; then
git remote set-url origin [email protected]:packages/$i.git
git remote -v
git commit -am "$CMT_MSG"
git push origin master
elif [ "$CMD" == "diff" ]; then
git diff
elif [ "$CMD" == "status" ]; then
git status
else
echo "$CMD is not a valid option"
fi
done
cd $BIOC