Merge lp:~webapps/unity-js-scopes/fix-npm-build into lp:unity-js-scopes

Proposed by Marcus Tomlinson
Status: Merged
Approved by: Marcus Tomlinson
Approved revision: 87
Merged at revision: 85
Proposed branch: lp:~webapps/unity-js-scopes/fix-npm-build
Merge into: lp:unity-js-scopes
Prerequisite: lp:~abreu-alexandre/unity-js-scopes/remove-factory-new-constructs
Diff against target: 79 lines (+41/-7)
1 file modified
src/tool/main.cc (+41/-7)
To merge this branch: bzr merge lp:~webapps/unity-js-scopes/fix-npm-build
Reviewer Review Type Date Requested Status
Alexandre Abreu (community) Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+274371@code.launchpad.net

Commit message

Detect current arch for unity-js-scopes-tool build.

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

Merged remove-factory-new-constructs

Revision history for this message
Alexandre Abreu (abreu-alexandre) wrote :

A small comment

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
86. By Marcus Tomlinson

Added better error checking to get_arch() call

Revision history for this message
Marcus Tomlinson (marcustomlinson) wrote :

> A small comment

fixed

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
87. By Marcus Tomlinson

Merged trunk

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alexandre Abreu (abreu-alexandre) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/tool/main.cc'
--- src/tool/main.cc 2015-10-06 20:01:49 +0000
+++ src/tool/main.cc 2015-10-16 10:48:39 +0000
@@ -30,6 +30,38 @@
30#include <boost/algorithm/string/predicate.hpp>30#include <boost/algorithm/string/predicate.hpp>
31#include <boost/filesystem.hpp>31#include <boost/filesystem.hpp>
3232
33std::string get_arch() {
34 std::string result = "";
35
36 {
37 FILE* pipe = popen("dpkg-architecture -qDEB_HOST_ARCH", "r");
38 if (!pipe) throw std::runtime_error("'dpkg-architecture' command failed");
39 char buffer[128];
40 while (!feof(pipe)) {
41 if (fgets(buffer, 128, pipe) != NULL)
42 result += buffer;
43 }
44 result.pop_back();
45 pclose(pipe);
46 }
47
48 result += "-";
49
50 {
51 FILE* pipe = popen("lsb_release -rs", "r");
52 if (!pipe) throw std::runtime_error("'lsb_release' command failed");
53 char buffer[128];
54 while (!feof(pipe)) {
55 if (fgets(buffer, 128, pipe) != NULL)
56 result += buffer;
57 }
58 result.pop_back();
59 pclose(pipe);
60 }
61
62 return result;
63}
64
33void usage() {65void usage() {
34 std::cout << "Usage:"66 std::cout << "Usage:"
35 << std::endl67 << std::endl
@@ -41,7 +73,6 @@
41 << executable_name()73 << executable_name()
42 << " [re]build "74 << " [re]build "
43 << "<path/to/node_modules> "75 << "<path/to/node_modules> "
44 << "[<target_arch>]"
45 << std::endl;76 << std::endl;
46}77}
4778
@@ -198,10 +229,13 @@
198 {229 {
199 bool should_build = true;230 bool should_build = true;
200 std::string current_arch = "default";231 std::string current_arch = "default";
201232 try
202 if (argc > 3)233 {
203 {234 current_arch = get_arch();
204 current_arch = std::string(argv[3]);235 }
236 catch (std::exception const& e)
237 {
238 std::cout << "Failed to detect target architecture (using 'default' instead): " << e.what() << " ..." << std::endl;
205 }239 }
206240
207 // Check if we have built for this arch already, if so set should_build to false241 // Check if we have built for this arch already, if so set should_build to false
@@ -221,8 +255,8 @@
221 {255 {
222 std::vector<std::string> environment_updates;256 std::vector<std::string> environment_updates;
223 257
224 std::cout << "Setting target arch to '" << current_arch << "' ..." << std::endl;258 std::cout << "Setting target architecture to '" << current_arch << "' ..." << std::endl;
225 if (current_arch == "armhf")259 if (boost::algorithm::starts_with(current_arch, "armhf"))
226 {260 {
227 if (boost::filesystem::exists("/usr/bin/arm-linux-gnueabihf-gcc-5"))261 if (boost::filesystem::exists("/usr/bin/arm-linux-gnueabihf-gcc-5"))
228 {262 {

Subscribers

People subscribed via source and target branches

to all changes: