set the directory mode to '-' instead of omit

This commit is contained in:
dongyuzhen 2023-02-10 10:52:39 +08:00
parent 409e118cee
commit f2b0fb78b6
4 changed files with 32 additions and 58 deletions

View File

@ -1,28 +0,0 @@
From 10ef16bc38f4b3480a60fff829df09cb6b02761b Mon Sep 17 00:00:00 2001
From: licunlong1 <licunlong1@huawei.com>
Date: Wed, 9 Mar 2022 16:40:49 +0800
Subject: [PATCH] reset %defattr when users want to keep files permission, uid
and gid
---
rpmrebuild_files.sh | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/rpmrebuild_files.sh b/rpmrebuild_files.sh
index 6d0db46..fd1c75a 100755
--- a/rpmrebuild_files.sh
+++ b/rpmrebuild_files.sh
@@ -69,6 +69,10 @@ if [ "$RPMREBUILD_CAP_FROM_FS" = "yes" ]; then
fi
fi
+if [ "$RPMREBUILD_PUG_FROM_FS" = "yes" ]; then
+ echo "%defattr(-,-,-,-)"
+fi
+
while :; do
read file_type
[ -z "$file_type" ] && break
--
2.33.0

View File

@ -1,29 +0,0 @@
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

View File

@ -1,11 +1,12 @@
Name: rpmrebuild
Version: 2.18
Release: 1
Release: 2
Summary: A tool to build a rpm file from the rpm database
License: GPLv2+
URL: http://rpmrebuild.sourceforge.net
Source0: https://downloads.sourceforge.net/rpmrebuild/%{name}-%{version}.tar.gz
Patch9000: set-the-directory-mode-to-instead-of-omit.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
@ -57,6 +58,9 @@ rm -rf $RPM_BUILD_ROOT%{_mandir}/fr_FR.UTF-8/man1/
%{_mandir}/fr/man1/*.gz
%changelog
* Fri Feb 10 2023 dongyuzhen <dongyuzhen@h-partners.com> - 2.18-2
- set the directory mode to '-' instead of omit
* Mon Feb 6 2023 dillon chen <dillon.chen@gmail.com> - 2.18-1
- upgrade version to 2.18

View File

@ -0,0 +1,27 @@
From 8ae69fc903e45cf692fa57cf48d8b31f222c0a2c Mon Sep 17 00:00:00 2001
From: xujing <xujing125@huawei.com>
Date: Wed, 8 Feb 2023 10:54:46 +0800
Subject: [PATCH] Set the directory mode to '-' instead of omit
The directory mode is not explicitly set. It should be explicitly
set to '-' ensure the accuracy of the "-k" option.
---
rpmrebuild_files.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rpmrebuild_files.sh b/rpmrebuild_files.sh
index cf2d6be..30955c0 100755
--- a/rpmrebuild_files.sh
+++ b/rpmrebuild_files.sh
@@ -70,7 +70,7 @@ if [ "$RPMREBUILD_CAP_FROM_FS" = "yes" ]; then
fi
if [ "$RPMREBUILD_PUG_FROM_FS" = "yes" ]; then
- echo "%defattr(-,-,-)"
+ echo "%defattr(-,-,-,-)"
fi
while :; do
--
2.33.0