opt/python/Pkgfile
Juergen Daubert b514894f5d python: fix issue with man-page symlink
0) Problem: Some people have an additional link to the python man-page:

is the python footprint mismatch something I can fix or am I missing anything important?
NEW       lrwxrwxrwx      root/root       usr/man/man1/python.1.gz -> python2.1.gz

1) the relevant part of Makefile.pre.in:

maninstall:     altmaninstall
        -rm -f $(DESTDIR)$(MANDIR)/man1/python2.1
        (cd $(DESTDIR)$(MANDIR)/man1; $(LN) -s python$(VERSION).1 python2.1)
        -rm -f $(DESTDIR)$(MANDIR)/man1/python.1
        (cd $(DESTDIR)$(MANDIR)/man1; $(LN) -s python2.1 python.1)

2) after 'make install' we have the following chain of symlinks:

lrwxrwxrwx  1 juergen users     9 Apr 21 09:13 python.1 -> python2.1
lrwxrwxrwx  1 juergen users    11 Apr 21 09:13 python2.1 -> python2.7.1
-rw-r--r--  1 juergen users 14582 Apr 21 09:12 python2.7.1

3) the compress_manpages function of our pkgmk:

compress_manpages() {
        local FILE DIR TARGET

        cd $PKG

        find . -type f -path "*/man/man*/*" | while read FILE; do
                if [ "$FILE" = "${FILE%%.gz}" ]; then
                        gzip -9 "$FILE"
                fi
        done

        find . -type l -path "*/man/man*/*" | while read FILE; do
                TARGET=`readlink -n "$FILE"`
                TARGET="${TARGET##*/}"
                TARGET="${TARGET%%.gz}.gz"
                rm -f "$FILE"
                FILE="${FILE%%.gz}.gz"
                DIR=`dirname "$FILE"`

                if [ -e "$DIR/$TARGET" ]; then
                        ln -sf "$TARGET" "$FILE"
                fi
        done
}

4) How it works:

We search for real man-pages in $PKG and compress them, breaking all
symlinks to these man-pages, which we repair afterwards. Fixing is done by
adding a .gz extension to all targets of the symlinks.

However, we do a test if $TARGET exists before we do the actual link,
which is not the case if we have chained symlink and we do not process
in the right order.
For a "normal" collating we have the order python.1 before python2.1, so
python2.1.gz does not exits at the time we process python.1
2013-04-21 11:48:33 +02:00

44 lines
1.4 KiB
Plaintext

# Description: Python interpreter, version 2.7
# URL: http://www.python.org
# Maintainer: Juergen Daubert, jue at crux dot nu
# Depends on: db gdbm openssl bzip2 zlib sqlite3
name=python
version=2.7.4
release=2
source=(http://www.python.org/ftp/$name/$version/Python-$version.tar.xz \
pyconfig.h)
build () {
cd Python-$version
# set OPT to the python default without -O3
# our CFLAGS are used as well
OPT="-Wall -Wstrict-prototypes -fwrapv" \
./configure --prefix=/usr \
--mandir=/usr/man \
--enable-shared \
--with-threads \
--enable-ipv6
make
make -j1 DESTDIR=$PKG install
# fix issue with man-page symlink
ln -sf python2.7.1 $PKG/usr/man/man1/python.1
ln -sf python2.7 $PKG/usr/bin/python
ln -s python2.7 $PKG/usr/lib/python
ln -s python2.7 $PKG/usr/include/python
ln -s /usr/lib/libpython2.7.so $PKG/usr/lib/python2.7/config/libpython2.7.so
rm -r $PKG/usr/lib/python/{bsddb,ctypes,email,sqlite3}/test
rm -r $PKG/usr/lib/python/{distutils,json,lib2to3}/tests
rm $PKG/usr/lib/python/{distutils,site-packages,test/data}/README
rm $PKG/usr/lib/python/idlelib/{ChangeLog,{NEWS,README,TODO}.txt}
rm $PKG/usr/lib/python/ctypes/macholib/README.ctypes
mv $PKG/usr/include/python2.7/pyconfig{,-64}.h
cp $SRC/pyconfig.h $PKG/usr/include/python2.7/
}