summaryrefslogtreecommitdiff
path: root/packaging/qemu-accel.spec.in
diff options
context:
space:
mode:
authorVyacheslav Barinov <v.barinov@samsung.com>2016-01-15 11:57:56 +0300
committerVyacheslav Barinov <v.barinov@samsung.com>2016-01-15 15:33:01 +0300
commitba4d917b86021948a990336938d4e6876440aa49 (patch)
tree5b0f10b1d5a331968e1cb63f81b139d050b88fe5 /packaging/qemu-accel.spec.in
parent1586c942c607fda7d1177864387f70e196f05b60 (diff)
downloadqemu-accel-ba4d917b86021948a990336938d4e6876440aa49.tar.gz
qemu-accel-ba4d917b86021948a990336938d4e6876440aa49.tar.bz2
qemu-accel-ba4d917b86021948a990336938d4e6876440aa49.zip
Now all file attributes are saved and restored properly Change-Id: I3059295381c95bde16c983075c215f151f59eba2 Signed-off-by: Vyacheslav Barinov <v.barinov@samsung.com>
Diffstat (limited to 'packaging/qemu-accel.spec.in')
-rw-r--r--packaging/qemu-accel.spec.in13
1 files changed, 11 insertions, 2 deletions
diff --git a/packaging/qemu-accel.spec.in b/packaging/qemu-accel.spec.in
index 67deb2b..95b453d 100644
--- a/packaging/qemu-accel.spec.in
+++ b/packaging/qemu-accel.spec.in
@@ -52,7 +52,7 @@ BuildRequires: python-xml
BuildRequires: python-magic
BuildRequires: python-rpm
BuildRequires: file
-BuildRequires: sudo
+BuildRequires: sudo acl
Summary: Native binaries for speeding up cross compile
License: GPL-2.0
Group: Development/Cross Compilation
@@ -119,7 +119,8 @@ for executable in $LD \
%{_bindir}/%{target_arch}-{c++,g++,cpp,gcc,gcc-${gcc_version},gcc-ar,gcc-nm,gcc-ranlib,gcov,gfortran} \
%{libdir}/gcc/%{target_arch}/${gcc_version}/{cc1,cc1plus,collect2,f951,lto1,lto-wrapper,liblto_plugin.so} \
%{_bindir}/file \
- %{_bindir}/sudo \
+ %{_bindir}/{sudo,getfacl,setfacl} \
+ %{_libexecdir}/sudo/{group_file.so,sudo_noexec.so,sudoers.so,system_group.so} \
%{_bindir}/{find,xargs}
do
binaries="$binaries $executable `ldd $executable | sed -n 's,.*=> \(/[^ ]*\) .*,\1,p'`"
@@ -135,6 +136,9 @@ do
done | grep -v "not owned" | sed -e "s/-[0-9].*//g" | sort -u
echo ""
+# Create storage for permissions
+mkdir -p %{buildroot}/%{our_path}
+echo '' > %{buildroot}/%{our_path}/permissions.acl
for binary in $binaries
do
@@ -149,6 +153,7 @@ do
echo "ERROR file $binary leaks host information into the guest"
exit 1
fi
+ getfacl $binary | sed -e '/file:/s|: |: %{our_path}/|' >> %{buildroot}%{our_path}/permissions.acl
rm -f $outfile.data
[ "$binary" == "$LD" ] && continue
patchelf --set-rpath "%{our_path}/%{libdir}" $outfile
@@ -181,6 +186,7 @@ ln -s usr/lib %{buildroot}%{our_path}/lib
for binary in addr2line ar as c++filt dwp elfedit gprof ld ld.bfd ld.gold nm objcopy objdump ranlib readelf size strings strip
do
mv %{buildroot}%{our_path}%{_bindir}/%{target_arch}-$binary %{buildroot}%{our_path}%{_bindir}/$binary
+ sed -e "/file:/s|%{_bindir}/%{target_arch}-$binary|%{_bindir}/$binary|" -i %{buildroot}%{our_path}/permissions.acl
done
mkdir -p %{buildroot}/%{our_path}/%{_prefix}/%{target_arch}/bin
@@ -233,6 +239,7 @@ for bin in c++ g++ cpp gcc gcc-ar gcc-nm gcc-ranlib gfortran
do
mv %{buildroot}%{our_path}%{_bindir}/%{target_arch}-$bin %{buildroot}/%{our_path}%{_bindir}/$bin
ln -s $bin %{buildroot}%{our_path}%{_bindir}/%{target_arch}-$bin
+ sed -e "/file:/s|%{_bindir}/%{target_arch}-$bin|%{_bindir}/$bin|" -i %{buildroot}%{our_path}/permissions.acl
done
mv %{buildroot}%{our_path}%{_bindir}/%{target_arch}-gcov %{buildroot}%{our_path}%{_bindir}/gcov
ln -s gcc %{buildroot}%{our_path}/%{_bindir}/cc
@@ -266,6 +273,8 @@ set -x
# update baselibs.conf, overwrite LTO plugin
sed -i -e "s,#PLUGIN_POSTIN#,ln -sf %{our_path}%{_libdir}/gcc/%{target_arch}/${gcc_version}/liblto_plugin.so %{libdir}/gcc/%{target_arch}/${gcc_version}/liblto_plugin.so," %{_sourcedir}/baselibs.conf
sed -i -e "s,#PLUGIN_POSTUN#,ln -sf liblto_plugin.so.0 %{libdir}/gcc/%{target_arch}/${gcc_version}/liblto_plugin.so," %{_sourcedir}/baselibs.conf
+sed -i -e "s,#PLUGIN_POSTIN_ACL#,%{our_path}/bin/setfacl --restore=%{our_path}/permissions.acl," %{_sourcedir}/baselibs.conf
+sed -i -e "s,#PLUGIN_POSTIN_SUDO#,for f in group_file.so sudo_noexec.so sudoers.so system_group.so; do ln -sf %{our_path}%{_libexecdir}/sudo/\$f %{_libexecdir}/sudo/\$f ; done," %{_sourcedir}/baselibs.conf
# allow build of baselibs.conf
sed -i -e "/targettype %{cross} block!/d" %{_sourcedir}/baselibs.conf