summaryrefslogtreecommitdiff
path: root/tests.branching/setup
blob: 126714a0787280695a12151348ecf74d7e67ee9c (plain)
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
#!/bin/sh
# Copyright (C) 2012  Codethink Limited
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


# Set up $DATADIR.
#
# - a morph.conf configuration file
# - an empty morph mine directory
# - a git repository called "morphs" for fake system, stratum morphologies
# - a git repository calle "hello" for a dummy chunk

set -eu

export GIT_AUTHOR_NAME
export GIT_AUTHOR_EMAIL
export GIT_AUTHOR_DATE
export GIT_COMMITTER_NAME
export GIT_COMMITTER_EMAIL
export GIT_COMMITTER_DATE
GIT_AUTHOR_NAME=developer
GIT_AUTHOR_EMAIL=developer@example.com
GIT_AUTHOR_DATE="1343753514 +0000"
GIT_COMMITTER_NAME=developer
GIT_COMMITTER_EMAIL=developer@example.com
GIT_COMMITTER_DATE="1343753514 +0000"

# Create a morph configuration file
cat <<EOF > "$DATADIR/morph.conf"
[config]
repo-alias = baserock=file://$DATADIR/%s#file://$DATADIR/%s
cachedir = $DATADIR/mine/.morph/cache
log = $DATADIR/morph.log
keep-path = true
no-distcc = true
quiet = true
EOF


# Create an empty directory to be used as a morph mine
mkdir "$DATADIR/mine"


# Create a fake morphs repository
mkdir "$DATADIR/morphs"

cat <<EOF > "$DATADIR/morphs/hello-system.morph"
{
    "name": "hello-system",
    "kind": "system",
    "system-kind": "syslinux-disk",
    "disk-size": "1G",
    "strata": [
        {
            "morph": "hello-stratum",
            "repo": "baserock:hello",
            "ref": "master"
        }
    ]
}
EOF

cat <<EOF > "$DATADIR/morphs/hello-stratum.morph"
{
    "name": "hello-stratum",
    "kind": "stratum",
    "chunks": [
        {
            "name": "hello",
            "repo": "baserock:hello",
            "ref": "master",
            "build-depends": []
        }
    ]
}
EOF

scripts/run-git-in "$DATADIR/morphs" init
scripts/run-git-in "$DATADIR/morphs" add .
scripts/run-git-in "$DATADIR/morphs" commit -m initial


# Add an extra branch to the morphs repo.
scripts/run-git-in "$DATADIR/morphs" checkout -b alfred
touch "$DATADIR/morphs/this.is.alfred"
scripts/run-git-in "$DATADIR/morphs" add this.is.alfred
scripts/run-git-in "$DATADIR/morphs" commit --quiet -m 'mark as alfred'
scripts/run-git-in "$DATADIR/morphs" checkout master


# Create a dummy chunk repository
mkdir "$DATADIR/hello"

cat <<EOF > "$DATADIR/hello/hello.morph"
{
    "name": "hello",
    "kind": "chunk",
    "build-system": "dummy"
}
EOF

scripts/run-git-in "$DATADIR/hello" init
scripts/run-git-in "$DATADIR/hello" add .
scripts/run-git-in "$DATADIR/hello" commit -m initial


# Add an extra branch to the hello repo.
scripts/run-git-in "$DATADIR/hello" checkout -b alfred
scripts/run-git-in "$DATADIR/hello" checkout master