-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrailsbuild-fetch-sources
More file actions
executable file
·59 lines (44 loc) · 1.67 KB
/
railsbuild-fetch-sources
File metadata and controls
executable file
·59 lines (44 loc) · 1.67 KB
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
#!/bin/bash
# Get the information about sources (test suites, js, ...) for Rails gems from
# their spec files, prepare the `git archive` tarballs from
# ~/.railsbuild/upstream/rails (upstream git repo) and place them in
# ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem
#
# Usage:
# ./railsbuild-fetch-tests FEDORA_BRANCH
. $(dirname $(readlink -f "$0"))/railsbuild-common
FEDORA_BRANCH=$1
cd ~/.railsbuild/upstream/rails
git pull
for gem in "${GEMS[@]}"
do
echo "Getting sources for $gem..."
VERSION=`cat ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem/rubygem-$gem.spec | sed -rn "/^Version: / s/^Version: (.*)$/\1/ p"`
GEM_FILE="$gem-$VERSION.gem"
# Is .gem already in place?
if [[ -f ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem/$GEM_FILE ]]; then
echo " ✔ $GEM_FILE already exists"
else
pushd ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem/ >> /dev/null
gem fetch $gem --version $VERSION
popd >> /dev/null
fi
GIT_ARCHIVE_CMDS=`grep -R -B1 '^Source[[:digit:]]*: ' ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem/rubygem-$gem.spec | \
sed -nr "/^#/ s/.*(git archive.*$gem.*\.tar\.gz.*)/\1/ p"`
if [[ -z "$GIT_ARCHIVE_CMDS" ]]; then
echo " ⚠ No additional source identified"
continue
fi
echo "$GIT_ARCHIVE_CMDS" | while read GIT_ARCHIVE_CMD; do
TARBALL=`echo $GIT_ARCHIVE_CMD | sed -r "s/.*($gem.*\.tar.\gz).*/\1/"`
# Is source already in place?
if [[ -f ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem/$TARBALL ]]; then
echo " ✔ $TARBALL already exists"
continue
fi
cd ~/.railsbuild/upstream/rails/$gem
`$GIT_ARCHIVE_CMD`
mv $TARBALL ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem/.
echo " $TARBALL created"
done
done