rpmrebuild/fix-k-may-not-keep-uid-or-gid.patch
2023-02-01 11:58:18 +08:00

30 lines
1.2 KiB
Diff

From 7f15e07b7a94765459d51dfa315562187cc14161 Mon Sep 17 00:00:00 2001
From: xujing <xujing125@huawei.com>
Date: Fri, 30 Sep 2022 09:19:10 +0800
Subject: [PATCH] fix -k may not keep uid or gid
when rpmrebuild run with -k and --change-files, some files may not keep uid or
gid. when use --change-files, remrebuild will mkdir a tmp dir and copy files to
tmp dir, and when use -k, files will be installed by %attr(-,-,-), which will
inherit permissions of tmp dir. However, --change-files only set permission.
---
rpmrebuild_buildroot.sh | 2 ++
1 file changed, 2 insertions(+)
diff --git a/rpmrebuild_buildroot.sh b/rpmrebuild_buildroot.sh
index 4996e2e..00393eb 100755
--- a/rpmrebuild_buildroot.sh
+++ b/rpmrebuild_buildroot.sh
@@ -75,6 +75,8 @@ while :; do
file_perm="${file_perm#${not_perm}}"
Mkdir_p "$BuildRoot/$file" || Critical "$MY_BASENAME Mkdir_p $BuildRoot/$file"
chmod "$file_perm" "$BuildRoot/$file" || Critical "$MY_BASENAME chmod $file_perm $BuildRoot/$file"
+ chown "$file_user" "$BuildRoot/$file" || Critical "$MY_BASENAME chown $file_user $BuildRoot/$file"
+ chgrp "$file_group" "$BuildRoot/$file" || Critical "$MY_BASENAME chgrp $file_group $BuildRoot/$file"
;;
*)
--
2.33.0