Accepting request 909203 from home:lnussel:usrmove

- implement mkdir_p for ghost files as components may not exist
- move usrmerge conversion to %pre instead of %pretrans (boo#1188847)
- get rid of usrmerged macro usage, usrmerge is on in Factory always

OBS-URL: https://build.opensuse.org/request/show/909203
OBS-URL: https://build.opensuse.org/package/show/Base:System/filesystem?expand=0&rev=210
This commit is contained in:
Dominique Leuenberger 2021-07-30 07:45:30 +00:00 committed by Git OBS Bridge
parent c1bab9bb4d
commit 2897da1e48
2 changed files with 34 additions and 28 deletions

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Jul 29 11:52:33 UTC 2021 - Ludwig Nussel <lnussel@suse.de>
- implement mkdir_p for ghost files as components may not exist
- move usrmerge conversion to %pre instead of %pretrans (boo#1188847)
- get rid of usrmerged macro usage, usrmerge is on in Factory always
-------------------------------------------------------------------
Wed Jun 9 15:46:59 UTC 2021 - Ludwig Nussel <lnussel@suse.de>

View File

@ -30,10 +30,8 @@ Version: 84.87
Release: 0
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?usrmerged}
# XXX libsolv never sees the rpmlib provides fulfilled
Requires(pre): (compat-usrmerge-tools or rpmlib(X-CheckUnifiedSystemdir))
%endif
Requires: group(root)
Requires: user(root)
URL: https://build.opensuse.org/package/show/openSUSE:Factory/filesystem
@ -83,7 +81,31 @@ if posix.stat("/var/lock.rpmsave.tmpx") then
os.execute("mv /var/lock.rpmsave.tmpx/* /var/lock")
os.remove("/var/lock.rpmsave.tmpx")
end
%if 0%{?usrmerged}
local ghosts = {
EOF
#
while read MOD OWN GRP NAME ; do
[ "$OWN" = root -a "$GRP" = root ]
echo "[\"$NAME\"] = $MOD,"
done < ghost.list >> pretrans.lua
cat >> pretrans.lua <<'EOF'
}
function mkdir_p(path)
d = ''
for p in string.gmatch(path, "([^/]+)") do
d = d.."/"..p
posix.mkdir(d)
end
end
for i in pairs(ghosts) do
mkdir_p(i)
posix.chmod(i, ghosts[i])
end
EOF
#
#
cat > pre.lua <<'EOF'
needmigrate = false
local dirs = {"/bin",
"/sbin",
@ -102,19 +124,6 @@ end
if needmigrate then
assert(os.execute("/usr/libexec/convertfs"))
end
%endif
local ghosts = {
EOF
while read MOD OWN GRP NAME ; do
[ "$OWN" = root -a "$GRP" = root ]
echo "[\"$NAME\"] = $MOD,"
done < ghost.list >> pretrans.lua
cat >> pretrans.lua <<'EOF'
}
for i in pairs(ghosts) do
posix.mkdir(i)
posix.chmod(i, ghosts[i])
end
EOF
%install
@ -151,7 +160,6 @@ echo "%%defattr(-,root,root)" > filesystem.list
%ifarch s390x %sparc x86_64 ppc64 ppc aarch64 ppc64le riscv64
cat %{SOURCE64} >> directory.list
%endif
%if 0%{?usrmerged}
cat >> filesystem.links << EOF
usr/bin /bin
usr/sbin /sbin
@ -160,18 +168,8 @@ usr/lib /lib
usr/lib64 /lib64
%endif
EOF
%else
cat >> directory.list << EOF
0555 root root /bin
0555 root root /lib
0555 root root /sbin
%ifarch s390x %sparc x86_64 ppc64 ppc aarch64 ppc64le riscv64
0555 root root /lib64
%endif
EOF
%endif
cat >> directory.list <<EOF
0755 root root %{?usrmerged:/usr}/lib/modules
0755 root root /usr/lib/modules
0755 root root %{_firmwaredir}
EOF
while read MOD OWN GRP NAME ; do
@ -306,6 +304,7 @@ install -m 0644 fs-var.conf $RPM_BUILD_ROOT/usr/lib/tmpfiles.d/fs-var.conf
install -m 0644 fs-var-tmp.conf $RPM_BUILD_ROOT/usr/lib/tmpfiles.d/fs-var-tmp.conf
%pretrans -p <lua> -f pretrans.lua
%pre -p <lua> -f pre.lua
%files -f filesystem.list
/usr/lib/tmpfiles.d/fs-tmp.conf