summaryrefslogtreecommitdiff
path: root/scripts/makepkg.in
diff options
context:
space:
mode:
authorAndrew Fyfe <andrew@neptune-one.net>2007-04-11 20:05:23 +0100
committerDan McGee <dan@archlinux.org>2007-05-14 11:05:58 -0400
commit5b4a4af94d8d57b52ffd6c2e1bc664584810ec75 (patch)
tree64932ecd8c27cbeed1fb9bb403697f7d78540f29 /scripts/makepkg.in
parenta1adddddfe7151c8aa649dbc0d20efee703215c2 (diff)
downloadpacman-5b4a4af94d8d57b52ffd6c2e1bc664584810ec75.tar.xz
Moved commands to create package file into create_package().
Signed-off-by: Andrew Fyfe <andrew@neptune-one.net>
Diffstat (limited to 'scripts/makepkg.in')
-rwxr-xr-xscripts/makepkg.in179
1 files changed, 91 insertions, 88 deletions
diff --git a/scripts/makepkg.in b/scripts/makepkg.in
index 1125e852..077b7742 100755
--- a/scripts/makepkg.in
+++ b/scripts/makepkg.in
@@ -393,6 +393,95 @@ removedeps() {
fi
}
+create_package() {
+ # get some package meta info
+ builddate=$(LC_ALL= ; LANG= ; date -u "+%a %b %e %H:%M:%S %Y")
+ if [ "$PACKAGER" != "" ]; then
+ packager="$PACKAGER"
+ else
+ packager="Arch Linux (http://www.archlinux.org)"
+ fi
+ size=$(du -cb "$startdir/pkg" | tail -n 1 | 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
+
+ # write the .PKGINFO file
+ msg "$(gettext "Generating .PKGINFO file...")"
+ cd "$startdir/pkg"
+ echo "# Generated by makepkg $myver" >.PKGINFO
+ echo -n "# " >>.PKGINFO
+ date >>.PKGINFO
+ echo "pkgname = $pkgname" >>.PKGINFO
+ echo "pkgver = $pkgver-$pkgrel" >>.PKGINFO
+ echo "pkgdesc = $pkgdesc" >>.PKGINFO
+ echo "url = $url" >>.PKGINFO
+ echo "builddate = $builddate" >>.PKGINFO
+ echo "packager = $packager" >>.PKGINFO
+ echo "size = $size" >>.PKGINFO
+ if [ "$CARCH" != "" ]; then
+ echo "arch = $CARCH" >>.PKGINFO
+ fi
+
+ for it in "${license[@]}"; do
+ echo "license = $it" >>.PKGINFO
+ done
+ for it in "${replaces[@]}"; do
+ echo "replaces = $it" >>.PKGINFO
+ done
+ for it in "${groups[@]}"; do
+ echo "group = $it" >>.PKGINFO
+ done
+ for it in "${depends[@]}"; do
+ echo "depend = $it" >>.PKGINFO
+ done
+ for it in "${conflicts[@]}"; do
+ echo "conflict = $it" >>.PKGINFO
+ done
+ for it in "${provides[@]}"; do
+ echo "provides = $it" >>.PKGINFO
+ done
+ for it in "${backup[@]}"; do
+ echo "backup = $it" >>.PKGINFO
+ done
+
+ # TODO maybe remove this at some point
+ # warn if license array is not present or empty
+ if [ "$license" = "" ]; then
+ warning "$(eval_gettext "Please add a license line to your \$BUILDSCRIPT!")"
+ plain "$(gettext "example for GPL\'ed software: license=(\'GPL\').")"
+ fi
+
+ # check for an install script
+ if [ "$install" != "" ]; then
+ msg "$(gettext "Copying install script...")"
+ cp "$startdir/$install" "$startdir/pkg/.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
+ fi
+
+ # tar it up
+ msg "$(gettext "Compressing package...")"
+ cd "$startdir/pkg"
+
+ pkg_file="$PKGDEST/$pkgname-$pkgver-$pkgrel-${CARCH}.${PKGEXT}"
+ comp_files=".PKGINFO .FILELIST ${install:+.INSTALL}"
+ [ $have_changelog -eq 1 ] && comp_files=".CHANGELOG $comp_files"
+
+ if ! tar czf $pkg_file $comp_files *; then
+ error "$(gettext "Failed to create package file.")"
+ exit 1
+ fi
+}
+
installpackage() {
if [ "$INSTALL" = "1" -a "$SUDO" = "1" ]; then
msg "$(gettext "Installing package with pacman -U...")"
@@ -1021,92 +1110,7 @@ if [ "$(check_option emptydirs)" = "n" ]; then
find -depth -type d -empty -delete;
fi
-# get some package meta info
-builddate=$(LC_ALL= ; LANG= ; date -u "+%a %b %e %H:%M:%S %Y")
-if [ "$PACKAGER" != "" ]; then
- packager="$PACKAGER"
-else
- packager="Arch Linux (http://www.archlinux.org)"
-fi
-size=$(du -cb "$startdir/pkg" | tail -n 1 | 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
-
-# write the .PKGINFO file
-msg "$(gettext "Generating .PKGINFO file...")"
-cd "$startdir/pkg"
-echo "# Generated by makepkg $myver" >.PKGINFO
-echo -n "# " >>.PKGINFO
-date >>.PKGINFO
-echo "pkgname = $pkgname" >>.PKGINFO
-echo "pkgver = $pkgver-$pkgrel" >>.PKGINFO
-echo "pkgdesc = $pkgdesc" >>.PKGINFO
-echo "url = $url" >>.PKGINFO
-echo "builddate = $builddate" >>.PKGINFO
-echo "packager = $packager" >>.PKGINFO
-echo "size = $size" >>.PKGINFO
-if [ "$CARCH" != "" ]; then
- echo "arch = $CARCH" >>.PKGINFO
-fi
-
-for it in "${license[@]}"; do
- echo "license = $it" >>.PKGINFO
-done
-for it in "${replaces[@]}"; do
- echo "replaces = $it" >>.PKGINFO
-done
-for it in "${groups[@]}"; do
- echo "group = $it" >>.PKGINFO
-done
-for it in "${depends[@]}"; do
- echo "depend = $it" >>.PKGINFO
-done
-for it in "${conflicts[@]}"; do
- echo "conflict = $it" >>.PKGINFO
-done
-for it in "${provides[@]}"; do
- echo "provides = $it" >>.PKGINFO
-done
-for it in "${backup[@]}"; do
- echo "backup = $it" >>.PKGINFO
-done
-
-# TODO maybe remove this at some point
-# warn if license array is not present or empty
-if [ "$license" = "" ]; then
- warning "$(eval_gettext "Please add a license line to your \$BUILDSCRIPT!")"
- plain "$(gettext "example for GPL\'ed software: license=(\'GPL\').")"
-fi
-
-# check for an install script
-if [ "$install" != "" ]; then
- msg "$(gettext "Copying install script...")"
- cp "$startdir/$install" "$startdir/pkg/.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
-fi
-
-# tar it up
-msg "$(gettext "Compressing package...")"
-cd "$startdir/pkg"
-
-pkg_file="$PKGDEST/$pkgname-$pkgver-$pkgrel-${CARCH}.${PKGEXT}"
-comp_files=".PKGINFO .FILELIST ${install:+.INSTALL}"
-[ $have_changelog -eq 1 ] && comp_files=".CHANGELOG $comp_files"
-
-if ! tar czf $pkg_file $comp_files *; then
- error "$(gettext "Failed to create package file.")"
- exit 1
-fi
+create_package
cd "$startdir"
if [ "$CLEANUP" = "1" ]; then
@@ -1124,5 +1128,4 @@ installpackage
exit 0
-# vim: set ts=2 sw=2 noet:
-
+# vim: set ts=2 sw=2 noet: \ No newline at end of file