1 |
40 |
root |
#!/bin/bash
|
2 |
|
|
#oc_cvs_checkin.sh
|
3 |
|
|
|
4 |
|
|
echo "#!/bin/bash"
|
5 |
|
|
echo "# AUTOMATICALLY GENERATED SCRIPT"
|
6 |
|
|
echo "# Scans the cores directory, excludes the projects and subdirectories"
|
7 |
|
|
echo "# listed below, and generates a script which checks in all of the "
|
8 |
|
|
echo "# remaining files to the SVN repository"
|
9 |
|
|
echo "# This should be run and the output piped to a new file something like:"
|
10 |
|
|
echo "# ./oc_cvs_checkin.sh > checkin_script.sh"
|
11 |
|
|
echo "# and then probably the execute permission enabled on checkin_script.sh"
|
12 |
|
|
|
13 |
|
|
DO_CHECKIN="1"
|
14 |
|
|
DIRECTORY_HAS_CONTENTS="1"
|
15 |
|
|
|
16 |
|
|
echo "# Encapsulate the checkins inside this loop we can "
|
17 |
|
|
echo "# break out of in the event of a problem checking"
|
18 |
|
|
echo "# one of them in"
|
19 |
|
|
echo ""
|
20 |
|
|
echo "# Function to check the return value of each SVN checkin"
|
21 |
|
|
echo "function check_svn_return_value { if [ \$? -gt 1 ]; then echo \"Error during checkins - aborting script.\"; exit 1; fi"
|
22 |
|
|
echo "}"
|
23 |
|
|
echo "ALL_DONE=\"0\""
|
24 |
|
|
echo "while [ \$ALL_DONE = 0 ]; do"
|
25 |
|
|
for PROJECT in *; do
|
26 |
|
|
DO_CHECKIN="1"
|
27 |
|
|
DIRECTORY_HAS_CONTENTS="1"
|
28 |
|
|
if [ -d "$PROJECT" ] # Check if we're looking at a directory
|
29 |
|
|
then
|
30 |
|
|
# A list of projects we don't want to checkin
|
31 |
|
|
# automatically, they will be done manually
|
32 |
|
|
if [ "$PROJECT" = "or1k" ]; then DO_CHECKIN="0" ; fi
|
33 |
|
|
if [ "$PROJECT" = "or1k-backup" ]; then DO_CHECKIN="0"; fi
|
34 |
|
|
if [ "$PROJECT" = "or1200-gct" ]; then DO_CHECKIN="0"; fi
|
35 |
|
|
if [ "$PROJECT" = "or2k" ]; then DO_CHECKIN="0"; fi
|
36 |
|
|
|
37 |
|
|
# The following need to be checked in to the repository
|
38 |
|
|
# with a slightly different name to its directory name
|
39 |
|
|
if [ "$PROJECT" = "8051" ]; then DO_CHECKIN="0"; fi
|
40 |
|
|
if [ "$PROJECT" = "ac97" ]; then DO_CHECKIN="0"; fi
|
41 |
|
|
if [ "$PROJECT" = "DebugInterface" ]; then DO_CHECKIN="0"; fi
|
42 |
|
|
if [ "$PROJECT" = "ethmac" ]; then DO_CHECKIN="0"; fi
|
43 |
|
|
if [ "$PROJECT" = "mips" ]; then DO_CHECKIN="0"; fi
|
44 |
|
|
if [ "$PROJECT" = "uart" ]; then DO_CHECKIN="0"; fi
|
45 |
|
|
if [ "$PROJECT" = "usb" ]; then DO_CHECKIN="0"; fi
|
46 |
|
|
if [ "$PROJECT" = "miniuart2" ]; then DO_CHECKIN="0"; fi
|
47 |
|
|
if [ "$PROJECT" = "video_systems" ]; then DO_CHECKIN="0"; fi
|
48 |
|
|
if [ "$PROJECT" = "microriscii" ]; then DO_CHECKIN="0"; fi
|
49 |
|
|
if [ "$PROJECT" = "oc54x" ]; then DO_CHECKIN="0"; fi
|
50 |
|
|
if [ "$PROJECT" = "divider" ]; then DO_CHECKIN="0"; fi
|
51 |
|
|
if [ "$PROJECT" = "hsca_adder" ]; then DO_CHECKIN="0"; fi
|
52 |
|
|
# Bug with this project when using this script, so don't check it in
|
53 |
|
|
if [ "$PROJECT" = "ae68" ]; then DO_CHECKIN="0"; fi
|
54 |
|
|
|
55 |
|
|
if [ $DO_CHECKIN -gt 0 ]
|
56 |
|
|
then
|
57 |
|
|
cd "$PROJECT"
|
58 |
|
|
# Now we're in the project subdirectory, we
|
59 |
|
|
# want to checkin everything apart from the
|
60 |
|
|
# stats and lint directories
|
61 |
|
|
|
62 |
|
|
|
63 |
|
|
# This pushd and the following popd make the script
|
64 |
|
|
# change into the right directory to do the checkin
|
65 |
|
|
# The command above runs an ls and word count (wc)
|
66 |
|
|
# and strips the whitespace to determine the number
|
67 |
|
|
# of files in the directory. An empty one with just
|
68 |
|
|
# a stats dir has a value of 4, so if it's more than
|
69 |
|
|
# that, odds are we have something to checkin.
|
70 |
|
|
#if [ `ls | wc -l | sed 's/^[ ]*//'` -gt 3 ]
|
71 |
|
|
#then
|
72 |
|
|
echo " pushd \"$PROJECT\""
|
73 |
|
|
# echo "$PROJECT"
|
74 |
|
|
#else
|
75 |
|
|
#DIRECTORY_HAS_CONTENTS="0"
|
76 |
|
|
#fi
|
77 |
|
|
|
78 |
|
|
# Only go through the directory checking if
|
79 |
|
|
# there's things in there
|
80 |
|
|
#if [ $DIRECTORY_HAS_CONTENTS -gt 0 ]
|
81 |
|
|
#then
|
82 |
|
|
for PROJ_FILE in *; do
|
83 |
|
|
DO_CHECKIN="1"
|
84 |
|
|
if [ "$PROJ_FILE" = "stats" ]; then DO_CHECKIN="0"; fi
|
85 |
|
|
if [ "$PROJ_FILE" = "lint" ]; then DO_CHECKIN="0"; fi
|
86 |
|
|
if [ $DO_CHECKIN -gt 0 ]
|
87 |
|
|
then
|
88 |
|
|
#Do checkin
|
89 |
|
|
#echo "#Checking in $PROJECT/$PROJ_FILE"
|
90 |
|
|
echo " svn import -m \"Import from OC\" \"$PROJ_FILE\" \"http://orsoc.se:4488/svn/$PROJECT/$PROJ_FILE\""
|
91 |
|
|
echo " check_svn_return_value"
|
92 |
|
|
#else
|
93 |
|
|
#echo "#Excluding $PROJ_FILE from checkin of $PROJECT"
|
94 |
|
|
fi
|
95 |
|
|
done
|
96 |
|
|
# We now write out the popd to change back to the main dir
|
97 |
|
|
# in the script
|
98 |
|
|
echo " popd"
|
99 |
|
|
#if [ $DIRECTORY_HAS_CONTENTS -gt 0 ]; then echo "$PROJECT"; fi
|
100 |
|
|
#fi #if [ $DIRECTORY_HAS_CONTENTS -gt 0 ]
|
101 |
|
|
cd ..
|
102 |
|
|
|
103 |
|
|
#else
|
104 |
|
|
#echo "#Excluding project $PROJECT from checkin!"
|
105 |
|
|
fi #if [ $DO_CHECKIN -gt 0 ]
|
106 |
|
|
fi #if [ -d "$PROJECT" ]
|
107 |
|
|
done
|
108 |
|
|
echo " ALL_DONE=\"1\""
|
109 |
|
|
echo " echo \"All checkins done\""
|
110 |
|
|
echo "done"
|
111 |
|
|
|
112 |
|
|
|