mirror of
git://git.yoctoproject.org/yocto-autobuilder-helper.git
synced 2025-07-19 20:59:02 +02:00
scripts/sstate-clean: run by cron on the autobuilder
Publish what cleans up the public SSTATE to help with debugging. Signed-off-by: Michael Halstead <mhalstead@linuxfoundation.org>
This commit is contained in:
parent
e1289afb9e
commit
1c3a588fc9
13
scripts/sstate-clean.py
Normal file
13
scripts/sstate-clean.py
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
import os
|
||||||
|
f = open('/mnt/tank/yocto/sstate-matime.log', 'r')
|
||||||
|
for line in f.readlines():
|
||||||
|
ssdir, ssfile = os.path.split(line[61:-1])
|
||||||
|
if os.path.isfile(os.path.join('/mnt/tank/yocto/autobuilder/autobuilder.yoctoproject.org/pub', ssdir, ssfile)):
|
||||||
|
if not os.path.isdir(os.path.join('/mnt/tank/yocto/sstate-to-remove-30', ssdir)):
|
||||||
|
#print("Creating ", os.path.join('/mnt/tank/yocto/sstate-to-remove-30', ssdir))
|
||||||
|
os.makedirs(os.path.join('/mnt/tank/yocto/sstate-to-remove-30', ssdir))
|
||||||
|
os.rename(
|
||||||
|
os.path.join('/mnt/tank/yocto/autobuilder/autobuilder.yoctoproject.org/pub', ssdir, ssfile),
|
||||||
|
os.path.join('/mnt/tank/yocto/sstate-to-remove-30', ssdir, ssfile)
|
||||||
|
)
|
||||||
|
|
24
scripts/sstate-clean.sh
Normal file
24
scripts/sstate-clean.sh
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
#!/bin/bash
|
||||||
|
{
|
||||||
|
if [ -f /mnt/tank/yocto/sstate-clean.lock ]; then
|
||||||
|
echo "Already running a clean up. Exiting."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
touch /mnt/tank/yocto/sstate-clean.lock
|
||||||
|
|
||||||
|
# Track how much we delete and long it takes to do it on any given day
|
||||||
|
/usr/bin/time -ao /mnt/tank/yocto/sstate-matime.log du -chs /mnt/tank/yocto/sstate-to-remove/sstate >> /mnt/tank/yocto/sstate-matime.log
|
||||||
|
/usr/bin/time -ao /mnt/tank/yocto/sstate-matime.log rm -R /mnt/tank/yocto/sstate-to-remove/sstate
|
||||||
|
|
||||||
|
mv /mnt/tank/yocto/sstate-matime.log /mnt/tank/yocto/$(date +%Y%m%d)-sstate-matime.log
|
||||||
|
|
||||||
|
cd /mnt/tank/yocto
|
||||||
|
/usr/bin/find /mnt/tank/yocto/autobuilder/autobuilder.yoctoproject.org/pub/sstate \( -mtime +15 -a -atime +15 \) -type f \( -name '*.tar*' -o -name '*.tgz*' \) -print > /mnt/tank/yocto/sstate-matime.log
|
||||||
|
|
||||||
|
# Call out to a python program to move file while preserving the directory structure
|
||||||
|
/usr/local/bin/python3 sstate-clean.py
|
||||||
|
|
||||||
|
# Exit and wait until next run for deletion
|
||||||
|
rm /mnt/tank/yocto/sstate-clean.lock
|
Loading…
Reference in New Issue
Block a user