aboutsummaryrefslogtreecommitdiffstats
path: root/maven-meeper/src/bin/synchronize.sh
blob: 4ee418a3e61e4143828406a44875a53b4c72d1b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/bin/sh

# ------------------------------------------------------------------------
# 1. Sync Maven 1.x repositories to central
# 2. Convert Maven 1.x repository to Maven 2.x repository
# 3. Manual fixes
# 4. Sync Maven 2.x repositories to central
# 5. Sync the Maven 2.x repository to Ibiblio
# 6. Copy the mod_rewrite rules to the Maven 1.x repository @ Ibiblio
# ------------------------------------------------------------------------

PID=$$
RUNNING=`ps -ef | grep synchronize.sh | grep -v 'sh -c' | grep -v grep | grep -v $PID`
echo $RUNNING
if [ ! -z "$RUNNING" ]; then
  echo Sync already running... exiting
  echo $RUNNING
  exit 1
fi

dir=`pwd`
syncProperties=$dir/synchronize.properties
source $syncProperties

((

MODE=$1

echo "Using the following settings:"
echo "CENTRAL_HOST = $CENTRAL_HOST"
echo "TOOLS_BASE = $TOOLS_BASE"
echo "SYNC_TOOLS = $SYNC_TOOLS"
echo "SYNCOPATE = $SYNCOPATE"
echo "REPOCLEAN = $REPOCLEAN"
echo "M1_M2_REWRITE_RULES = $M1_M2_REWRITE_RULES"
echo "SYNC_REPORTS = $SYNC_REPORTS"
echo "JAVA = $JAVA"

[ "$MODE" = "batch" ] && echo && echo "Press any key to continue, or hit ^C to quit." && echo

# ------------------------------------------------------------------------
# Syncopate: Sync the Maven 1.x repositories 
# ------------------------------------------------------------------------

[ "$MODE" = "batch" ] && echo && echo "Press any key to run syncopate, or hit ^C to quit." && echo

echo "Running Syncopate"

(
  cd $SYNCOPATE
  ./sync
  retval=$?; if [ $retval != 0 ]; then exit $retval; fi
)
retval=$?; if [ $retval != 0 ]; then exit $retval; fi

# ------------------------------------------------------------------------
# Repoclean: converting the Maven 1.x repository to Maven 2.x 
# ------------------------------------------------------------------------

[ "$MODE" = "batch" ] && echo && echo "Press any key to run the m1 to m2 conversion, or hit ^C to quit." && echo

echo "Running Maven 1.x to Maven 2.x conversion ..."

(
  cd $REPOCLEAN
  ./convert-m1-m2.sh $syncProperties
  retval=$?; if [ $retval != 0 ]; then exit $retval; fi
)
retval=$?; if [ $retval != 0 ]; then exit $retval; fi

# ------------------------------------------------------------------------
# Manual fixes
# ------------------------------------------------------------------------

[ "$MODE" = "batch" ] && echo && echo "Press any key to run manual fixes, or hit ^C to quit." && echo

echo "Removing commons-logging 1.1-dev"

# hack prevent commons-logging-1.1-dev
CL=$MAVEN2_REPO/commons-logging/commons-logging
rm -rf $CL/1.1-dev
grep -v 1.1-dev $CL/maven-metadata.xml > $CL/maven-metadata.xml.tmp
mv $CL/maven-metadata.xml.tmp $CL/maven-metadata.xml
md5sum $CL/maven-metadata.xml > $CL/maven-metadata.xml.md5
sha1sum $CL/maven-metadata.xml > $CL/maven-metadata.xml.sha1

# ------------------------------------------------------------------------
# 4. Sync Maven 2.x repositories to central
# ------------------------------------------------------------------------

[ "$MODE" = "batch" ] && echo && echo "Press any key to sync Maven 2.x repositories to central, or hit ^C to quit." && echo

(
  cd $M2_SYNC
  ./m2-sync.sh go
)

# ------------------------------------------------------------------------
# Ibiblio synchronization: sync the central repository to Ibiblio 
# ------------------------------------------------------------------------

[ "$MODE" = "batch" ] && echo && echo "Press any key to run the sync to Ibiblio, or hit ^C to quit." && echo

echo "Synchronizing to ibiblio"

./synchronize-central-to-ibiblio.sh $syncProperties
retval=$?; if [ $retval != 0 ]; then exit $retval; fi
retval=$?; if [ $retval != 0 ]; then exit $retval; fi

# ------------------------------------------------------------------------
# Copy the mod_rewrite rules to the Maven 1.x repository
# ------------------------------------------------------------------------

./synchronize-rewrite-rules-to-ibiblio.sh $syncProperties

) | tee $SYNC_REPORTS/last-sync-results.txt ) 2>&1