X Tutup
Skip to content

Commit 00dad9b

Browse files
committed
SESPRINGPYTHONPY-56: Merged in changes that deliver sha digest file along with regular releases.
git-svn-id: https://src.springframework.org/svn/se-springpython-py/trunk/springpython@388 ce8fead1-4192-4296-8608-a705134b927f
1 parent 9217155 commit 00dad9b

File tree

2 files changed

+38
-15
lines changed

2 files changed

+38
-15
lines changed

build.py

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import getopt
2424
import shutil
2525
import S3
26+
import sha # Need to support python 2.4, see SESPRINGPYTHONPY-56
2627

2728
############################################################################
2829
# Get external properties and load into a dictionary. NOTE: These properties
@@ -136,13 +137,19 @@ def package(dir, version):
136137
build("samples", version)
137138
os.system("mv *.tar.gz %s" % dir)
138139

139-
def publish(filename, BUCKET_NAME, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
140-
KEY_NAME = p["s3.key_prefix"] + filename.split("/")[-1]
140+
def publish(filepath, s3bucket, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
141+
filename = filepath.split("/")[-1]
142+
s3key = "/".join([ p['release.type'],
143+
p['project.key'],
144+
p['natural.name'],
145+
filename ])
141146

142-
print "Reading in content from %s" % filename
143-
filedata = open(filename, "rb").read()
147+
print "Reading in content from %s" % filepath
148+
filedata = open(filepath, "rb").read()
144149

145-
print "Preparing to upload %s to %s/%s" % (filename, BUCKET_NAME, KEY_NAME)
150+
filehash = sha.new(filedata).hexdigest()
151+
152+
print "Preparing to upload %s to %s/%s" % (filename, s3bucket, s3key)
146153

147154
content_type = mimetypes.guess_type(filename)[0]
148155
if content_type is None:
@@ -153,14 +160,26 @@ def publish(filename, BUCKET_NAME, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY):
153160
print "Connecting to S3..."
154161
conn = S3.AWSAuthConnection(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
155162

156-
print "Checking if bucket %s exists..." % BUCKET_NAME
157-
check = conn.check_bucket_exists(BUCKET_NAME)
163+
print "Checking if bucket %s exists..." % s3bucket
164+
check = conn.check_bucket_exists(s3bucket)
158165
if (check.status == 200):
159-
print "It does! Now uploading %s to %s/%s" % (filename, BUCKET_NAME, KEY_NAME)
166+
print "Uploading %s to %s/%s" % (filename, s3bucket, s3key)
160167
print conn.put(
161-
BUCKET_NAME,
162-
KEY_NAME,
168+
s3bucket,
169+
s3key,
163170
S3.S3Object(filedata),
171+
{ 'Content-Type': content_type,
172+
'x-amz-acl': 'public-read',
173+
'x-amz-meta-project.name': 'Spring Extensions',
174+
'x-amz-meta-release.type': p['release.type'],
175+
'x-amz-meta-bundle.version': p['version'],
176+
'x-amz-meta-package.file.name': filename } ).message
177+
178+
print "Uploading SHA1 digest to %s/%s" % (s3bucket, s3key + '.sha1')
179+
print conn.put(
180+
s3bucket,
181+
s3key + '.sha1',
182+
S3.S3Object(filehash + ' ' + filename + "\n" ),
164183
{ 'Content-Type': content_type, 'x-amz-acl': 'public-read'}).message
165184
else:
166185
print "Error code %s: Unable to publish" % check.status

springpython.properties

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
# Collection of properties involved in managing Spring Python testing and packaging.
22

3-
version=0.9.0
3+
version=1.0.0
4+
natural.name=se-springpython-py
5+
project.key=EXT
6+
7+
# release, milestone or snapshot. Trunk is always snapshot for CI build
8+
release.type=release
49

510
# This property is only un-commented and set for official tagged releases.
6-
#build.stamp=RELEASE
11+
build.stamp=RELEASE
712

813
# docbook reference documentation
914
doc.ref.dir=docs/reference
@@ -13,8 +18,7 @@ dist.ref.dir=docs/reference
1318
double.sided=0
1419

1520
# S3 hosting properties
21+
1622
s3.bucket=dist.springframework.org
17-
s3.key_prefix=snapshot/EXT/se-springpython-py/
18-
# When tagged for official release
19-
#s3.key_prefix=release/EXT/se-springpython-py/
23+
2024
s3.key_file=.s3keys

0 commit comments

Comments
 (0)
X Tutup