mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-23 00:08:50 -05:00
makepkg: allow overriding arch in split packages
This allows building a mixture of binary and arch=any packages. Fixes FS#15955. The value of CARCH is no longer overridden to "any" in when arch=any is used and the assigning of the "any" arch is delayed to during the packaging stage. Adjustments were required to fix installing and checking for pre-built packages of varing arches. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
2020e6297b
commit
c7e4d10df3
@ -37,6 +37,7 @@ package_pkg1() {
|
|||||||
pkgver=
|
pkgver=
|
||||||
pkgrel=
|
pkgrel=
|
||||||
pkgdesc=""
|
pkgdesc=""
|
||||||
|
arch=()
|
||||||
license=()
|
license=()
|
||||||
groups=()
|
groups=()
|
||||||
depends=()
|
depends=()
|
||||||
|
@ -276,7 +276,7 @@ name of the split package.
|
|||||||
All options and directives for the split packages default to the global values given
|
All options and directives for the split packages default to the global values given
|
||||||
within the PKGBUILD. However, some of these can be overridden within each split
|
within the PKGBUILD. However, some of these can be overridden within each split
|
||||||
package's packaging function. The following variables can be overridden: `pkgver`,
|
package's packaging function. The following variables can be overridden: `pkgver`,
|
||||||
`pkgrel`, `pkgdesc`, `license`, `groups`, `depends`, `optdepends`,
|
`pkgrel`, `pkgdesc`, `arch`, `license`, `groups`, `depends`, `optdepends`,
|
||||||
`provides`, `conflicts`, `replaces`, `backup`, `options`, `install` and `changelog`.
|
`provides`, `conflicts`, `replaces`, `backup`, `options`, `install` and `changelog`.
|
||||||
|
|
||||||
An optional global directive is available when building a split package:
|
An optional global directive is available when building a split package:
|
||||||
|
@ -46,7 +46,7 @@ pkgdir="$startdir/pkg"
|
|||||||
|
|
||||||
packaging_options=('strip' 'docs' 'libtool' 'emptydirs' 'zipman' 'purge')
|
packaging_options=('strip' 'docs' 'libtool' 'emptydirs' 'zipman' 'purge')
|
||||||
other_options=('ccache' 'distcc' 'makeflags' 'force')
|
other_options=('ccache' 'distcc' 'makeflags' 'force')
|
||||||
splitpkg_overrides=('pkgver' 'pkgrel' 'pkgdesc' 'license' 'groups' \
|
splitpkg_overrides=('pkgver' 'pkgrel' 'pkgdesc' 'arch' 'license' 'groups' \
|
||||||
'depends' 'optdepends' 'provides' 'conflicts' 'replaces' \
|
'depends' 'optdepends' 'provides' 'conflicts' 'replaces' \
|
||||||
'backup' 'options' 'install' 'changelog')
|
'backup' 'options' 'install' 'changelog')
|
||||||
readonly -a packaging_options other_options splitpkg_overrides
|
readonly -a packaging_options other_options splitpkg_overrides
|
||||||
@ -902,9 +902,7 @@ write_pkginfo() {
|
|||||||
echo "builddate = $builddate" >>.PKGINFO
|
echo "builddate = $builddate" >>.PKGINFO
|
||||||
echo "packager = $packager" >>.PKGINFO
|
echo "packager = $packager" >>.PKGINFO
|
||||||
echo "size = $size" >>.PKGINFO
|
echo "size = $size" >>.PKGINFO
|
||||||
if [ -n "$CARCH" ]; then
|
echo "arch = $PKGARCH" >>.PKGINFO
|
||||||
echo "arch = $CARCH" >>.PKGINFO
|
|
||||||
fi
|
|
||||||
if [ "$(check_option force)" = "y" ]; then
|
if [ "$(check_option force)" = "y" ]; then
|
||||||
echo "force = true" >> .PKGINFO
|
echo "force = true" >> .PKGINFO
|
||||||
fi
|
fi
|
||||||
@ -983,6 +981,12 @@ create_package() {
|
|||||||
nameofpkg="$1"
|
nameofpkg="$1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$arch" = "any" ]; then
|
||||||
|
PKGARCH="any"
|
||||||
|
else
|
||||||
|
PKGARCH=$CARCH
|
||||||
|
fi
|
||||||
|
|
||||||
write_pkginfo $nameofpkg
|
write_pkginfo $nameofpkg
|
||||||
|
|
||||||
local comp_files=".PKGINFO"
|
local comp_files=".PKGINFO"
|
||||||
@ -1011,7 +1015,7 @@ create_package() {
|
|||||||
*) warning "$(gettext "'%s' is not a valid archive extension.")" \
|
*) warning "$(gettext "'%s' is not a valid archive extension.")" \
|
||||||
"$PKGEXT" ; EXT=$PKGEXT ;;
|
"$PKGEXT" ; EXT=$PKGEXT ;;
|
||||||
esac
|
esac
|
||||||
local pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${CARCH}${EXT}"
|
local pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${EXT}"
|
||||||
|
|
||||||
local ret=0
|
local ret=0
|
||||||
|
|
||||||
@ -1117,7 +1121,11 @@ install_package() {
|
|||||||
|
|
||||||
local pkglist
|
local pkglist
|
||||||
for pkg in ${pkgname[@]}; do
|
for pkg in ${pkgname[@]}; do
|
||||||
pkglist="${pkglist} $PKGDEST/${pkg}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}"
|
if [ -f $PKGDEST/${pkg}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT} ]; then
|
||||||
|
pkglist="${pkglist} $PKGDEST/${pkg}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}"
|
||||||
|
else
|
||||||
|
pkglist="${pkglist} $PKGDEST/${pkg}-${pkgver}-${pkgrel}-any${PKGEXT}"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
local ret=0
|
local ret=0
|
||||||
@ -1160,15 +1168,14 @@ check_sanity() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$arch" = 'any' ]; then
|
if [ "$arch" != 'any' ]; then
|
||||||
CARCH='any'
|
if ! in_array $CARCH ${arch[@]}; then
|
||||||
fi
|
if [ "$IGNOREARCH" -eq 0 ]; then
|
||||||
if ! in_array $CARCH ${arch[@]}; then
|
error "$(gettext "%s is not available for the '%s' architecture.")" "$pkgbase" "$CARCH"
|
||||||
if [ "$IGNOREARCH" -eq 0 ]; then
|
plain "$(gettext "Note that many packages may need a line added to their %s")" "$BUILDSCRIPT"
|
||||||
error "$(gettext "%s is not available for the '%s' architecture.")" "$pkgbase" "$CARCH"
|
plain "$(gettext "such as arch=('%s').")" "$CARCH"
|
||||||
plain "$(gettext "Note that many packages may need a line added to their %s")" "$BUILDSCRIPT"
|
return 1
|
||||||
plain "$(gettext "such as arch=('%s').")" "$CARCH"
|
fi
|
||||||
return 1
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -1714,8 +1721,9 @@ fi
|
|||||||
pkgbase=${pkgbase:-${pkgname[0]}}
|
pkgbase=${pkgbase:-${pkgname[0]}}
|
||||||
|
|
||||||
if [ "$SPLITPKG" -eq 0 ]; then
|
if [ "$SPLITPKG" -eq 0 ]; then
|
||||||
if [ -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" \
|
if [ \( -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" \
|
||||||
-a "$FORCE" -eq 0 -a "$SOURCEONLY" -eq 0 -a "$NOBUILD" -eq 0 ]; then
|
-f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-any${PKGEXT}" \) \
|
||||||
|
-a "$FORCE" -eq 0 -a "$SOURCEONLY" -eq 0 -a "$NOBUILD" -eq 0 ]; then
|
||||||
if [ "$INSTALL" -eq 1 ]; then
|
if [ "$INSTALL" -eq 1 ]; then
|
||||||
warning "$(gettext "A package has already been built, installing existing package...")"
|
warning "$(gettext "A package has already been built, installing existing package...")"
|
||||||
install_package
|
install_package
|
||||||
@ -1729,7 +1737,8 @@ else
|
|||||||
allpkgbuilt=1
|
allpkgbuilt=1
|
||||||
somepkgbuilt=0
|
somepkgbuilt=0
|
||||||
for pkg in ${pkgname[@]}; do
|
for pkg in ${pkgname[@]}; do
|
||||||
if [ -f "$PKGDEST/${pkg}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" ]; then
|
if [ \( -f "$PKGDEST/${pkg}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" \
|
||||||
|
-f "$PKGDEST/${pkg}-${pkgver}-${pkgrel}-any${PKGEXT}" \) ]; then
|
||||||
somepkgbuilt=1
|
somepkgbuilt=1
|
||||||
else
|
else
|
||||||
allpkgbuilt=0
|
allpkgbuilt=0
|
||||||
@ -1784,7 +1793,7 @@ if [ "$INFAKEROOT" -eq 1 ]; then
|
|||||||
exit 0 # $E_OK
|
exit 0 # $E_OK
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg "$(gettext "Making package: %s")" "$pkgbase $pkgver-$pkgrel $CARCH ($(date))"
|
msg "$(gettext "Making package: %s")" "$pkgbase $pkgver-$pkgrel ($(date))"
|
||||||
|
|
||||||
# if we are creating a source-only package, go no further
|
# if we are creating a source-only package, go no further
|
||||||
if [ "$SOURCEONLY" -ne 0 ]; then
|
if [ "$SOURCEONLY" -ne 0 ]; then
|
||||||
@ -1908,7 +1917,7 @@ else
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg "$(gettext "Finished making: %s")" "$pkgbase $pkgver-$pkgrel $CARCH ($(date))"
|
msg "$(gettext "Finished making: %s")" "$pkgbase $pkgver-$pkgrel ($(date))"
|
||||||
|
|
||||||
install_package
|
install_package
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user