Merge lp:~alecu/unity-scope-click/architecture-in-search into lp:unity-scope-click

Proposed by Alejandro J. Cura
Status: Merged
Approved by: Alejandro J. Cura
Approved revision: 70
Merged at revision: 74
Proposed branch: lp:~alecu/unity-scope-click/architecture-in-search
Merge into: lp:unity-scope-click
Diff against target: 76 lines (+29/-1)
3 files modified
src/click-interface.vala (+14/-0)
src/click-webservice.vala (+3/-1)
src/test-click-webservice.vala (+12/-0)
To merge this branch: bzr merge lp:~alecu/unity-scope-click/architecture-in-search
Reviewer Review Type Date Requested Status
Mike McCracken (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+189421@code.launchpad.net

Commit message

Send the device architecture in the click search query

Description of the change

PLEASE NOTE: this branch depends on a new server feature, so it must not be landed until the server is fixed. Contact alecu or jayteeuk for more info.

NOTE 2: the server fix has landed, so this branch is ready to land.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Mike McCracken (mikemc) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/click-interface.vala'
2--- src/click-interface.vala 2013-10-01 15:29:10 +0000
3+++ src/click-interface.vala 2013-10-04 20:12:27 +0000
4@@ -21,6 +21,20 @@
5
6 public class ClickInterface : GLib.Object {
7 const string ARG_DESKTOP_FILE_HINT = "--desktop_file_hint";
8+ private static string arch = null;
9+
10+ public static string get_arch () {
11+ if (arch == null) {
12+ try {
13+ string standard_output;
14+ Process.spawn_command_line_sync ("dpkg --print-architecture", out standard_output);
15+ arch = standard_output.strip();
16+ } catch (SpawnError e) {
17+ error("Error starting dpkg: %s", e.message);
18+ }
19+ }
20+ return arch;
21+ }
22
23 public string get_click_id (string full_app_id) {
24 return full_app_id.split("_")[0];
25
26=== modified file 'src/click-webservice.vala'
27--- src/click-webservice.vala 2013-10-03 17:40:19 +0000
28+++ src/click-webservice.vala 2013-10-04 20:12:27 +0000
29@@ -240,6 +240,7 @@
30 private const string SEARCH_BASE_URL = "https://search.apps.ubuntu.com/";
31 private const string SEARCH_PATH = "api/v1/search?q=%s";
32 private const string SUPPORTED_FRAMEWORKS = "framework:ubuntu-sdk-13.10";
33+ private const string ARCHITECTURE = "architecture:";
34 private const string DETAILS_PATH = "api/v1/package/%s";
35
36 internal Soup.SessionAsync http_session;
37@@ -258,7 +259,8 @@
38 }
39
40 string get_search_url() {
41- return get_base_url() + SEARCH_PATH + "," + SUPPORTED_FRAMEWORKS;
42+ return get_base_url() + SEARCH_PATH + "," + SUPPORTED_FRAMEWORKS + "," +
43+ ARCHITECTURE + ClickInterface.get_arch();
44 }
45
46 string get_details_url() {
47
48=== modified file 'src/test-click-webservice.vala'
49--- src/test-click-webservice.vala 2013-09-25 21:18:19 +0000
50+++ src/test-click-webservice.vala 2013-10-04 20:12:27 +0000
51@@ -182,6 +182,17 @@
52 }
53 }
54
55+ public static void test_click_architecture ()
56+ {
57+ try {
58+ var arch = ClickInterface.get_arch();
59+ debug("Got arch: %s", arch);
60+ assert_cmpint (arch.length, OperatorType.GREATER_THAN, 1);
61+ } catch (GLib.Error e) {
62+ assert_not_reached ();
63+ }
64+ }
65+
66 public static void test_click_get_versions ()
67 {
68 MainLoop mainloop = new MainLoop ();
69@@ -256,6 +267,7 @@
70 public static int main (string[] args)
71 {
72 Test.init (ref args);
73+ Test.add_data_func ("/Unit/ClickChecker/Test_Click_Architecture", test_click_architecture);
74 Test.add_data_func ("/Unit/ClickChecker/Test_Click_Get_Versions", test_click_get_versions);
75 Test.add_data_func ("/Unit/ClickChecker/Test_Click_Interface", test_click_interface);
76 Test.add_data_func ("/Unit/ClickChecker/Test_Click_Get_DotDesktop", test_click_get_dotdesktop);

Subscribers

People subscribed via source and target branches