Le jeudi 21 décembre 2023 à 08:49 +0100, Rafael Laboissière a écrit :
> * Santiago Vila <sanv...@debian.org> [2023-12-20 22:03]:
> 
> > El 20/12/23 a las 21:08, Rafael Laboissière escribió:
> > > > HOME := $(shell mktemp -d)
> > > > 
> > > > so that the same directory is never used twice between consecutive 
> > > > builds.
> > > 
> > > Yes, this is a much better solution. Thanks for the suggestion. I am 
> > > just wondering: is there a simple way to delete the temporary 
> > > directory after he build is finished ?
> > 
> > I don't know, but most people build packages in temporary/disposable 
> > chroots, 
> > so if the package just writes a few files which are also small, it's not 
> > something for which I would worry too much.
> 
> Yes, it not really a worrisome issue. However, I have just noticed that 
> the solution that you proposed with mktemp is a little bit intrusive. 
> Indeed, a new temporary directory is created at each invocation of 
> debain/rules, such that I end up with five /tmp/tmp.* directories after 
> package building, with only the last one being actually used. I will try 
> another approach, probably by changing the dh_octave_check script, which 
> is the one that eventually needs a writable $HOME directory.

Note that within the context of a shell script, the following ensures
that the directory is automatically deleted upon exit:

tmpdir=$(mktemp -d)
cleanup ()
{
    rm -rf "${tmpdir}"
}
trap cleanup EXIT

-- 
⢀⣴⠾⠻⢶⣦⠀  Sébastien Villemot
⣾⠁⢠⠒⠀⣿⡁  Debian Developer
⢿⡄⠘⠷⠚⠋⠀  https://sebastien.villemot.name
⠈⠳⣄⠀⠀⠀⠀  https://www.debian.org

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to