summaryrefslogtreecommitdiff
path: root/packaging/README.md
blob: dcbb5c9d96cf3b4518b5b722ac6021db0956a103 (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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# TIZEN GIT BUILD SYSTEM (GBS) 

This file contains the spec files used to create a Tizen RPM through
gbs (Git Build System).

If you are looking to build a regular RPM for debian use, please check out the 
'rpm' target of the top-level Makefile

# PREPARATION
Since the erlang build tool 'rebar' will download dependencies using
git-https the GBS build environment will fail on two items:

## Setting up GBS 
The GBS build system can be setup as described
[here](https://source.tizen.org/documentation/reference/git-build-system).



## Setting up repositories

The RVI build generated by GBS has a self-contained erlang runtime
system. This means that erlang does **not** have to be installed on
the target machine.

However, during the build process an erlang RPM needs to be installed
in the build environment.  Erlang is available at AGL's gerrit:

    https://gerrit.automotivelinux.org/gerrit/#/admin/projects/RVI/erlang

This repo also contains the pre-built erlang RPM's necessary for the
RVI build to complete. In order to have this repo pulled, the ```.gbs.conf```
in your home directory needs to be updated.
Add the following repo at the bottom of the ````.gbs.conf file```:

    [repo.erlang]
	# We still haven't determined the right repo to 
	# store the RPM file in. Use alternative repo setup
	# for now.
    url = http://XXXXXXXXXXXXXXXXXXXXXXXXX
	
Update the ```repos``` line in ```.gbs.conf``` from

    repos = repo.tizen_2.0

to

    repos = repo.tizen_2.0,repo.erlang

*Please note that your initial value of ```repos``` entry may differ.*

## Alternative set up of repositories 

A suitable erlang RPM file is packaged as a part of RVI. This can be
used instead of pulling the RPM from a repo, as describe above.

To use the RVI-packagederlang RPM file, add the following lines
```.gbs.conf```:

    [repo.erlang]
    url = /home/some_user/work/rvi/packaging/repo

*Replace the ```/home/some_user/work/rvi``` with the path to the RVI
 root directory you are building in*


## Create ~/BUILD-ROOT
If your GBS build root, ```~/GBS-ROOT```, does not exist,
you can greate it by running GBS until it fails by executing the BUILDING
step below. 

Once that build has errored out, you will have a ```~/GBS-ROOT```
directory that you can update with the DNS and certificate fixes
described below.


## DNS Server fix
The chrooted build environment does not have its /etc/resolv.conf
setup, and all DNS lookups will fail.  This is fixed by copying your local
resolv.conf file into the /etc directory of buildroot:

    sudo cp /etc/resolv.conf ~/GBS-ROOT/local/BUILD-ROOTS/scratch.i586.0/etc

*Please note that your path to the build root may differ.*

## Certificates fix 
Since the chrooted build environment does not have a /etc/ssl/certs
directory, the git SSL session will fail when it cannot authenticate
any certificates delivered by git's https sessions. 

This is fixed by copying the certificate repo from your local machine
to the /etc directory of buildroot:

    sudo cp -rL /etc/ssl/ ~/GBS-ROOT/local/BUILD-ROOTS/scratch.i586.0/etc

*Please note that your path to the build root may differ.*

# BUILDING
Go to the top directory of RVI and execute:

    sudo gbs build -A i586

An RPM file will be generated at the end of the build which can be
installed on a Tizen box. The RPM can be found at:

    ~/GBS-ROOT/local/repos/tizen/i586/RPMS/rvi-0.3.1-1.i686.rpm


# UPDATING REBAR DEPENDENCIES
All erlang dependencies, residing in ```deps```, are checked in with rvi_core in order
to avoid having GBS and OBS to access the network to resolve them.
If a new or updated module is to be included in deps, the following procedure
can be used:

1. <b>Update rebar.config</b><br>
Edit rebar.config to include the correct version of the modules you need.

2. <b>Clear deps</b><br>
Delete the old deps with:

    ```rm -rf deps/*```

3. <b>Retrieve new deps</b><br>
Use rebar to retrieve all modules listed in rebar.config.

    ```rebar get-deps```

3. <b>Clean out git info from deps</b><br>
The checked out modules in deps are all their own repos. Clear the
repo information.

    ```rm -rf deps/*/.git
	find deps -name .gitignore | xargs rm```

4. <b>Add all new files in deps to the rvi_core repo</b><br>
If any new files are added to deps by ```rebar get-deps``` above, they
need to be added to the repo:

    ```git add deps/*```

5. <b>Commit rvi_core</b><br>
Commit the updated deps directory to the repo:

    ```git commit -a -m "Updated deps/gsm to version x"```