On Fri, Aug 09, 2013 at 09:38:27AM +0200, Dominik Heidler wrote:Looks fine, but I still have trouble grok'ing the usefulness of this. If
> Users can set a ccache directory (which must be writeable by
> the user nobody) to be mapped to /build/.ccache (which is the
> directory, that ccache will use in the chroot)
>
> Signed-off-by: Dominik Heidler <dheidler@gmail.com>
> ---
you "import" the ccache directory, there's no telling what's in it --
there might be object files compiled using CFLAGS incompatible with the
final output (resulting in a package that won't necessarily work as you
expect). For example, my local builds (not using devtools) add
-march=native and (sometimes) -flto. Building with devtools, there's no
way these should be added.
Is ccache smart enough to recompile the .o files in this case?
> makechrootpkg.in | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/makechrootpkg.in b/makechrootpkg.in
> index 1cd08fb..7cf0031 100644
> --- a/makechrootpkg.in
> +++ b/makechrootpkg.in
> @@ -21,6 +21,7 @@ run_namcap=false
> temp_chroot=false
> chrootdir=
> passeddir=
> +ccachedir=
> declare -a install_pkgs
> declare -i ret=0
>
> @@ -58,10 +59,11 @@ usage() {
> echo " Default: $copy"
> echo '-n Run namcap on the package'
> echo '-T Build in a temporary directory'
> + echo '-C <dir> The ccache directory to use'
> exit 1
> }
>
> -while getopts 'hcur:I:l:nT' arg; do
> +while getopts 'hcur:I:l:C:nT' arg; do
> case "$arg" in
> h) usage ;;
> c) clean_first=true ;;
> @@ -71,6 +73,7 @@ while getopts 'hcur:I:l:nT' arg; do
> l) copy="$OPTARG" ;;
> n) run_namcap=true; makepkg_args="$makepkg_args -i" ;;
> T) temp_chroot=true; copy+="-$$" ;;
> + C) ccachedir="$OPTARG" ;;
> *) makepkg_args="$makepkg_args -$arg $OPTARG" ;;
> esac
> done
> @@ -84,6 +87,8 @@ chrootdir=$(readlink -e "$passeddir")
> [[ ! -d $chrootdir ]] && die "No chroot dir defined, or invalid path '%s'" "$passeddir"
> [[ ! -d $chrootdir/root ]] && die "Missing chroot dir root directory. Try using: mkarchroot %s/root base-devel" "$chrootdir"
>
> +[[ -n $ccachedir && ! -d $ccachedir ]] && die "Invalid path '%s' given for ccache directory" "$ccachedir"
> +
> # Detect chrootdir filesystem type
> chroottype=$(stat -f -c %T "$chrootdir")
>
> @@ -349,6 +354,7 @@ download_sources
> if arch-nspawn "$copydir" \
> --bind-ro="$PWD:/startdir_host" \
> --bind-ro="$SRCDEST:/srcdest_host" \
> + ${ccachedir:+"--bind=$ccachedir:/build/.ccache"} \
> /chrootbuild
> then
> move_products
> --
> 1.8.3.4
>