source: branches/4.x/mktar @ 783

Last change on this file since 783 was 783, checked in by cito, 4 years ago

Add more safety checks to the mktar script

Make sure the right files are packaged, and with the right permissions.

Also specified the exact top-level source files in MANIFEST.in,
in order to make sure that other files used for testing etc.
do not accidentally get packaged. The mktar script now also checks
the number of top-level files and warns if something does not fit.

  • Property svn:executable set to *
File size: 1.8 KB
Line 
1#! /bin/sh
2
3VERSION=4.2
4DISTDIR=/u/pyg/files
5
6# some safety tests
7if [ ! -d $DISTDIR ]
8then
9        echo "Hmmm.  Are you sure you are on the right server?"
10        exit 1
11fi
12if [ ! -f setup.py -o ! -f pgmodule.c -o ! -d tests -o ! -d docs ]
13then
14        echo "Hmmm.  Are you sure you are in the right directory?"
15        exit 1
16fi
17FILES="*.c *.h *.py *.cfg *.rst *.txt"
18NUMFILES=`ls $FILES | wc -l`
19if [ "$NUMFILES" != "9" ]
20then
21    echo "Hmmm.  The number of top-level files seems to be wrong:"
22    ls $FILES
23    echo "Maybe you should do a clean checkout first."
24    echo "If something has changed, edit MANIFEST.in and mktar."
25    exit 1
26fi
27FILES="mktar mkdocs docs tests pg.py pgdb.py pgmodule.c setup.cfg"
28PERMS=`stat --printf="%a" $FILES`
29if [ $? -ne 0 -o "$PERMS" != '755755755755644644644644' ]
30then
31    echo "Hmmm.  File permissions are not set properly."
32    echo "Use a filesystem with permissions and do a clean checkout first."
33    exit 1
34fi
35
36if [ -f BETA ]
37then
38        VERSION=$VERSION-pre`date +"%y%m%d"`
39        PACKAGE=pygresql.pkg-beta
40        SYMLINK=PyGreSQL-beta.tar.gz
41else
42        PACKAGE=pygresql.pkg
43        SYMLINK=PyGreSQL.tar.gz
44fi
45
46# Package up as a source tarball in the distribution directory.
47
48echo "Making source tarball..."
49echo
50
51umask 0022
52
53# Make sure that the documentation has been built.
54
55if ! ./mkdocs
56then
57        echo "Hmmm.  The documentation could not be built."
58        exit 1
59fi
60
61# Package as source distribution.
62
63rm -rf build dist
64
65if ! python2 setup.py sdist
66then
67        echo "Hmmm.  The source distribution could not be created."
68        exit 1
69fi
70
71DF=`ls dist`
72if [ $? -ne 0 -o -z "$DF" ]
73then
74        echo "Hmmm.  The source distribution could not be found."
75        exit 1
76fi
77
78TF=$DISTDIR/$DF
79
80if ! cp dist/$DF $TF
81then
82        echo "Hmmm.  The source distribution could not be copied."
83        exit 1
84fi
85
86chmod 644 $TF
87
88rm -f $DISTDIR/$SYMLINK
89ln -s $DF $DISTDIR/$SYMLINK
90
91echo
92echo "$TF has been built."
Note: See TracBrowser for help on using the repository browser.