From ee72c016ab316aaca3781d2c45bf0de77fefcf3c Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Fri, 1 Nov 2013 21:34:34 +1000 Subject: Always supply base name and version info in .PKGFILE if needed Provide pkgbase information for non-split packages with pkgbase set. Also record the version of the "base" package. This is useful for matching package files to source packages. Signed-off-by: Allan McRae --- scripts/makepkg.sh.in | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'scripts') diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index d9a14e29..78941d4f 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1829,9 +1829,18 @@ write_pkginfo() { printf "# Generated by makepkg %s\n" "$makepkg_version" printf "# using %s\n" "$(fakeroot -v)" printf "# %s\n" "$(LC_ALL=C date -u)" + printf "pkgname = %s\n" "$pkgname" - (( SPLITPKG )) && printf "pkgbase = %s\n" "$pkgbase" - printf "pkgver = %s\n" "$(get_full_version)" + if (( SPLITPKG )) || [[ "$pkgbase" != "$pkgname" ]]; then + printf "pkgbase = %s\n" "$pkgbase" + fi + + local fullver=$(get_full_version) + printf "pkgver = %s\n" "$fullver" + if [[ "$fullver" != "$basever" ]]; then + printf "basever = %s\n" "$basever" + fi + printf "pkgdesc = %s\n" "${pkgdesc//+([[:space:]])/ }" printf "url = %s\n" "$url" printf "builddate = %s\n" "$builddate" @@ -1880,7 +1889,6 @@ create_package() { msg "$(gettext "Creating package \"%s\"...")" "$pkgname" pkgarch=$(get_pkg_arch) - write_pkginfo > .PKGINFO local comp_files=('.PKGINFO') @@ -2827,6 +2835,7 @@ fi # set defaults if they weren't specified in buildfile pkgbase=${pkgbase:-${pkgname[0]}} epoch=${epoch:-0} +basever=$(get_full_version) if [[ $BUILDDIR = "$startdir" ]]; then srcdir="$BUILDDIR/src" @@ -2933,12 +2942,11 @@ if (( INFAKEROOT )); then exit 0 # $E_OK fi -fullver=$(get_full_version) -msg "$(gettext "Making package: %s")" "$pkgbase $fullver ($(date))" +msg "$(gettext "Making package: %s")" "$pkgbase $basever ($(date))" # if we are creating a source-only package, go no further if (( SOURCEONLY )); then - if [[ -f $SRCPKGDEST/${pkgbase}-${fullver}${SRCEXT} ]] \ + if [[ -f $SRCPKGDEST/${pkgbase}-${basever}${SRCEXT} ]] \ && (( ! FORCE )); then error "$(gettext "A source package has already been built. (use %s to overwrite)")" "-f" exit 1 @@ -3018,6 +3026,7 @@ elif (( !REPKG )); then extract_sources if (( PKGVERFUNC )); then update_pkgver + basever=$(get_full_version) check_build_status fi if (( PREPAREFUNC )); then @@ -3053,8 +3062,7 @@ if (( NOARCHIVE )); then exit 0 fi -fullver=$(get_full_version) -msg "$(gettext "Finished making: %s")" "$pkgbase $fullver ($(date))" +msg "$(gettext "Finished making: %s")" "$pkgbase $basever ($(date))" install_package -- cgit v1.2.3-24-g4f1b