-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup_repos.sh
executable file
·56 lines (45 loc) · 1.73 KB
/
setup_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
#!/bin/bash
set -ex
# Must be provided by user
RELEASE_DIR=$(realpath $1)
PATCHES_DIR="$RELEASE_DIR/patches/"
UPSTREAM_DIR="$RELEASE_DIR/upstream/"
DEFAULT_DEPTH="100"
NO_DEPTH="-1"
# Format: <upstream repo name>@
# <upstream repo url>@
# <upstream branch>@
# <base revision on chosen upstream branch>@
# <clone depth>
REVS_MAP=("DeepRecSys@https://github.com/harvard-acc@master@1383176@$NO_DEPTH"
"dlrm@https://github.com/facebookresearch@main@4a9d0182@$NO_DEPTH"
"pytorch@https://github.com/pytorch@release/2.0@c263bd43e8@$DEFAULT_DEPTH"
"gramine@https://github.com/gramineproject@master@37550e1@$NO_DEPTH"
"qemu@https://github.com/[email protected]@b67b00e@$DEFAULT_DEPTH"
"DRAMsim3@https://github.com/umd-memsys@master@2981759@$DEFAULT_DEPTH"
"linux@https://git.kernel.org/pub/scm/linux/kernel/git/[email protected]@38f3ee126@$DEFAULT_DEPTH")
PNM_LIB_DIR="PNMLibrary"
rm -fr $UPSTREAM_DIR && mkdir -p $UPSTREAM_DIR
cd $RELEASE_DIR
setup_pnm_lib_repo() {
(cd $PNM_LIB_DIR; patch -p1 < $PATCHES_DIR/$PNM_LIB_DIR/*.patch)
}
setup_upstream_repo() {
URL="${2}/${1}"
DEPTH_OPT="--depth $5"
if [ "x$5" = "x$NO_DEPTH" ];
then
DEPTH_OPT=""
fi
(cd $UPSTREAM_DIR && git clone $URL -b $3 $DEPTH_OPT && cd $1 && git checkout $4 && \
git checkout -b pnm && git am $PATCHES_DIR/$1/*.patch)
}
setup_pnm_lib_repo
for rec in "${REVS_MAP[@]}"; do
REPO=$(echo "$rec" | awk -F "@" '{print $1}')
UPSTREAM_PREFIX=$(echo "$rec" | awk -F "@" '{print $2}')
BRANCH=$(echo "$rec" | awk -F "@" '{print $3}')
REV=$(echo "$rec" | awk -F "@" '{print $4}')
DEPTH=$(echo "$rec" | awk -F "@" '{print $5}')
setup_upstream_repo $REPO $UPSTREAM_PREFIX $BRANCH $REV $DEPTH
done