summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAndrew Fyfe <andrew@neptune-one.net>2007-04-11 20:05:47 +0100
committerDan McGee <dan@archlinux.org>2007-05-14 11:05:58 -0400
commit7fb1dc3f201a2847a01bf9acd761cc680b35458a (patch)
treefea9c8846cb777720df798b467636b256b181faa /scripts
parent5b4a4af94d8d57b52ffd6c2e1bc664584810ec75 (diff)
downloadpacman-7fb1dc3f201a2847a01bf9acd761cc680b35458a.tar.xz
Cleaned up and simplified create_package().
Signed-off-by: Andrew Fyfe <andrew@neptune-one.net>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/makepkg.in51
1 files 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
}