3
# This script doesn't actually do the verification stuff yet. You should
4
# manually check, after this script completes, that signed_release_unpack:
5
# dpkg-sig --verify *.deb
7
# cd BitcoinArmory; git tag -v v0.90-beta (or whatever the tag is)
12
from release_utils import *
14
from datetime import datetime
17
from release_settings import getReleaseParams, getMasterPackageList
22
print textwrap.dedent("""
23
Script Arguments (* is optional)
25
argv[1] inputDir (from Step2)
26
argv[2]* isDryRun (default ~ 0)
27
argv[3]* useTestParams (default ~ 0)
33
inDir = checkExists(argv[1])
34
isDryRun = (len(argv)>2 and not argv[2]=='0')
35
testParams = (len(argv)>3 and not argv[3]=='0')
38
masterPkgList = getMasterPackageList()
39
RELEASE = getReleaseParams(testParams)
41
signAddress = RELEASE['SignAddr']
42
announceName = RELEASE['AnnounceFile']
43
bucketPrefix = RELEASE['BucketPrefix']
44
htmlRelease = bucketPrefix + RELEASE['BucketReleases']
45
htmlAnnounce = bucketPrefix + RELEASE['BucketAnnounce']
46
s3Release = 's3://%s' % RELEASE['BucketReleases']
47
s3Announce = 's3://%s' % RELEASE['BucketAnnounce']
48
gpgKeyID = RELEASE['GPGKeyID']
49
btcWltID = RELEASE['BTCWltID']
52
#uploadlog = open('step3_log_%d.txt' % long(time.time()), 'w')
53
uploadlog = open('step3_log.txt', 'w')
56
uploadlog.write(s + '\n')
58
srcGitRepo = checkExists(os.path.join(inDir, 'BitcoinArmory'))
59
srcInstalls = checkExists(os.path.join(inDir, 'installers'))
60
srcAnnounce = checkExists(os.path.join(inDir, 'signedannounce'))
62
# Scan the list of files in installers dir to get latest
63
instList = [fn for fn in os.listdir(srcInstalls)]
64
topVerInt,topVerStr,topVerType = getLatestVerFromList(instList)
67
def getPkgFilename(pkgName, offline=False):
68
if pkgName=='SHAFILE_TXT':
69
suffix = 'sha256sum.txt'
70
elif pkgName=='SHAFILE_ASC':
71
suffix = 'sha256sum.txt.asc'
73
suffixType = 'BundleSuffix' if offline else 'FileSuffix'
74
suffix = masterPkgList[pkgName][suffixType]
76
return 'armory_%s%s_%s' % (topVerStr, topVerType, suffix)
80
#uploads.sort(key=lambda x: x[1])
82
# Now actually execute the uploads and make them public
89
# Try to make things sorted properly
90
osSort = ['Windows', 'MacOSX', 'Ubuntu', 'RaspberryPi'][::-1]
95
for pkgName,pkgInfo in masterPkgList.iteritems():
96
if thisOS == pkgInfo['OSNameDisp']:
97
pkgPairs.append([pkgName,pkgInfo])
102
for pkgName,pkgInfo in pkgPairs:
104
pkgDict['SrcFile'] = getPkgFilename(pkgName)
105
pkgDict['SrcPath'] = os.path.join(inDir, 'installers', pkgDict['SrcFile'])
106
pkgDict['OSName'] = pkgInfo['OSNameDisp']
107
pkgDict['OSVar'] = pkgInfo['OSVarDisp']
108
pkgDict['OSArch'] = pkgInfo['OSArchDisp']
109
pkgDict['IsHash'] = False
110
pkgDict['IsBundle'] = False
111
pkgDict['DstUpload'] = '%s%s' % (s3Release, pkgDict['SrcFile'])
112
pkgDict['DownLink'] = '%s%s' % (htmlRelease, pkgDict['SrcFile'])
113
uploadsRegular.append(pkgDict)
115
if pkgInfo['HasBundle']:
117
pkgDict['SrcFile'] = getPkgFilename(pkgName, offline=True)
118
pkgDict['SrcPath'] = os.path.join(inDir, 'installers', pkgDict['SrcFile'])
119
pkgDict['OSName'] = pkgInfo['OSNameDisp']
120
pkgDict['OSVar'] = pkgInfo['BundleOSVar']
121
pkgDict['OSArch'] = pkgInfo['OSArchDisp']
122
pkgDict['IsHash'] = False
123
pkgDict['IsBundle'] = True
124
pkgDict['DstUpload'] = '%s%s' % (s3Release, pkgDict['SrcFile'])
125
pkgDict['DownLink'] = '%s%s' % (htmlRelease, pkgDict['SrcFile'])
126
uploadsOffline.append(pkgDict)
128
uploads = uploadsRegular + uploadsOffline
132
ascDict['SrcFile'] = getPkgFilename('SHAFILE_ASC')
133
ascDict['SrcPath'] = os.path.join(inDir, 'installers', ascDict['SrcFile'])
134
ascDict['IsHash'] = True
135
ascDict['IsBundle'] = False
136
ascDict['DstUpload'] = '%s%s' % (s3Release, ascDict['SrcFile'])
137
ascDict['DownLink'] = '%s%s' % (htmlRelease, ascDict['SrcFile'])
138
uploads.append(ascDict)
142
jsonOut['VersionStr'] = topVerStr + topVerType
143
jsonOut['ReleaseDate'] = datetime.fromtimestamp(time.time()).strftime("%B %d, %Y")
144
jsonOut['Downloads'] = uploads
146
print json.dumps(jsonOut, indent=4)
149
print 'Going to upload:'
150
for key,val in upl.iteritems():
151
print ' ', key.ljust(10), ':', val
156
for pkgDict in uploads:
158
#osStr, subOS, bits, vi, vs = fivevals
159
#print fullfn, fn, isbundle, ishash, osStr, subOS, bits, vi, vs
160
verFullStr = topVerStr + topVerType
162
humanText = 'Armory %s' % verFullStr
163
if pkgDict['IsBundle']:
164
humanText += ' Offline Bundle'
166
if pkgDict['IsHash']:
167
humanText += ': Signed hashes of all installers '
169
osParams = [pkgDict[a] for a in ['OSName', 'OSVar', 'OSArch']]
170
humanText += ' for %s %s (%s)' % tuple(osParams)
172
uploadurl = pkgDict['DstUpload']
173
linkurl = pkgDict['DownLink']
175
s3cmd = 's3cmd put --acl-public %s %s' % (pkgDict['SrcPath'], uploadurl)
176
forumText = '[url=%s]%s[/url]' % (linkurl, humanText)
177
htmlText = '<a href="%s">%s</a>' % (linkurl, humanText)
179
forumTextList.append(forumText)
180
htmlTextList.append(htmlText)
181
rawUrlList.append(linkurl)
182
s3cmdList.append(s3cmd)
185
announceDir = os.path.join(inDir, 'signedannounce')
186
for fn in os.listdir(announceDir):
187
fpath = os.path.join(announceDir, fn)
188
uploadurl = '%s%s' % (s3Announce, fn)
189
s3cmd = 's3cmd put --acl-public %s %s' % (fpath, uploadurl)
190
s3cmdList.append(s3cmd)
193
logprint('\nRAW URL LIST')
194
for txt in rawUrlList:
197
logprint('\nFORUM POSTING LINKS')
198
for txt in forumTextList:
201
logprint('\nWEBSITE POSTING LINKS')
202
for txt in htmlTextList:
205
logprint('\nS3CMD UPLOAD COMMANDS')
206
for txt in s3cmdList:
213
yn = raw_input('Continue with upload? [y/N]')
215
if yn.lower().startswith('y'):
216
logprint('STARTING UPLOADS')
217
for s3cmd in s3cmdList:
218
logprint('Uploading: ' + s3cmd.split()[-1].strip())
219
execAndWait(s3cmd, usepipes=False)
223
logprint('Not actually pushing the signed tag; do it manually --')
224
logprint('Copy the following command to push the tag:')
225
logprint(' cd %s/BitcoinArmory; git push origin v%s' % (inDir, verFullStr))