forked from mongodb/mongo-java-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mavenPush.py
executable file
·56 lines (41 loc) · 1.51 KB
/
mavenPush.py
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
#!/usr/bin/python
# http://repo1.maven.org/maven2/org/mongodb/mongo-java-driver/
import os
import sys
import shutil
import subprocess
if len( sys.argv ) == 1:
print "Usage: mavenPush.py VERSION [PUBDIR]"
print "VERSION - version you want to publish"
print "PUBDIR - directory to publish to. default = /ebs/maven/"
sys.exit()
version = sys.argv[1]
if len( sys.argv ) > 2:
root = os.path.expanduser( sys.argv[2] )
else:
root = "/ebs/maven/"
p = subprocess.Popen( [ "/usr/bin/ant" , "clean" ] , stdout=subprocess.PIPE ).communicate()
p = subprocess.Popen( [ "/usr/bin/ant" , "alljars" ] , stdout=subprocess.PIPE ).communicate()
if p[0].find( "SUCCESSFUL" ) < 0:
print( p[0] )
print( p[1] )
raise( "build failed" )
def go( shortName , longName ):
dir = root + "/org/mongodb/" + longName + "/" + version
if not os.path.exists( dir ):
os.makedirs( dir )
fileRoot = dir + "/" + longName + "-" + version
for x in [ "" , "-sources" , "-javadoc" ]:
shutil.copy2( shortName + x + ".jar" , fileRoot + x + ".jar" )
pom = open( "maven-" + shortName + ".xml" , "r" ).read()
pom = pom.replace( "$VERSION" , version )
out = open( fileRoot + ".pom" , 'w' )
out.write( pom )
out.close()
p = subprocess.Popen( [ "sha1sum" , fileRoot + ".jar" ] , stdout=subprocess.PIPE ).communicate()
sha1 = p[0].split( ' ' )[0]
out = open( fileRoot + ".jar.sha1" , 'w' )
out.write( sha1 )
out.close()
go( "mongo" , "mongo-java-driver" )
go( "bson" , "bson" )