diff mbox series

[kteam-tool] git-build-kernel: Build packages in user's homedir

Message ID 20180125131642.28918-1-juerg.haefliger@canonical.com
State New
Headers show
Series [kteam-tool] git-build-kernel: Build packages in user's homedir | expand

Commit Message

Juerg Haefliger Jan. 25, 2018, 1:16 p.m. UTC
Rather than polluting the global /tmp directory, build the packages in
the user's home directory ~/tmp.

Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
---
 git-build-kernel/git-build-kernel | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Colin Ian King Jan. 25, 2018, 1:29 p.m. UTC | #1
On 25/01/18 13:16, Juerg Haefliger wrote:
> Rather than polluting the global /tmp directory, build the packages in
> the user's home directory ~/tmp.
> 
> Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
> ---
>  git-build-kernel/git-build-kernel | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/git-build-kernel/git-build-kernel b/git-build-kernel/git-build-kernel
> index df95e12e3c6e..44cba7257b29 100755
> --- a/git-build-kernel/git-build-kernel
> +++ b/git-build-kernel/git-build-kernel
> @@ -106,9 +106,9 @@ VERSION=`echo "$chg" | sed -n -e '1s/^.*(\([^)]*\)).*$/\1/p'`
>  
>  ### Set up the /tmp work directory
>  
> -WORKDIR="kernel-$LOGNAME-$GITSHASHORT-XXXX"
> -WORKDIR="`mktemp -u -d -t $WORKDIR`"
> -mkdir "$WORKDIR" || exit
> +WORKDIR="kernel-$GITSHASHORT-XXXX"
> +WORKDIR="`mktemp -u -d -p /home/$LOGNAME/tmp -t $WORKDIR`"
> +mkdir -p "$WORKDIR" || exit
>  
>  BUILDDIR="$WORKDIR/build"
>  LOG="$WORKDIR/build.log"
> 

If /tmp is memory backed then this will be slower but it won't eat up
tmp and is less likely be forgotten which I'm all for.

Acked-by: Colin Ian King <colin.king@canonical.com>
Kamal Mostafa Jan. 25, 2018, 4:47 p.m. UTC | #2
In my opinion, this would be an undesirable change.  We specifically chose
to leave the build dirs in /tmp, so that they could be cleaned globally by
the sysadmin (via cron job, a reboot, or manually) -- its just that nobody
ever enabled a cron job.  I think we should instead just implement a
one-line cron job to wipe out /tmp/kernel-{foo} builds older than 1 week
(or use a standard "clean-temp" daemon).   Spreading the builds out to each
$HOME/tmp will, IMHO, actually make them *less* likely to get cleaned up by
anybody -- particularly since they won't get cleaned by reboot anymore.

 -Kamal




On Thu, Jan 25, 2018 at 5:16 AM, Juerg Haefliger <
juerg.haefliger@canonical.com> wrote:

