Fix directory permissions for *-force-options packages 32/258332/6 accepted/tizen/base/tool/20210514.083901 submit/tizen_base/20210514.081010
authorSlava Barinov <v.barinov@samsung.com>
Thu, 13 May 2021 12:20:27 +0000 (15:20 +0300)
committerSlava Barinov <v.barinov@samsung.com>
Thu, 13 May 2021 16:00:08 +0000 (19:00 +0300)
Change-Id: Icf48f938a67607e1d68a57616ecf0c0aa1038f2e
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
packaging/baselibs_body
packaging/qemu-accel-aarch64.spec
packaging/qemu-accel-armv7hl.spec
packaging/qemu-accel-armv7l.spec
packaging/qemu-accel.spec.in

index d00e563..8a9e92c 100644 (file)
@@ -18,6 +18,7 @@ python-accel
   targettype 32bit block!
   autoreqprov off
   +/
+  post "#PYTHON_POSTIN#"
 
 clang-accel
   targettype aarch64 block!
@@ -25,3 +26,4 @@ clang-accel
   targettype 32bit block!
   autoreqprov off
   +/
+  post "#CLANG_POSTIN#"
index 1c9c9fb..3531b4c 100644 (file)
@@ -130,6 +130,15 @@ Group:          Development/Cross Compilation
 %description -n python-accel
 This package is used in qemu-accel to accelerate python.
 
