@@ -172,73 +172,24 @@ def download_binary(tag, args) -> int:
172172 return 0
173173
174174
175- def build_release (tag , args ) -> int :
176- githubUrl = "https://github.com/bitcoin/bitcoin"
177- if args .remove_dir :
178- if Path (tag ).is_dir ():
179- shutil .rmtree (tag )
180- if not Path (tag ).is_dir ():
181- # fetch new tags
182- subprocess .run (
183- ["git" , "fetch" , githubUrl , "--tags" ])
184- output = subprocess .check_output (['git' , 'tag' , '-l' , tag ])
185- if not output :
186- print ('Tag {} not found' .format (tag ))
187- return 1
188- ret = subprocess .run ([
189- 'git' , 'clone' , f'--branch={ tag } ' , '--depth=1' , githubUrl , tag
190- ]).returncode
191- if ret :
192- return ret
193- with pushd (tag ):
194- host = args .host
195- if args .depends :
196- with pushd ('depends' ):
197- ret = subprocess .run (['make' , 'NO_QT=1' ]).returncode
198- if ret :
199- return ret
200- host = os .environ .get (
201- 'HOST' , subprocess .check_output (['./config.guess' ]))
202- config_flags = '--prefix={pwd}/depends/{host} ' .format (
203- pwd = os .getcwd (),
204- host = host ) + args .config_flags
205- cmds = [
206- './autogen.sh' ,
207- './configure {}' .format (config_flags ),
208- 'make' ,
209- ]
210- for cmd in cmds :
211- ret = subprocess .run (cmd .split ()).returncode
212- if ret :
213- return ret
214- # Move binaries, so they're in the same place as in the
215- # release download
216- Path ('bin' ).mkdir (exist_ok = True )
217- files = ['bitcoind' , 'bitcoin-cli' , 'bitcoin-tx' ]
218- for f in files :
219- Path ('src/' + f ).rename ('bin/' + f )
220- return 0
221-
222-
223175def check_host (args ) -> int :
224176 args .host = os .environ .get ('HOST' , subprocess .check_output (
225177 './depends/config.guess' ).decode ())
226- if args .download_binary :
227- platforms = {
228- 'aarch64-*-linux*' : 'aarch64-linux-gnu' ,
229- 'powerpc64le-*-linux-*' : 'powerpc64le-linux-gnu' ,
230- 'riscv64-*-linux*' : 'riscv64-linux-gnu' ,
231- 'x86_64-*-linux*' : 'x86_64-linux-gnu' ,
232- 'x86_64-apple-darwin*' : 'x86_64-apple-darwin' ,
233- 'aarch64-apple-darwin*' : 'arm64-apple-darwin' ,
234- }
235- args .platform = ''
236- for pattern , target in platforms .items ():
237- if fnmatch (args .host , pattern ):
238- args .platform = target
239- if not args .platform :
240- print ('Not sure which binary to download for {}' .format (args .host ))
241- return 1
178+ platforms = {
179+ 'aarch64-*-linux*' : 'aarch64-linux-gnu' ,
180+ 'powerpc64le-*-linux-*' : 'powerpc64le-linux-gnu' ,
181+ 'riscv64-*-linux*' : 'riscv64-linux-gnu' ,
182+ 'x86_64-*-linux*' : 'x86_64-linux-gnu' ,
183+ 'x86_64-apple-darwin*' : 'x86_64-apple-darwin' ,
184+ 'aarch64-apple-darwin*' : 'arm64-apple-darwin' ,
185+ }
186+ args .platform = ''
187+ for pattern , target in platforms .items ():
188+ if fnmatch (args .host , pattern ):
189+ args .platform = target
190+ if not args .platform :
191+ print ('Not sure which binary to download for {}' .format (args .host ))
192+ return 1
242193 return 0
243194
244195
@@ -248,18 +199,9 @@ def main(args) -> int:
248199 ret = check_host (args )
249200 if ret :
250201 return ret
251- if args .download_binary :
252- with pushd (args .target_dir ):
253- for tag in args .tags :
254- ret = download_binary (tag , args )
255- if ret :
256- return ret
257- return 0
258- args .config_flags = os .environ .get ('CONFIG_FLAGS' , '' )
259- args .config_flags += ' --without-gui --disable-tests --disable-bench'
260202 with pushd (args .target_dir ):
261203 for tag in args .tags :
262- ret = build_release (tag , args )
204+ ret = download_binary (tag , args )
263205 if ret :
264206 return ret
265207 return 0
@@ -270,10 +212,6 @@ def main(args) -> int:
270212 formatter_class = argparse .ArgumentDefaultsHelpFormatter )
271213 parser .add_argument ('-r' , '--remove-dir' , action = 'store_true' ,
272214 help = 'remove existing directory.' )
273- parser .add_argument ('-d' , '--depends' , action = 'store_true' ,
274- help = 'use depends.' )
275- parser .add_argument ('-b' , '--download-binary' , action = 'store_true' ,
276- help = 'download release binary.' )
277215 parser .add_argument ('-t' , '--target-dir' , action = 'store' ,
278216 help = 'target directory.' , default = 'releases' )
279217 all_tags = sorted ([* set ([v ['tag' ] for v in SHA256_SUMS .values ()])])
0 commit comments