Re: [dunfell] hidden files/folders in WORKDIR
On 2021-12-15 2:22 p.m., Joel Winarske wrote:
I'm finding that if I create files/folders (prefixed with '.') in WORKDIR, they don't get cleaned up with INHERIT += "rm_work".I think it's an oversight that doesn't affect many people.
The rm_work code for WORKDIR is:
for dir in *
# Retain only logs and other files in temp, safely ignore
# failures of removing pseudo folers on NFS2/3 server.
if [ $dir = 'pseudo' ]; then
rm -rf -- $dir 2> /dev/null || true
elif ! echo "$excludes" | grep -q -w "$dir"; then
rm -rf -- $dir
so you can see that if you want to submit a patch to remove .FOO files,
you'd have to change the glob and exclude . and ..
The comment seems to justify doing that.
I guess one question is how common is it for 'dot' files to be there
and have people come to rely on the fact that rm_work doesn't remove them.
See some analysis below if you're interested but I think it's sensible
to also remove 'dot' files. Wait a day or so to see if anyone has a
use case that would be a problem and if not, could you send a patch?
"This directory is located within the TMPDIR directory structure and is specific to the recipe being built and the system for which it is being built. "
so that seems to give you carte blanche!
and there's no restriction given in the rm_work docs either:
In a build that I have on hand:
# how many files could be cleaned up?
$ ls -d tmp-glibc/work/core2-64-wrs-linux/*/*/[a-Z]* | wc -l
# how many of them are 'dot' files?
$ ls -d tmp-glibc/work/core2-64-wrs-linux/*/*/.[a-Z]* | wc -l
# What's the file:
$ ls -d tmp-glibc/work/core2-64-wrs-linux/*/*/.[a-Z]*
# .pc files are usually stored in a subdirectory like:
# how many 'proper' .pc files are there just out of curiousity?
$ ls -d tmp-glibc/work/core2-64-wrs-linux/*/*/*/.pc | wc -l
# Let's look at usleep:
$ ls tmp-glibc/work/core2-64-wrs-linux/usleep/1.0-r0
configure.sstate deploy-rpms image packages-split pkgdata-pdata-input recipe-sysroot sstate-install-deploy_source_date_epoch usleep usleep.spec
COPYING deploy-source-date-epoch license-destdir patches pkgdata-sysroot recipe-sysroot-native sstate-install-populate_lic usleep.1
debugsources.list GPLv2.patch package pkgdata pseudo source-date-epoch temp usleep.c
Ah it has the source in WORKDIR, that seem odd but it's a simple recipe with the source
provided in the recipe:
# Let's clean it:
$ bitbake -c rm_work usleep
$ ls -a tmp-glibc/work/core2-64-wrs-linux/usleep/1.0-r0
. .. .pc temp
$ bitbake -c patch usleep
$ echo $?
so that works and it seems there's no harm done.
# Randy MacLeod
# Wind River Linux