summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/sstate.bbclass29
-rw-r--r--meta/lib/oeqa/selftest/cases/signing.py8
-rw-r--r--meta/lib/oeqa/selftest/cases/sstatetests.py24
-rwxr-xr-xscripts/sstate-cache-management.sh40
4 files changed, 55 insertions, 46 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index 701a19bc61..c125286f74 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -1,17 +1,19 @@
1SSTATE_VERSION = "7" 1SSTATE_VERSION = "7"
2 2
3SSTATE_ZSTD_CLEVEL ??= "8"
4
3SSTATE_MANIFESTS ?= "${TMPDIR}/sstate-control" 5SSTATE_MANIFESTS ?= "${TMPDIR}/sstate-control"
4SSTATE_MANFILEPREFIX = "${SSTATE_MANIFESTS}/manifest-${SSTATE_MANMACH}-${PN}" 6SSTATE_MANFILEPREFIX = "${SSTATE_MANIFESTS}/manifest-${SSTATE_MANMACH}-${PN}"
5 7
6def generate_sstatefn(spec, hash, taskname, siginfo, d): 8def generate_sstatefn(spec, hash, taskname, siginfo, d):
7 if taskname is None: 9 if taskname is None:
8 return "" 10 return ""
9 extension = ".tgz" 11 extension = ".tar.zst"
10 # 8 chars reserved for siginfo 12 # 8 chars reserved for siginfo
11 limit = 254 - 8 13 limit = 254 - 8
12 if siginfo: 14 if siginfo:
13 limit = 254 15 limit = 254
14 extension = ".tgz.siginfo" 16 extension = ".tar.zst.siginfo"
15 if not hash: 17 if not hash:
16 hash = "INVALID" 18 hash = "INVALID"
17 fn = spec + hash + "_" + taskname + extension 19 fn = spec + hash + "_" + taskname + extension
@@ -37,7 +39,7 @@ SSTATE_PKGNAME = "${SSTATE_EXTRAPATH}${@generate_sstatefn(d.getVar('SSTATE_PK
37SSTATE_PKG = "${SSTATE_DIR}/${SSTATE_PKGNAME}" 39SSTATE_PKG = "${SSTATE_DIR}/${SSTATE_PKGNAME}"
38SSTATE_EXTRAPATH = "" 40SSTATE_EXTRAPATH = ""
39SSTATE_EXTRAPATHWILDCARD = "" 41SSTATE_EXTRAPATHWILDCARD = ""
40SSTATE_PATHSPEC = "${SSTATE_DIR}/${SSTATE_EXTRAPATHWILDCARD}*/*/${SSTATE_PKGSPEC}*_${SSTATE_PATH_CURRTASK}.tgz*" 42SSTATE_PATHSPEC = "${SSTATE_DIR}/${SSTATE_EXTRAPATHWILDCARD}*/*/${SSTATE_PKGSPEC}*_${SSTATE_PATH_CURRTASK}.tar.zst*"
41 43
42# explicitly make PV to depend on evaluated value of PV variable 44# explicitly make PV to depend on evaluated value of PV variable
43PV[vardepvalue] = "${PV}" 45PV[vardepvalue] = "${PV}"
@@ -832,23 +834,24 @@ sstate_create_package () {
832 mkdir --mode=0775 -p `dirname ${SSTATE_PKG}` 834 mkdir --mode=0775 -p `dirname ${SSTATE_PKG}`
833 TFILE=`mktemp ${SSTATE_PKG}.XXXXXXXX` 835 TFILE=`mktemp ${SSTATE_PKG}.XXXXXXXX`
834 836
835 # Use pigz if available 837 OPT="-cS"
836 OPT="-czS" 838 ZSTD="zstd -${SSTATE_ZSTD_CLEVEL} -T${ZSTD_THREADS}"
837 if [ -x "$(command -v pigz)" ]; then 839 # Use pzstd if available
838 OPT="-I pigz -cS" 840 if [ -x "$(command -v pzstd)" ]; then
841 ZSTD="pzstd -${SSTATE_ZSTD_CLEVEL} -p ${ZSTD_THREADS}"
839 fi 842 fi
840 843
841 # Need to handle empty directories 844 # Need to handle empty directories
842 if [ "$(ls -A)" ]; then 845 if [ "$(ls -A)" ]; then
843 set +e 846 set +e
844 tar $OPT -f $TFILE * 847 tar -I "$ZSTD" $OPT -f $TFILE *
845 ret=$? 848 ret=$?
846 if [ $ret -ne 0 ] && [ $ret -ne 1 ]; then 849 if [ $ret -ne 0 ] && [ $ret -ne 1 ]; then
847 exit 1 850 exit 1
848 fi 851 fi
849 set -e 852 set -e
850 else 853 else
851 tar $OPT --file=$TFILE --files-from=/dev/null 854 tar -I "$ZSTD" $OPT --file=$TFILE --files-from=/dev/null
852 fi 855 fi
853 chmod 0664 $TFILE 856 chmod 0664 $TFILE
854 # Skip if it was already created by some other process 857 # Skip if it was already created by some other process
@@ -887,7 +890,13 @@ python sstate_report_unihash() {
887# Will be run from within SSTATE_INSTDIR. 890# Will be run from within SSTATE_INSTDIR.
888# 891#
889sstate_unpack_package () { 892sstate_unpack_package () {
890 tar -xvzf ${SSTATE_PKG} 893 ZSTD="zstd -T${ZSTD_THREADS}"
894 # Use pzstd if available
895 if [ -x "$(command -v pzstd)" ]; then
896 ZSTD="pzstd -p ${ZSTD_THREADS}"
897 fi
898
899 tar -I "$ZSTD" -xvf ${SSTATE_PKG}
891 # update .siginfo atime on local/NFS mirror 900 # update .siginfo atime on local/NFS mirror
892 [ -O ${SSTATE_PKG}.siginfo ] && [ -w ${SSTATE_PKG}.siginfo ] && [ -h ${SSTATE_PKG}.siginfo ] && touch -a ${SSTATE_PKG}.siginfo 901 [ -O ${SSTATE_PKG}.siginfo ] && [ -w ${SSTATE_PKG}.siginfo ] && [ -h ${SSTATE_PKG}.siginfo ] && touch -a ${SSTATE_PKG}.siginfo
893 # Use "! -w ||" to return true for read only files 902 # Use "! -w ||" to return true for read only files
diff --git a/meta/lib/oeqa/selftest/cases/signing.py b/meta/lib/oeqa/selftest/cases/signing.py
index af7a0b8b45..6f3d4aeae9 100644
--- a/meta/lib/oeqa/selftest/cases/signing.py
+++ b/meta/lib/oeqa/selftest/cases/signing.py
@@ -159,13 +159,13 @@ class Signing(OESelftestTestCase):
159 bitbake('-c clean %s' % test_recipe) 159 bitbake('-c clean %s' % test_recipe)
160 bitbake('-c populate_lic %s' % test_recipe) 160 bitbake('-c populate_lic %s' % test_recipe)
161 161
162 recipe_sig = glob.glob(sstatedir + '/*/*/*:ed:*_populate_lic.tgz.sig') 162 recipe_sig = glob.glob(sstatedir + '/*/*/*:ed:*_populate_lic.tar.zst.sig')
163 recipe_tgz = glob.glob(sstatedir + '/*/*/*:ed:*_populate_lic.tgz') 163 recipe_archive = glob.glob(sstatedir + '/*/*/*:ed:*_populate_lic.tar.zst')
164 164
165 self.assertEqual(len(recipe_sig), 1, 'Failed to find .sig file.') 165 self.assertEqual(len(recipe_sig), 1, 'Failed to find .sig file.')
166 self.assertEqual(len(recipe_tgz), 1, 'Failed to find .tgz file.') 166 self.assertEqual(len(recipe_archive), 1, 'Failed to find .tar.zst file.')
167 167
168 ret = runCmd('gpg --homedir %s --verify %s %s' % (self.gpg_dir, recipe_sig[0], recipe_tgz[0])) 168 ret = runCmd('gpg --homedir %s --verify %s %s' % (self.gpg_dir, recipe_sig[0], recipe_archive[0]))
169 # gpg: Signature made Thu 22 Oct 2015 01:45:09 PM EEST using RSA key ID 61EEFB30 169 # gpg: Signature made Thu 22 Oct 2015 01:45:09 PM EEST using RSA key ID 61EEFB30
170 # gpg: Good signature from "testuser (nocomment) <testuser@email.com>" 170 # gpg: Good signature from "testuser (nocomment) <testuser@email.com>"
171 self.assertIn('gpg: Good signature from', ret.output, 'Package signed incorrectly.') 171 self.assertIn('gpg: Good signature from', ret.output, 'Package signed incorrectly.')
diff --git a/meta/lib/oeqa/selftest/cases/sstatetests.py b/meta/lib/oeqa/selftest/cases/sstatetests.py
index 874f439282..3dab607eeb 100644
--- a/meta/lib/oeqa/selftest/cases/sstatetests.py
+++ b/meta/lib/oeqa/selftest/cases/sstatetests.py
@@ -68,7 +68,7 @@ class SStateTests(SStateBase):
68 results = self.search_sstate('|'.join(map(str, targets)), distro_specific, distro_nonspecific) 68 results = self.search_sstate('|'.join(map(str, targets)), distro_specific, distro_nonspecific)
69 if distro_nonspecific: 69 if distro_nonspecific:
70 for r in results: 70 for r in results:
71 if r.endswith(("_populate_lic.tgz", "_populate_lic.tgz.siginfo", "_fetch.tgz.siginfo", "_unpack.tgz.siginfo", "_patch.tgz.siginfo")): 71 if r.endswith(("_populate_lic.tar.zst", "_populate_lic.tar.zst.siginfo", "_fetch.tar.zst.siginfo", "_unpack.tar.zst.siginfo", "_patch.tar.zst.siginfo")):
72 continue 72 continue
73 file_tracker.append(r) 73 file_tracker.append(r)
74 else: 74 else:
@@ -98,15 +98,15 @@ class SStateTests(SStateBase):
98 bitbake(['-ccleansstate'] + targets) 98 bitbake(['-ccleansstate'] + targets)
99 99
100 bitbake(targets) 100 bitbake(targets)
101 tgz_created = self.search_sstate('|'.join(map(str, [s + r'.*?\.tgz$' for s in targets])), distro_specific, distro_nonspecific) 101 archives_created = self.search_sstate('|'.join(map(str, [s + r'.*?\.tar.zst$' for s in targets])), distro_specific, distro_nonspecific)
102 self.assertTrue(tgz_created, msg="Could not find sstate .tgz files for: %s (%s)" % (', '.join(map(str, targets)), str(tgz_created))) 102 self.assertTrue(archives_created, msg="Could not find sstate .tar.zst files for: %s (%s)" % (', '.join(map(str, targets)), str(archives_created)))
103 103
104 siginfo_created = self.search_sstate('|'.join(map(str, [s + r'.*?\.siginfo$' for s in targets])), distro_specific, distro_nonspecific) 104 siginfo_created = self.search_sstate('|'.join(map(str, [s + r'.*?\.siginfo$' for s in targets])), distro_specific, distro_nonspecific)
105 self.assertTrue(siginfo_created, msg="Could not find sstate .siginfo files for: %s (%s)" % (', '.join(map(str, targets)), str(siginfo_created))) 105 self.assertTrue(siginfo_created, msg="Could not find sstate .siginfo files for: %s (%s)" % (', '.join(map(str, targets)), str(siginfo_created)))
106 106
107 bitbake(['-ccleansstate'] + targets) 107 bitbake(['-ccleansstate'] + targets)
108 tgz_removed = self.search_sstate('|'.join(map(str, [s + r'.*?\.tgz$' for s in targets])), distro_specific, distro_nonspecific) 108 archives_removed = self.search_sstate('|'.join(map(str, [s + r'.*?\.tar.zst$' for s in targets])), distro_specific, distro_nonspecific)
109 self.assertTrue(not tgz_removed, msg="do_cleansstate didn't remove .tgz sstate files for: %s (%s)" % (', '.join(map(str, targets)), str(tgz_removed))) 109 self.assertTrue(not archives_removed, msg="do_cleansstate didn't remove .tar.zst sstate files for: %s (%s)" % (', '.join(map(str, targets)), str(archives_removed)))
110 110
111 def test_cleansstate_task_distro_specific_nonspecific(self): 111 def test_cleansstate_task_distro_specific_nonspecific(self):
112 targets = ['binutils-cross-'+ self.tune_arch, 'binutils-native'] 112 targets = ['binutils-cross-'+ self.tune_arch, 'binutils-native']
@@ -129,14 +129,14 @@ class SStateTests(SStateBase):
129 bitbake(['-ccleansstate'] + targets) 129 bitbake(['-ccleansstate'] + targets)
130 130
131 bitbake(targets) 131 bitbake(targets)
132 results = self.search_sstate('|'.join(map(str, [s + r'.*?\.tgz$' for s in targets])), distro_specific=False, distro_nonspecific=True) 132 results = self.search_sstate('|'.join(map(str, [s + r'.*?\.tar.zst$' for s in targets])), distro_specific=False, distro_nonspecific=True)
133 filtered_results = [] 133 filtered_results = []
134 for r in results: 134 for r in results:
135 if r.endswith(("_populate_lic.tgz", "_populate_lic.tgz.siginfo")): 135 if r.endswith(("_populate_lic.tar.zst", "_populate_lic.tar.zst.siginfo")):
136 continue 136 continue
137 filtered_results.append(r) 137 filtered_results.append(r)
138 self.assertTrue(filtered_results == [], msg="Found distro non-specific sstate for: %s (%s)" % (', '.join(map(str, targets)), str(filtered_results))) 138 self.assertTrue(filtered_results == [], msg="Found distro non-specific sstate for: %s (%s)" % (', '.join(map(str, targets)), str(filtered_results)))
139 file_tracker_1 = self.search_sstate('|'.join(map(str, [s + r'.*?\.tgz$' for s in targets])), distro_specific=True, distro_nonspecific=False) 139 file_tracker_1 = self.search_sstate('|'.join(map(str, [s + r'.*?\.tar.zst$' for s in targets])), distro_specific=True, distro_nonspecific=False)
140 self.assertTrue(len(file_tracker_1) >= len(targets), msg = "Not all sstate files were created for: %s" % ', '.join(map(str, targets))) 140 self.assertTrue(len(file_tracker_1) >= len(targets), msg = "Not all sstate files were created for: %s" % ', '.join(map(str, targets)))
141 141
142 self.track_for_cleanup(self.distro_specific_sstate + "_old") 142 self.track_for_cleanup(self.distro_specific_sstate + "_old")
@@ -145,7 +145,7 @@ class SStateTests(SStateBase):
145 145
146 bitbake(['-cclean'] + targets) 146 bitbake(['-cclean'] + targets)
147 bitbake(targets) 147 bitbake(targets)
148 file_tracker_2 = self.search_sstate('|'.join(map(str, [s + r'.*?\.tgz$' for s in targets])), distro_specific=True, distro_nonspecific=False) 148 file_tracker_2 = self.search_sstate('|'.join(map(str, [s + r'.*?\.tar.zst$' for s in targets])), distro_specific=True, distro_nonspecific=False)
149 self.assertTrue(len(file_tracker_2) >= len(targets), msg = "Not all sstate files were created for: %s" % ', '.join(map(str, targets))) 149 self.assertTrue(len(file_tracker_2) >= len(targets), msg = "Not all sstate files were created for: %s" % ', '.join(map(str, targets)))
150 150
151 not_recreated = [x for x in file_tracker_1 if x not in file_tracker_2] 151 not_recreated = [x for x in file_tracker_1 if x not in file_tracker_2]
@@ -188,18 +188,18 @@ class SStateTests(SStateBase):
188 if not sstate_arch in sstate_archs_list: 188 if not sstate_arch in sstate_archs_list:
189 sstate_archs_list.append(sstate_arch) 189 sstate_archs_list.append(sstate_arch)
190 if target_config[idx] == target_config[-1]: 190 if target_config[idx] == target_config[-1]:
191 target_sstate_before_build = self.search_sstate(target + r'.*?\.tgz$') 191 target_sstate_before_build = self.search_sstate(target + r'.*?\.tar.zst$')
192 bitbake("-cclean %s" % target) 192 bitbake("-cclean %s" % target)
193 result = bitbake(target, ignore_status=True) 193 result = bitbake(target, ignore_status=True)
194 if target_config[idx] == target_config[-1]: 194 if target_config[idx] == target_config[-1]:
195 target_sstate_after_build = self.search_sstate(target + r'.*?\.tgz$') 195 target_sstate_after_build = self.search_sstate(target + r'.*?\.tar.zst$')
196 expected_remaining_sstate += [x for x in target_sstate_after_build if x not in target_sstate_before_build if not any(pattern in x for pattern in ignore_patterns)] 196 expected_remaining_sstate += [x for x in target_sstate_after_build if x not in target_sstate_before_build if not any(pattern in x for pattern in ignore_patterns)]
197 self.remove_config(global_config[idx]) 197 self.remove_config(global_config[idx])
198 self.remove_recipeinc(target, target_config[idx]) 198 self.remove_recipeinc(target, target_config[idx])
199 self.assertEqual(result.status, 0, msg = "build of %s failed with %s" % (target, result.output)) 199 self.assertEqual(result.status, 0, msg = "build of %s failed with %s" % (target, result.output))
200 200
201 runCmd("sstate-cache-management.sh -y --cache-dir=%s --remove-duplicated --extra-archs=%s" % (self.sstate_path, ','.join(map(str, sstate_archs_list)))) 201 runCmd("sstate-cache-management.sh -y --cache-dir=%s --remove-duplicated --extra-archs=%s" % (self.sstate_path, ','.join(map(str, sstate_archs_list))))
202 actual_remaining_sstate = [x for x in self.search_sstate(target + r'.*?\.tgz$') if not any(pattern in x for pattern in ignore_patterns)] 202 actual_remaining_sstate = [x for x in self.search_sstate(target + r'.*?\.tar.zst$') if not any(pattern in x for pattern in ignore_patterns)]
203 203
204 actual_not_expected = [x for x in actual_remaining_sstate if x not in expected_remaining_sstate] 204 actual_not_expected = [x for x in actual_remaining_sstate if x not in expected_remaining_sstate]
205 self.assertFalse(actual_not_expected, msg="Files should have been removed but were not: %s" % ', '.join(map(str, actual_not_expected))) 205 self.assertFalse(actual_not_expected, msg="Files should have been removed but were not: %s" % ', '.join(map(str, actual_not_expected)))
diff --git a/scripts/sstate-cache-management.sh b/scripts/sstate-cache-management.sh
index f1706a2229..d39671f7c6 100755
--- a/scripts/sstate-cache-management.sh
+++ b/scripts/sstate-cache-management.sh
@@ -114,7 +114,7 @@ echo_error () {
114# * Add .done/.siginfo to the remove list 114# * Add .done/.siginfo to the remove list
115# * Add destination of symlink to the remove list 115# * Add destination of symlink to the remove list
116# 116#
117# $1: output file, others: sstate cache file (.tgz) 117# $1: output file, others: sstate cache file (.tar.zst)
118gen_rmlist (){ 118gen_rmlist (){
119 local rmlist_file="$1" 119 local rmlist_file="$1"
120 shift 120 shift
@@ -131,13 +131,13 @@ gen_rmlist (){
131 dest="`readlink -e $i`" 131 dest="`readlink -e $i`"
132 if [ -n "$dest" ]; then 132 if [ -n "$dest" ]; then
133 echo $dest >> $rmlist_file 133 echo $dest >> $rmlist_file
134 # Remove the .siginfo when .tgz is removed 134 # Remove the .siginfo when .tar.zst is removed
135 if [ -f "$dest.siginfo" ]; then 135 if [ -f "$dest.siginfo" ]; then
136 echo $dest.siginfo >> $rmlist_file 136 echo $dest.siginfo >> $rmlist_file
137 fi 137 fi
138 fi 138 fi
139 fi 139 fi
140 # Add the ".tgz.done" and ".siginfo.done" (may exist in the future) 140 # Add the ".tar.zst.done" and ".siginfo.done" (may exist in the future)
141 base_fn="${i##/*/}" 141 base_fn="${i##/*/}"
142 t_fn="$base_fn.done" 142 t_fn="$base_fn.done"
143 s_fn="$base_fn.siginfo.done" 143 s_fn="$base_fn.siginfo.done"
@@ -188,10 +188,10 @@ remove_duplicated () {
188 total_files=`find $cache_dir -name 'sstate*' | wc -l` 188 total_files=`find $cache_dir -name 'sstate*' | wc -l`
189 # Save all the sstate files in a file 189 # Save all the sstate files in a file
190 sstate_files_list=`mktemp` || exit 1 190 sstate_files_list=`mktemp` || exit 1
191 find $cache_dir -name 'sstate:*:*:*:*:*:*:*.tgz*' >$sstate_files_list 191 find $cache_dir -iname 'sstate:*:*:*:*:*:*:*.tar.zst*' >$sstate_files_list
192 192
193 echo "Figuring out the suffixes in the sstate cache dir ... " 193 echo "Figuring out the suffixes in the sstate cache dir ... "
194 sstate_suffixes="`sed 's%.*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^_]*_\([^:]*\)\.tgz.*%\1%g' $sstate_files_list | sort -u`" 194 sstate_suffixes="`sed 's%.*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^_]*_\([^:]*\)\.tar\.zst.*%\1%g' $sstate_files_list | sort -u`"
195 echo "Done" 195 echo "Done"
196 echo "The following suffixes have been found in the cache dir:" 196 echo "The following suffixes have been found in the cache dir:"
197 echo $sstate_suffixes 197 echo $sstate_suffixes
@@ -200,10 +200,10 @@ remove_duplicated () {
200 # Using this SSTATE_PKGSPEC definition it's 6th colon separated field 200 # Using this SSTATE_PKGSPEC definition it's 6th colon separated field
201 # SSTATE_PKGSPEC = "sstate:${PN}:${PACKAGE_ARCH}${TARGET_VENDOR}-${TARGET_OS}:${PV}:${PR}:${SSTATE_PKGARCH}:${SSTATE_VERSION}:" 201 # SSTATE_PKGSPEC = "sstate:${PN}:${PACKAGE_ARCH}${TARGET_VENDOR}-${TARGET_OS}:${PV}:${PR}:${SSTATE_PKGARCH}:${SSTATE_VERSION}:"
202 for arch in $all_archs; do 202 for arch in $all_archs; do
203 grep -q ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:$arch:[^:]*:[^:]*\.tgz$" $sstate_files_list 203 grep -q ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:$arch:[^:]*:[^:]*\.tar\.zst$" $sstate_files_list
204 [ $? -eq 0 ] && ava_archs="$ava_archs $arch" 204 [ $? -eq 0 ] && ava_archs="$ava_archs $arch"
205 # ${builder_arch}_$arch used by toolchain sstate 205 # ${builder_arch}_$arch used by toolchain sstate
206 grep -q ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:${builder_arch}_$arch:[^:]*:[^:]*\.tgz$" $sstate_files_list 206 grep -q ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:${builder_arch}_$arch:[^:]*:[^:]*\.tar\.zst$" $sstate_files_list
207 [ $? -eq 0 ] && ava_archs="$ava_archs ${builder_arch}_$arch" 207 [ $? -eq 0 ] && ava_archs="$ava_archs ${builder_arch}_$arch"
208 done 208 done
209 echo "Done" 209 echo "Done"
@@ -219,13 +219,13 @@ remove_duplicated () {
219 continue 219 continue
220 fi 220 fi
221 # Total number of files including .siginfo and .done files 221 # Total number of files including .siginfo and .done files
222 total_files_suffix=`grep ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:_]*_$suffix\.tgz.*" $sstate_files_list | wc -l 2>/dev/null` 222 total_files_suffix=`grep ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:_]*_$suffix\.tar\.zst.*" $sstate_files_list | wc -l 2>/dev/null`
223 total_tgz_suffix=`grep ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:_]*_$suffix\.tgz$" $sstate_files_list | wc -l 2>/dev/null` 223 total_archive_suffix=`grep ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:_]*_$suffix\.tar\.zst$" $sstate_files_list | wc -l 2>/dev/null`
224 # Save the file list to a file, some suffix's file may not exist 224 # Save the file list to a file, some suffix's file may not exist
225 grep ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:_]*_$suffix\.tgz.*" $sstate_files_list >$list_suffix 2>/dev/null 225 grep ".*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:_]*_$suffix\.tar\.zst.*" $sstate_files_list >$list_suffix 2>/dev/null
226 local deleted_tgz=0 226 local deleted_archives=0
227 local deleted_files=0 227 local deleted_files=0
228 for ext in tgz tgz.siginfo tgz.done; do 228 for ext in tar.zst tar.zst.siginfo tar.zst.done; do
229 echo "Figuring out the sstate:xxx_$suffix.$ext ... " 229 echo "Figuring out the sstate:xxx_$suffix.$ext ... "
230 # Uniq BPNs 230 # Uniq BPNs
231 file_names=`for arch in $ava_archs ""; do 231 file_names=`for arch in $ava_archs ""; do
@@ -268,19 +268,19 @@ remove_duplicated () {
268 done 268 done
269 done 269 done
270 done 270 done
271 deleted_tgz=`cat $rm_list.* 2>/dev/null | grep ".tgz$" | wc -l` 271 deleted_archives=`cat $rm_list.* 2>/dev/null | grep "\.tar\.zst$" | wc -l`
272 deleted_files=`cat $rm_list.* 2>/dev/null | wc -l` 272 deleted_files=`cat $rm_list.* 2>/dev/null | wc -l`
273 [ "$deleted_files" -gt 0 -a $debug -gt 0 ] && cat $rm_list.* 273 [ "$deleted_files" -gt 0 -a $debug -gt 0 ] && cat $rm_list.*
274 echo "($deleted_tgz out of $total_tgz_suffix .tgz files for $suffix suffix will be removed or $deleted_files out of $total_files_suffix when counting also .siginfo and .done files)" 274 echo "($deleted_archives out of $total_archives_suffix .tar.zst files for $suffix suffix will be removed or $deleted_files out of $total_files_suffix when counting also .siginfo and .done files)"
275 let total_deleted=$total_deleted+$deleted_files 275 let total_deleted=$total_deleted+$deleted_files
276 done 276 done
277 deleted_tgz=0 277 deleted_archives=0
278 rm_old_list=$remove_listdir/sstate-old-filenames 278 rm_old_list=$remove_listdir/sstate-old-filenames
279 find $cache_dir -name 'sstate-*.tgz' >$rm_old_list 279 find $cache_dir -name 'sstate-*.tar.zst' >$rm_old_list
280 [ -s "$rm_old_list" ] && deleted_tgz=`cat $rm_old_list | grep ".tgz$" | wc -l` 280 [ -s "$rm_old_list" ] && deleted_archives=`cat $rm_old_list | grep "\.tar\.zst$" | wc -l`
281 [ -s "$rm_old_list" ] && deleted_files=`cat $rm_old_list | wc -l` 281 [ -s "$rm_old_list" ] && deleted_files=`cat $rm_old_list | wc -l`
282 [ -s "$rm_old_list" -a $debug -gt 0 ] && cat $rm_old_list 282 [ -s "$rm_old_list" -a $debug -gt 0 ] && cat $rm_old_list
283 echo "($deleted_tgz .tgz files with old sstate-* filenames will be removed or $deleted_files when counting also .siginfo and .done files)" 283 echo "($deleted_archives or .tar.zst files with old sstate-* filenames will be removed or $deleted_files when counting also .siginfo and .done files)"
284 let total_deleted=$total_deleted+$deleted_files 284 let total_deleted=$total_deleted+$deleted_files
285 285
286 rm -f $list_suffix 286 rm -f $list_suffix
@@ -289,7 +289,7 @@ remove_duplicated () {
289 read_confirm 289 read_confirm
290 if [ "$confirm" = "y" -o "$confirm" = "Y" ]; then 290 if [ "$confirm" = "y" -o "$confirm" = "Y" ]; then
291 for list in `ls $remove_listdir/`; do 291 for list in `ls $remove_listdir/`; do
292 echo "Removing $list.tgz (`cat $remove_listdir/$list | wc -w` files) ... " 292 echo "Removing $list.tar.zst archive (`cat $remove_listdir/$list | wc -w` files) ... "
293 # Remove them one by one to avoid the argument list too long error 293 # Remove them one by one to avoid the argument list too long error
294 for i in `cat $remove_listdir/$list`; do 294 for i in `cat $remove_listdir/$list`; do
295 rm -f $verbose $i 295 rm -f $verbose $i
@@ -322,7 +322,7 @@ rm_by_stamps (){
322 find $cache_dir -type f -name 'sstate*' | sort -u -o $cache_list 322 find $cache_dir -type f -name 'sstate*' | sort -u -o $cache_list
323 323
324 echo "Figuring out the suffixes in the sstate cache dir ... " 324 echo "Figuring out the suffixes in the sstate cache dir ... "
325 local sstate_suffixes="`sed 's%.*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^_]*_\([^:]*\)\.tgz.*%\1%g' $cache_list | sort -u`" 325 local sstate_suffixes="`sed 's%.*/sstate:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^_]*_\([^:]*\)\.tar\.zst.*%\1%g' $cache_list | sort -u`"
326 echo "Done" 326 echo "Done"
327 echo "The following suffixes have been found in the cache dir:" 327 echo "The following suffixes have been found in the cache dir:"
328 echo $sstate_suffixes 328 echo $sstate_suffixes