Introduce new PKGBUILD variable changelog

Currently, a changelog is added to a package if a specific file with a
hardcoded name exists in the PKGBUILD's directory. This approach is not
pretty and also inconsistent with the handling of install files, but it
works.

With the introduction of split PKGBUILDs, however, a drawback in this
old behavior has arisen: you only have the possibility to include one
specific changelog file in either every package defined in the PKGBUILD
or in none.

The use of an additional variable, `changelog`, works around this issue
and makes it possible to include a changelog in only some of the
packages, and besides, each package of the PKGBUILD can have its own
changelog file.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Cedric Staniewski 2009-10-08 16:10:05 +02:00 committed by Dan McGee
parent e3ac806262
commit 2cabe336eb
5 changed files with 36 additions and 9 deletions

View file

@ -21,6 +21,7 @@ replaces=()
backup=() backup=()
options=() options=()
install= install=
changelog=
source=($pkgbase-$pkgver.tar.gz) source=($pkgbase-$pkgver.tar.gz)
noextract=() noextract=()
md5sums=() #generate with 'makepkg -g' md5sums=() #generate with 'makepkg -g'
@ -44,6 +45,7 @@ package_pkg1() {
backup=() backup=()
options=() options=()
install= install=
changelog=
cd "$srcdir/$pkgbase-$pkgver" cd "$srcdir/$pkgbase-$pkgver"
make DESTDIR="$pkgdir/" install-pkg1 make DESTDIR="$pkgdir/" install-pkg1

View file

@ -21,6 +21,7 @@ replaces=()
backup=() backup=()
options=() options=()
install= install=
changelog=
source=($pkgname-$pkgver.tar.gz) source=($pkgname-$pkgver.tar.gz)
noextract=() noextract=()
md5sums=() #generate with 'makepkg -g' md5sums=() #generate with 'makepkg -g'

View file

@ -115,6 +115,12 @@ syn match pbValidInstall /\([[:alnum:]]\|\$\|+\|-\|_\)*\.install/ contained
syn match pbIllegalInstall /[^=]/ contained contains=pbValidInstall syn match pbIllegalInstall /[^=]/ contained contains=pbValidInstall
syn match pbInstallGroup /^install=.*/ contains=pb_k_install,pbValidInstall,pbIllegalInstall,shDeref,shDoubleQuote,shSingleQuote syn match pbInstallGroup /^install=.*/ contains=pb_k_install,pbValidInstall,pbIllegalInstall,shDeref,shDoubleQuote,shSingleQuote
" changelog
syn keyword pb_k_changelog changelog contained
syn match pbValidChangelog /\([[:alnum:]]\|\$\|+\|-\|_\)*/ contained
syn match pbIllegalChangelog /[^=]/ contained contains=pbValidChangelog
syn match pbChangelogGroup /^changelog=.*/ contains=pb_k_changelog,pbValidChangelog,pbIllegalChangelog,shDeref,shDoubleQuote,shSingleQuote
" source: " source:
" XXX remove source from shStatement, fix strange bug " XXX remove source from shStatement, fix strange bug
syn clear shStatement syn clear shStatement
@ -212,6 +218,9 @@ hi def link pb_k_provides pbKeywords
hi def link pbIllegalInstall Error hi def link pbIllegalInstall Error
hi def link pb_k_install pbKeywords hi def link pb_k_install pbKeywords
hi def link pbIllegalChangelog Error
hi def link pb_k_changelog pbKeywords
hi def link pb_k_source pbKeywords hi def link pb_k_source pbKeywords
hi def link pbIllegalSource Error hi def link pbIllegalSource Error

View file

@ -79,6 +79,12 @@ similar to `$_basekernver`.
be copied into the package by makepkg. It does not need to be included be copied into the package by makepkg. It does not need to be included
in the source array (e.g. `install=pkgname.install`). in the source array (e.g. `install=pkgname.install`).
*changelog*::
Specifies a changelog file that is to be included in the package.
This file should reside in the same directory as the PKGBUILD, and will
be copied into the package by makepkg. It does not need to be included
in the source array (e.g. `changelog=$pkgname.changelog`).
*source (array)*:: *source (array)*::
An array of source files required to build the package. Source files An array of source files required to build the package. Source files
must either reside in the same directory as the PKGBUILD file, or be a must either reside in the same directory as the PKGBUILD file, or be a
@ -271,7 +277,7 @@ All options and directives for the split packages default to the global values g
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: `pkgdesc`, package's packaging function. The following variables can be overridden: `pkgdesc`,
`license`, `groups`, `depends`, `optdepends`, `provides`, `conflicts`, `replaces`, `license`, `groups`, `depends`, `optdepends`, `provides`, `conflicts`, `replaces`,
`backup`, `options` and `install`. `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:

View file

@ -47,7 +47,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=('pkgdesc' 'license' 'groups' 'depends' 'optdepends' 'provides' \ splitpkg_overrides=('pkgdesc' 'license' 'groups' 'depends' 'optdepends' 'provides' \
'conflicts' 'replaces' 'backup' 'options' 'install') 'conflicts' 'replaces' 'backup' 'options' 'install' 'changelog')
readonly -a packaging_options other_options splitpkg_overrides readonly -a packaging_options other_options splitpkg_overrides
# Options # Options
@ -991,9 +991,9 @@ create_package() {
fi fi
# do we have a changelog? # do we have a changelog?
if [ -f "$startdir/ChangeLog" ]; then if [ -n "$changelog" ]; then
msg2 "$(gettext "Adding package changelog...")" msg2 "$(gettext "Adding package changelog...")"
cp "$startdir/ChangeLog" .CHANGELOG cp "$startdir/$changelog" .CHANGELOG
comp_files="$comp_files .CHANGELOG" comp_files="$comp_files .CHANGELOG"
fi fi
@ -1055,13 +1055,17 @@ create_srcpackage() {
msg2 "$(gettext "Adding install script...")" msg2 "$(gettext "Adding install script...")"
ln -s "${startdir}/$install" "${srclinks}/${pkgbase}/" ln -s "${startdir}/$install" "${srclinks}/${pkgbase}/"
else else
error "$(gettext "Install script %s not found.")" "$install" error "$(gettext "Install scriptlet (%s) does not exist.")" "$install"
fi fi
fi fi
if [ -f ChangeLog ]; then if [ -n "$changelog" ]; then
msg2 "$(gettext "Adding %s...")" "ChangeLog" if [ -f "$changelog" ]; then
ln -s "${startdir}/ChangeLog" "${srclinks}/${pkgbase}" msg2 "$(gettext "Adding package changelog...")"
ln -s "${startdir}/$changelog" "${srclinks}/${pkgbase}/"
else
error "$(gettext "Changelog file (%s) does not exist.")" "$changelog"
fi
fi fi
local netfile local netfile
@ -1193,6 +1197,11 @@ check_sanity() {
return 1 return 1
fi fi
if [ -n "$changelog" -a ! -f "$changelog" ]; then
error "$(gettext "Changelog file (%s) does not exist.")" "$changelog"
return 1
fi
local valid_options=1 local valid_options=1
local opt known kopt local opt known kopt
for opt in ${options[@]}; do for opt in ${options[@]}; do
@ -1646,7 +1655,7 @@ if [ "$ASROOT" -eq 0 \
fi fi
unset pkgname pkgbase pkgver pkgrel pkgdesc url license groups provides unset pkgname pkgbase pkgver pkgrel pkgdesc url license groups provides
unset md5sums replaces depends conflicts backup source install build unset md5sums replaces depends conflicts backup source install changelog build
unset makedepends optdepends options noextract unset makedepends optdepends options noextract
BUILDFILE=${BUILDFILE:-$BUILDSCRIPT} BUILDFILE=${BUILDFILE:-$BUILDSCRIPT}