Merge ~rmescandon/snappy-hwe-snaps/+git/wifi-connect:refactor-go-paths into ~snappy-hwe-team/snappy-hwe-snaps/+git/wifi-connect:master
- Git
- lp:~rmescandon/snappy-hwe-snaps/+git/wifi-connect
- refactor-go-paths
- Merge into master
Status: | Merged |
---|---|
Approved by: | Kyle Nitzsche |
Approved revision: | 3f47b80f1abe7b4b6659e6841995c876613aa176 |
Merged at revision: | e15facb1e86e0c4cdb909e23b8120a447935e9b8 |
Proposed branch: | ~rmescandon/snappy-hwe-snaps/+git/wifi-connect:refactor-go-paths |
Merge into: | ~snappy-hwe-team/snappy-hwe-snaps/+git/wifi-connect:master |
Diff against target: |
327 lines (+77/-39) 17 files modified
.gitignore (+1/-0) .travis.yml (+1/-1) MAINTAINERS (+2/-0) README.md (+1/-1) cmd/main.go (+4/-4) daemon/daemon.go (+5/-5) daemon/daemon_test.go (+28/-1) package.json (+4/-4) server/fmt.go (+1/-1) server/fmt_test.go (+1/-1) server/handlers.go (+3/-3) server/handlers_test.go (+1/-1) server/launcher.go (+1/-1) server/manager.go (+1/-1) service/service.go (+4/-4) snap/snapcraft.yaml (+18/-10) spread_tests/main/ap/task.yaml (+1/-1) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
System Enablement Bot | continuous-integration | Approve | |
Konrad Zapałowicz (community) | code | Approve | |
Simon Fels | Approve | ||
Review via email: mp+325235@code.launchpad.net |
Commit message
Description of the change
Changed go import paths from github.
Set go-checks in go part install scriptlet
This MP will be used to check if snappy-hwe-snaps CI works well with this repo
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
Simon Fels (morphis) wrote : | # |
In order to get the CI to build this MP you need to have a toplevel snapcraft.yaml
Having the file in snap/snapcraft.yaml is not yet supported.
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:cffcecd3214
https:/
Executed test runs:
FAILURE: https:/
None: https:/
Click here to trigger a rebuild:
https:/
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:13f345d7a76
https:/
Executed test runs:
FAILURE: https:/
None: https:/
Click here to trigger a rebuild:
https:/
Konrad Zapałowicz (kzapalowicz) wrote : | # |
import paths need further tweaking
Konrad Zapałowicz (kzapalowicz) wrote : | # |
import paths need further tweaking
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:175526a6905
https:/
Executed test runs:
FAILURE: https:/
None: https:/
None: https:/
Click here to trigger a rebuild:
https:/
Roberto Mier Escandon (rmescandon) wrote : | # |
> import paths need further tweaking
Not sure if I understand it...
If I use local paths ( import "../netman" instead of import "launchpad.
local import "../netman" in non-local package
when snapcraft.
If I move the project folder out of GOPATH and execute, say, go run cmd/main.go that works. However same operation into GOPATH causes errors. So seems that if using local packages, all the project packages, main included, must be taken as local.
I'm not sure how to solve this. Actually, udisks2 project is using also complete path when referencing udisks2 package from command file, for instance
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:c63000efae9
https:/
Executed test runs:
FAILURE: https:/
None: https:/
None: https:/
Click here to trigger a rebuild:
https:/
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:31cc28c4964
https:/
Executed test runs:
FAILURE: https:/
None: https:/
FAILURE: https:/
None: https:/
Click here to trigger a rebuild:
https:/
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:31cc28c4964
https:/
Executed test runs:
SUCCESS: https:/
None: https:/
SUCCESS: https:/
None: https:/
Click here to trigger a rebuild:
https:/
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:604a0f28b99
https:/
Executed test runs:
SUCCESS: https:/
None: https:/
SUCCESS: https:/
None: https:/
Click here to trigger a rebuild:
https:/
Simon Fels (morphis) wrote : | # |
One minor comment in line, otherwise LGTM
Roberto Mier Escandon (rmescandon) wrote : | # |
addressed comments
Konrad Zapałowicz (kzapalowicz) wrote : | # |
> > import paths need further tweaking
> Not sure if I understand it...
> If I use local paths ( import "../netman" instead of import "launchpad.net
> /wifi-connect/
>
> local import "../netman" in non-local package
>
> when snapcraft.
>
> If I move the project folder out of GOPATH and execute, say, go run
> cmd/main.go that works. However same operation into GOPATH causes errors. So
> seems that if using local packages, all the project packages, main included,
> must be taken as local.
>
> I'm not sure how to solve this. Actually, udisks2 project is using also
> complete path when referencing udisks2 package from command file, for instance
Interesting. Forget about my comment then.
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:dcd985865e0
https:/
Executed test runs:
SUCCESS: https:/
None: https:/
SUCCESS: https:/
None: https:/
Click here to trigger a rebuild:
https:/
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:81203b15719
https:/
Executed test runs:
SUCCESS: https:/
None: https:/
SUCCESS: https:/
None: https:/
Click here to trigger a rebuild:
https:/
Konrad Zapałowicz (kzapalowicz) wrote : | # |
ack
Kyle Nitzsche (knitzsche) wrote : | # |
couple of small points only. I did not intend to "reject" this.
Roberto Mier Escandon (rmescandon) wrote : | # |
Added tests to SetDefaults when hash file exists
Modified wificonnect to wifi-connect in package.json file
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:6fabbd82057
https:/
Executed test runs:
SUCCESS: https:/
None: https:/
SUCCESS: https:/
None: https:/
Click here to trigger a rebuild:
https:/
System Enablement Bot (system-enablement-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:3f47b80f1ab
https:/
Executed test runs:
SUCCESS: https:/
None: https:/
SUCCESS: https:/
None: https:/
Click here to trigger a rebuild:
https:/
Preview Diff
1 | diff --git a/.gitignore b/.gitignore |
2 | index 68a34b3..167bd28 100644 |
3 | --- a/.gitignore |
4 | +++ b/.gitignore |
5 | @@ -1,3 +1,4 @@ |
6 | .coverage |
7 | +.tests-extras |
8 | netman/.dbus.go.swp |
9 | cmds/netman/.cmd_netman.go.swp |
10 | diff --git a/.travis.yml b/.travis.yml |
11 | index 57ed9c8..00b3f42 100644 |
12 | --- a/.travis.yml |
13 | +++ b/.travis.yml |
14 | @@ -1,7 +1,7 @@ |
15 | sudo: required |
16 | dist: xenial |
17 | language: go |
18 | -go_import_path: github.com/CanonicalLtd/UCWifiConnect |
19 | +go_import_path: launchpad.net/wifi-connect |
20 | go: |
21 | - 1.6 |
22 | env: |
23 | diff --git a/MAINTAINERS b/MAINTAINERS |
24 | new file mode 100644 |
25 | index 0000000..076ed54 |
26 | --- /dev/null |
27 | +++ b/MAINTAINERS |
28 | @@ -0,0 +1,2 @@ |
29 | +Kyle Nitzsche <kyle.nitzsche@canonical.com> |
30 | +Roberto Mier Escandon <roberto.escandon@canonical.com> |
31 | \ No newline at end of file |
32 | diff --git a/README.md b/README.md |
33 | index 4e2904c..b4c4716 100644 |
34 | --- a/README.md |
35 | +++ b/README.md |
36 | @@ -11,7 +11,7 @@ Wifi-connect snap allows you to connect the device to an external wifi AP. First |
37 | |
38 | ## Issue tracking |
39 | |
40 | -[Issues](https://github.com/CanonicalLtd/UCWifiConnect/issues) |
41 | +[Issues](https://bugs.launchpad.net/snappy-hwe-snaps) |
42 | |
43 | ## Use refreshed pi3 image |
44 | |
45 | diff --git a/cmd/main.go b/cmd/main.go |
46 | index daa39b9..cff9ab8 100644 |
47 | --- a/cmd/main.go |
48 | +++ b/cmd/main.go |
49 | @@ -24,10 +24,10 @@ import ( |
50 | "os" |
51 | "strings" |
52 | |
53 | - "github.com/CanonicalLtd/UCWifiConnect/netman" |
54 | - "github.com/CanonicalLtd/UCWifiConnect/server" |
55 | - "github.com/CanonicalLtd/UCWifiConnect/utils" |
56 | - "github.com/CanonicalLtd/UCWifiConnect/wifiap" |
57 | + "launchpad.net/wifi-connect/netman" |
58 | + "launchpad.net/wifi-connect/server" |
59 | + "launchpad.net/wifi-connect/utils" |
60 | + "launchpad.net/wifi-connect/wifiap" |
61 | |
62 | "github.com/gorilla/mux" |
63 | ) |
64 | diff --git a/daemon/daemon.go b/daemon/daemon.go |
65 | index 38697e3..2732da7 100644 |
66 | --- a/daemon/daemon.go |
67 | +++ b/daemon/daemon.go |
68 | @@ -23,11 +23,11 @@ import ( |
69 | "os" |
70 | "strings" |
71 | |
72 | - "github.com/CanonicalLtd/UCWifiConnect/avahi" |
73 | - "github.com/CanonicalLtd/UCWifiConnect/netman" |
74 | - "github.com/CanonicalLtd/UCWifiConnect/server" |
75 | - "github.com/CanonicalLtd/UCWifiConnect/utils" |
76 | - "github.com/CanonicalLtd/UCWifiConnect/wifiap" |
77 | + "launchpad.net/wifi-connect/avahi" |
78 | + "launchpad.net/wifi-connect/netman" |
79 | + "launchpad.net/wifi-connect/server" |
80 | + "launchpad.net/wifi-connect/utils" |
81 | + "launchpad.net/wifi-connect/wifiap" |
82 | ) |
83 | |
84 | // enum to track current system state |
85 | diff --git a/daemon/daemon_test.go b/daemon/daemon_test.go |
86 | index 8ff1a7a..c6242cd 100644 |
87 | --- a/daemon/daemon_test.go |
88 | +++ b/daemon/daemon_test.go |
89 | @@ -21,7 +21,7 @@ import ( |
90 | "os" |
91 | "testing" |
92 | |
93 | - "github.com/CanonicalLtd/UCWifiConnect/utils" |
94 | + "launchpad.net/wifi-connect/utils" |
95 | ) |
96 | |
97 | func TestManualFlagPath(t *testing.T) { |
98 | @@ -97,6 +97,33 @@ func TestManualMode(t *testing.T) { |
99 | func TestSetDefaults(t *testing.T) { |
100 | client := GetClient() |
101 | hfp := "/tmp/hash" |
102 | + if _, err := os.Stat(hfp); err == nil { |
103 | + err = os.Remove(hfp) |
104 | + if err != nil { |
105 | + t.Errorf("Could not remove previous file version") |
106 | + } |
107 | + } |
108 | + utils.SetHashFile(hfp) |
109 | + client.SetDefaults() |
110 | + _, err := os.Stat(utils.HashFile) |
111 | + if os.IsNotExist(err) { |
112 | + t.Errorf("SetDefaults should have created %s but did not", hfp) |
113 | + } |
114 | + res, _ := utils.MatchingHash("wifi-connect") |
115 | + if !res { |
116 | + t.Errorf("SetDefaults password match did not match") |
117 | + } |
118 | +} |
119 | + |
120 | +func TestSetDefaultsAlreadyExistsHashFile(t *testing.T) { |
121 | + client := GetClient() |
122 | + hfp := "/tmp/hash" |
123 | + // create file if not exists |
124 | + if _, err := os.Stat(utils.HashFile); os.IsNotExist(err) { |
125 | + if _, err = os.OpenFile(hfp, os.O_CREATE, 0666); err != nil { |
126 | + t.Errorf("Error creating %v file", hfp) |
127 | + } |
128 | + } |
129 | utils.SetHashFile(hfp) |
130 | client.SetDefaults() |
131 | _, err := os.Stat(utils.HashFile) |
132 | diff --git a/package.json b/package.json |
133 | index 9efcf79..d3e2671 100644 |
134 | --- a/package.json |
135 | +++ b/package.json |
136 | @@ -1,5 +1,5 @@ |
137 | { |
138 | - "name": "ucwificonnect", |
139 | + "name": "wifi-connect", |
140 | "version": "1.0.0", |
141 | "description": "Management UI to be able to switch a wireless card of a UC device into AP mode and use it to configure wireless", |
142 | "main": "index.js", |
143 | @@ -8,14 +8,14 @@ |
144 | }, |
145 | "repository": { |
146 | "type": "git", |
147 | - "url": "git+https://github.com/CanonicalLtd/UCWifiConnect.git" |
148 | + "url": "git+ssh://git.launchpad.net/~snappy-hwe-team/snappy-hwe-snaps/+git/wifi-connect" |
149 | }, |
150 | "author": "", |
151 | "license": "GPL-3.0", |
152 | "bugs": { |
153 | - "url": "https://github.com/CanonicalLtd/UCWifiConnect/issues" |
154 | + "url": "https://bugs.launchpad.net/snappy-hwe-snaps" |
155 | }, |
156 | - "homepage": "https://github.com/CanonicalLtd/UCWifiConnect#readme", |
157 | + "homepage": "https://git.launchpad.net/~snappy-hwe-team/snappy-hwe-snaps/+git/wifi-connect", |
158 | "devDependencies": { |
159 | "gulp": "^3.9.1", |
160 | "gulp-sass": "^3.1.0", |
161 | diff --git a/server/fmt.go b/server/fmt.go |
162 | index 5f80f20..a614bd3 100644 |
163 | --- a/server/fmt.go |
164 | +++ b/server/fmt.go |
165 | @@ -1,7 +1,7 @@ |
166 | package server |
167 | |
168 | import ( |
169 | - "github.com/CanonicalLtd/UCWifiConnect/utils" |
170 | + "launchpad.net/wifi-connect/utils" |
171 | ) |
172 | |
173 | // Errorf returns a new instance implementing error interface taken a formatted string and |
174 | diff --git a/server/fmt_test.go b/server/fmt_test.go |
175 | index 7b99a7d..bec4a03 100644 |
176 | --- a/server/fmt_test.go |
177 | +++ b/server/fmt_test.go |
178 | @@ -3,7 +3,7 @@ package server |
179 | import ( |
180 | "testing" |
181 | |
182 | - "github.com/CanonicalLtd/UCWifiConnect/utils" |
183 | + "launchpad.net/wifi-connect/utils" |
184 | ) |
185 | |
186 | const ( |
187 | diff --git a/server/handlers.go b/server/handlers.go |
188 | index 58c7fcd..4467d32 100644 |
189 | --- a/server/handlers.go |
190 | +++ b/server/handlers.go |
191 | @@ -25,9 +25,9 @@ import ( |
192 | "path/filepath" |
193 | "text/template" |
194 | |
195 | - "github.com/CanonicalLtd/UCWifiConnect/netman" |
196 | - "github.com/CanonicalLtd/UCWifiConnect/utils" |
197 | - "github.com/CanonicalLtd/UCWifiConnect/wifiap" |
198 | + "launchpad.net/wifi-connect/netman" |
199 | + "launchpad.net/wifi-connect/utils" |
200 | + "launchpad.net/wifi-connect/wifiap" |
201 | ) |
202 | |
203 | const ( |
204 | diff --git a/server/handlers_test.go b/server/handlers_test.go |
205 | index f738c21..09c4d00 100644 |
206 | --- a/server/handlers_test.go |
207 | +++ b/server/handlers_test.go |
208 | @@ -23,7 +23,7 @@ import ( |
209 | "strings" |
210 | "testing" |
211 | |
212 | - "github.com/CanonicalLtd/UCWifiConnect/utils" |
213 | + "launchpad.net/wifi-connect/utils" |
214 | ) |
215 | |
216 | func TestManagementHandler(t *testing.T) { |
217 | diff --git a/server/launcher.go b/server/launcher.go |
218 | index c68dd52..cc42587 100644 |
219 | --- a/server/launcher.go |
220 | +++ b/server/launcher.go |
221 | @@ -23,7 +23,7 @@ import ( |
222 | "net/http" |
223 | "time" |
224 | |
225 | - "github.com/CanonicalLtd/UCWifiConnect/utils" |
226 | + "launchpad.net/wifi-connect/utils" |
227 | ) |
228 | |
229 | const ( |
230 | diff --git a/server/manager.go b/server/manager.go |
231 | index 7dd1d51..57d9b53 100644 |
232 | --- a/server/manager.go |
233 | +++ b/server/manager.go |
234 | @@ -20,7 +20,7 @@ package server |
235 | import ( |
236 | "os" |
237 | |
238 | - "github.com/CanonicalLtd/UCWifiConnect/utils" |
239 | + "launchpad.net/wifi-connect/utils" |
240 | ) |
241 | |
242 | // Enum of available server options |
243 | diff --git a/service/service.go b/service/service.go |
244 | index 03fcd95..1e85777 100644 |
245 | --- a/service/service.go |
246 | +++ b/service/service.go |
247 | @@ -22,10 +22,10 @@ import ( |
248 | "os" |
249 | "time" |
250 | |
251 | - "github.com/CanonicalLtd/UCWifiConnect/daemon" |
252 | - "github.com/CanonicalLtd/UCWifiConnect/netman" |
253 | - "github.com/CanonicalLtd/UCWifiConnect/utils" |
254 | - "github.com/CanonicalLtd/UCWifiConnect/wifiap" |
255 | + "launchpad.net/wifi-connect/daemon" |
256 | + "launchpad.net/wifi-connect/netman" |
257 | + "launchpad.net/wifi-connect/utils" |
258 | + "launchpad.net/wifi-connect/wifiap" |
259 | ) |
260 | |
261 | func main() { |
262 | diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml |
263 | index 8bc6378..80554f1 100644 |
264 | --- a/snap/snapcraft.yaml |
265 | +++ b/snap/snapcraft.yaml |
266 | @@ -1,14 +1,15 @@ |
267 | name: wifi-connect |
268 | -version: '0.10' |
269 | +version: 0.10-1 |
270 | summary: Connect your device to external wifi over temp wifi AP |
271 | description: | |
272 | - A solution to enable your device to connect to ian external |
273 | - wifi AP using a temporary wifi AP the device puts up and then |
274 | - opening its web portal. Note that wifi-connect daemon assumes |
275 | - control of device network management and other management solutions |
276 | - should not be simultaneously used. |
277 | - |
278 | -grade: devel |
279 | + A solution to enable your device to connect to ian external |
280 | + wifi AP using a temporary wifi AP the device puts up and then |
281 | + opening its web portal. Note that wifi-connect daemon assumes |
282 | + control of device network management and other management solutions |
283 | + should not be simultaneously used. |
284 | + Please find the source of this snap at: |
285 | + https://code.launchpad.net/~snappy-hwe-team/snappy-hwe-snaps/+git/wifi-connect |
286 | +grade: stable |
287 | confinement: strict |
288 | |
289 | apps: |
290 | @@ -16,7 +17,7 @@ apps: |
291 | command: cmd |
292 | plugs: [network, network-bind, network-manager, control] |
293 | daemon: |
294 | - command: service |
295 | + command: service |
296 | daemon: simple |
297 | plugs: [network-manager, control, network-bind] |
298 | |
299 | @@ -31,7 +32,14 @@ parts: |
300 | go: |
301 | plugin: go |
302 | source: . |
303 | - go-importpath: github.com/CanonicalLtd/UCWifiConnect |
304 | + go-importpath: launchpad.net/wifi-connect |
305 | + build-packages: |
306 | + # needed by go get |
307 | + - bzr |
308 | + install: | |
309 | + export GOPATH=$PWD/../go |
310 | + cd $GOPATH/src/launchpad.net/wifi-connect |
311 | + ./run-checks all |
312 | assets: |
313 | plugin: dump |
314 | source: . |
315 | diff --git a/spread_tests/main/ap/task.yaml b/spread_tests/main/ap/task.yaml |
316 | index 6664279..b281cd7 100644 |
317 | --- a/spread_tests/main/ap/task.yaml |
318 | +++ b/spread_tests/main/ap/task.yaml |
319 | @@ -2,7 +2,7 @@ summary: Test default service is running at beginning, correct configuration at |
320 | put wifi-connect in manual mode and see wlan1 can connect to it |
321 | |
322 | environment: |
323 | - MAX_ITERATIONS: 10 |
324 | + MAX_ITERATIONS: 20 |
325 | |
326 | prepare: | |
327 | # We need some tools for scanning etc. |
FAILED: Continuous integration, rev:00640de19c2 7eea2189d005d65 733db3ad880fea /jenkins. canonical. com/system- enablement/ job/generic- build-snap/ 1591/ /jenkins. canonical. com/system- enablement/ job/generic- build-snap- worker/ 1971/console /jenkins. canonical. com/system- enablement/ job/generic- update- snap-mp/ 1499/console /jenkins. canonical. com/system- enablement/ job/generic- test-snap/ 2348/console
https:/
Executed test runs:
FAILURE: https:/
None: https:/
FAILURE: https:/
Click here to trigger a rebuild: /jenkins. canonical. com/system- enablement/ job/generic- build-snap/ 1591/rebuild
https:/