Phillip Smyth pushed to branch issue-640-contrib-build-all at BuildStream / buildstream
Commits:
-
eeedc27c
by Phillip Smyth at 2018-12-05T16:37:34Z
-
b5131981
by Phillip Smyth at 2018-12-05T16:38:30Z
-
f7e289f2
by Phillip Smyth at 2018-12-05T16:38:34Z
3 changed files:
Changes:
| 1 |
+#!/usr/bin/python3
|
|
| 2 |
+#
|
|
| 3 |
+# Copyright 2018 Bloomberg Finance LP
|
|
| 4 |
+#
|
|
| 5 |
+# This program is free software; you can redistribute it and/or
|
|
| 6 |
+# modify it under the terms of the GNU Lesser General Public
|
|
| 7 |
+# License as published by the Free Software Foundation; either
|
|
| 8 |
+# version 2 of the License, or (at your option) any later version.
|
|
| 9 |
+#
|
|
| 10 |
+# This library is distributed in the hope that it will be useful,
|
|
| 11 |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 12 |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
| 13 |
+# Lesser General Public License for more details.
|
|
| 14 |
+#
|
|
| 15 |
+# You should have received a copy of the GNU Lesser General Public
|
|
| 16 |
+# License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
| 17 |
+#
|
|
| 18 |
+# Authors:
|
|
| 19 |
+# Phillip Smyth <phillip smyth codethink co uk>
|
|
| 20 |
+ |
|
| 21 |
+# This is a helper script for building all the elements in a project
|
|
| 22 |
+ |
|
| 23 |
+import os
|
|
| 24 |
+import bstGetAllElements
|
|
| 25 |
+import subprocess
|
|
| 26 |
+ |
|
| 27 |
+def bst_build_all_elements():
|
|
| 28 |
+ elements = bstGetAllElements.get_all_buildable_elements()
|
|
| 29 |
+ command = ["bst", "build"] + elements
|
|
| 30 |
+ subprocess.call(command)
|
|
| 31 |
+ |
|
| 32 |
+bst_build_all_elements()
|
| 1 |
+#
|
|
| 2 |
+# Copyright 2018 Bloomberg Finance LP
|
|
| 3 |
+#
|
|
| 4 |
+# This program is free software; you can redistribute it and/or
|
|
| 5 |
+# modify it under the terms of the GNU Lesser General Public
|
|
| 6 |
+# License as published by the Free Software Foundation; either
|
|
| 7 |
+# version 2 of the License, or (at your option) any later version.
|
|
| 8 |
+#
|
|
| 9 |
+# This library is distributed in the hope that it will be useful,
|
|
| 10 |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 11 |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
| 12 |
+# Lesser General Public License for more details.
|
|
| 13 |
+#
|
|
| 14 |
+# You should have received a copy of the GNU Lesser General Public
|
|
| 15 |
+# License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
| 16 |
+#
|
|
| 17 |
+# Authors:
|
|
| 18 |
+# Phillip Smyth <phillip smyth codethink co uk>
|
|
| 19 |
+ |
|
| 20 |
+# This is a helper script for returning all the elements in a project
|
|
| 21 |
+ |
|
| 22 |
+import os
|
|
| 23 |
+import yaml
|
|
| 24 |
+ |
|
| 25 |
+def get_all_buildable_elements():
|
|
| 26 |
+ elements = []
|
|
| 27 |
+ cwd = os.getcwd()
|
|
| 28 |
+ element_path = get_element_path("project.conf")
|
|
| 29 |
+ for root, _, files in os.walk(cwd):
|
|
| 30 |
+ for file in files:
|
|
| 31 |
+ if file.endswith(".bst"):
|
|
| 32 |
+ relDir = os.path.relpath(root, cwd)
|
|
| 33 |
+ relFile = os.path.join(relDir, file).strip("./")
|
|
| 34 |
+ if is_not_junction(relFile):
|
|
| 35 |
+ relFile = relFile.replace(element_path, '')
|
|
| 36 |
+ elements.append(relFile)
|
|
| 37 |
+ return elements
|
|
| 38 |
+ |
|
| 39 |
+ |
|
| 40 |
+def is_not_junction(element):
|
|
| 41 |
+ try:
|
|
| 42 |
+ with open(element) as stream:
|
|
| 43 |
+ data = yaml.load(stream)
|
|
| 44 |
+ data["junction"]
|
|
| 45 |
+ return False
|
|
| 46 |
+ except:
|
|
| 47 |
+ return True
|
|
| 48 |
+ |
|
| 49 |
+ |
|
| 50 |
+def get_element_path(project_conf):
|
|
| 51 |
+ if os.path.isfile(project_conf):
|
|
| 52 |
+ try:
|
|
| 53 |
+ with open(project_conf) as stream:
|
|
| 54 |
+ data = yaml.load(stream)
|
|
| 55 |
+ data["element-path"]
|
|
| 56 |
+ return line + '/'
|
|
| 57 |
+ except:
|
|
| 58 |
+ return "."
|
|
| 59 |
+ raise Exception("No project.conf was found in this directory")
|
| 1 |
+#!/usr/bin/python3
|
|
| 2 |
+#
|
|
| 3 |
+# Copyright 2018 Bloomberg Finance LP
|
|
| 4 |
+#
|
|
| 5 |
+# This program is free software; you can redistribute it and/or
|
|
| 6 |
+# modify it under the terms of the GNU Lesser General Public
|
|
| 7 |
+# License as published by the Free Software Foundation; either
|
|
| 8 |
+# version 2 of the License, or (at your option) any later version.
|
|
| 9 |
+#
|
|
| 10 |
+# This library is distributed in the hope that it will be useful,
|
|
| 11 |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 12 |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
| 13 |
+# Lesser General Public License for more details.
|
|
| 14 |
+#
|
|
| 15 |
+# You should have received a copy of the GNU Lesser General Public
|
|
| 16 |
+# License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
| 17 |
+#
|
|
| 18 |
+# Authors:
|
|
| 19 |
+# Phillip Smyth <phillip smyth codethink co uk>
|
|
| 20 |
+ |
|
| 21 |
+# This is a helper script for validating all the elements in a project
|
|
| 22 |
+ |
|
| 23 |
+import os
|
|
| 24 |
+import bstGetAllElements
|
|
| 25 |
+import subprocess
|
|
| 26 |
+ |
|
| 27 |
+def bst_show_all_elements():
|
|
| 28 |
+ elements = bstGetAllElements.get_all_buildable_elements()
|
|
| 29 |
+ command = ["bst", "show"] + elements
|
|
| 30 |
+ subprocess.call(command)
|
|
| 31 |
+ |
|
| 32 |
+bst_show_all_elements()
|