+%post -n python-accel
+ldconfig
+
+# Check if there is possibility of gcc-unforce-options call and fix permissions
+rpm -qa --qf '%{NAME}\n' | grep force-options && \
+    chmod a+w /usr/bin && \
+    chmod a+w /emul/usr/bin/ && chmod a+w /emul/home/abuild/rpmbuild/BUILD/gcc-*/obj/gcc/ \
+        && find -L /emul/usr/*/gcc -name 'collect2' | xargs dirname | xargs chmod a+w
+
 %package -n clang-accel
 AutoReqProv: off
 Requires: qemu-accel
@@ -143,6 +152,15 @@ Requires: qemu-accel
 %description -n clang-accel
 This package is used in qemu-accel to accelerate clang compiler.
 
+%post -n clang-accel
+# Check if there is possibility of gcc-unforce-options call and fix permissions
+pkg=$(rpm -qa --qf '%{NAME}\n' | grep force-options)
+if [[ x"$pkg" != x"" ]]; then
+    chmod a+w /usr/bin
+    chmod a+w /emul/usr/bin/ && chmod a+w /emul/home/abuild/rpmbuild/BUILD/gcc-*/obj/gcc/ \
+        && find -L /emul/usr/*/gcc -name 'collect2' | xargs dirname | xargs chmod a+w
+fi
+
 %prep
 
 %build
@@ -514,8 +532,13 @@ cat %{_sourcedir}/baselibs_prologue %{_sourcedir}/baselibs_body > %{_sourcedir}/
 # By default this is ${gcc_install_dir}/liblto_plugin.so
 target_liblto_plugin="$(%{target_arch}-gcc -print-file-name=liblto_plugin.so)"
 # update baselibs.conf, overwrite LTO plugin
-sed -i -e "s,#PLUGIN_POSTIN#,if [ -d $(dirname ${target_liblto_plugin}) ]; then\"\n  post \"  ln -sf %{emul_path}${target_liblto_plugin} ${target_liblto_plugin}\"\n  post \"fi," %{_sourcedir}/baselibs.conf
-sed -i -e "s,#PLUGIN_POSTUN#,ln -sf liblto_plugin.so.0 ${target_liblto_plugin}," %{_sourcedir}/baselibs.conf
+sed -e "s,#PLUGIN_POSTIN#,if [ -d $(dirname ${target_liblto_plugin}) ]; then\"\n  post \"  ln -sf %{emul_path}${target_liblto_plugin} ${target_liblto_plugin}\"\n  post \"fi," -i %{_sourcedir}/baselibs.conf
+sed -e "s,#PLUGIN_POSTUN#,ln -sf liblto_plugin.so.0 ${target_liblto_plugin}," -i %{_sourcedir}/baselibs.conf
+
+# Add support of gcc-unforce-options for baselibs-generated packages
+sed -e "s,#PYTHON_POSTIN#,rpm -qa --qf '%%%%{NAME}' | grep force-options \&\& chmod a+w /usr/bin \&\& chmod a+w /emul/usr/bin/ \&\& chmod a+w /emul/home/abuild/rpmbuild/BUILD/gcc-*/obj/gcc/ \&\& find -L /emul/usr/*/gcc -name 'collect2' | xargs dirname | xargs chmod a+w," -i %{_sourcedir}/baselibs.conf
+sed -e "s,#CLANG_POSTIN#,rpm -qa --qf '%%%%{NAME}' | grep force-options \&\& chmod a+w /usr/bin \&\& chmod a+w /emul/usr/bin/ \&\& chmod a+w /emul/home/abuild/rpmbuild/BUILD/gcc-*/obj/gcc/ \&\& find -L /emul/usr/*/gcc -name 'collect2' | xargs dirname | xargs chmod a+w," -i %{_sourcedir}/baselibs.conf
+
 
 # Use /usr/lib for cross clang libdir on armv7l architecture
 %{?armv7l:
@@ -567,9 +590,6 @@ ldconfig
 %postun
 ldconfig
 
-%post -n python-accel
-ldconfig
-
 %postun -n python-accel
 ldconfig
 
index ecdb4d6..a5d2bc3 100644 (file)
@@ -130,6 +130,15 @@ Group:          Development/Cross Compilation
 %description -n python-accel
 This package is used in qemu-accel to accelerate python.
 
+%post -n python-accel
+ldconfig
+
+# Check if there is possibility of gcc-unforce-options call and fix permissions
+rpm -qa --qf '%{NAME}\n' | grep force-options && \
+    chmod a+w /usr/bin && \
+    chmod a+w /emul/usr/bin/ && chmod a+w /emul/home/abuild/rpmbuild/BUILD/gcc-*/obj/gcc/ \
+        && find -L /emul/usr/*/gcc -name 'collect2' | xargs dirname | xargs chmod a+w
+
 %package -n clang-accel
 AutoReqProv: off
 Requires: qemu-accel
@@ -143,6 +152,15 @@ Requires: qemu-accel
 %description -n clang-accel
 This package is used in qemu-accel to accelerate clang compiler.
 
+%post -n clang-accel
+# Check if there is possibility of gcc-unforce-options call and fix permissions
+pkg=$(rpm -qa --qf '%{NAME}\n' | grep force-options)
+if [[ x"$pkg" != x"" ]]; then
+    chmod a+w /usr/bin
+    chmod a+w /emul/usr/bin/ && chmod a+w /emul/home/abuild/rpmbuild/BUILD/gcc-*/obj/gcc/ \
+        && find -L /emul/usr/*/gcc -name 'collect2' | xargs dirname | xargs chmod a+w
+fi
+
 %prep
 
 %build
@@ -514,8 +532,13 @@ cat %{_sourcedir}/baselibs_prologue %{_sourcedir}/baselibs_body > %{_sourcedir}/
 # By default this is ${gcc_install_dir}/liblto_plugin.so
 target_liblto_plugin="$(%{target_arch}-gcc -print-file-name=liblto_plugin.so)"
 # update baselibs.conf, overwrite LTO plugin
-sed -i -e "s,#PLUGIN_POSTIN#,if [ -d $(dirname ${target_liblto_plugin}) ]; then\"\n  post \"  ln -sf %{emul_path}${target_liblto_plugin} ${target_liblto_plugin}\"\n  post \"fi," %{_sourcedir}/baselibs.conf
-sed -i -e "s,#PLUGIN_POSTUN#,ln -sf liblto_plugin.so.0 ${target_liblto_plugin}," %{_sourcedir}/baselibs.conf
+sed -e "s,#PLUGIN_POSTIN#,if [ -d $(dirname ${target_liblto_plugin}) ]; then\"\n  post \"  ln -sf %{emul_path}${target_liblto_plugin} ${target_liblto_plugin}\"\n  post \"fi," -i %{_sourcedir}/baselibs.conf
+sed -e "s,#PLUGIN_POSTUN#,ln -sf liblto_plugin.so.0 ${target_liblto_plugin}," -i %{_sourcedir}/baselibs.conf
+
+# Add support of gcc-unforce-options for baselibs-generated packages
+sed -e "s,#PYTHON_POSTIN#,rpm -qa --qf '%%%%{NAME}' | grep force-options \&\& chmod a+w /usr/bin \&\& chmod a+w /emul/usr/bin/ \&\& chmod a+w /emul/home/abuild/rpmbuild/BUILD/gcc-*/obj/gcc/ \&\& find -L /emul/usr/*/gcc -name 'collect2' | xargs dirname | xargs chmod a+w," -i %{_sourcedir}/baselibs.conf
+sed -e "s,#CLANG_POSTIN#,rpm -qa --qf '%%%%{NAME}' | grep force-options \&\& chmod a+w /usr/bin \&\& chmod a+w /emul/usr/bin/ \&\& chmod a+w /emul/home/abuild/rpmbuild/BUILD/gcc-*/obj/gcc/ \&\& find -L /emul/usr/*/gcc -name 'collect2' | xargs dirname | xargs chmod a+w," -i %{_sourcedir}/baselibs.conf
+
 
 # Use /usr/lib for cross clang libdir on armv7l architecture
 %{?armv7l:
@@ -567,9 +590,6 @@ ldconfig
 %postun
 ldconfig
 
-%post -n python-accel
-ldconfig
-
 %postun -n python-accel
 ldconfig
 
index 98d0dc1..33fb131 100644 (file)
@@ -130,6 +130,15 @@ Group:          Development/Cross Compilation
 %description -n python-accel
 This package is used in qemu-accel to accelerate python.
 
+%post -n python-accel
+ldconfig
+
+# Check if there is possibility of gcc-unforce-options call and fix permissions
+rpm -qa --qf '%{NAME}\n' | grep force-options && \
+    chmod a+w /usr/bin && \
+    chmod a+w /emul/usr/bin/ && chmod a+w /emul/home/abuild/rpmbuild/BUILD/gcc-*/obj/gcc/ \
+        && find -L /emul/usr/*/gcc -name 'collect2' | xargs dirname | xargs chmod a+w
+
 %package -n clang-accel
 AutoReqProv: off
 Requires: qemu-accel
@@ -143,6 +152,15 @@ Requires: qemu-accel
 %description -n clang-accel
 This package is used in qemu-accel to accelerate clang compiler.
 
+%post -n clang-accel
+# Check if there is possibility of gcc-unforce-options call and fix permissions
+pkg=$(rpm -qa --qf '%{NAME}\n' | grep force-options)
+if [[ x"$pkg" != x"" ]]; then
+    chmod a+w /usr/bin
+    chmod a+w /emul/usr/bin/ && chmod a+w /emul/home/abuild/rpmbuild/BUILD/gcc-*/obj/gcc/ \
+        && find -L /emul/usr/*/gcc -name 'collect2' | xargs dirname | xargs chmod a+w
+fi
+
 %prep
 
 %build
@@ -514,8 +532,13 @@ cat %{_sourcedir}/baselibs_prologue %{_sourcedir}/baselibs_body > %{_sourcedir}/
 # By default this is ${gcc_install_dir}/liblto_plugin.so
 target_liblto_plugin="$(%{target_arch}-gcc -print-file-name=liblto_plugin.so)"
 # update baselibs.conf, overwrite LTO plugin
-sed -i -e "s,#PLUGIN_POSTIN#,if [ -d $(dirname ${target_liblto_plugin}) ]; then\"\n  post \"  ln -sf %{emul_path}${target_liblto_plugin} ${target_liblto_plugin}\"\n  post \"fi," %{_sourcedir}/baselibs.conf
-sed -i -e "s,#PLUGIN_POSTUN#,ln -sf liblto_plugin.so.0 ${target_liblto_plugin}," %{_sourcedir}/baselibs.conf
+sed -e "s,#PLUGIN_POSTIN#,if [ -d $(dirname ${target_liblto_plugin}) ]; then\"\n  post \"  ln -sf %{emul_path}${target_liblto_plugin} ${target_liblto_plugin}\"\n  post \"fi," -i %{_sourcedir}/baselibs.conf
+sed -e "s,#PLUGIN_POSTUN#,ln -sf liblto_plugin.so.0 ${target_liblto_plugin}," -i %{_sourcedir}/baselibs.conf
+
+# Add support of gcc-unforce-options for baselibs-generated packages
+sed -e "s,#PYTHON_POSTIN#,rpm -qa --qf '%%%%{NAME}' | grep force-options \&\& chmod a+w /usr/bin \&\& chmod a+w /emul/usr/bin/ \&\& chmod a+w /emul/home/abuild/rpmbuild/BUILD/gcc-*/obj/gcc/ \&\& find -L /emul/usr/*/gcc -name 'collect2' | xargs dirname | xargs chmod a+w," -i %{_sourcedir}/baselibs.conf
+sed -e "s,#CLANG_POSTIN#,rpm -qa --qf '%%%%{NAME}' | grep force-options \&\& chmod a+w /usr/bin \&\& chmod a+w /emul/usr/bin/ \&\& chmod a+w /emul/home/abuild/rpmbuild/BUILD/gcc-*/obj/gcc/ \&\& find -L /emul/usr/*/gcc -name 'collect2' | xargs dirname | xargs chmod a+w," -i %{_sourcedir}/baselibs.conf
+
 
 # Use /usr/lib for cross clang libdir on armv7l architecture
 %{?armv7l:
@@ -567,9 +590,6 @@ ldconfig
 %postun
 ldconfig
 
-%post -n python-accel
-ldconfig
-
 %postun -n python-accel
 ldconfig
 
index 0767396..9fde2d6 100644 (file)
@@ -127,6 +127,15 @@ Group:          Development/Cross Compilation
 %description -n python-accel
 This package is used in qemu-accel to accelerate python.
 
+%post -n python-accel
+ldconfig
+
+# Check if there is possibility of gcc-unforce-options call and fix permissions
+rpm -qa --qf '%{NAME}\n' | grep force-options && \
+    chmod a+w /usr/bin && \
+    chmod a+w /emul/usr/bin/ && chmod a+w /emul/home/abuild/rpmbuild/BUILD/gcc-*/obj/gcc/ \
+        && find -L /emul/usr/*/gcc -name 'collect2' | xargs dirname | xargs chmod a+w
+
 %package -n clang-accel
 AutoReqProv: off
 Requires: qemu-accel
@@ -140,6 +149,15 @@ Requires: qemu-accel
 %description -n clang-accel
 This package is used in qemu-accel to accelerate clang compiler.
 
+%post -n clang-accel
+# Check if there is possibility of gcc-unforce-options call and fix permissions
+pkg=$(rpm -qa --qf '%{NAME}\n' | grep force-options)
+if [[ x"$pkg" != x"" ]]; then
+    chmod a+w /usr/bin
+    chmod a+w /emul/usr/bin/ && chmod a+w /emul/home/abuild/rpmbuild/BUILD/gcc-*/obj/gcc/ \
+        && find -L /emul/usr/*/gcc -name 'collect2' | xargs dirname | xargs chmod a+w
+fi
+
 %prep
 
 %build
@@ -511,8 +529,13 @@ cat %{_sourcedir}/baselibs_prologue %{_sourcedir}/baselibs_body > %{_sourcedir}/
 # By default this is ${gcc_install_dir}/liblto_plugin.so
 target_liblto_plugin="$(%{target_arch}-gcc -print-file-name=liblto_plugin.so)"
 # update baselibs.conf, overwrite LTO plugin
-sed -i -e "s,#PLUGIN_POSTIN#,if [ -d $(dirname ${target_liblto_plugin}) ]; then\"\n  post \"  ln -sf %{emul_path}${target_liblto_plugin} ${target_liblto_plugin}\"\n  post \"fi," %{_sourcedir}/baselibs.conf
-sed -i -e "s,#PLUGIN_POSTUN#,ln -sf liblto_plugin.so.0 ${target_liblto_plugin}," %{_sourcedir}/baselibs.conf
+sed -e "s,#PLUGIN_POSTIN#,if [ -d $(dirname ${target_liblto_plugin}) ]; then\"\n  post \"  ln -sf %{emul_path}${target_liblto_plugin} ${target_liblto_plugin}\"\n  post \"fi," -i %{_sourcedir}/baselibs.conf
+sed -e "s,#PLUGIN_POSTUN#,ln -sf liblto_plugin.so.0 ${target_liblto_plugin}," -i %{_sourcedir}/baselibs.conf
+
+# Add support of gcc-unforce-options for baselibs-generated packages
+sed -e "s,#PYTHON_POSTIN#,rpm -qa --qf '%%%%{NAME}' | grep force-options \&\& chmod a+w /usr/bin \&\& chmod a+w /emul/usr/bin/ \&\& chmod a+w /emul/home/abuild/rpmbuild/BUILD/gcc-*/obj/gcc/ \&\& find -L /emul/usr/*/gcc -name 'collect2' | xargs dirname | xargs chmod a+w," -i %{_sourcedir}/baselibs.conf
+sed -e "s,#CLANG_POSTIN#,rpm -qa --qf '%%%%{NAME}' | grep force-options \&\& chmod a+w /usr/bin \&\& chmod a+w /emul/usr/bin/ \&\& chmod a+w /emul/home/abuild/rpmbuild/BUILD/gcc-*/obj/gcc/ \&\& find -L /emul/usr/*/gcc -name 'collect2' | xargs dirname | xargs chmod a+w," -i %{_sourcedir}/baselibs.conf
+
 
 # Use /usr/lib for cross clang libdir on armv7l architecture
 %{?armv7l:
@@ -564,9 +587,6 @@ ldconfig
 %postun
 ldconfig
 
-%post -n python-accel
-ldconfig
-
 %postun -n python-accel
 ldconfig