Page MenuHomePhabricator

[electrum] use correct Electrum ABC version for DMG filename
ClosedPublic

Authored by PiRK on Jun 28 2023, 14:27.

Details

Summary

The version used to be computed using the most recent git tag. Now that we are in the monorepo, this yields the Bitcoin ABC version. Fix it by using electrum's setup.py

Use the same method also for the Appimage and the windows build (although they already detected the correct version), and move this version fetching where it is needed instead of forwarding it through an env variable to the dockers.

This deduplicates the version parsing code, which is now only done in electrum/electrumabc/version.py

Test Plan
contrib/build-wine/build.sh
contrib/build-linux/appimage/build.sh

On MacOS:

contrib/osx/make_osx

Check the release files use 5.2.5 in their filename.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

PiRK edited the test plan for this revision. (Show Details)

@bot electrum-functional-tests

Failed tests logs:

====== electrumabc.tests.regtest.test_rpc_misc.test_getunusedaddress ======
test setup failed
docker_compose_command = 'docker-compose'
docker_compose_file = '/work/electrum/electrumabc/tests/regtest/docker-compose.yml'
docker_compose_project_name = 'pytest19', docker_setup = 'up --build -d'
docker_cleanup = 'down -v'

    @pytest.fixture(scope="session")
    def docker_services(
        docker_compose_command,
        docker_compose_file,
        docker_compose_project_name,
        docker_setup,
        docker_cleanup,
    ):
        """Start all services from a docker compose file (`docker-compose up`).
        After test are finished, shutdown all services (`docker-compose down`)."""
    
>       with get_docker_services(
            docker_compose_command,
            docker_compose_file,
            docker_compose_project_name,
            docker_setup,
            docker_cleanup,
        ) as docker_service:

/usr/local/lib/python3.9/dist-packages/pytest_docker/plugin.py:221: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.9/contextlib.py:117: in __enter__
    return next(self.gen)
/usr/local/lib/python3.9/dist-packages/pytest_docker/plugin.py:199: in get_docker_services
    docker_compose.execute(docker_setup)
/usr/local/lib/python3.9/dist-packages/pytest_docker/plugin.py:129: in execute
    return execute(command)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

command = 'docker-compose -f "/work/electrum/electrumabc/tests/regtest/docker-compose.yml" -p "pytest19" up --build -d'
success_codes = (0,)

    def execute(command, success_codes=(0,)):
        """Run a shell command."""
        try:
            output = subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True)
            status = 0
        except subprocess.CalledProcessError as error:
            output = error.output or b""
            status = error.returncode
            command = error.cmd
    
        if status not in success_codes:
>           raise Exception(
                'Command {} returned {}: """{}""".'.format(
                    command, status, output.decode("utf-8")
                )
            )
E           Exception: Command docker-compose -f "/work/electrum/electrumabc/tests/regtest/docker-compose.yml" -p "pytest19" up --build -d returned 127: """/bin/sh: 1: docker-compose: not found
E           """.

/usr/local/lib/python3.9/dist-packages/pytest_docker/plugin.py:24: Exception
====== electrumabc.tests.regtest.test_rpc_misc.test_getservers ======
test setup failed
docker_compose_command = 'docker-compose'
docker_compose_file = '/work/electrum/electrumabc/tests/regtest/docker-compose.yml'
docker_compose_project_name = 'pytest19', docker_setup = 'up --build -d'
docker_cleanup = 'down -v'

    @pytest.fixture(scope="session")
    def docker_services(
        docker_compose_command,
        docker_compose_file,
        docker_compose_project_name,
        docker_setup,
        docker_cleanup,
    ):
        """Start all services from a docker compose file (`docker-compose up`).
        After test are finished, shutdown all services (`docker-compose down`)."""
    
>       with get_docker_services(
            docker_compose_command,
            docker_compose_file,
            docker_compose_project_name,
            docker_setup,
            docker_cleanup,
        ) as docker_service:

/usr/local/lib/python3.9/dist-packages/pytest_docker/plugin.py:221: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.9/contextlib.py:117: in __enter__
    return next(self.gen)
/usr/local/lib/python3.9/dist-packages/pytest_docker/plugin.py:199: in get_docker_services
    docker_compose.execute(docker_setup)
/usr/local/lib/python3.9/dist-packages/pytest_docker/plugin.py:129: in execute
    return execute(command)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

command = 'docker-compose -f "/work/electrum/electrumabc/tests/regtest/docker-compose.yml" -p "pytest19" up --build -d'
success_codes = (0,)

    def execute(command, success_codes=(0,)):
        """Run a shell command."""
        try:
            output = subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True)
            status = 0
        except subprocess.CalledProcessError as error:
            output = error.output or b""
            status = error.returncode
            command = error.cmd
    
        if status not in success_codes:
>           raise Exception(
                'Command {} returned {}: """{}""".'.format(
                    command, status, output.decode("utf-8")
                )
            )
E           Exception: Command docker-compose -f "/work/electrum/electrumabc/tests/regtest/docker-compose.yml" -p "pytest19" up --build -d returned 127: """/bin/sh: 1: docker-compose: not found
E           """.

