Skip to content

Commit 6ac659e

Browse files
committed
Install OBS clang_build Source Service
1 parent eb8905b commit 6ac659e

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed

salt/files/clang_build

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
set -x
3+
echo "Entering customization script..."
4+
CLANG_VERSION="6.0"
5+
6+
echo "Replace gcc, g++ & cpp by clang"
7+
VERSIONS="4.6 4.7 4.8 4.9 5 6 7 8"
8+
cd /usr/bin
9+
for VERSION in $VERSIONS; do
10+
rm -f g++-$VERSION gcc-$VERSION cpp-$VERSION gcc
11+
ln -s clang++-$CLANG_VERSION g++-$VERSION
12+
ln -s clang-$CLANG_VERSION gcc-$VERSION
13+
ln -s clang-$CLANG_VERSION cpp-$VERSION
14+
ln -s clang-$CLANG_VERSION gcc
15+
echo "gcc-$VERSION hold"|dpkg --set-selections
16+
echo "g++-$VERSION hold"|dpkg --set-selections
17+
done
18+
cd -
19+
20+
echo "Check if gcc, g++ & cpp are actually clang"
21+
gcc --version|grep clang > /dev/null || exit 1
22+
cpp --version|grep clang > /dev/null || exit 1
23+
g++ --version|grep clang > /dev/null || exit 1

salt/files/clang_build.service

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<service name="clang_build">
2+
<summary>Build packages against Clang</summary>
3+
<description>
4+
This service substitutes CC and CXX for clang before builds
5+
</description>
6+
</service>

salt/obs.sls

+21
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ restart_apache:
7676
- setup_obs_api
7777
{% endif %}
7878

79+
start_obsservice:
80+
service.running:
81+
- name: obsservice
82+
- enable: True
83+
7984
/root/.oscrc:
8085
file.managed:
8186
- source: salt://files/oscrc
@@ -174,6 +179,22 @@ restart_apache:
174179
- group: root
175180
- mode: 644
176181

182+
/usr/lib/obs/service/clang_build.service:
183+
file.managed:
184+
- source: salt://files/clang_build.service
185+
- user: root
186+
- group: root
187+
- mode: 644
188+
- makedirs: True
189+
190+
/usr/lib/obs/service/clang_build:
191+
file.managed:
192+
- source: salt://files/clang_build
193+
- user: root
194+
- group: root
195+
- mode: 755
196+
- makedirs: True
197+
177198
set_obs_instance_configurations:
178199
cmd.run:
179200
- name: osc -A https://localhost:443 api /configuration -T /tmp/obs_instance_configuration.xml

0 commit comments

Comments
 (0)