From 7fb1dc3f201a2847a01bf9acd761cc680b35458a Mon Sep 17 00:00:00 2001 From: Andrew Fyfe Date: Wed, 11 Apr 2007 20:05:47 +0100 Subject: Cleaned up and simplified create_package(). Signed-off-by: Andrew Fyfe --- scripts/makepkg.in | 51 ++++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/scripts/makepkg.in b/scripts/makepkg.in index 077b7742..f8463fc4 100755 --- a/scripts/makepkg.in +++ b/scripts/makepkg.in @@ -394,26 +394,25 @@ removedeps() { } create_package() { - # get some package meta info - builddate=$(LC_ALL= ; LANG= ; date -u "+%a %b %e %H:%M:%S %Y") + cd "$startdir"/pkg + msg "$(gettext "Creating package...")" # get some package meta info + + local builddate=$(LC_ALL= LANG= date -u "+%a %b %e %H:%M:%S %Y") if [ "$PACKAGER" != "" ]; then - packager="$PACKAGER" + local packager="$PACKAGER" else - packager="Arch Linux (http://www.archlinux.org)" + local packager="Arch Linux (http://www.archlinux.org)" fi - size=$(du -cb "$startdir/pkg" | tail -n 1 | awk '{print $1}') + local size=$(du -sb | awk '{print $1}') # build a filelist - do this first to keep meta files out of the list - msg "$(gettext "Generating .FILELIST file...")" - cd "$startdir/pkg" - tar cvf /dev/null * | sort >.FILELIST + msg2 "$(gettext "Generating .FILELIST file...")" + tar -cvf /dev/null * | sort >.FILELIST # write the .PKGINFO file - msg "$(gettext "Generating .PKGINFO file...")" - cd "$startdir/pkg" + msg2 "$(gettext "Generating .PKGINFO file...")" echo "# Generated by makepkg $myver" >.PKGINFO - echo -n "# " >>.PKGINFO - date >>.PKGINFO + echo "# $(LC_ALL= LANG= date -u)" >>.PKGINFO echo "pkgname = $pkgname" >>.PKGINFO echo "pkgver = $pkgver-$pkgrel" >>.PKGINFO echo "pkgdesc = $pkgdesc" >>.PKGINFO @@ -425,6 +424,7 @@ create_package() { echo "arch = $CARCH" >>.PKGINFO fi + local it for it in "${license[@]}"; do echo "license = $it" >>.PKGINFO done @@ -454,31 +454,32 @@ create_package() { plain "$(gettext "example for GPL\'ed software: license=(\'GPL\').")" fi + local comp_files + # check for an install script + # TODO: should we include ${pkgname}.install if it exists and $install is unset? if [ "$install" != "" ]; then - msg "$(gettext "Copying install script...")" - cp "$startdir/$install" "$startdir/pkg/.INSTALL" + msg2 "$(gettext "Copying install script...")" + cp "$startdir/$install" .INSTALL + comp_files="$comp_files .INSTALL" fi # do we have a changelog? - have_changelog=0 if [ -f "$startdir/ChangeLog" ]; then - msg "$(gettext "Copying package changelog")" - cp "$startdir/ChangeLog" "$startdir/pkg/.CHANGELOG" - have_changelog=1 + msg2 "$(gettext "Copying package changelog")" + cp "$startdir/ChangeLog" .CHANGELOG + comp_files="$comp_files .CHANGELOG" fi # tar it up - msg "$(gettext "Compressing package...")" - cd "$startdir/pkg" + msg2 "$(gettext "Compressing package...")" - pkg_file="$PKGDEST/$pkgname-$pkgver-$pkgrel-${CARCH}.${PKGEXT}" - comp_files=".PKGINFO .FILELIST ${install:+.INSTALL}" - [ $have_changelog -eq 1 ] && comp_files=".CHANGELOG $comp_files" + local pkg_file="$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}.${PKGEXT}" + comp_files="$comp_files .PKGINFO .FILELIST" - if ! tar czf $pkg_file $comp_files *; then + if ! tar -czf "$pkg_file" $comp_files *; then error "$(gettext "Failed to create package file.")" - exit 1 + exit 1 # TODO: error code fi } -- cgit v1.2.3-70-g09d2