<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Aug 9, 2013 at 1:29 AM, Dave Reisner <span dir="ltr"><<a href="mailto:d@falconindy.com" target="_blank">d@falconindy.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><p dir="ltr"><br>
On Aug 8, 2013 5:32 PM, "Dominik Heidler" <<a href="mailto:dheidler@gmail.com" target="_blank">dheidler@gmail.com</a>> wrote:<br>
><br>
> Users can set a ccache directory (which must be writeable by<br>
> the user nobody) to be mapped to /build/.ccache (which is the<br>
> directory, that ccache will use in the chroot)<br>
><br>
> Signed-off-by: Dominik Heidler <<a href="mailto:dheidler@gmail.com" target="_blank">dheidler@gmail.com</a>><br>
> ---<br>
>  <a href="http://makechrootpkg.in" target="_blank">makechrootpkg.in</a> | 11 ++++++++++-<br>
>  1 file changed, 10 insertions(+), 1 deletion(-)<br>
><br>
> diff --git a/<a href="http://makechrootpkg.in" target="_blank">makechrootpkg.in</a> b/<a href="http://makechrootpkg.in" target="_blank">makechrootpkg.in</a><br>
> index 1cd08fb..8770378 100644<br>
> --- a/<a href="http://makechrootpkg.in" target="_blank">makechrootpkg.in</a><br>
> +++ b/<a href="http://makechrootpkg.in" target="_blank">makechrootpkg.in</a><br>
> @@ -21,6 +21,7 @@ run_namcap=false<br>
>  temp_chroot=false<br>
>  chrootdir=<br>
>  passeddir=<br>
> +ccachedir=<br>
>  declare -a install_pkgs<br>
>  declare -i ret=0<br>
><br>
> @@ -58,10 +59,11 @@ usage() {<br>
>         echo "           Default: $copy"<br>
>         echo '-n         Run namcap on the package'<br>
>         echo '-T         Build in a temporary directory'<br>
> +       echo '-C <dir>   The ccache directory to use'<br>
>         exit 1<br>
>  }<br>
><br>
> -while getopts 'hcur:I:l:nT' arg; do<br>
> +while getopts 'hcur:I:l:C:nT' arg; do<br>
>         case "$arg" in<br>
>                 h) usage ;;<br>
>                 c) clean_first=true ;;<br>
> @@ -71,6 +73,7 @@ while getopts 'hcur:I:l:nT' arg; do<br>
>                 l) copy="$OPTARG" ;;<br>
>                 n) run_namcap=true; makepkg_args="$makepkg_args -i" ;;<br>
>                 T) temp_chroot=true; copy+="-$$" ;;<br>
> +               C) ccachedir="$OPTARG" ;;<br>
>                 *) makepkg_args="$makepkg_args -$arg $OPTARG" ;;<br>
>         esac<br>
>  done<br>
> @@ -84,6 +87,11 @@ chrootdir=$(readlink -e "$passeddir")<br>
>  [[ ! -d $chrootdir ]] && die "No chroot dir defined, or invalid path '%s'" "$passeddir"<br>
>  [[ ! -d $chrootdir/root ]] && die "Missing chroot dir root directory. Try using: mkarchroot %s/root base-devel" "$chrootdir"<br>
><br>
> +# Canonicalize ccachedir, getting rid of trailing /</p>
</div></div><p dir="ltr">This comment is bogus.</p><div class="im">
<p dir="ltr">> +if [[ "$ccachedir" != "" ]]; then<br>
> +       [[ ! -d $ccachedir ]] && die "Invalid path '%s' given for ccache directory" "$ccachedir"</p>
</div><p dir="ltr">Just fold these checks together into the same [[ and please use the -n test for the non-empty string. No need to quote in the test, either.</p></blockquote><div>I'll send a new patch. <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">
<p dir="ltr">> +fi<br>
> +<br>
>  # Detect chrootdir filesystem type<br>
>  chroottype=$(stat -f -c %T "$chrootdir")<br>
><br>
> @@ -349,6 +357,7 @@ download_sources<br>
>  if arch-nspawn "$copydir" \<br>
>         --bind-ro="$PWD:/startdir_host" \<br>
>         --bind-ro="$SRCDEST:/srcdest_host" \<br>
> +       ${ccachedir:+"--bind=$ccachedir:/build/.ccache"} \<br>
>         /chrootbuild<br>
>  then<br>
>         move_products<br>
> --<br>
> 1.8.3.4<br>
><br>
</p>
</div></div></blockquote></div><br></div></div>