mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-09-04 20:44:06 +00:00
Revert "lb_binary_layered: fix mtimes in layered squashfses"
This reverts commit eec13dad681c66f3a318600827f52dde55291f9f.
This commit is contained in:
parent
934a269424
commit
75ad30fe5d
1
debian/install
vendored
1
debian/install
vendored
@ -4,4 +4,3 @@ get-ppa-fingerprint usr/share/livecd-rootfs
|
||||
minimize-manual usr/share/livecd-rootfs
|
||||
checkout-translations-branch usr/share/livecd-rootfs
|
||||
update-source-catalog usr/share/livecd-rootfs
|
||||
sync-mtime usr/share/livecd-rootfs
|
||||
|
@ -169,12 +169,6 @@ build_layered_squashfs () {
|
||||
# --del because we want to remove files that have been
|
||||
# deleted in this layer.
|
||||
rsync -aXHAS --checksum --no-times --del chroot/ chroot-2/
|
||||
# but since we used --no-times, mtime was not actually
|
||||
# replicated to chroot-2, instead using the mtime of
|
||||
# the moment of rsync. This will break anything that
|
||||
# requires an accurate mtime, so go fix that up.
|
||||
# LP: #2107332
|
||||
/usr/share/livecd-rootfs/sync-mtime chroot chroot-2
|
||||
umount chroot-2
|
||||
rmdir chroot-2
|
||||
overlay_dir="$overlay_dir-2"
|
||||
|
38
sync-mtime
38
sync-mtime
@ -1,38 +0,0 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
# usage: sync-mtime src dst
|
||||
#
|
||||
# synchronize atime/mtime on files between src and dst.
|
||||
#
|
||||
# src and dst are directories, where dst is expected to contain a subset of the
|
||||
# files found in src. for each file present in dst or a subdirectory thereof,
|
||||
# if atime/mtime differ between the same file in src and that file in dst,
|
||||
# update atime/mtime on the file in dst.
|
||||
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def time_eq(a: os.stat_result, b: os.stat_result) -> bool:
|
||||
return (
|
||||
(a.st_mtime_ns == b.st_mtime_ns) and
|
||||
(a.st_atime_ns == b.st_atime_ns)
|
||||
)
|
||||
|
||||
|
||||
src, dst = sys.argv[1:]
|
||||
for dirpath, dirnames, filenames in Path(dst).walk():
|
||||
for filename in filenames:
|
||||
dst_file = dirpath / filename
|
||||
if not dst_file.is_file():
|
||||
continue
|
||||
src_file = src / dst_file.relative_to(dst)
|
||||
|
||||
src_stat = src_file.stat(follow_symlinks=False)
|
||||
dst_stat = dst_file.stat(follow_symlinks=False)
|
||||
if time_eq(src_stat, dst_stat):
|
||||
continue
|
||||
|
||||
ns = (src_stat.st_atime_ns, src_stat.st_mtime_ns)
|
||||
os.utime(dst_file, ns=ns, follow_symlinks=False)
|
Loading…
x
Reference in New Issue
Block a user