From bfd8331121e473759d8fbc596a456db81081da50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jelmer=20Vernoo=C4=B3?= Date: Sun, 16 May 2021 17:18:51 +0100 Subject: [PATCH 1/7] Cope with PermissionError. --- ognibuild/debian/file_search.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ognibuild/debian/file_search.py b/ognibuild/debian/file_search.py index 4f33ebf..5276835 100644 --- a/ognibuild/debian/file_search.py +++ b/ognibuild/debian/file_search.py @@ -156,7 +156,12 @@ def load_apt_cache_file(url, cache_dir): import lz4.frame return lz4.frame.open(p, mode="rb") - return _unwrap(open(p, "rb"), ext) + try: + f = open(p, "rb") + except PermissionError as e: + logging.warning('Unable to open %s: %s', p, e) + raise FileNotFoundError(url) + return _unwrap(f, ext) raise FileNotFoundError(url) From e1352808c96dee06143979dbcca4965d028eb2c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jelmer=20Vernoo=C4=B3?= Date: Sun, 16 May 2021 19:13:45 +0100 Subject: [PATCH 2/7] Only create build if it doesn't yet exist. --- ognibuild/buildsystem.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ognibuild/buildsystem.py b/ognibuild/buildsystem.py index 08ac13c..8659e80 100644 --- a/ognibuild/buildsystem.py +++ b/ognibuild/buildsystem.py @@ -1126,7 +1126,8 @@ class Make(BuildSystem): run_with_build_fixers(session, ["qmake"], fixers) if not makefile_exists() and session.exists('CMakeLists.txt'): - session.mkdir('build') + if not session.exists("build"): + session.mkdir('build') run_with_build_fixers(session, ["cmake", '..'], fixers, cwd='build') def build(self, session, resolver, fixers): From df46ea21e9d138283141e30997dfaba079542dcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jelmer=20Vernoo=C4=B3?= Date: Sun, 16 May 2021 19:15:16 +0100 Subject: [PATCH 3/7] Bump buildlog consultant version. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 11a4d5c..2ffefb3 100755 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ setup(name="ognibuild", }, install_requires=[ 'breezy', - 'buildlog-consultant>=0.0.4', + 'buildlog-consultant>=0.0.10', 'requirements-parser', ], extras_require={ From 0c6fdc9b0865359f3c14fef0f17899b69f3b3335 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jelmer=20Vernoo=C4=B3?= Date: Sun, 16 May 2021 19:16:08 +0100 Subject: [PATCH 4/7] Release 0.0.6. --- ognibuild/__init__.py | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ognibuild/__init__.py b/ognibuild/__init__.py index d5896e2..82408b8 100644 --- a/ognibuild/__init__.py +++ b/ognibuild/__init__.py @@ -20,7 +20,7 @@ import os import stat -__version__ = (0, 0, 5) +__version__ = (0, 0, 6) USER_AGENT = "Ognibuild" diff --git a/setup.py b/setup.py index 2ffefb3..0be4ae0 100755 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ from setuptools import setup setup(name="ognibuild", description="Detect and run any build system", - version="0.0.5", + version="0.0.6", maintainer="Jelmer Vernooij", maintainer_email="jelmer@jelmer.uk", license="GNU GPLv2 or later", From 7b2f565a115a3609d0ae4141782e041594457072 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jelmer=20Vernoo=C4=B3?= Date: Mon, 17 May 2021 18:23:10 +0100 Subject: [PATCH 5/7] Fix use of extra args. --- ognibuild/buildsystem.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ognibuild/buildsystem.py b/ognibuild/buildsystem.py index 8659e80..f3cd7a0 100644 --- a/ognibuild/buildsystem.py +++ b/ognibuild/buildsystem.py @@ -726,9 +726,11 @@ class R(BuildSystem): return dc.copy_single(target_directory) def install(self, session, resolver, fixers, install_target): - extra_args.append("--prefix=%s" % install_target.prefix) + extra_args = [] + if install_target.prefix: + extra_args.append("--prefix=%s" % install_target.prefix) r_path = guaranteed_which(session, resolver, "R") - run_with_build_fixers(session, [r_path, "CMD", "INSTALL", "."], fixers) + run_with_build_fixers(session, [r_path, "CMD", "INSTALL", "."] + extra_args, fixers) def test(self, session, resolver, fixers): r_path = guaranteed_which(session, resolver, "R") From f338e67b0ab39e889e1e46dc9e1a73d7964f75fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jelmer=20Vernoo=C4=B3?= Date: Mon, 17 May 2021 18:42:59 +0100 Subject: [PATCH 6/7] Skip debian tests on non-debian systems. --- ognibuild/tests/__init__.py | 4 +++- ognibuild/tests/test_debian_fix_build.py | 2 -- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ognibuild/tests/__init__.py b/ognibuild/tests/__init__.py index 42d25c4..075535d 100644 --- a/ognibuild/tests/__init__.py +++ b/ognibuild/tests/__init__.py @@ -17,14 +17,16 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. +import os import unittest def test_suite(): names = [ "debian_build", - "debian_fix_build", ] + if os.path.exists("/usr/bin/dpkg-architecture"): + names.append("debian_fix_build") module_names = ["ognibuild.tests.test_" + name for name in names] loader = unittest.TestLoader() return loader.loadTestsFromNames(module_names) diff --git a/ognibuild/tests/test_debian_fix_build.py b/ognibuild/tests/test_debian_fix_build.py index e3288b5..67151e4 100644 --- a/ognibuild/tests/test_debian_fix_build.py +++ b/ognibuild/tests/test_debian_fix_build.py @@ -65,8 +65,6 @@ class DummyAptSearcher(FileSearcher): class ResolveErrorTests(TestCaseWithTransport): def setUp(self): super(ResolveErrorTests, self).setUp() - if not os.path.exists("/usr/bin/dpkg-architecture"): - self.skipTest("not a debian system") self.tree = self.make_branch_and_tree(".") self.build_tree_contents( [ From 8189e9189d2c8be1d8c0d87e7bf3594bb2f7b52e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jelmer=20Vernoo=C4=B3?= Date: Mon, 17 May 2021 18:48:15 +0100 Subject: [PATCH 7/7] Remove unused import. --- ognibuild/tests/test_debian_fix_build.py | 1 - 1 file changed, 1 deletion(-) diff --git a/ognibuild/tests/test_debian_fix_build.py b/ognibuild/tests/test_debian_fix_build.py index 67151e4..c0a5456 100644 --- a/ognibuild/tests/test_debian_fix_build.py +++ b/ognibuild/tests/test_debian_fix_build.py @@ -15,7 +15,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -import os import re from debian.deb822 import Deb822