Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Towards independent modules #510

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ install: install_qmstr_client

# Installation targets
install_qmstr_server: $(QMSTR_SERVER_BINARIES)
install -t $(prefix)/bin $^
install $^ $(prefix)/bin

install_qmstr_client: $(QMSTR_CLIENT_BINARIES)
install -t $(prefix)/bin $^
install $^ $(prefix)/bin

install_qmstr_all: install_qmstr_client install_qmstr_server

Expand Down
17 changes: 8 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ require (
github.com/Microsoft/go-winio v0.4.12 // indirect
github.com/Sirupsen/logrus v0.0.0-00010101000000-000000000000 // indirect
github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb
github.com/census-instrumentation/opencensus-proto v0.2.1 // indirect
github.com/cpuguy83/go-md2man v1.0.10 // indirect
github.com/creack/pty v1.1.9 // indirect
github.com/dgraph-io/dgo/v2 v2.1.0
github.com/dgraph-io/dgo/v2 v2.2.0
github.com/docker/distribution v2.7.1+incompatible // indirect
github.com/docker/docker v1.13.1
github.com/docker/go-connections v0.4.0
github.com/docker/go-units v0.3.3 // indirect
github.com/envoyproxy/go-control-plane v0.6.9 // indirect
github.com/envoyproxy/go-control-plane v0.7.1 // indirect
github.com/envoyproxy/protoc-gen-validate v0.1.0 // indirect
github.com/gogo/googleapis v1.1.0 // indirect
github.com/gogo/protobuf v1.2.0 // indirect
github.com/golang/groupcache v0.0.0-20191002201903-404acd9df4cc // indirect
github.com/golang/mock v1.3.1 // indirect
github.com/golang/protobuf v1.3.2
github.com/golang/protobuf v1.4.0
github.com/google/btree v1.0.0 // indirect
github.com/google/go-cmp v0.3.1 // indirect
github.com/google/pprof v0.0.0-20191022163618-5260658b92d7 // indirect
github.com/googleapis/gax-go/v2 v2.0.5 // indirect
github.com/hashicorp/go-version v1.1.0
Expand All @@ -35,6 +35,7 @@ require (
github.com/opencontainers/go-digest v1.0.0-rc1 // indirect
github.com/opencontainers/runc v0.1.1 // indirect
github.com/pkg/errors v0.8.1
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 // indirect
github.com/rogpeppe/go-internal v1.5.0 // indirect
github.com/sirupsen/logrus v1.4.1 // indirect
github.com/spdx/tools-golang v0.0.0-20190418005930-ea86b81b8378
Expand All @@ -48,15 +49,13 @@ require (
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8 // indirect
golang.org/x/lint v0.0.0-20190930215403-16217165b5de // indirect
golang.org/x/mobile v0.0.0-20191002175909-6d0d39b2ca82 // indirect
golang.org/x/net v0.0.0-20191021144547-ec77196f6094
golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 // indirect
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e // indirect
golang.org/x/sys v0.0.0-20191022100944-742c48ecaeb7 // indirect
golang.org/x/sys v0.0.0-20200501145240-bc7a7d42d5c3 // indirect
golang.org/x/time v0.0.0-20191023065245-6d3f0bb11be5 // indirect
golang.org/x/tools v0.0.0-20191022213345-0bbdf54effa2 // indirect
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 // indirect
google.golang.org/appengine v1.6.5 // indirect
google.golang.org/genproto v0.0.0-20191009194640-548a555dbc03 // indirect
google.golang.org/grpc v1.23.0
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
gopkg.in/yaml.v2 v2.2.2
Expand Down
35 changes: 35 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,14 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgraph-io/dgo v0.0.0-20190306204622-95299da439fd h1:qVmopyaVT5uJj0Pw9n922dZcu58AvJ6rGuzi0w1RWfw=
github.com/dgraph-io/dgo v0.0.0-20190306204622-95299da439fd/go.mod h1:/3OtwVvGnHiyXL9bWTjZaHQk4cp8rakX6jVBFoykWaA=
github.com/dgraph-io/dgo v1.0.0 h1:DRuI66G+j0XWDOXly4v5PSk2dGkbIopAZIirRjq7lzI=
github.com/dgraph-io/dgo/v2 v2.0.0-rc1/go.mod h1:K5FHP4uXUZrqAA8icsTCdg4s7raNdwoRpZ/ygHHvm+4=
github.com/dgraph-io/dgo/v2 v2.0.0 h1:TIjOhQMgX2jDI86oOvLisRP3vS2RQu4QyDOSJ5oJkFo=
github.com/dgraph-io/dgo/v2 v2.0.0/go.mod h1:R/MTZMGhTo60XSziuKpLXzI1OnVWQCZS5oJjxA8Q1bo=
github.com/dgraph-io/dgo/v2 v2.1.0 h1:zm4gygHzZwu11y3VqDG/fDA80xgpSvLMlrhEcb9KfT0=
github.com/dgraph-io/dgo/v2 v2.1.0/go.mod h1:R/MTZMGhTo60XSziuKpLXzI1OnVWQCZS5oJjxA8Q1bo=
github.com/dgraph-io/dgo/v2 v2.2.0 h1:qYbm6mEF3wuKiRpgNOldk6PmPbBJFwj6vL7I7dTSdyc=
github.com/dgraph-io/dgo/v2 v2.2.0/go.mod h1:LJCkLxm5fUMcU+yb8gHFjHt7ChgNuz3YnQQ6MQkmscI=
github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug=
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/docker v1.13.1 h1:IkZjBSIc8hBjLpqeAbeE5mca5mNgeatLHBy3GO78BWo=
Expand All @@ -59,9 +62,16 @@ github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5Xh
github.com/docker/go-units v0.3.3 h1:Xk8S3Xj5sLGlG5g67hJmYMmUgXv5N4PhkjJHHqrwnTk=
github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g=
github.com/envoyproxy/go-control-plane v0.7.1/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g=
github.com/envoyproxy/go-control-plane v0.8.0/go.mod h1:GSSbY9P1neVhdY7G4wu+IK1rk/dqhiCC/4ExuWJZVuk=
github.com/envoyproxy/go-control-plane v0.8.1/go.mod h1:gf53HlEP0AmznyKjC6le9wyCpVYcDRoZzi+rKat7TdI=
github.com/envoyproxy/go-control-plane v0.8.2/go.mod h1:EWRTAFN6uuDZIa6KOuUfrOMJ7ySgXZ44rVKiTWjKe34=
github.com/envoyproxy/go-control-plane v0.8.3/go.mod h1:EWRTAFN6uuDZIa6KOuUfrOMJ7ySgXZ44rVKiTWjKe34=
github.com/envoyproxy/go-control-plane v0.8.4/go.mod h1:XB9+ce7x+IrsjgIVnRnql0O61gj/np0/bGDfhJI3sCU=
github.com/envoyproxy/go-control-plane v0.8.5/go.mod h1:XB9+ce7x+IrsjgIVnRnql0O61gj/np0/bGDfhJI3sCU=
github.com/envoyproxy/go-control-plane v0.8.6/go.mod h1:XB9+ce7x+IrsjgIVnRnql0O61gj/np0/bGDfhJI3sCU=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/protoc-gen-validate v0.0.0-20190405222122-d6164de49109/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/envoyproxy/protoc-gen-validate v0.0.14/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
Expand All @@ -86,11 +96,19 @@ github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0 h1:oOuy+ugB+P/kBdUnG5QaMXSIyJ1q38wWSojYCb3z5VQ=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
Expand Down Expand Up @@ -222,6 +240,8 @@ golang.org/x/net v0.0.0-20190916140828-c8589233b77d h1:mCMDWKhNO37A7GAhOpHPbIw1c
golang.org/x/net v0.0.0-20190916140828-c8589233b77d/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20191021144547-ec77196f6094 h1:5O4U9trLjNpuhpynaDsqwCk+Tw6seqJz1EbqbnzHrc8=
golang.org/x/net v0.0.0-20191021144547-ec77196f6094/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5 h1:WQ8q63x+f/zpC8Ac1s9wLElVoHhm32p6tudrU72n1QA=
golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down Expand Up @@ -254,6 +274,9 @@ golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3 h1:7TYNF4UdlohbFwpNH04CoPMp1
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191022100944-742c48ecaeb7 h1:HmbHVPwrPEKPGLAcHSrMe6+hqSUlvZU0rab6x5EXfGU=
golang.org/x/sys v0.0.0-20191022100944-742c48ecaeb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200501145240-bc7a7d42d5c3 h1:5B6i6EAiSYyejWfvc5Rc9BbI3rzIsrrXfAQBWnYfn+w=
golang.org/x/sys v0.0.0-20200501145240-bc7a7d42d5c3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down Expand Up @@ -290,6 +313,7 @@ golang.org/x/tools v0.0.0-20191022210528-83d82311fd1f/go.mod h1:b+2E5dAYhXwXZwtn
golang.org/x/tools v0.0.0-20191022213345-0bbdf54effa2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
google.golang.org/api v0.5.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
google.golang.org/api v0.6.0/go.mod h1:btoxGiFvQNVUZQ8W08zLtrVS08CNpINPEfxXxgJL1Q4=
Expand All @@ -310,6 +334,7 @@ google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRn
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190508193815-b515fa19cec8 h1:x913Lq/RebkvUmRSdQ8MNb0GZKn+SR1ESfoetcQSeak=
google.golang.org/genproto v0.0.0-20190508193815-b515fa19cec8/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190513181449-d00d292a067c h1:m9avZ3wyOWBR0fLC+qWbMBulk+Jiiqelngssgp8jfIs=
google.golang.org/genproto v0.0.0-20190513181449-d00d292a067c/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s=
Expand All @@ -325,6 +350,8 @@ google.golang.org/genproto v0.0.0-20190916214212-f660b8655731 h1:Phvl0+G5t5k/EUF
google.golang.org/genproto v0.0.0-20190916214212-f660b8655731/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8=
google.golang.org/genproto v0.0.0-20191009194640-548a555dbc03 h1:4HYDjxeNXAOTv3o1N2tjo8UUSlhQgAD52FVkwxnWgM8=
google.golang.org/genproto v0.0.0-20191009194640-548a555dbc03/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84 h1:pSLkPbrjnPyLDYUO2VM9mDLqo2V6CFBY84lFSZAfoi4=
google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.0 h1:DlsSIrgEBuZAUFJcta2B5i/lzeHHbnfkNFAfFXLVFYQ=
Expand All @@ -333,6 +360,14 @@ google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiq
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
google.golang.org/grpc v1.23.0 h1:AzbTB6ux+okLTzP8Ru1Xs41C303zdcfEht7MQnYJt5A=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.27.0 h1:rRYRFMVgRv6E0D70Skyfsr28tDXIuuPZyWGMPdMcnXg=
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0 h1:qdOKuR/EIArgaWNjetjgTzgVTAZ+S/WXVrq9HW9zimw=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
50 changes: 44 additions & 6 deletions lib/go-qmstr/analysis/analyzer.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package analysis

import (
"encoding/json"
"fmt"
"log"
"os"
Expand All @@ -9,6 +10,8 @@ import (

goflag "flag"

"github.com/QMSTR/qmstr/lib/go-qmstr/cli"
"github.com/QMSTR/qmstr/lib/go-qmstr/config"
"github.com/QMSTR/qmstr/lib/go-qmstr/module"
"github.com/QMSTR/qmstr/lib/go-qmstr/service"
flag "github.com/spf13/pflag"
Expand All @@ -27,10 +30,15 @@ type AnalyzerModule interface {
PostAnalyze() error
}

// CountAnalyzers counts the analyzers that run in the current process
var CountAnalyzers int32

func NewAnalyzer(anaModule AnalyzerModule) *Analyzer {
var serviceAddress string
var anaID int32
flag.StringVar(&serviceAddress, "aserv", "localhost:50051", "Analyzer service address")
CountAnalyzers++
// TODO: Connect to QMSTRADDRESS
flag.StringVar(&serviceAddress, "aserv", "", "connect to analyzer service address")
flag.Int32Var(&anaID, "aid", -1, "unique analyzer id")
flag.CommandLine.AddGoFlagSet(goflag.CommandLine)
flag.Parse()
Expand All @@ -50,10 +58,14 @@ func (a *Analyzer) RunAnalyzerModule() error {
log.Printf("Could not get configuration %v\n", err)
return fmt.Errorf("could not get analyzer configuration %v", err)
}

a.name = configResp.Name
cacheDir := configResp.ConfigMap["cachedir"]
outDir := configResp.ConfigMap["outputdir"]
var analyzerConfig *config.Analysis
err = json.Unmarshal([]byte(configResp.AnalyzerConfig), &analyzerConfig)
if err != nil {
return fmt.Errorf("fail unmarshalling analyzer config %v", err)
}
a.name = analyzerConfig.Analyzer
cacheDir := analyzerConfig.Config["cachedir"]
outDir := analyzerConfig.Config["outputdir"]

err = os.MkdirAll(cacheDir, os.ModePerm)
if err != nil {
Expand All @@ -65,7 +77,14 @@ func (a *Analyzer) RunAnalyzerModule() error {
return fmt.Errorf("failed to create output directory for module %s %v", a.GetModuleName(), err)
}

err = a.module.Configure(configResp.ConfigMap)
// Initialize analyzer
_, err = a.CtrlSvcClient.InitModule(context.Background(), &service.InitModuleRequest{
ModuleName: a.name, ExtraConfig: analyzerConfig.TrustLevel})
if err != nil {
return fmt.Errorf("%v: %v", err, cli.ReturnCodeServerCommunicationError)
}

err = a.module.Configure(analyzerConfig.Config)
if err != nil {
return fmt.Errorf("failed to configure analyzer module %s %v", a.GetModuleName(), err)
}
Expand All @@ -74,5 +93,24 @@ func (a *Analyzer) RunAnalyzerModule() error {
if err != nil {
return fmt.Errorf("Analysis failed for analyzer module %s %v", a.GetModuleName(), err)
}

msg := fmt.Sprintf("Analyzer %s finished successfully ", a.name)
log.Println(msg)
// Ping master server that the analyzer finished
a.CtrlSvcClient.ShutdownModule(context.Background(), &service.ShutdownModuleRequest{Message: msg, DB: true})

return nil
}

// ReduceAnalyzersCounter is called everytime an analyzer finishes its process.
// When it reaches 0, it sends a signal to close the analysis phase
func ReduceAnalyzersCounter() {
CountAnalyzers--
if CountAnalyzers == 0 { // all analyzers have finished
// close analysis phase
close(cli.ModulesAreDone)
}
if CountAnalyzers < 0 {
log.Printf("WARNING: Analyzers count cannot be minus")
}
}
44 changes: 44 additions & 0 deletions lib/go-qmstr/cli/phasecontrol.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
package cli

import (
"bufio"
"bytes"
"fmt"
"log"
"os"
"strings"

"golang.org/x/net/context"

"github.com/QMSTR/qmstr/lib/go-qmstr/service"
"github.com/spf13/cobra"
)

// ModulesAreDone is a signal channel to close
// analysis/reporting phase once modules are done
var ModulesAreDone chan struct{}

var anaCmd = &cobra.Command{
Use: "analyze",
Short: "Start analysis on the QMSTR master",
Expand All @@ -18,6 +26,7 @@ var anaCmd = &cobra.Command{

setUpControlService()
startPhase(service.Phase_ANALYSIS)
startAnalyzers()
tearDownServer()
},
}
Expand All @@ -30,6 +39,7 @@ var reportCmd = &cobra.Command{

setUpControlService()
startPhase(service.Phase_REPORT)
startReporters()
tearDownServer()
},
}
Expand All @@ -39,10 +49,12 @@ func init() {
rootCmd.AddCommand(reportCmd)
}

// start analysis/reporting phase
func startPhase(phase service.Phase) {
if verbose {
go printEvents()
}
// switch master server phase
resp, err := controlServiceClient.SwitchPhase(context.Background(), &service.SwitchPhaseMessage{Phase: phase})
if err != nil {
fmt.Printf("Failed to communicate with qmstr-master server. %v\n", err)
Expand All @@ -53,3 +65,35 @@ func startPhase(phase service.Phase) {
os.Exit(ReturnCodeResponseFalseError)
}
}

func startAnalyzers() {
close(PingAnalyzer) // Ping modules to start!
GiasemiSh marked this conversation as resolved.
Show resolved Hide resolved
waitModulesToFinish()

// Close analysis phase
controlServiceClient.ClosePhase(context.Background(), &service.Request{})
}

func startReporters() {
close(PingReporter) // Ping modules to start!
waitModulesToFinish()
// No need to close phase
}

func waitModulesToFinish() {
// wait until all modules have finished
ModulesAreDone = make(chan struct{})
log.Printf("Waiting for modules to finish.. \n")
<-ModulesAreDone // <-- THIS MAY NOT WORK!!! Select{}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need help to understand

log.Printf("All modules have finished! \n")
}

func logModuleError(moduleName string, output []byte) {
GiasemiSh marked this conversation as resolved.
Show resolved Hide resolved
var buffer bytes.Buffer
buffer.WriteString(fmt.Sprintf("%s failed with:\n", moduleName))
s := bufio.NewScanner(strings.NewReader(string(output)))
for s.Scan() {
buffer.WriteString(fmt.Sprintf("\t--> %s\n", s.Text()))
}
log.Println(buffer.String())
}
Loading