This patch is a proof of concept to create a separate package for docs file ($pkgname-docs) with an only PKGBUILD. Do you like it? --- scripts/makepkg.in | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 108 insertions(+), 3 deletions(-) diff --git a/scripts/makepkg.in b/scripts/makepkg.in index 1125e85..0fa9015 100755 --- a/scripts/makepkg.in +++ b/scripts/makepkg.in @@ -414,6 +414,27 @@ installpackage() { fi } +installdocspackage() { + if [ "$INSTALL" = "1" -a "$SUDO" = "1" ]; then + msg "$(gettext "Installing docs package with pacman -U...")" + if [ "$INFAKEROOT" = "1" ]; then + FAKEROOTKEY2=$FAKEROOTKEY + unset FAKEROOTKEY + fi + sudo pacman $PACMAN_OPTS -U $PKGDEST/${pkgname}-docs-${pkgver}-${pkgrel}-${CARCH}.${PKGEXT} + local exitcode=$? + if [ "$INFAKEROOT" = "1" ]; then + export FAKEROOTKEY=$FAKEROOTKEY2 + unset FAKEROOTKEY2 + fi + exit $exitcode + elif [ "$INSTALL" = "1" -a "$EUID" = "0" -a "$INFAKEROOT" != "1" ]; then + msg "$(gettext "Installing docs package with pacman -U...")" + pacman $PACMAN_OPTS -U $PKGDEST/${pkgname}-docs-${pkgver}-${pkgrel}-${CARCH}.${PKGEXT} + exit $? + fi +} + usage() { echo "$(eval_gettext "makepkg version \$myver")" echo @@ -961,9 +982,90 @@ else fi fi -if [ "$(check_option docs)" = "n" ]; then - # remove info/doc files - msg "$(gettext "Removing info/doc files...")" + +if [ "$(check_option packdocs)" = "y" ]; then + msg "Packaging docs" + + rm -fr $startdir/pkg-docs + + cd "$startdir/pkg" + for ddir in ${DOC_DIRS[@]}; do + if [ -d $ddir ]; then + mkdir -p "$startdir/pkg-docs/$ddir" + mv $ddir/* "$startdir/pkg-docs/$ddir" + fi + done + + # remove docs from the master package + rm -rf ${DOC_DIRS[@]} + find -depth -type d -empty -delete; + + cd "$startdir/pkg-docs" + tar cvf /dev/null * | sort >.FILELIST + + 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-docs" | tail -n 1 | awk '{print $1}') + + # write the .PKGINFO file + msg "$(gettext "Generating .PKGINFO file...")" + echo "# Generated by makepkg $myver" >.PKGINFO + echo -n "# " >>.PKGINFO + date >>.PKGINFO + echo "pkgname = $pkgname-docs" >>.PKGINFO + echo "pkgver = $pkgver-$pkgrel" >>.PKGINFO + + # You may want to change this + echo "pkgdesc = $pkgname docs" >>.PKGINFO + + echo "url = $url" >>.PKGINFO + echo "builddate = $builddate" >>.PKGINFO + echo "packager = $packager" >>.PKGINFO + echo "size = $size" >>.PKGINFO + + # maybe put NOARCH or something similar? + if [ "$CARCH" != "" ]; then + echo "arch = $CARCH" >>.PKGINFO + fi + + # and which license? should docs package + # inherit master package license? (I don't think so) + # maybe we could add a docslicense var into the PKGBUILD + for it in "${license[@]}"; do + echo "license = $it" >>.PKGINFO + done + + # We could use a 'docs' group, or inherit master package group + for it in "${groups[@]}"; do + echo "group = $it" >>.PKGINFO + done + +# I don't think these are needed for a -docs package +# echo "replaces = $it" >>.PKGINFO +# echo "depend = $it" >>.PKGINFO +# echo "conflict = $it" >>.PKGINFO +# echo "provides = $it" >>.PKGINFO +# echo "backup = $it" >>.PKGINFO + + pkg_docs_file="$PKGDEST/$pkgname-docs-$pkgver-$pkgrel-${CARCH}.${PKGEXT}" + comp_files=".PKGINFO .FILELIST ${install:+.INSTALL}" + + msg "$(gettext "Compressing docs package...")" + if ! tar czf $pkg_docs_file $comp_files *; then + error "$(gettext "Failed to create docs package file.")" + exit 1 + fi + +elif [ "$(check_option docs)" = "n" ]; then +# maybe "else" instead of "elif" would be better? + + # remove info/doc files + msg "$(gettext "Removing info/doc files...")" cd "$startdir/pkg" #fix flyspray bug #5021 rm -rf ${DOC_DIRS[@]} @@ -1122,6 +1224,9 @@ msg "$(eval_gettext "Finished making: \$pkgname (\$date)")" installpackage +if [ "$(check_option packdocs)" = "y" ]; then + installdocspackage +fi exit 0 # vim: set ts=2 sw=2 noet: -- 1.5.1 -- Alessio 'mOLOk' Bolognino Arch Linux Trusted User Public Key @ http://themolok.netsons.org/uploads/themolok.asc Key ID = 1024D / FE0270FB 2007-04-11 Key Fingerprint = 9AF8 9011 F271 450D 59CF 2D7D 96C9 8F2A FE02 70FB