crew: fix cached build extraction (#7986)

* crew: fix cached build extraction

* Also backup sha256 file from cached build when replacing.
This commit is contained in:
Satadru Pramanik, DO, MPH, MEng
2023-02-24 15:04:32 -05:00
committed by GitHub
parent ff45a964e7
commit b615e4ddc4
2 changed files with 3 additions and 2 deletions

View File

@@ -518,6 +518,7 @@ def cache_build
# because some builds will use that information.
# Backup build cachefile it if exists.
FileUtils.mv @build_cachefile, "#{@build_cachefile}.bak", force: true if File.file?(@build_cachefile)
FileUtils.mv "#{@build_cachefile}.sha256", "#{@build_cachefile}.sha256.bak", force: true if File.file?("#{@build_cachefile}.sha256")
Dir.chdir(CREW_BREW_DIR) do
system "tar c#{@verbose} #{@pkg_build_dirname} \
| nice -n 20 #{CREW_PREFIX}/bin/zstd -c --ultra --fast -f -o #{@build_cachefile} -"
@@ -886,7 +887,7 @@ def unpack(meta)
system "tar -Izstd -x#{@verbose}f #{@build_cachefile} -C #{CREW_BREW_DIR}", exception: true
# Need to reset @extract_dir to the extracted cached build
# directory.
@extract_dir = `tar --exclude='./*/*' -tf #{@build_cachefile} | cut -d '/' -f 1 | sort -u`.chomp
@extract_dir = `tar -Izstd --exclude='./*/*' -tf #{@build_cachefile} | cut -d '/' -f 1 | sort -u`.chomp
else
@pkg.cached_build = false
case File.basename meta[:filename]

View File

@@ -1,6 +1,6 @@
# Defines common constants used in different parts of crew
CREW_VERSION = '1.31.4'
CREW_VERSION = '1.31.5'
# kernel architecture
KERN_ARCH = `uname -m`.chomp