forked from ARPA-SIMC/wreport
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfabfile.py
104 lines (90 loc) · 3.72 KB
/
fabfile.py
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
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from fabric.api import local, run, cd, env, hosts
import git
import re
import shlex
env.hosts = ["venti", "ventiquattro"]
env.use_ssh_config = True
def cmd(*args):
return " ".join(shlex.quote(a) for a in args)
@hosts("venti")
def test_venti():
fedora_cxxflags = "-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong"\
" --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic"
fedora_ldflags = "-Wl,-z,relro"
repo = git.Repo()
remote = repo.remote("venti")
push_url = remote.config_reader.get("url")
remote_dir = re.sub(r"^ssh://[^/]+", "", push_url)
local(cmd("git", "push", "venti", "HEAD"))
with cd(remote_dir):
run(cmd("git", "checkout", "-B", "test_venti", repo.head.commit.hexsha))
run(cmd("git", "reset", "--hard"))
run(cmd("git", "clean", "-fx"))
run(cmd("autoreconf", "-if"))
run(cmd("./configure",
"--build=x86_64-redhat-linux-gnu",
"--host=x86_64-redhat-linux-gnu",
"--program-prefix=",
"--prefix=/usr",
"--exec-prefix=/usr",
"--bindir=/usr/bin",
"--sbindir=/usr/sbin",
"--sysconfdir=/etc",
"--datadir=/usr/share",
"--includedir=/usr/include",
"--libdir=/usr/lib64",
"--libexecdir=/usr/libexec",
"--localstatedir=/var",
"--sharedstatedir=/var/lib",
"--mandir=/usr/share/man",
"--infodir=/usr/share/info",
"CFLAGS=" + fedora_cxxflags,
"CXXFLAGS=" + fedora_cxxflags,
"LDFLAGS=" + fedora_ldflags))
run(cmd("make"))
run(cmd("make", "check"))
@hosts("ventiquattro")
def test_ventiquattro():
fedora_cxxflags = "-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong"\
" --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic"
fedora_ldflags = "-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld"
repo = git.Repo()
remote = repo.remote("ventiquattro")
push_url = remote.config_reader.get("url")
remote_dir = re.sub(r"^ssh://[^/]+", "", push_url)
local(cmd("git", "push", "ventiquattro", "HEAD"))
with cd(remote_dir):
run(cmd("git", "checkout", "-B", "test_venti", repo.head.commit.hexsha))
run(cmd("git", "reset", "--hard"))
run(cmd("git", "clean", "-fx"))
run(cmd("autoreconf", "-if"))
run(cmd("./configure",
"--build=x86_64-redhat-linux-gnu",
"--host=x86_64-redhat-linux-gnu",
"--program-prefix=",
"--disable-dependency-tracking",
"--prefix=/usr",
"--exec-prefix=/usr",
"--bindir=/usr/bin",
"--sbindir=/usr/sbin",
"--sysconfdir=/etc",
"--datadir=/usr/share",
"--includedir=/usr/include",
"--libdir=/usr/lib64",
"--libexecdir=/usr/libexec",
"--localstatedir=/var",
"--sharedstatedir=/var/lib",
"--mandir=/usr/share/man",
"--infodir=/usr/share/info",
"CFLAGS=" + fedora_cxxflags,
"CXXFLAGS=" + fedora_cxxflags,
"LDFLAGS=" + fedora_ldflags))
run(cmd("make"))
run(cmd("make", "check"))
def test():
test_venti()
test_ventiquattro()