-
Notifications
You must be signed in to change notification settings - Fork 4
/
test.py
111 lines (82 loc) · 3.08 KB
/
test.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
105
106
107
108
109
110
111
from infra.system.core.factory.functionfactory import FunctionFactory
from infra.system.resources.specifier import ResourceSpecifier
from infra.system.resources import types
import logging
import json
logging.basicConfig(level=logging.INFO)
def getAPI():
data = {
"resource": "/home/jchaloup/Packages/golang-github-bradfitz-http2/fedora/golang-github-bradfitz-http2/http2-f8202bc903bda493ebba4aa54922d78430c2c42f",
"directories_to_skip": ["Godeps","hack"],
"project": "github.com/bradfitz/http2",
"commit": "f8202bc903bda493ebba4aa54922d78430c2c42f",
"ipprefix": "github.com/bradfitz/http2"
}
data["resource"] = ResourceSpecifier().generateUserDirectory(data["resource"], type = types.RESOURCE_TYPE_DIRECTORY)
ff = FunctionFactory()
return ff.bake("gosymbolsextractor").call(data)
def getAPI1():
data = {
"resource": "/home/jchaloup/Packages/etcd/rhel/etcd/etcd-2.2.2",
"directories_to_skip": ["Godeps","hack"],
"project": "github.com/coreos/etcd",
"commit": "b4bddf685b26b4aa70e939445044bdeac822d042",
"ipprefix": "github.com/coreos/etcd"
}
data["resource"] = ResourceSpecifier().generateUserDirectory(data["resource"], type = types.RESOURCE_TYPE_DIRECTORY)
ff = FunctionFactory()
return ff.bake("gosymbolsextractor").call(data)
def getAPI2():
data = {
"resource": "/home/jchaloup/Packages/etcd/fedora/etcd/etcd-2.2.5",
#"resource": "/home/jchaloup/Packages/kubernetes/fedora/kubernetes/origin-cffae0523cfa80ddf917aba69f08508b91f603d5",
"directories_to_skip": ["Godeps","hack"],
"project": "github.com/coreos/etcd",
"commit": "bdee27b19e8601ffd7bd4f0481abe9bbae04bd09",
"ipprefix": "github.com/coreos/etcd"
}
data["resource"] = ResourceSpecifier().generateUserDirectory(data["resource"], type = types.RESOURCE_TYPE_DIRECTORY)
ff = FunctionFactory()
return ff.bake("gosymbolsextractor").call(data)
def storeExportedAPI():
exported_api1 = getAPI1()
exported_api2 = getAPI2()
# store the data
ff = FunctionFactory()
ff.bake("etcdstoragewriter").call(exported_api1[1])
ff.bake("etcdstoragewriter").call(exported_api2[1])
ff.bake("etcdstoragewriter").call(exported_api1[0])
ff.bake("etcdstoragewriter").call(exported_api2[0])
def retrieveExportedAPI():
data = {
"artefact": "golang-project-exported-api",
"project": "github.com/coreos/etcd",
"commit": "b4bddf685b26b4aa70e939445044bdeac822d042"
}
ff = FunctionFactory()
_, exported_api1 = ff.bake("etcdstoragereader").call(data)
data = {
"artefact": "golang-project-exported-api",
"project": "github.com/coreos/etcd",
"commit": "bdee27b19e8601ffd7bd4f0481abe9bbae04bd09"
}
_, exported_api2 = ff.bake("etcdstoragereader").call(data)
return (exported_api1, exported_api2)
getAPI2()
exit(1)
#data = getAPI()
#driver = GolangProjectExportedAPIDriver()
#driver.store(data[1])
#exit(1)
#storeExportedAPI()
exported_api1, exported_api2 = retrieveExportedAPI()
data = {
"exported_api_1": exported_api1,
"exported_api_2": exported_api2
}
#print json.dumps(exported_api2)
#exit(1)
ff = FunctionFactory()
data = ff.bake("goapidiff").call(data)
ff.bake("etcdstoragewriter").call(data)
print(json.dumps(data))