On 27/07/14 02:11, Dave Reisner wrote:
> This introduces support for architecutre-specific conflicts, depends,
> and optdepends by appending "_$CARCH" to the array name. For example,
> in the global section:
> 
>   arch=('i686' 'x86_64')
>   depends=('foo')
>   depends_x86_64=('bar')
> 
> This will generate depends of 'foo' and 'bar' on x86_64, but only 'foo'
> on i686. Moreover, this is supported in the package functions with the
> same heuristics as the generic names, e.g.
> 
>   ...
>   arch=('i686' 'x86_64')
>   depends=('foo')
>   ...
> 
>   package_somepkg() {
>     depends_x86_64=('bar')
> 
>     ...
>   }
> 
> Again, will cause x86_64 to have depends of 'foo' and 'bar', but only
> 'foo' for i686.
> ---
> So, what it *doesn't* yet support is arch-specific sources. This is strictly 
> an
> optimization and only applies to packaging of binary blobs so, personally, I'm
> okay with this lingering for another patch.
> 
> If we're okay with the syntax and the way this operates, I can follow up with
> the documentation side of things.
> 

I am OK with this change.  The only thing that concerns me is that
looking at a PKGBUILD does not make it clear these are additional
dependencies.   Could we do this in our prototypes...

depends=('foo')
depends_x86_64+=('bar')

It is effectively the same, but makes it look like the dependency is
being added?


Patch needs:
 - documentation
 - check_sanity integration

Sources/checksum etc support would be great too...


>  scripts/makepkg.sh.in | 20 +++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index e20b707..06c7374 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -1487,6 +1487,22 @@ source_safe() {
>       shopt -s extglob
>  }
>  
> +merge_arch_attrs() {
> +     local attr supported_attrs=(conflicts depends optdepends)
> +
> +     for attr in "${supported_attrs[@]}"; do
> +             eval "$attr+=(\"\${${attr}_$CARCH[@]}\")"
> +     done
> +
> +     # ensure that calling this function is idempotent.
> +     unset -v "${supported_attrs[@]/%/_$CARCH}"
> +}
> +
> +source_buildfile() {
> +     source_safe "$@"
> +     merge_arch_attrs
> +}
> +
>  run_function_safe() {
>       local restoretrap
>  
> @@ -1905,6 +1921,8 @@ write_pkginfo() {
>       local size="$(@DUPATH@ @DUFLAGS@)"
>       size="$(( ${size%%[^0-9]*} * 1024 ))"
>  
> +     merge_arch_attrs
> +
>       msg2 "$(gettext "Generating %s file...")" ".PKGINFO"
>       printf "# Generated by makepkg %s\n" "$makepkg_version"
>       printf "# using %s\n" "$(fakeroot -v)"
> @@ -2914,7 +2932,7 @@ else
>       if [[ ${BUILDFILE:0:1} != "/" ]]; then
>               BUILDFILE="$startdir/$BUILDFILE"
>       fi
> -     source_safe "$BUILDFILE"
> +     source_buildfile "$BUILDFILE"
>  fi
>  
>  # set defaults if they weren't specified in buildfile
> 

Reply via email to