diff --git a/.travis.yml b/.travis.yml index 1280318a4..2b451f735 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,7 +27,7 @@ cache: before_install: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./packaging/travis/setup_osx.sh; fi - mkdir -p lbrynet/resources/ui - - ./packaging/travis/setup_qa.sh + - ./packaging/travis/setup_build.sh install: - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./packaging/travis/install_dependencies_and_run_tests.sh; fi diff --git a/packaging/travis/setup_qa.sh b/packaging/travis/setup_build.sh similarity index 67% rename from packaging/travis/setup_qa.sh rename to packaging/travis/setup_build.sh index 1192521a2..311dd57ec 100755 --- a/packaging/travis/setup_qa.sh +++ b/packaging/travis/setup_build.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Configure the library for a non-production release +# Configure build-specific things # set -euo pipefail @@ -13,12 +13,23 @@ add_ui() { wget https://s3.amazonaws.com/lbry-ui/development/data.json -O lbrynet/resources/ui/data.json } +set_build() { + local file="lbrynet/build_type.py" + # cannot use 'sed -i' because BSD sed and GNU sed are incompatible + sed 's/^\(BUILD = "\)[^"]\+\(".*\)$/\1'"${1}"'\2/' "$file" > tmpbuildfile + mv -- tmpbuildfile "$file" +} + IS_RC_REGEX="v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+-rc[[:digit:]]+" if [[ -z "$TRAVIS_TAG" ]]; then python packaging/append_sha_to_version.py lbrynet/__init__.py "${TRAVIS_COMMIT}" add_ui + set_build "qa" elif [[ "$TRAVIS_TAG" =~ $IS_RC_REGEX ]]; then # If the tag looks like v0.7.6-rc0 then this is a tagged release candidate. add_ui + set_build "rc" +else + set_build "release" fi diff --git a/packaging/windows/build.ps1 b/packaging/windows/build.ps1 index 83d3ec481..78a058b12 100644 --- a/packaging/windows/build.ps1 +++ b/packaging/windows/build.ps1 @@ -1,4 +1,4 @@ -# this is a port of setup_qa.sh used for the unix platforms +# this is a port of setup_build.sh used for the unix platforms function AddUi { wget https://s3.amazonaws.com/lbry-ui/development/dist.zip -OutFile dist.zip @@ -11,14 +11,24 @@ function AddUi { if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) } } +function SetBuild([string]$build) { + (Get-Content lbrynet\build_type.py).replace('dev', $build) | Set-Content lbrynet\build_type.py + if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) } +} + If (${Env:APPVEYOR_REPO_TAG} -NotMatch "true") { C:\Python27\python.exe packaging\append_sha_to_version.py lbrynet\__init__.py ${Env:APPVEYOR_REPO_COMMIT} if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) } AddUi + SetBuild "qa" } ElseIf (${Env:APPVEYOR_REPO_TAG_NAME} -Match "v\d+\.\d+\.\d+-rc\d+") { AddUi + SetBuild "rc" +} +Else { + SetBuild "release" } C:\Python27\python.exe setup.py build bdist_msi