-
Notifications
You must be signed in to change notification settings - Fork 53
/
CloneRepositories.sh
134 lines (112 loc) · 3.03 KB
/
CloneRepositories.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#/bin/bash
set -e
clone()
{
local repo=$1
local folder=$2
echo ''
echo "Cloning $repo"
if [ ! -d "$folder" ]; then
git clone https://github.com/ImageMagick/$repo.git $folder
if [ $? != 0 ]; then echo "Error during checkout"; exit; fi
fi
cd $folder
git reset --hard
git pull origin main
cd ..
}
clone_commit()
{
local repo=$1
local commit=$2
local folder=$3
clone $repo $folder
cd $folder
git checkout $commit >/dev/null
git show --oneline -s
cd ..
}
clone_date()
{
local repo=$1
local date=$2
clone $repo $repo
cd $repo
local commit=$(git rev-list -n 1 --before="$date" origin/main)
git checkout $commit >/dev/null
git show --oneline -s
cd ..
}
imagemagick=$1
sha=$2
if [ -z "$imagemagick" ]; then
echo "Usage: $0 ImageMagick/ImageMagick6 [<commit>|latest]"
exit 1
fi
if [ -d "../$imagemagick" ]; then
echo "Copying repository from ../$imagemagick"
cp -R ../$imagemagick "ImageMagick"
git -C "ImageMagick" show --oneline -s
else
if [ -z "$sha" ] || [ "$sha" = "latest" ]; then
commit=$(git ls-remote "https://github.com/ImageMagick/$imagemagick" "main" | cut -f 1)
else
commit=$sha
fi
clone_commit "$imagemagick" "$commit" "ImageMagick"
fi
if [ "$sha" = "latest" ]; then
declare -r commitDate=`date "+%Y-%m-%d %H:%M:%S %z"`
else
# get a commit date from the current ImageMagick checkout
declare -r commitDate=`git -C ImageMagick log -1 --format=%ci`
fi
echo "Set latest commit date as $commitDate"
if [ ! -d "Dependencies" ]; then
mkdir -p "Dependencies"
fi
cd "Dependencies"
clone_date 'aom' "$commitDate"
clone_date 'brotli' "$commitDate"
clone_date 'bzlib' "$commitDate"
clone_date 'cairo' "$commitDate"
clone_date 'croco' "$commitDate"
clone_date 'de265' "$commitDate"
clone_date 'deflate' "$commitDate"
clone_date 'exr' "$commitDate"
clone_date 'ffi' "$commitDate"
clone_date 'freetype' "$commitDate"
clone_date 'fribidi' "$commitDate"
clone_date 'glib' "$commitDate"
clone_date 'harfbuzz' "$commitDate"
clone_date 'heif' "$commitDate"
clone_date 'highway' "$commitDate"
clone_date 'jpeg-turbo' "$commitDate"
clone_date 'jpeg-turbo-12' "$commitDate"
clone_date 'jpeg-turbo-16' "$commitDate"
clone_date 'jpeg-xl' "$commitDate"
clone_date 'lcms' "$commitDate"
clone_date 'lqr' "$commitDate"
clone_date 'lzma' "$commitDate"
clone_date 'openjpeg' "$commitDate"
clone_date 'pango' "$commitDate"
clone_date 'pixman' "$commitDate"
clone_date 'png' "$commitDate"
clone_date 'raqm' "$commitDate"
clone_date 'raw' "$commitDate"
clone_date 'rsvg' "$commitDate"
clone_date 'tiff' "$commitDate"
clone_date 'webp' "$commitDate"
clone_date 'xml' "$commitDate"
clone_date 'zip' "$commitDate"
clone_date 'zlib' "$commitDate"
cd ..
if [ ! -d "OptionalDependencies" ]; then
mkdir -p "OptionalDependencies"
fi
cd "OptionalDependencies"
clone_date 'dcraw' "$commitDate"
clone_date 'fftw' "$commitDate"
clone_date 'flif' "$commitDate"
clone_date 'IMDisplay' "$commitDate"
clone_date 'jbig' "$commitDate"