Debian Codegraph @

test/regression/scripts/upload

raw
1 #!/bin/bash
2 #
3 # Copyright (C) 2013 Anders Logg and Martin Sandve Alnaes
4 #
5 # This file is part of FIAT.
6 #
7 # FIAT is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU Lesser General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
11 #
12 # FIAT is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU Lesser General Public License for more details.
16 #
17 # You should have received a copy of the GNU Lesser General Public License
18 # along with FIAT. If not, see <http://www.gnu.org/licenses/>.
19 #
20 # First added: 2013-04-22
21 # Last changed: 2013-08-21
22 #
23 # This script overwrites the reference data with the current output
24 # and stores the new reference data as part of the FIAT reference data
25 # repository. The commit id of the stored reference data is commited
26 # to a file in the main repo.
27
28 # Parameters
29 source ./scripts/parameters
30
31 # Get updated reference repository
32 ./scripts/getreferencerepo
33 if [ $? -ne 0 ]; then
34 exit 1
35 fi
36
37 # Check that we have any data
38 if [ ! -d "$OUTPUT_DIR" ]; then
39 echo "Missing data directory '$OUTPUT_DIR'."
40 exit 1
41 fi
42
43 # Copy references
44 echo "Copying new reference data to $DATA_DIR"
45 rsync -r --exclude='README.rst' --exclude='*.bin' --exclude='*.cpp' $OUTPUT_DIR/ $DATA_DIR
46 echo ""
47
48 # Get current id for main repo (does not include dirty files, so not quite trustworthy!)
49 REPO_ID=`git rev-list --max-count 1 HEAD`
50
51 # Commit new data to reference repository
52 pushd $DATA_DIR
53 git add *
54 git commit -m "Update reference data, current project head is ${REPO_ID}." | grep -v "create mode"
55 if [ $? -ne 0 ]; then
56 echo "Failed to commit reference data."
57 exit 1
58 fi
59 DATA_ID=`git rev-list --max-count 1 HEAD`
60 popd
61
62 # Commit reference data commit id to file in main repo
63 echo $DATA_ID > $DATA_ID_FILE
64 git commit $DATA_ID_FILE -m"Update reference data pointer to ${DATA_ID}."
65
66 # Push references to server
67 pushd $DATA_DIR
68 git push
69 if [ $? -ne 0 ]; then
70 echo "WARNING: Failed to push new reference data to server."
71 fi
72 popd