mirror of
https://github.com/moparisthebest/pacman
synced 2024-08-13 17:03:46 -04:00
Moved commands to create package file into create_package().
Signed-off-by: Andrew Fyfe <andrew@neptune-one.net>
This commit is contained in:
parent
a1adddddfe
commit
5b4a4af94d
@ -393,6 +393,95 @@ removedeps() {
|
|||||||
fi
|
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() {
|
installpackage() {
|
||||||
if [ "$INSTALL" = "1" -a "$SUDO" = "1" ]; then
|
if [ "$INSTALL" = "1" -a "$SUDO" = "1" ]; then
|
||||||
msg "$(gettext "Installing package with pacman -U...")"
|
msg "$(gettext "Installing package with pacman -U...")"
|
||||||
@ -1021,92 +1110,7 @@ if [ "$(check_option emptydirs)" = "n" ]; then
|
|||||||
find -depth -type d -empty -delete;
|
find -depth -type d -empty -delete;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# get some package meta info
|
create_package
|
||||||
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
|
|
||||||
|
|
||||||
cd "$startdir"
|
cd "$startdir"
|
||||||
if [ "$CLEANUP" = "1" ]; then
|
if [ "$CLEANUP" = "1" ]; then
|
||||||
@ -1125,4 +1129,3 @@ installpackage
|
|||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
# vim: set ts=2 sw=2 noet:
|
# vim: set ts=2 sw=2 noet:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user