From: Fabrice Fontaine Date: Tue, 13 Mar 2018 19:07:37 +0100 Subject: [Buildroot] [PATCH 1/1] meson: fix error when restorecon unavailable Message-ID: <20180313180737.1065-1-fontaine.fabrice@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: buildroot@busybox.net host-meson is used by some packages such as libmpdclient. If selinuxenabled is installed on host but restorecon is unavailable (for an "unknwown" reason), install will crash. Fixes: - http://autobuild.buildroot.net/results/d5dcdfdfab3503fdc387f99e68267972a38c417d Signed-off-by: Fabrice Fontaine --- ...NotFoundError-when-restorecon-unavailable.patch | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 package/meson/0001-Fix-FileNotFoundError-when-restorecon-unavailable.patch diff --git a/package/meson/0001-Fix-FileNotFoundError-when-restorecon-unavailable.patch b/package/meson/0001-Fix-FileNotFoundError-when-restorecon-unavailable.patch new file mode 100644 index 0000000000..d2737f7fab --- /dev/null +++ b/package/meson/0001-Fix-FileNotFoundError-when-restorecon-unavailable.patch @@ -0,0 +1,33 @@ +From 5aa4320566f25db2bbe1a1069d795ba728413e92 Mon Sep 17 00:00:00 2001 +From: Fabrice Fontaine +Date: Tue, 13 Mar 2018 18:52:36 +0100 +Subject: [PATCH] Fix FileNotFoundError when restorecon unavailable + +Fixes: + - http://autobuild.buildroot.net/results/d5dcdfdfab3503fdc387f99e68267972a38c417d + +Signed-off-by: Fabrice Fontaine +--- + mesonbuild/scripts/meson_install.py | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/mesonbuild/scripts/meson_install.py b/mesonbuild/scripts/meson_install.py +index f895f17d..4e9cfa74 100644 +--- a/mesonbuild/scripts/meson_install.py ++++ b/mesonbuild/scripts/meson_install.py +@@ -97,6 +97,12 @@ def restore_selinux_contexts(): + # is ignored quietly. + return + ++ try: ++ subprocess.check_call(['restorecon']) ++ except (FileNotFoundError, PermissionError, subprocess.CalledProcessError) as e: ++ # If we don't have restorecon, failure is ignored quietly. ++ return ++ + with subprocess.Popen(['restorecon', '-F', '-f-', '-0'], + stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) as proc: + out, err = proc.communicate(input=b'\0'.join(os.fsencode(f) for f in selinux_updates) + b'\0') +-- +2.14.1 + -- 2.14.1