> Rather than polluting the global /tmp directory, build the packages in
> the user's home directory ~/tmp.
>
> Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
> ---
>  git-build-kernel/git-build-kernel | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/git-build-kernel/git-build-kernel
> b/git-build-kernel/git-build-kernel
> index df95e12e3c6e..44cba7257b29 100755
> --- a/git-build-kernel/git-build-kernel
> +++ b/git-build-kernel/git-build-kernel
> @@ -106,9 +106,9 @@ VERSION=`echo "$chg" | sed -n -e
> '1s/^.*(\([^)]*\)).*$/\1/p'`
>
>  ### Set up the /tmp work directory
>
> -WORKDIR="kernel-$LOGNAME-$GITSHASHORT-XXXX"
> -WORKDIR="`mktemp -u -d -t $WORKDIR`"
> -mkdir "$WORKDIR" || exit
> +WORKDIR="kernel-$GITSHASHORT-XXXX"
> +WORKDIR="`mktemp -u -d -p /home/$LOGNAME/tmp -t $WORKDIR`"
> +mkdir -p "$WORKDIR" || exit
>
>  BUILDDIR="$WORKDIR/build"
>  LOG="$WORKDIR/build.log"
> --
> 2.14.1
>
>
> --
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
>
<div dir="ltr">In my opinion, this would be an undesirable change.  We specifically chose to leave the build dirs in /tmp, so that they could be cleaned globally by the sysadmin (via cron job, a reboot, or manually) -- its just that nobody ever enabled a cron job.  I think we should instead just implement a one-line cron job to wipe out /tmp/kernel-{foo} builds older than 1 week (or use a standard &quot;clean-temp&quot; daemon).   Spreading the builds out to each $HOME/tmp will, IMHO, actually make them *less* likely to get cleaned up by anybody -- particularly since they won&#39;t get cleaned by reboot anymore.<div><br></div><div> -Kamal</div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 25, 2018 at 5:16 AM, Juerg Haefliger <span dir="ltr">&lt;<a href="mailto:juerg.haefliger@canonical.com" target="_blank">juerg.haefliger@canonical.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Rather than polluting the global /tmp directory, build the packages in<br>
the user&#39;s home directory ~/tmp.<br>
<br>
Signed-off-by: Juerg Haefliger &lt;<a href="mailto:juerg.haefliger@canonical.com">juerg.haefliger@canonical.com</a><wbr>&gt;<br>
---<br>
 git-build-kernel/git-build-<wbr>kernel | 6 +++---<br>
 1 file changed, 3 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/git-build-kernel/git-build-<wbr>kernel b/git-build-kernel/git-build-<wbr>kernel<br>
index df95e12e3c6e..44cba7257b29 100755<br>
--- a/git-build-kernel/git-build-<wbr>kernel<br>
+++ b/git-build-kernel/git-build-<wbr>kernel<br>
@@ -106,9 +106,9 @@ VERSION=`echo &quot;$chg&quot; | sed -n -e &#39;1s/^.*(\([^)]*\)).*$/\1/p&#39;`<br>
<br>
 ### Set up the /tmp work directory<br>
<br>
-WORKDIR=&quot;kernel-$LOGNAME-$<wbr>GITSHASHORT-XXXX&quot;<br>
-WORKDIR=&quot;`mktemp -u -d -t $WORKDIR`&quot;<br>
-mkdir &quot;$WORKDIR&quot; || exit<br>
+WORKDIR=&quot;kernel-$GITSHASHORT-<wbr>XXXX&quot;<br>
+WORKDIR=&quot;`mktemp -u -d -p /home/$LOGNAME/tmp -t $WORKDIR`&quot;<br>
+mkdir -p &quot;$WORKDIR&quot; || exit<br>
<br>
 BUILDDIR=&quot;$WORKDIR/build&quot;<br>
 LOG=&quot;$WORKDIR/build.log&quot;<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.14.1<br>
<br>
<br>
--<br>
kernel-team mailing list<br>
<a href="mailto:kernel-team@lists.ubuntu.com">kernel-team@lists.ubuntu.com</a><br>
<a href="https://lists.ubuntu.com/mailman/listinfo/kernel-team" rel="noreferrer" target="_blank">https://lists.ubuntu.com/<wbr>mailman/listinfo/kernel-team</a><br>
</font></span></blockquote></div><br></div>
diff mbox series

Patch

diff --git a/git-build-kernel/git-build-kernel b/git-build-kernel/git-build-kernel
index df95e12e3c6e..44cba7257b29 100755
--- a/git-build-kernel/git-build-kernel
+++ b/git-build-kernel/git-build-kernel
@@ -106,9 +106,9 @@  VERSION=`echo "$chg" | sed -n -e '1s/^.*(\([^)]*\)).*$/\1/p'`
 
 ### Set up the /tmp work directory
 
-WORKDIR="kernel-$LOGNAME-$GITSHASHORT-XXXX"
-WORKDIR="`mktemp -u -d -t $WORKDIR`"
-mkdir "$WORKDIR" || exit
+WORKDIR="kernel-$GITSHASHORT-XXXX"
+WORKDIR="`mktemp -u -d -p /home/$LOGNAME/tmp -t $WORKDIR`"
+mkdir -p "$WORKDIR" || exit
 
 BUILDDIR="$WORKDIR/build"
 LOG="$WORKDIR/build.log"