/usr/local/lib/python3.9/dist-packages/pytest_docker/plugin.py:24: Exception
====== electrumabc.tests.regtest.test_rpc_misc.test_balance ======
test setup failed
docker_compose_command = 'docker-compose'
docker_compose_file = '/work/electrum/electrumabc/tests/regtest/docker-compose.yml'
docker_compose_project_name = 'pytest19', docker_setup = 'up --build -d'
docker_cleanup = 'down -v'

    @pytest.fixture(scope="session")
    def docker_services(
        docker_compose_command,
        docker_compose_file,
        docker_compose_project_name,
        docker_setup,
        docker_cleanup,
    ):
        """Start all services from a docker compose file (`docker-compose up`).
        After test are finished, shutdown all services (`docker-compose down`)."""
    
>       with get_docker_services(
            docker_compose_command,
            docker_compose_file,
            docker_compose_project_name,
            docker_setup,
            docker_cleanup,
        ) as docker_service:

/usr/local/lib/python3.9/dist-packages/pytest_docker/plugin.py:221: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.9/contextlib.py:117: in __enter__
    return next(self.gen)
/usr/local/lib/python3.9/dist-packages/pytest_docker/plugin.py:199: in get_docker_services
    docker_compose.execute(docker_setup)
/usr/local/lib/python3.9/dist-packages/pytest_docker/plugin.py:129: in execute
    return execute(command)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

command = 'docker-compose -f "/work/electrum/electrumabc/tests/regtest/docker-compose.yml" -p "pytest19" up --build -d'
success_codes = (0,)

    def execute(command, success_codes=(0,)):
        """Run a shell command."""
        try:
            output = subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True)
            status = 0
        except subprocess.CalledProcessError as error:
            output = error.output or b""
            status = error.returncode
            command = error.cmd
    
        if status not in success_codes:
>           raise Exception(
                'Command {} returned {}: """{}""".'.format(
                    command, status, output.decode("utf-8")
                )
            )
E           Exception: Command docker-compose -f "/work/electrum/electrumabc/tests/regtest/docker-compose.yml" -p "pytest19" up --build -d returned 127: """/bin/sh: 1: docker-compose: not found
E           """.

/usr/local/lib/python3.9/dist-packages/pytest_docker/plugin.py:24: Exception
====== electrumabc.tests.regtest.test_rpc_payment_request.test_addrequest ======
test setup failed
docker_compose_command = 'docker-compose'
docker_compose_file = '/work/electrum/electrumabc/tests/regtest/docker-compose.yml'
docker_compose_project_name = 'pytest19', docker_setup = 'up --build -d'
docker_cleanup = 'down -v'

    @pytest.fixture(scope="session")
    def docker_services(
        docker_compose_command,
        docker_compose_file,
        docker_compose_project_name,
        docker_setup,
        docker_cleanup,
    ):
        """Start all services from a docker compose file (`docker-compose up`).
        After test are finished, shutdown all services (`docker-compose down`)."""
    
>       with get_docker_services(
            docker_compose_command,
            docker_compose_file,
            docker_compose_project_name,
            docker_setup,
            docker_cleanup,
        ) as docker_service:

/usr/local/lib/python3.9/dist-packages/pytest_docker/plugin.py:221: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.9/contextlib.py:117: in __enter__
    return next(self.gen)
/usr/local/lib/python3.9/dist-packages/pytest_docker/plugin.py:199: in get_docker_services
    docker_compose.execute(docker_setup)
/usr/local/lib/python3.9/dist-packages/pytest_docker/plugin.py:129: in execute
    return execute(command)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

command = 'docker-compose -f "/work/electrum/electrumabc/tests/regtest/docker-compose.yml" -p "pytest19" up --build -d'
success_codes = (0,)

    def execute(command, success_codes=(0,)):
        """Run a shell command."""
        try:
            output = subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True)
            status = 0
        except subprocess.CalledProcessError as error:
            output = error.output or b""
            status = error.returncode
            command = error.cmd
    
        if status not in success_codes:
>           raise Exception(
                'Command {} returned {}: """{}""".'.format(
                    command, status, output.decode("utf-8")
                )
            )
E           Exception: Command docker-compose -f "/work/electrum/electrumabc/tests/regtest/docker-compose.yml" -p "pytest19" up --build -d returned 127: """/bin/sh: 1: docker-compose: not found
E           """.

/usr/local/lib/python3.9/dist-packages/pytest_docker/plugin.py:24: Exception

Each failure log is accessible here:
electrumabc.tests.regtest.test_rpc_misc.test_getunusedaddress
electrumabc.tests.regtest.test_rpc_misc.test_getservers
electrumabc.tests.regtest.test_rpc_misc.test_balance
electrumabc.tests.regtest.test_rpc_payment_request.test_addrequest

fix the appimage and wine scripts:

  • make setup.py --version work from any location, not only from the electrum root
  • remove "\r" on windows
  • run the setup.py after installing all build dependencies and before uninstalling them (next to pip install "${ELECTRUM_ROOT}")
PiRK published this revision for review.Jul 24 2023, 12:03

apply isort (remove extra blank line)

This revision is now accepted and ready to land.Jul 24 2023, 13:25