Merge pull request #469 from lbryio/build-fixes

Fix build and release system to store all daemon version settings in app/package.json
This commit is contained in:
Jeremy Kauffman 2017-08-10 22:47:41 -04:00 committed by GitHub
commit ce0dd5ae62
5 changed files with 33 additions and 21 deletions

View file

@ -20,6 +20,7 @@
"electron-rebuild": "^1.5.11"
},
"lbrySettings": {
"lbrynetDaemonVersion": "0.14.2"
"lbrynetDaemonVersion": "0.14.2",
"lbrynetDaemonUrlTemplate": "https://github.com/lbryio/lbry/releases/download/vDAEMONVER/lbrynet-daemon-vDAEMONVER-OSNAME.zip"
}
}

View file

@ -1 +0,0 @@
https://github.com/lbryio/lbry/releases/download/v0.14.2/lbrynet-daemon-v0.14.2-OSNAME.zip

View file

@ -29,7 +29,10 @@ cd ..
# get daemon and cli executable
$daemon_url = (Get-Content build\DAEMON_URL -Raw).replace("OSNAME", "windows")
$package_settings = (Get-Content app\package.json -Raw | ConvertFrom-Json).lbrySettings
$daemon_ver = $package_settings.lbrynetDaemonVersion
$daemon_url_template = $package_settings.lbrynetDaemonUrlTemplate
$daemon_url = $daemon_url_template.Replace('OSNAME', 'windows').Replace('DAEMONVER', $daemon_ver)
Invoke-WebRequest -Uri $daemon_url -OutFile daemon.zip
Expand-Archive daemon.zip -DestinationPath app\dist\
dir app\dist\ # verify that daemon binary is there

View file

@ -80,7 +80,8 @@ else
OSNAME="linux"
fi
DAEMON_VER=$(node -e "console.log(require(\"$ROOT/app/package.json\").lbrySettings.lbrynetDaemonVersion)")
DAEMON_URL="https://github.com/lbryio/lbry/releases/download/v${DAEMON_VER}/lbrynet-daemon-v${DAEMON_VER}-${OSNAME}.zip"
DAEMON_URL_TEMPLATE=$(node -e "console.log(require(\"$ROOT/app/package.json\").lbrySettings.lbrynetDaemonUrlTemplate)")
DAEMON_URL=$(echo ${DAEMON_URL_TEMPLATE//DAEMONVER/$DAEMON_VER} | sed "s/OSNAME/$OSNAME/g")
wget --quiet "$DAEMON_URL" -O "$BUILD_DIR/daemon.zip"
unzip "$BUILD_DIR/daemon.zip" -d "$ROOT/app/dist/"
rm "$BUILD_DIR/daemon.zip"

View file

@ -5,6 +5,7 @@ This script should be run locally, not on a build server.
import argparse
import contextlib
import os
import json
import re
import requests
import subprocess
@ -16,7 +17,7 @@ import github
import changelog
ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
DAEMON_URL_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'DAEMON_URL')
APP_PACKAGE_JSON_FILE = os.path.join(ROOT, 'app', 'package.json')
def main():
@ -38,11 +39,11 @@ def main():
print 'Current version: {}'.format(repo.current_version)
print 'New version: {}'.format(repo.new_version)
with open(DAEMON_URL_FILE, 'r') as f:
daemon_url_template = f.read().strip()
daemon_version = re.search('/(?P<version>v[^/]+)', daemon_url_template)
print 'Daemon version: {} ({})'.format(
daemon_version.group('version'), daemon_url_template)
with open(APP_PACKAGE_JSON_FILE, 'r') as f:
package_settings = json.load(f)['lbrySettings']
daemon_url_template = package_settings['lbrynetDaemonUrlTemplate']
daemon_version = package_settings['lbrynetDaemonVersion']
print 'Daemon version: {} ({})'.format(daemon_version, daemon_url_template.replace('DAEMONVER', daemon_version))
if not args.confirm and not confirm():
print "Aborting"
@ -190,18 +191,25 @@ def run_sanity_checks(repo, branch):
def check_daemon_urls():
success = True
with open(DAEMON_URL_FILE, 'r') as f:
daemon_url_template = f.read().strip()
if "OSNAME" not in daemon_url_template:
print "Daemon URL must include the string 'OSNAME'"
return False
for osname in ('linux', 'macos', 'windows'):
if not check_url(daemon_url_template.replace('OSNAME', osname)):
success = False
print "Daemon URL for " + osname + " does not work"
return success
with open(APP_PACKAGE_JSON_FILE, 'r') as f:
package_settings = json.load(f)['lbrySettings']
daemon_url_template = package_settings['lbrynetDaemonUrlTemplate']
daemon_version = package_settings['lbrynetDaemonVersion']
if "OSNAME" not in daemon_url_template:
print "Daemon URL must include the string \"OSNAME\""
return False
elif "DAEMONVER" not in daemon_url_template:
print "Daemon URL must include the string \"DAEMONVER\""
return False
for osname in ('linux', 'macos', 'windows'):
if not check_url(daemon_url_template.replace('DAEMONVER', daemon_version).replace('OSNAME', osname)):
print "Daemon URL for", osname, " does not work"
return False
return True
def check_url(url):
url = url.strip()