1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 15:58:50 -05:00

Moved commands to create package file into create_package().

Signed-off-by: Andrew Fyfe <andrew@neptune-one.net>
This commit is contained in:
Andrew Fyfe 2007-04-11 20:05:23 +01:00 committed by Dan McGee
parent a1adddddfe
commit 5b4a4af94d

View File

@ -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
@ -1125,4 +1129,3 @@ installpackage
exit 0
# vim: set ts=2 sw=2 noet: