fixups for qa after build changes
[xfstests-dev.git] / tools / srctest
1 #!/bin/sh -x
2
3 # Simple script which does the following:
4 #       o  Generates a src tarball from a WORKAREA
5 #       o  Copies it over to ~/test and unpacks it
6 #       o  Generates a src tarball from src tarball
7 #       o  Compares the build status' ... reports problems
8 #       o  removes ~/test
9
10
11 tmpdir="$HOME/test"
12
13 if [ -z "$WORKAREA" ]
14 then
15         echo "WORKAREA is not set -- aborting."
16         exit 1
17 fi
18
19 if [ -d $tmpdir ]
20 then
21         echo "$tmpdir exists already -- aborting."
22         exit 1
23 else
24         mkdir $tmpdir
25         if [ ! -d $tmpdir ]
26         then
27                 echo "Cannot create $tmpdir -- aborting."
28                 exit 1
29         fi
30 fi
31
32
33 # Pleasantries are now out of the way, lets proceed.
34 # NB: If something goes wrong we'll leave the unpacked
35 # source alone for consumption by a human.
36
37
38 _cleanup()
39 {
40         if [ $status -eq 0 ]
41         then
42                 rm -fr $tmpdir
43         else
44                 echo "Problem?  -- leaving $tmpdir for inspection"
45         fi
46 }
47
48 _buildme()
49 {
50         cd $1
51
52         if ./Makepkgs
53         then
54                 :
55         else
56                 echo Makepkgs thinks theres a problem in $1
57                 exit 1
58         fi
59
60         if [ ! -f build/xfs-cmds-*.src.tar.gz ]
61         then
62                 echo Makepkgs failed to create build/xfs-cmds-*.src.tar.gz
63                 exit 1
64         fi
65 }
66
67 status=1
68 trap "_cleanup; exit \$status" 0 1 2 3 15
69
70 # first, build from the WORKAREA
71 _buildme $WORKAREA/cmd/xfs
72
73 cp $WORKAREA/cmd/xfs/build/xfs-cmds-*.src.tar.gz $tmpdir
74 cd $tmpdir
75 tar xzf xfs-cmds-*.src.tar.gz
76 rm xfs-cmds-*.src.tar.gz        # must delete for _buildme "cd" to work
77
78 # now, cross check the src build
79 _buildme $tmpdir/xfs-cmds-*
80
81 status=0