diff --git a/contrib/automation/hgautomation/linux.py b/contrib/automation/hgautomation/linux.py --- a/contrib/automation/hgautomation/linux.py +++ b/contrib/automation/hgautomation/linux.py @@ -1,597 +1,597 @@ # linux.py - Linux specific automation functionality # # Copyright 2019 Gregory Szorc # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. # no-check-code because Python 3 native. import os import pathlib import shlex import subprocess import tempfile from .ssh import exec_command # Linux distributions that are supported. DISTROS = { 'debian9', 'debian10', 'ubuntu18.04', 'ubuntu19.04', } INSTALL_PYTHONS = r''' PYENV2_VERSIONS="2.7.17 pypy2.7-7.2.0" PYENV3_VERSIONS="3.5.10 3.6.12 3.7.9 3.8.6 pypy3.5-7.0.0 pypy3.6-7.3.0" git clone https://github.com/pyenv/pyenv.git /hgdev/pyenv pushd /hgdev/pyenv git checkout 8bf79eb44ce1ea0a8b36544eb3e8a694a3a6ed78 popd export PYENV_ROOT="/hgdev/pyenv" export PATH="$PYENV_ROOT/bin:$PATH" # pip 19.2.3. PIP_SHA256=57e3643ff19f018f8a00dfaa6b7e4620e3c1a7a2171fd218425366ec006b3bfe wget -O get-pip.py --progress dot:mega https://github.com/pypa/get-pip/raw/309a56c5fd94bd1134053a541cb4657a4e47e09d/get-pip.py echo "${PIP_SHA256} get-pip.py" | sha256sum --check - VIRTUALENV_SHA256=f78d81b62d3147396ac33fc9d77579ddc42cc2a98dd9ea38886f616b33bc7fb2 VIRTUALENV_TARBALL=virtualenv-16.7.5.tar.gz wget -O ${VIRTUALENV_TARBALL} --progress dot:mega https://files.pythonhosted.org/packages/66/f0/6867af06d2e2f511e4e1d7094ff663acdebc4f15d4a0cb0fed1007395124/${VIRTUALENV_TARBALL} echo "${VIRTUALENV_SHA256} ${VIRTUALENV_TARBALL}" | sha256sum --check - for v in ${PYENV2_VERSIONS}; do pyenv install -v ${v} ${PYENV_ROOT}/versions/${v}/bin/python get-pip.py ${PYENV_ROOT}/versions/${v}/bin/pip install ${VIRTUALENV_TARBALL} ${PYENV_ROOT}/versions/${v}/bin/pip install -r /hgdev/requirements-py2.txt done for v in ${PYENV3_VERSIONS}; do pyenv install -v ${v} ${PYENV_ROOT}/versions/${v}/bin/python get-pip.py ${PYENV_ROOT}/versions/${v}/bin/pip install -r /hgdev/requirements-py3.txt done pyenv global ${PYENV2_VERSIONS} ${PYENV3_VERSIONS} system '''.lstrip().replace( '\r\n', '\n' ) INSTALL_RUST = r''' RUSTUP_INIT_SHA256=a46fe67199b7bcbbde2dcbc23ae08db6f29883e260e23899a88b9073effc9076 wget -O rustup-init --progress dot:mega https://static.rust-lang.org/rustup/archive/1.18.3/x86_64-unknown-linux-gnu/rustup-init echo "${RUSTUP_INIT_SHA256} rustup-init" | sha256sum --check - chmod +x rustup-init sudo -H -u hg -g hg ./rustup-init -y sudo -H -u hg -g hg /home/hg/.cargo/bin/rustup install 1.31.1 1.46.0 sudo -H -u hg -g hg /home/hg/.cargo/bin/rustup component add clippy -sudo -H -u hg -g hg /home/hg/.cargo/bin/cargo install --version 0.7.0 pyoxidizer +sudo -H -u hg -g hg /home/hg/.cargo/bin/cargo install --git https://github.com/indygreg/PyOxidizer.git --rev 4697fb25918dfad6dc73288daeea501063963a08 pyoxidizer ''' BOOTSTRAP_VIRTUALENV = r''' /usr/bin/virtualenv /hgdev/venv-bootstrap HG_SHA256=35fc8ba5e0379c1b3affa2757e83fb0509e8ac314cbd9f1fd133cf265d16e49f HG_TARBALL=mercurial-5.1.1.tar.gz wget -O ${HG_TARBALL} --progress dot:mega https://www.mercurial-scm.org/release/${HG_TARBALL} echo "${HG_SHA256} ${HG_TARBALL}" | sha256sum --check - /hgdev/venv-bootstrap/bin/pip install ${HG_TARBALL} '''.lstrip().replace( '\r\n', '\n' ) BOOTSTRAP_DEBIAN = ( r''' #!/bin/bash set -ex DISTRO=`grep DISTRIB_ID /etc/lsb-release | awk -F= '{{print $2}}'` DEBIAN_VERSION=`cat /etc/debian_version` LSB_RELEASE=`lsb_release -cs` sudo /usr/sbin/groupadd hg sudo /usr/sbin/groupadd docker sudo /usr/sbin/useradd -g hg -G sudo,docker -d /home/hg -m -s /bin/bash hg sudo mkdir /home/hg/.ssh sudo cp ~/.ssh/authorized_keys /home/hg/.ssh/authorized_keys sudo chown -R hg:hg /home/hg/.ssh sudo chmod 700 /home/hg/.ssh sudo chmod 600 /home/hg/.ssh/authorized_keys cat << EOF | sudo tee /etc/sudoers.d/90-hg hg ALL=(ALL) NOPASSWD:ALL EOF sudo apt-get update sudo DEBIAN_FRONTEND=noninteractive apt-get -yq dist-upgrade # Install packages necessary to set up Docker Apt repo. sudo DEBIAN_FRONTEND=noninteractive apt-get -yq install --no-install-recommends \ apt-transport-https \ gnupg cat > docker-apt-key << EOF -----BEGIN PGP PUBLIC KEY BLOCK----- mQINBFit2ioBEADhWpZ8/wvZ6hUTiXOwQHXMAlaFHcPH9hAtr4F1y2+OYdbtMuth lqqwp028AqyY+PRfVMtSYMbjuQuu5byyKR01BbqYhuS3jtqQmljZ/bJvXqnmiVXh 38UuLa+z077PxyxQhu5BbqntTPQMfiyqEiU+BKbq2WmANUKQf+1AmZY/IruOXbnq L4C1+gJ8vfmXQt99npCaxEjaNRVYfOS8QcixNzHUYnb6emjlANyEVlZzeqo7XKl7 UrwV5inawTSzWNvtjEjj4nJL8NsLwscpLPQUhTQ+7BbQXAwAmeHCUTQIvvWXqw0N cmhh4HgeQscQHYgOJjjDVfoY5MucvglbIgCqfzAHW9jxmRL4qbMZj+b1XoePEtht ku4bIQN1X5P07fNWzlgaRL5Z4POXDDZTlIQ/El58j9kp4bnWRCJW0lya+f8ocodo vZZ+Doi+fy4D5ZGrL4XEcIQP/Lv5uFyf+kQtl/94VFYVJOleAv8W92KdgDkhTcTD G7c0tIkVEKNUq48b3aQ64NOZQW7fVjfoKwEZdOqPE72Pa45jrZzvUFxSpdiNk2tZ XYukHjlxxEgBdC/J3cMMNRE1F4NCA3ApfV1Y7/hTeOnmDuDYwr9/obA8t016Yljj q5rdkywPf4JF8mXUW5eCN1vAFHxeg9ZWemhBtQmGxXnw9M+z6hWwc6ahmwARAQAB tCtEb2NrZXIgUmVsZWFzZSAoQ0UgZGViKSA8ZG9ja2VyQGRvY2tlci5jb20+iQI3 BBMBCgAhBQJYrefAAhsvBQsJCAcDBRUKCQgLBRYCAwEAAh4BAheAAAoJEI2BgDwO v82IsskP/iQZo68flDQmNvn8X5XTd6RRaUH33kXYXquT6NkHJciS7E2gTJmqvMqd tI4mNYHCSEYxI5qrcYV5YqX9P6+Ko+vozo4nseUQLPH/ATQ4qL0Zok+1jkag3Lgk jonyUf9bwtWxFp05HC3GMHPhhcUSexCxQLQvnFWXD2sWLKivHp2fT8QbRGeZ+d3m 6fqcd5Fu7pxsqm0EUDK5NL+nPIgYhN+auTrhgzhK1CShfGccM/wfRlei9Utz6p9P XRKIlWnXtT4qNGZNTN0tR+NLG/6Bqd8OYBaFAUcue/w1VW6JQ2VGYZHnZu9S8LMc FYBa5Ig9PxwGQOgq6RDKDbV+PqTQT5EFMeR1mrjckk4DQJjbxeMZbiNMG5kGECA8 g383P3elhn03WGbEEa4MNc3Z4+7c236QI3xWJfNPdUbXRaAwhy/6rTSFbzwKB0Jm ebwzQfwjQY6f55MiI/RqDCyuPj3r3jyVRkK86pQKBAJwFHyqj9KaKXMZjfVnowLh 9svIGfNbGHpucATqREvUHuQbNnqkCx8VVhtYkhDb9fEP2xBu5VvHbR+3nfVhMut5 G34Ct5RS7Jt6LIfFdtcn8CaSas/l1HbiGeRgc70X/9aYx/V/CEJv0lIe8gP6uDoW FPIZ7d6vH+Vro6xuWEGiuMaiznap2KhZmpkgfupyFmplh0s6knymuQINBFit2ioB EADneL9S9m4vhU3blaRjVUUyJ7b/qTjcSylvCH5XUE6R2k+ckEZjfAMZPLpO+/tF M2JIJMD4SifKuS3xck9KtZGCufGmcwiLQRzeHF7vJUKrLD5RTkNi23ydvWZgPjtx Q+DTT1Zcn7BrQFY6FgnRoUVIxwtdw1bMY/89rsFgS5wwuMESd3Q2RYgb7EOFOpnu w6da7WakWf4IhnF5nsNYGDVaIHzpiqCl+uTbf1epCjrOlIzkZ3Z3Yk5CM/TiFzPk z2lLz89cpD8U+NtCsfagWWfjd2U3jDapgH+7nQnCEWpROtzaKHG6lA3pXdix5zG8 eRc6/0IbUSWvfjKxLLPfNeCS2pCL3IeEI5nothEEYdQH6szpLog79xB9dVnJyKJb VfxXnseoYqVrRz2VVbUI5Blwm6B40E3eGVfUQWiux54DspyVMMk41Mx7QJ3iynIa 1N4ZAqVMAEruyXTRTxc9XW0tYhDMA/1GYvz0EmFpm8LzTHA6sFVtPm/ZlNCX6P1X zJwrv7DSQKD6GGlBQUX+OeEJ8tTkkf8QTJSPUdh8P8YxDFS5EOGAvhhpMBYD42kQ pqXjEC+XcycTvGI7impgv9PDY1RCC1zkBjKPa120rNhv/hkVk/YhuGoajoHyy4h7 ZQopdcMtpN2dgmhEegny9JCSwxfQmQ0zK0g7m6SHiKMwjwARAQABiQQ+BBgBCAAJ BQJYrdoqAhsCAikJEI2BgDwOv82IwV0gBBkBCAAGBQJYrdoqAAoJEH6gqcPyc/zY 1WAP/2wJ+R0gE6qsce3rjaIz58PJmc8goKrir5hnElWhPgbq7cYIsW5qiFyLhkdp YcMmhD9mRiPpQn6Ya2w3e3B8zfIVKipbMBnke/ytZ9M7qHmDCcjoiSmwEXN3wKYI mD9VHONsl/CG1rU9Isw1jtB5g1YxuBA7M/m36XN6x2u+NtNMDB9P56yc4gfsZVES KA9v+yY2/l45L8d/WUkUi0YXomn6hyBGI7JrBLq0CX37GEYP6O9rrKipfz73XfO7 JIGzOKZlljb/D9RX/g7nRbCn+3EtH7xnk+TK/50euEKw8SMUg147sJTcpQmv6UzZ cM4JgL0HbHVCojV4C/plELwMddALOFeYQzTif6sMRPf+3DSj8frbInjChC3yOLy0 6br92KFom17EIj2CAcoeq7UPhi2oouYBwPxh5ytdehJkoo+sN7RIWua6P2WSmon5 U888cSylXC0+ADFdgLX9K2zrDVYUG1vo8CX0vzxFBaHwN6Px26fhIT1/hYUHQR1z VfNDcyQmXqkOnZvvoMfz/Q0s9BhFJ/zU6AgQbIZE/hm1spsfgvtsD1frZfygXJ9f irP+MSAI80xHSf91qSRZOj4Pl3ZJNbq4yYxv0b1pkMqeGdjdCYhLU+LZ4wbQmpCk SVe2prlLureigXtmZfkqevRz7FrIZiu9ky8wnCAPwC7/zmS18rgP/17bOtL4/iIz QhxAAoAMWVrGyJivSkjhSGx1uCojsWfsTAm11P7jsruIL61ZzMUVE2aM3Pmj5G+W 9AcZ58Em+1WsVnAXdUR//bMmhyr8wL/G1YO1V3JEJTRdxsSxdYa4deGBBY/Adpsw 24jxhOJR+lsJpqIUeb999+R8euDhRHG9eFO7DRu6weatUJ6suupoDTRWtr/4yGqe dKxV3qQhNLSnaAzqW/1nA3iUB4k7kCaKZxhdhDbClf9P37qaRW467BLCVO/coL3y Vm50dwdrNtKpMBh3ZpbB1uJvgi9mXtyBOMJ3v8RZeDzFiG8HdCtg9RvIt/AIFoHR H3S+U79NT6i0KPzLImDfs8T7RlpyuMc4Ufs8ggyg9v3Ae6cN3eQyxcK3w0cbBwsh /nQNfsA6uu+9H7NhbehBMhYnpNZyrHzCmzyXkauwRAqoCbGCNykTRwsur9gS41TQ M8ssD1jFheOJf3hODnkKU+HKjvMROl1DK7zdmLdNzA1cvtZH/nCC9KPj1z8QC47S xx+dTZSx4ONAhwbS/LN3PoKtn8LPjY9NP9uDWI+TWYquS2U+KHDrBDlsgozDbs/O jCxcpDzNmXpWQHEtHU7649OXHP7UeNST1mCUCH5qdank0V1iejF6/CfTFU4MfcrG YT90qFF93M3v01BbxP+EIY2/9tiIPbrd =0YYh -----END PGP PUBLIC KEY BLOCK----- EOF sudo apt-key add docker-apt-key if [ "$LSB_RELEASE" = "stretch" ]; then cat << EOF | sudo tee -a /etc/apt/sources.list # Need backports for clang-format-6.0 deb http://deb.debian.org/debian stretch-backports main EOF fi if [ "$LSB_RELEASE" = "stretch" -o "$LSB_RELEASE" = "buster" ]; then cat << EOF | sudo tee -a /etc/apt/sources.list # Sources are useful if we want to compile things locally. deb-src http://deb.debian.org/debian $LSB_RELEASE main deb-src http://security.debian.org/debian-security $LSB_RELEASE/updates main deb-src http://deb.debian.org/debian $LSB_RELEASE-updates main deb-src http://deb.debian.org/debian $LSB_RELEASE-backports main deb [arch=amd64] https://download.docker.com/linux/debian $LSB_RELEASE stable EOF elif [ "$DISTRO" = "Ubuntu" ]; then cat << EOF | sudo tee -a /etc/apt/sources.list deb [arch=amd64] https://download.docker.com/linux/ubuntu $LSB_RELEASE stable EOF fi sudo apt-get update PACKAGES="\ awscli \ btrfs-progs \ build-essential \ bzr \ clang-format-6.0 \ cvs \ darcs \ debhelper \ devscripts \ docker-ce \ dpkg-dev \ dstat \ emacs \ gettext \ git \ htop \ iotop \ jfsutils \ libbz2-dev \ libexpat1-dev \ libffi-dev \ libgdbm-dev \ liblzma-dev \ libncurses5-dev \ libnss3-dev \ libreadline-dev \ libsqlite3-dev \ libssl-dev \ netbase \ ntfs-3g \ nvme-cli \ pyflakes \ pyflakes3 \ pylint \ pylint3 \ python-all-dev \ python-dev \ python-docutils \ python-fuzzywuzzy \ python-pygments \ python-subversion \ python-vcr \ python3-boto3 \ python3-dev \ python3-docutils \ python3-fuzzywuzzy \ python3-pygments \ python3-vcr \ python3-venv \ rsync \ sqlite3 \ subversion \ tcl-dev \ tk-dev \ tla \ unzip \ uuid-dev \ vim \ virtualenv \ wget \ xfsprogs \ zip \ zlib1g-dev" if [ "LSB_RELEASE" = "stretch" ]; then PACKAGES="$PACKAGES linux-perf" elif [ "$DISTRO" = "Ubuntu" ]; then PACKAGES="$PACKAGES linux-tools-common" fi # Monotone only available in older releases. if [ "$LSB_RELEASE" = "stretch" -o "$LSB_RELEASE" = "xenial" ]; then PACKAGES="$PACKAGES monotone" fi sudo DEBIAN_FRONTEND=noninteractive apt-get -yq install --no-install-recommends $PACKAGES # Create clang-format symlink so test harness finds it. sudo update-alternatives --install /usr/bin/clang-format clang-format \ /usr/bin/clang-format-6.0 1000 sudo mkdir /hgdev # Will be normalized to hg:hg later. sudo chown `whoami` /hgdev {install_rust} cp requirements-py2.txt /hgdev/requirements-py2.txt cp requirements-py3.txt /hgdev/requirements-py3.txt # Disable the pip version check because it uses the network and can # be annoying. cat << EOF | sudo tee -a /etc/pip.conf [global] disable-pip-version-check = True EOF {install_pythons} {bootstrap_virtualenv} /hgdev/venv-bootstrap/bin/hg clone https://www.mercurial-scm.org/repo/hg /hgdev/src # Mark the repo as non-publishing. cat >> /hgdev/src/.hg/hgrc << EOF [phases] publish = false EOF sudo chown -R hg:hg /hgdev '''.lstrip() .format( install_rust=INSTALL_RUST, install_pythons=INSTALL_PYTHONS, bootstrap_virtualenv=BOOTSTRAP_VIRTUALENV, ) .replace('\r\n', '\n') ) # Prepares /hgdev for operations. PREPARE_HGDEV = ''' #!/bin/bash set -e FS=$1 ensure_device() { if [ -z "${DEVICE}" ]; then echo "could not find block device to format" exit 1 fi } # Determine device to partition for extra filesystem. # If only 1 volume is present, it will be the root volume and # should be /dev/nvme0. If multiple volumes are present, the # root volume could be nvme0 or nvme1. Use whichever one doesn't have # a partition. if [ -e /dev/nvme1n1 ]; then if [ -e /dev/nvme0n1p1 ]; then DEVICE=/dev/nvme1n1 else DEVICE=/dev/nvme0n1 fi else DEVICE= fi sudo mkdir /hgwork if [ "${FS}" != "default" -a "${FS}" != "tmpfs" ]; then ensure_device echo "creating ${FS} filesystem on ${DEVICE}" fi if [ "${FS}" = "default" ]; then : elif [ "${FS}" = "btrfs" ]; then sudo mkfs.btrfs ${DEVICE} sudo mount ${DEVICE} /hgwork elif [ "${FS}" = "ext3" ]; then # lazy_journal_init speeds up filesystem creation at the expense of # integrity if things crash. We are an ephemeral instance, so we don't # care about integrity. sudo mkfs.ext3 -E lazy_journal_init=1 ${DEVICE} sudo mount ${DEVICE} /hgwork elif [ "${FS}" = "ext4" ]; then sudo mkfs.ext4 -E lazy_journal_init=1 ${DEVICE} sudo mount ${DEVICE} /hgwork elif [ "${FS}" = "jfs" ]; then sudo mkfs.jfs ${DEVICE} sudo mount ${DEVICE} /hgwork elif [ "${FS}" = "tmpfs" ]; then echo "creating tmpfs volume in /hgwork" sudo mount -t tmpfs -o size=1024M tmpfs /hgwork elif [ "${FS}" = "xfs" ]; then sudo mkfs.xfs ${DEVICE} sudo mount ${DEVICE} /hgwork else echo "unsupported filesystem: ${FS}" exit 1 fi echo "/hgwork ready" sudo chown hg:hg /hgwork mkdir /hgwork/tmp chown hg:hg /hgwork/tmp rsync -a /hgdev/src /hgwork/ '''.lstrip().replace( '\r\n', '\n' ) HG_UPDATE_CLEAN = ''' set -ex HG=/hgdev/venv-bootstrap/bin/hg cd /hgwork/src ${HG} --config extensions.purge= purge --all ${HG} update -C $1 ${HG} log -r . '''.lstrip().replace( '\r\n', '\n' ) def prepare_exec_environment(ssh_client, filesystem='default'): """Prepare an EC2 instance to execute things. The AMI has an ``/hgdev`` bootstrapped with various Python installs and a clone of the Mercurial repo. In EC2, EBS volumes launched from snapshots have wonky performance behavior. Notably, blocks have to be copied on first access, which makes volume I/O extremely slow on fresh volumes. Furthermore, we may want to run operations, tests, etc on alternative filesystems so we examine behavior on different filesystems. This function is used to facilitate executing operations on alternate volumes. """ sftp = ssh_client.open_sftp() with sftp.open('/hgdev/prepare-hgdev', 'wb') as fh: fh.write(PREPARE_HGDEV) fh.chmod(0o0777) command = 'sudo /hgdev/prepare-hgdev %s' % filesystem chan, stdin, stdout = exec_command(ssh_client, command) stdin.close() for line in stdout: print(line, end='') res = chan.recv_exit_status() if res: raise Exception('non-0 exit code updating working directory; %d' % res) def synchronize_hg( source_path: pathlib.Path, ec2_instance, revision: str = None ): """Synchronize a local Mercurial source path to remote EC2 instance.""" with tempfile.TemporaryDirectory() as temp_dir: temp_dir = pathlib.Path(temp_dir) ssh_dir = temp_dir / '.ssh' ssh_dir.mkdir() ssh_dir.chmod(0o0700) public_ip = ec2_instance.public_ip_address ssh_config = ssh_dir / 'config' with ssh_config.open('w', encoding='utf-8') as fh: fh.write('Host %s\n' % public_ip) fh.write(' User hg\n') fh.write(' StrictHostKeyChecking no\n') fh.write(' UserKnownHostsFile %s\n' % (ssh_dir / 'known_hosts')) fh.write(' IdentityFile %s\n' % ec2_instance.ssh_private_key_path) if not (source_path / '.hg').is_dir(): raise Exception( '%s is not a Mercurial repository; synchronization ' 'not yet supported' % source_path ) env = dict(os.environ) env['HGPLAIN'] = '1' env['HGENCODING'] = 'utf-8' hg_bin = source_path / 'hg' res = subprocess.run( ['python2.7', str(hg_bin), 'log', '-r', revision, '-T', '{node}'], cwd=str(source_path), env=env, check=True, capture_output=True, ) full_revision = res.stdout.decode('ascii') args = [ 'python2.7', str(hg_bin), '--config', 'ui.ssh=ssh -F %s' % ssh_config, '--config', 'ui.remotecmd=/hgdev/venv-bootstrap/bin/hg', # Also ensure .hgtags changes are present so auto version # calculation works. 'push', '-f', '-r', full_revision, '-r', 'file(.hgtags)', 'ssh://%s//hgwork/src' % public_ip, ] res = subprocess.run(args, cwd=str(source_path), env=env) # Allow 1 (no-op) to not trigger error. if res.returncode not in (0, 1): res.check_returncode() # TODO support synchronizing dirty working directory. sftp = ec2_instance.ssh_client.open_sftp() with sftp.open('/hgdev/hgup', 'wb') as fh: fh.write(HG_UPDATE_CLEAN) fh.chmod(0o0700) chan, stdin, stdout = exec_command( ec2_instance.ssh_client, '/hgdev/hgup %s' % full_revision ) stdin.close() for line in stdout: print(line, end='') res = chan.recv_exit_status() if res: raise Exception( 'non-0 exit code updating working directory; %d' % res ) def run_tests(ssh_client, python_version, test_flags=None): """Run tests on a remote Linux machine via an SSH client.""" test_flags = test_flags or [] print('running tests') if python_version == 'system2': python = '/usr/bin/python2' elif python_version == 'system3': python = '/usr/bin/python3' elif python_version.startswith('pypy'): python = '/hgdev/pyenv/shims/%s' % python_version else: python = '/hgdev/pyenv/shims/python%s' % python_version test_flags = ' '.join(shlex.quote(a) for a in test_flags) command = ( '/bin/sh -c "export TMPDIR=/hgwork/tmp; ' 'cd /hgwork/src/tests && %s run-tests.py %s"' % (python, test_flags) ) chan, stdin, stdout = exec_command(ssh_client, command) stdin.close() for line in stdout: print(line, end='') return chan.recv_exit_status() diff --git a/contrib/install-windows-dependencies.ps1 b/contrib/install-windows-dependencies.ps1 --- a/contrib/install-windows-dependencies.ps1 +++ b/contrib/install-windows-dependencies.ps1 @@ -1,220 +1,220 @@ # install-dependencies.ps1 - Install Windows dependencies for building Mercurial # # Copyright 2019 Gregory Szorc # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. # This script can be used to bootstrap a Mercurial build environment on # Windows. # # The script makes a lot of assumptions about how things should work. # For example, the install location of Python is hardcoded to c:\hgdev\*. # # The script should be executed from a PowerShell with elevated privileges # if you don't want to see a UAC prompt for various installers. # # The script is tested on Windows 10 and Windows Server 2019 (in EC2). $VS_BUILD_TOOLS_URL = "https://download.visualstudio.microsoft.com/download/pr/a1603c02-8a66-4b83-b821-811e3610a7c4/aa2db8bb39e0cbd23e9940d8951e0bc3/vs_buildtools.exe" $VS_BUILD_TOOLS_SHA256 = "911E292B8E6E5F46CBC17003BDCD2D27A70E616E8D5E6E69D5D489A605CAA139" $VC9_PYTHON_URL = "https://download.microsoft.com/download/7/9/6/796EF2E4-801B-4FC4-AB28-B59FBF6D907B/VCForPython27.msi" $VC9_PYTHON_SHA256 = "070474db76a2e625513a5835df4595df9324d820f9cc97eab2a596dcbc2f5cbf" $PYTHON27_x64_URL = "https://www.python.org/ftp/python/2.7.18/python-2.7.18.amd64.msi" $PYTHON27_x64_SHA256 = "b74a3afa1e0bf2a6fc566a7b70d15c9bfabba3756fb077797d16fffa27800c05" $PYTHON27_X86_URL = "https://www.python.org/ftp/python/2.7.18/python-2.7.18.msi" $PYTHON27_X86_SHA256 = "d901802e90026e9bad76b8a81f8dd7e43c7d7e8269d9281c9e9df7a9c40480a9" $PYTHON35_x86_URL = "https://www.python.org/ftp/python/3.5.4/python-3.5.4.exe" $PYTHON35_x86_SHA256 = "F27C2D67FD9688E4970F3BFF799BB9D722A0D6C2C13B04848E1F7D620B524B0E" $PYTHON35_x64_URL = "https://www.python.org/ftp/python/3.5.4/python-3.5.4-amd64.exe" $PYTHON35_x64_SHA256 = "9B7741CC32357573A77D2EE64987717E527628C38FD7EAF3E2AACA853D45A1EE" $PYTHON36_x86_URL = "https://www.python.org/ftp/python/3.6.8/python-3.6.8.exe" $PYTHON36_x86_SHA256 = "89871D432BC06E4630D7B64CB1A8451E53C80E68DE29029976B12AAD7DBFA5A0" $PYTHON36_x64_URL = "https://www.python.org/ftp/python/3.6.8/python-3.6.8-amd64.exe" $PYTHON36_x64_SHA256 = "96088A58B7C43BC83B84E6B67F15E8706C614023DD64F9A5A14E81FF824ADADC" $PYTHON37_x86_URL = "https://www.python.org/ftp/python/3.7.9/python-3.7.9.exe" $PYTHON37_x86_SHA256 = "769bb7c74ad1df6d7d74071cc16a984ff6182e4016e11b8949b93db487977220" $PYTHON37_X64_URL = "https://www.python.org/ftp/python/3.7.9/python-3.7.9-amd64.exe" $PYTHON37_x64_SHA256 = "e69ed52afb5a722e5c56f6c21d594e85c17cb29f12f18bb69751cf1714e0f987" $PYTHON38_x86_URL = "https://www.python.org/ftp/python/3.8.6/python-3.8.6.exe" $PYTHON38_x86_SHA256 = "287d5df01ff22ff09e6a487ae018603ee19eade71d462ec703850c96f1d5e8a0" $PYTHON38_x64_URL = "https://www.python.org/ftp/python/3.8.6/python-3.8.6-amd64.exe" $PYTHON38_x64_SHA256 = "328a257f189cb500606bb26ab0fbdd298ed0e05d8c36540a322a1744f489a0a0" # PIP 19.2.3. $PIP_URL = "https://github.com/pypa/get-pip/raw/309a56c5fd94bd1134053a541cb4657a4e47e09d/get-pip.py" $PIP_SHA256 = "57e3643ff19f018f8a00dfaa6b7e4620e3c1a7a2171fd218425366ec006b3bfe" $VIRTUALENV_URL = "https://files.pythonhosted.org/packages/66/f0/6867af06d2e2f511e4e1d7094ff663acdebc4f15d4a0cb0fed1007395124/virtualenv-16.7.5.tar.gz" $VIRTUALENV_SHA256 = "f78d81b62d3147396ac33fc9d77579ddc42cc2a98dd9ea38886f616b33bc7fb2" $INNO_SETUP_URL = "http://files.jrsoftware.org/is/5/innosetup-5.6.1-unicode.exe" $INNO_SETUP_SHA256 = "27D49E9BC769E9D1B214C153011978DB90DC01C2ACD1DDCD9ED7B3FE3B96B538" $MINGW_BIN_URL = "https://osdn.net/frs/redir.php?m=constant&f=mingw%2F68260%2Fmingw-get-0.6.3-mingw32-pre-20170905-1-bin.zip" $MINGW_BIN_SHA256 = "2AB8EFD7C7D1FC8EAF8B2FA4DA4EEF8F3E47768284C021599BC7435839A046DF" $MERCURIAL_WHEEL_FILENAME = "mercurial-5.1.2-cp27-cp27m-win_amd64.whl" $MERCURIAL_WHEEL_URL = "https://files.pythonhosted.org/packages/6d/47/e031e47f7fe9b16e4e3383da47e2b0a7eae6e603996bc67a03ec4fa1b3f4/$MERCURIAL_WHEEL_FILENAME" $MERCURIAL_WHEEL_SHA256 = "1d18c7f6ca1456f0f62ee65c9a50c14cbba48ce6e924930cdb10537f5c9eaf5f" $RUSTUP_INIT_URL = "https://static.rust-lang.org/rustup/archive/1.21.1/x86_64-pc-windows-gnu/rustup-init.exe" $RUSTUP_INIT_SHA256 = "d17df34ba974b9b19cf5c75883a95475aa22ddc364591d75d174090d55711c72" # Writing progress slows down downloads substantially. So disable it. $progressPreference = 'silentlyContinue' function Secure-Download($url, $path, $sha256) { if (Test-Path -Path $path) { Get-FileHash -Path $path -Algorithm SHA256 -OutVariable hash if ($hash.Hash -eq $sha256) { Write-Output "SHA256 of $path verified as $sha256" return } Write-Output "hash mismatch on $path; downloading again" } Write-Output "downloading $url to $path" Invoke-WebRequest -Uri $url -OutFile $path Get-FileHash -Path $path -Algorithm SHA256 -OutVariable hash if ($hash.Hash -ne $sha256) { Remove-Item -Path $path throw "hash mismatch when downloading $url; got $($hash.Hash), expected $sha256" } } function Invoke-Process($path, $arguments) { $p = Start-Process -FilePath $path -ArgumentList $arguments -Wait -PassThru -WindowStyle Hidden if ($p.ExitCode -ne 0) { throw "process exited non-0: $($p.ExitCode)" } } function Install-Python3($name, $installer, $dest, $pip) { Write-Output "installing $name" # We hit this when running the script as part of Simple Systems Manager in # EC2. The Python 3 installer doesn't seem to like per-user installs # when running as the SYSTEM user. So enable global installs if executed in # this mode. if ($env:USERPROFILE -eq "C:\Windows\system32\config\systemprofile") { Write-Output "running with SYSTEM account; installing for all users" $allusers = "1" } else { $allusers = "0" } Invoke-Process $installer "/quiet TargetDir=${dest} InstallAllUsers=${allusers} AssociateFiles=0 CompileAll=0 PrependPath=0 Include_doc=0 Include_launcher=0 InstallLauncherAllUsers=0 Include_pip=0 Include_test=0" Invoke-Process ${dest}\python.exe $pip } function Install-Rust($prefix) { Write-Output "installing Rust" $Env:RUSTUP_HOME = "${prefix}\rustup" $Env:CARGO_HOME = "${prefix}\cargo" Invoke-Process "${prefix}\assets\rustup-init.exe" "-y --default-host x86_64-pc-windows-msvc" Invoke-Process "${prefix}\cargo\bin\rustup.exe" "target add i686-pc-windows-msvc" Invoke-Process "${prefix}\cargo\bin\rustup.exe" "install 1.46.0" Invoke-Process "${prefix}\cargo\bin\rustup.exe" "component add clippy" # Install PyOxidizer for packaging. - Invoke-Process "${prefix}\cargo\bin\cargo.exe" "install --version 0.7.0 pyoxidizer" + Invoke-Process "${prefix}\cargo\bin\cargo.exe" "install --git https://github.com/indygreg/PyOxidizer.git --rev 4697fb25918dfad6dc73288daeea501063963a08 pyoxidizer" } function Install-Dependencies($prefix) { if (!(Test-Path -Path $prefix\assets)) { New-Item -Path $prefix\assets -ItemType Directory } $pip = "${prefix}\assets\get-pip.py" Secure-Download $VC9_PYTHON_URL ${prefix}\assets\VCForPython27.msi $VC9_PYTHON_SHA256 Secure-Download $PYTHON27_x86_URL ${prefix}\assets\python27-x86.msi $PYTHON27_x86_SHA256 Secure-Download $PYTHON27_x64_URL ${prefix}\assets\python27-x64.msi $PYTHON27_x64_SHA256 Secure-Download $PYTHON35_x86_URL ${prefix}\assets\python35-x86.exe $PYTHON35_x86_SHA256 Secure-Download $PYTHON35_x64_URL ${prefix}\assets\python35-x64.exe $PYTHON35_x64_SHA256 Secure-Download $PYTHON36_x86_URL ${prefix}\assets\python36-x86.exe $PYTHON36_x86_SHA256 Secure-Download $PYTHON36_x64_URL ${prefix}\assets\python36-x64.exe $PYTHON36_x64_SHA256 Secure-Download $PYTHON37_x86_URL ${prefix}\assets\python37-x86.exe $PYTHON37_x86_SHA256 Secure-Download $PYTHON37_x64_URL ${prefix}\assets\python37-x64.exe $PYTHON37_x64_SHA256 Secure-Download $PYTHON38_x86_URL ${prefix}\assets\python38-x86.exe $PYTHON38_x86_SHA256 Secure-Download $PYTHON38_x64_URL ${prefix}\assets\python38-x64.exe $PYTHON38_x64_SHA256 Secure-Download $PIP_URL ${pip} $PIP_SHA256 Secure-Download $VIRTUALENV_URL ${prefix}\assets\virtualenv.tar.gz $VIRTUALENV_SHA256 Secure-Download $VS_BUILD_TOOLS_URL ${prefix}\assets\vs_buildtools.exe $VS_BUILD_TOOLS_SHA256 Secure-Download $INNO_SETUP_URL ${prefix}\assets\InnoSetup.exe $INNO_SETUP_SHA256 Secure-Download $MINGW_BIN_URL ${prefix}\assets\mingw-get-bin.zip $MINGW_BIN_SHA256 Secure-Download $MERCURIAL_WHEEL_URL ${prefix}\assets\${MERCURIAL_WHEEL_FILENAME} $MERCURIAL_WHEEL_SHA256 Secure-Download $RUSTUP_INIT_URL ${prefix}\assets\rustup-init.exe $RUSTUP_INIT_SHA256 Write-Output "installing Python 2.7 32-bit" Invoke-Process msiexec.exe "/i ${prefix}\assets\python27-x86.msi /l* ${prefix}\assets\python27-x86.log /q TARGETDIR=${prefix}\python27-x86 ALLUSERS=" Invoke-Process ${prefix}\python27-x86\python.exe ${prefix}\assets\get-pip.py Invoke-Process ${prefix}\python27-x86\Scripts\pip.exe "install ${prefix}\assets\virtualenv.tar.gz" Write-Output "installing Python 2.7 64-bit" Invoke-Process msiexec.exe "/i ${prefix}\assets\python27-x64.msi /l* ${prefix}\assets\python27-x64.log /q TARGETDIR=${prefix}\python27-x64 ALLUSERS=" Invoke-Process ${prefix}\python27-x64\python.exe ${prefix}\assets\get-pip.py Invoke-Process ${prefix}\python27-x64\Scripts\pip.exe "install ${prefix}\assets\virtualenv.tar.gz" Install-Python3 "Python 3.5 32-bit" ${prefix}\assets\python35-x86.exe ${prefix}\python35-x86 ${pip} Install-Python3 "Python 3.5 64-bit" ${prefix}\assets\python35-x64.exe ${prefix}\python35-x64 ${pip} Install-Python3 "Python 3.6 32-bit" ${prefix}\assets\python36-x86.exe ${prefix}\python36-x86 ${pip} Install-Python3 "Python 3.6 64-bit" ${prefix}\assets\python36-x64.exe ${prefix}\python36-x64 ${pip} Install-Python3 "Python 3.7 32-bit" ${prefix}\assets\python37-x86.exe ${prefix}\python37-x86 ${pip} Install-Python3 "Python 3.7 64-bit" ${prefix}\assets\python37-x64.exe ${prefix}\python37-x64 ${pip} Install-Python3 "Python 3.8 32-bit" ${prefix}\assets\python38-x86.exe ${prefix}\python38-x86 ${pip} Install-Python3 "Python 3.8 64-bit" ${prefix}\assets\python38-x64.exe ${prefix}\python38-x64 ${pip} Write-Output "installing Visual Studio 2017 Build Tools and SDKs" Invoke-Process ${prefix}\assets\vs_buildtools.exe "--quiet --wait --norestart --nocache --channelUri https://aka.ms/vs/15/release/channel --add Microsoft.VisualStudio.Workload.MSBuildTools --add Microsoft.VisualStudio.Component.Windows10SDK.17763 --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Component.Windows10SDK --add Microsoft.VisualStudio.Component.VC.140" Install-Rust ${prefix} Write-Output "installing Visual C++ 9.0 for Python 2.7" Invoke-Process msiexec.exe "/i ${prefix}\assets\VCForPython27.msi /l* ${prefix}\assets\VCForPython27.log /q" Write-Output "installing Inno Setup" Invoke-Process ${prefix}\assets\InnoSetup.exe "/SP- /VERYSILENT /SUPPRESSMSGBOXES" Write-Output "extracting MinGW base archive" Expand-Archive -Path ${prefix}\assets\mingw-get-bin.zip -DestinationPath "${prefix}\MinGW" -Force Write-Output "updating MinGW package catalogs" Invoke-Process ${prefix}\MinGW\bin\mingw-get.exe "update" Write-Output "installing MinGW packages" Invoke-Process ${prefix}\MinGW\bin\mingw-get.exe "install msys-base msys-coreutils msys-diffutils msys-unzip" # Construct a virtualenv useful for bootstrapping. It conveniently contains a # Mercurial install. Write-Output "creating bootstrap virtualenv with Mercurial" Invoke-Process "$prefix\python27-x64\Scripts\virtualenv.exe" "${prefix}\venv-bootstrap" Invoke-Process "${prefix}\venv-bootstrap\Scripts\pip.exe" "install ${prefix}\assets\${MERCURIAL_WHEEL_FILENAME}" } function Clone-Mercurial-Repo($prefix, $repo_url, $dest) { Write-Output "cloning $repo_url to $dest" # TODO Figure out why CA verification isn't working in EC2 and remove # --insecure. Invoke-Process "${prefix}\venv-bootstrap\Scripts\hg.exe" "clone --insecure $repo_url $dest" # Mark repo as non-publishing by default for convenience. Add-Content -Path "$dest\.hg\hgrc" -Value "`n[phases]`npublish = false" } $prefix = "c:\hgdev" Install-Dependencies $prefix Clone-Mercurial-Repo $prefix "https://www.mercurial-scm.org/repo/hg" $prefix\src diff --git a/contrib/packaging/hgpackaging/pyoxidizer.py b/contrib/packaging/hgpackaging/pyoxidizer.py --- a/contrib/packaging/hgpackaging/pyoxidizer.py +++ b/contrib/packaging/hgpackaging/pyoxidizer.py @@ -1,145 +1,143 @@ # pyoxidizer.py - Packaging support for PyOxidizer # # Copyright 2020 Gregory Szorc # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. # no-check-code because Python 3 native. import os import pathlib import shutil import subprocess import sys from .downloads import download_entry from .util import ( extract_zip_to_directory, process_install_rules, find_vc_runtime_dll, ) STAGING_RULES_WINDOWS = [ ('contrib/bash_completion', 'contrib/'), ('contrib/hgk', 'contrib/hgk.tcl'), ('contrib/hgweb.fcgi', 'contrib/'), ('contrib/hgweb.wsgi', 'contrib/'), ('contrib/logo-droplets.svg', 'contrib/'), ('contrib/mercurial.el', 'contrib/'), ('contrib/mq.el', 'contrib/'), ('contrib/tcsh_completion', 'contrib/'), ('contrib/tcsh_completion_build.sh', 'contrib/'), ('contrib/vim/*', 'contrib/vim/'), ('contrib/win32/postinstall.txt', 'ReleaseNotes.txt'), ('contrib/win32/ReadMe.html', 'ReadMe.html'), ('contrib/xml.rnc', 'contrib/'), ('contrib/zsh_completion', 'contrib/'), ('doc/*.html', 'doc/'), ('doc/style.css', 'doc/'), ('COPYING', 'Copying.txt'), ] STAGING_RULES_APP = [ - ('mercurial/helptext/**/*.txt', 'helptext/'), - ('mercurial/defaultrc/*.rc', 'defaultrc/'), - ('mercurial/locale/**/*', 'locale/'), - ('mercurial/templates/**/*', 'templates/'), + ('lib/mercurial/helptext/**/*.txt', 'helptext/'), + ('lib/mercurial/defaultrc/*.rc', 'defaultrc/'), + ('lib/mercurial/locale/**/*', 'locale/'), + ('lib/mercurial/templates/**/*', 'templates/'), ] STAGING_EXCLUDES_WINDOWS = [ "doc/hg-ssh.8.html", ] def run_pyoxidizer( source_dir: pathlib.Path, build_dir: pathlib.Path, out_dir: pathlib.Path, target_triple: str, ): """Build Mercurial with PyOxidizer and copy additional files into place. After successful completion, ``out_dir`` contains files constituting a Mercurial install. """ # We need to make gettext binaries available for compiling i18n files. gettext_pkg, gettext_entry = download_entry('gettext', build_dir) gettext_dep_pkg = download_entry('gettext-dep', build_dir)[0] gettext_root = build_dir / ('gettext-win-%s' % gettext_entry['version']) if not gettext_root.exists(): extract_zip_to_directory(gettext_pkg, gettext_root) extract_zip_to_directory(gettext_dep_pkg, gettext_root) env = dict(os.environ) env["PATH"] = "%s%s%s" % ( env["PATH"], os.pathsep, str(gettext_root / "bin"), ) args = [ "pyoxidizer", "build", "--path", str(source_dir / "rust" / "hgcli"), "--release", "--target-triple", target_triple, ] subprocess.run(args, env=env, check=True) if "windows" in target_triple: target = "app_windows" else: target = "app_posix" build_dir = ( source_dir / "build" / "pyoxidizer" / target_triple / "release" / target ) if out_dir.exists(): print("purging %s" % out_dir) shutil.rmtree(out_dir) # Now assemble all the files from PyOxidizer into the staging directory. shutil.copytree(build_dir, out_dir) - # Move some of those files around. + # Move some of those files around. We can get rid of this once Mercurial + # is taught to use the importlib APIs for reading resources. process_install_rules(STAGING_RULES_APP, build_dir, out_dir) - # Nuke the mercurial/* directory, as we copied resources - # to an appropriate location just above. - shutil.rmtree(out_dir / "mercurial") # We also need to run setup.py build_doc to produce html files, # as they aren't built as part of ``pip install``. # This will fail if docutils isn't installed. subprocess.run( [sys.executable, str(source_dir / "setup.py"), "build_doc", "--html"], cwd=str(source_dir), check=True, ) if "windows" in target_triple: process_install_rules(STAGING_RULES_WINDOWS, source_dir, out_dir) # Write out a default editor.rc file to configure notepad as the # default editor. with (out_dir / "defaultrc" / "editor.rc").open( "w", encoding="utf-8" ) as fh: fh.write("[ui]\neditor = notepad\n") for f in STAGING_EXCLUDES_WINDOWS: p = out_dir / f if p.exists(): print("removing %s" % p) p.unlink() # Add vcruntimeXXX.dll next to executable. vc_runtime_dll = find_vc_runtime_dll(x64="x86_64" in target_triple) shutil.copy(vc_runtime_dll, out_dir / vc_runtime_dll.name) diff --git a/rust/hgcli/Cargo.lock b/rust/hgcli/Cargo.lock --- a/rust/hgcli/Cargo.lock +++ b/rust/hgcli/Cargo.lock @@ -1,359 +1,509 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. [[package]] name = "aho-corasick" -version = "0.7.10" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "anyhow" -version = "1.0.28" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "autocfg" -version = "1.0.0" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "base64" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "base64" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "byteorder" version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cc" -version = "1.0.50" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cfg-if" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] +name = "charset" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding_rs 0.8.24 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "cpython" -version = "0.4.1" -source = "git+https://github.com/dgrunwald/rust-cpython?rev=387e87d9deb6b678508888239f9f87dc36973d3f#387e87d9deb6b678508888239f9f87dc36973d3f" +version = "0.5.0" +source = "git+https://github.com/dgrunwald/rust-cpython.git?rev=4283acd94f4e794fe03679efc7a6c18bc50938a8#4283acd94f4e794fe03679efc7a6c18bc50938a8" dependencies = [ - "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "paste 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "python3-sys 0.4.1 (git+https://github.com/dgrunwald/rust-cpython?rev=387e87d9deb6b678508888239f9f87dc36973d3f)", + "libc 0.2.78 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "paste 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "python3-sys 0.5.0 (git+https://github.com/dgrunwald/rust-cpython.git?rev=4283acd94f4e794fe03679efc7a6c18bc50938a8)", +] + +[[package]] +name = "either" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "encoding_rs" +version = "0.8.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "fs_extra" -version = "1.1.0" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "fuchsia-cprng" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "getrandom" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.78 (registry+https://github.com/rust-lang/crates.io-index)", "wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "hgcli" version = "0.1.0" dependencies = [ "jemallocator-global 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "pyembed 0.7.0-pre (git+https://github.com/indygreg/PyOxidizer.git?rev=c772a1379c3026314eda1c8ea244b86c0658951d)", + "pyembed 0.8.0-pre (git+https://github.com/indygreg/PyOxidizer.git?rev=4697fb25918dfad6dc73288daeea501063963a08)", +] + +[[package]] +name = "itertools" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "jemalloc-sys" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)", - "fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.60 (registry+https://github.com/rust-lang/crates.io-index)", + "fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.78 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "jemallocator" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "jemalloc-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.78 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "jemallocator-global" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "jemallocator 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.2.68" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] +name = "mailparse" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "base64 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", + "charset 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "quoted_printable 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "memchr" version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] +name = "memmap" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.78 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "memory-module-sys" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.60 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.78 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num-traits" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "paste" -version = "0.1.9" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "paste-impl 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro-hack 0.5.15 (registry+https://github.com/rust-lang/crates.io-index)", + "paste-impl 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack 0.5.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "paste-impl" -version = "0.1.9" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro-hack 0.5.15 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack 0.5.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ppv-lite86" -version = "0.2.6" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "proc-macro-hack" -version = "0.5.15" +version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "proc-macro2" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] name = "pyembed" -version = "0.7.0-pre" -source = "git+https://github.com/indygreg/PyOxidizer.git?rev=c772a1379c3026314eda1c8ea244b86c0658951d#c772a1379c3026314eda1c8ea244b86c0658951d" +version = "0.8.0-pre" +source = "git+https://github.com/indygreg/PyOxidizer.git?rev=4697fb25918dfad6dc73288daeea501063963a08#4697fb25918dfad6dc73288daeea501063963a08" dependencies = [ - "cpython 0.4.1 (git+https://github.com/dgrunwald/rust-cpython?rev=387e87d9deb6b678508888239f9f87dc36973d3f)", + "anyhow 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)", + "cpython 0.5.0 (git+https://github.com/dgrunwald/rust-cpython.git?rev=4283acd94f4e794fe03679efc7a6c18bc50938a8)", "jemalloc-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.78 (registry+https://github.com/rust-lang/crates.io-index)", + "memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "memory-module-sys 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "python-packed-resources 0.1.0-pre (git+https://github.com/indygreg/PyOxidizer.git?rev=c772a1379c3026314eda1c8ea244b86c0658951d)", - "python3-sys 0.4.1 (git+https://github.com/dgrunwald/rust-cpython?rev=387e87d9deb6b678508888239f9f87dc36973d3f)", + "python-packaging 0.1.0-pre (git+https://github.com/indygreg/PyOxidizer.git?rev=4697fb25918dfad6dc73288daeea501063963a08)", + "python-packed-resources 0.2.0-pre (git+https://github.com/indygreg/PyOxidizer.git?rev=4697fb25918dfad6dc73288daeea501063963a08)", + "python3-sys 0.5.0 (git+https://github.com/dgrunwald/rust-cpython.git?rev=4283acd94f4e794fe03679efc7a6c18bc50938a8)", "uuid 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "python-packaging" +version = "0.1.0-pre" +source = "git+https://github.com/indygreg/PyOxidizer.git?rev=4697fb25918dfad6dc73288daeea501063963a08#4697fb25918dfad6dc73288daeea501063963a08" +dependencies = [ + "anyhow 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding_rs 0.8.24 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "mailparse 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "python-packed-resources 0.2.0-pre (git+https://github.com/indygreg/PyOxidizer.git?rev=4697fb25918dfad6dc73288daeea501063963a08)", + "regex 1.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "python-packed-resources" -version = "0.1.0-pre" -source = "git+https://github.com/indygreg/PyOxidizer.git?rev=c772a1379c3026314eda1c8ea244b86c0658951d#c772a1379c3026314eda1c8ea244b86c0658951d" +version = "0.2.0-pre" +source = "git+https://github.com/indygreg/PyOxidizer.git?rev=4697fb25918dfad6dc73288daeea501063963a08#4697fb25918dfad6dc73288daeea501063963a08" dependencies = [ - "anyhow 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "anyhow 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "python3-sys" -version = "0.4.1" -source = "git+https://github.com/dgrunwald/rust-cpython?rev=387e87d9deb6b678508888239f9f87dc36973d3f#387e87d9deb6b678508888239f9f87dc36973d3f" +version = "0.5.0" +source = "git+https://github.com/dgrunwald/rust-cpython.git?rev=4283acd94f4e794fe03679efc7a6c18bc50938a8#4283acd94f4e794fe03679efc7a6c18bc50938a8" dependencies = [ - "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.78 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "quote" -version = "1.0.3" +name = "quoted_printable" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rand" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.78 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand" version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", + "getrandom 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.78 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_chacha" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "ppv-lite86 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_core" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_core" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rand_core" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "getrandom 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_hc" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "regex" -version = "1.3.6" +name = "rdrand" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "regex" +version = "1.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "aho-corasick 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.17 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-syntax" -version = "0.6.17" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "syn" -version = "1.0.17" +name = "remove_dir_all" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tempdir" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "thread_local" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "unicode-xid" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] name = "uuid" version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] +name = "walkdir" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "same-file 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "winapi" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] -"checksum aho-corasick 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)" = "8716408b8bc624ed7f65d223ddb9ac2d044c0547b6fa4b0d554f3a9540496ada" -"checksum anyhow 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)" = "d9a60d744a80c30fcb657dfe2c1b22bcb3e814c1a1e3674f32bf5820b570fbff" -"checksum autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" +"checksum aho-corasick 0.7.13 (registry+https://github.com/rust-lang/crates.io-index)" = "043164d8ba5c4c3035fec9bbee8647c0261d788f3474306f93bb65901cae0e86" +"checksum anyhow 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)" = "6b602bfe940d21c130f3895acd65221e8a61270debe89d628b9cb4e3ccb8569b" +"checksum autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +"checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" +"checksum base64 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" "checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" -"checksum cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)" = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd" +"checksum cc 1.0.60 (registry+https://github.com/rust-lang/crates.io-index)" = "ef611cc68ff783f18535d77ddd080185275713d852c4f5cbb6122c462a7a825c" "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" -"checksum cpython 0.4.1 (git+https://github.com/dgrunwald/rust-cpython?rev=387e87d9deb6b678508888239f9f87dc36973d3f)" = "" -"checksum fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5f2a4a2034423744d2cc7ca2068453168dcdb82c438419e639a26bd87839c674" -"checksum getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" +"checksum charset 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4f426e64df1c3de26cbf44593c6ffff5dbfd43bbf9de0d075058558126b3fc73" +"checksum cpython 0.5.0 (git+https://github.com/dgrunwald/rust-cpython.git?rev=4283acd94f4e794fe03679efc7a6c18bc50938a8)" = "" +"checksum either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +"checksum encoding_rs 0.8.24 (registry+https://github.com/rust-lang/crates.io-index)" = "a51b8cf747471cb9499b6d59e59b0444f4c90eba8968c4e44874e92b5b64ace2" +"checksum fs_extra 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" +"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" +"checksum getrandom 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6" +"checksum itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" "checksum jemalloc-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0d3b9f3f5c9b31aa0f5ed3260385ac205db665baa41d49bb8338008ae94ede45" "checksum jemallocator 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "43ae63fcfc45e99ab3d1b29a46782ad679e98436c3169d15a167a1108a724b69" "checksum jemallocator-global 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "991b61de8365c8b5707cf6cabbff98cfd6eaca9b851948b883efea408c7f581e" "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -"checksum libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)" = "dea0c0405123bba743ee3f91f49b1c7cfb684eef0da0a50110f758ccf24cdff0" +"checksum libc 0.2.78 (registry+https://github.com/rust-lang/crates.io-index)" = "aa7087f49d294270db4e1928fc110c976cd4b9e5a16348e0a1df09afa99e6c98" +"checksum mailparse 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "479b94621ea0fe875638d27f4a0b68213174b63e1ff9355d0948a04f71a5055a" "checksum memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" +"checksum memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b" "checksum memory-module-sys 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3bbdce2925c681860b08875119254fb5543dbf6337c56ff93afebeed9c686da3" -"checksum num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096" -"checksum paste 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "092d791bf7847f70bbd49085489fba25fc2c193571752bff9e36e74e72403932" -"checksum paste-impl 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "406c23fb4c45cc6f68a9bbabb8ec7bd6f8cfcbd17e9e8f72c2460282f8325729" -"checksum ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b" -"checksum proc-macro-hack 0.5.15 (registry+https://github.com/rust-lang/crates.io-index)" = "0d659fe7c6d27f25e9d80a1a094c223f5246f6a6596453e09d7229bf42750b63" -"checksum proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)" = "df246d292ff63439fea9bc8c0a270bed0e390d5ebd4db4ba15aba81111b5abe3" -"checksum pyembed 0.7.0-pre (git+https://github.com/indygreg/PyOxidizer.git?rev=c772a1379c3026314eda1c8ea244b86c0658951d)" = "" -"checksum python-packed-resources 0.1.0-pre (git+https://github.com/indygreg/PyOxidizer.git?rev=c772a1379c3026314eda1c8ea244b86c0658951d)" = "" -"checksum python3-sys 0.4.1 (git+https://github.com/dgrunwald/rust-cpython?rev=387e87d9deb6b678508888239f9f87dc36973d3f)" = "" -"checksum quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2bdc6c187c65bca4260c9011c9e3132efe4909da44726bad24cf7572ae338d7f" +"checksum num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611" +"checksum paste 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880" +"checksum paste-impl 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6" +"checksum ppv-lite86 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20" +"checksum proc-macro-hack 0.5.18 (registry+https://github.com/rust-lang/crates.io-index)" = "99c605b9a0adc77b7211c6b1f722dcb613d68d66859a44f3d485a6da332b0598" +"checksum pyembed 0.8.0-pre (git+https://github.com/indygreg/PyOxidizer.git?rev=4697fb25918dfad6dc73288daeea501063963a08)" = "" +"checksum python-packaging 0.1.0-pre (git+https://github.com/indygreg/PyOxidizer.git?rev=4697fb25918dfad6dc73288daeea501063963a08)" = "" +"checksum python-packed-resources 0.2.0-pre (git+https://github.com/indygreg/PyOxidizer.git?rev=4697fb25918dfad6dc73288daeea501063963a08)" = "" +"checksum python3-sys 0.5.0 (git+https://github.com/dgrunwald/rust-cpython.git?rev=4283acd94f4e794fe03679efc7a6c18bc50938a8)" = "" +"checksum quoted_printable 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "47b080c5db639b292ac79cbd34be0cfc5d36694768d8341109634d90b86930e2" +"checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" "checksum rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" "checksum rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" +"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" "checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" "checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -"checksum regex 1.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7f6946991529684867e47d86474e3a6d0c0ab9b82d5821e314b1ede31fa3a4b3" -"checksum regex-syntax 0.6.17 (registry+https://github.com/rust-lang/crates.io-index)" = "7fe5bd57d1d7414c6b5ed48563a2c855d995ff777729dcd91c369ec7fea395ae" -"checksum syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)" = "0df0eb663f387145cab623dea85b09c2c5b4b0aef44e945d928e682fce71bb03" +"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" +"checksum regex 1.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6" +"checksum regex-syntax 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)" = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8" +"checksum remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +"checksum same-file 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +"checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" "checksum thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" -"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" "checksum uuid 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9fde2f6a4bea1d6e007c4ad38c6839fa71cbb63b6dbf5b595aa38dc9b1093c11" +"checksum walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" "checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" -"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" +"checksum winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +"checksum winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/rust/hgcli/Cargo.toml b/rust/hgcli/Cargo.toml --- a/rust/hgcli/Cargo.toml +++ b/rust/hgcli/Cargo.toml @@ -1,24 +1,28 @@ [package] name = "hgcli" version = "0.1.0" build = "build.rs" authors = ["Gregory Szorc "] edition = "2018" license = "GPL-2.0" readme = "README.md" [[bin]] name = "hg" path = "src/main.rs" [dependencies] jemallocator-global = { version = "0.3", optional = true } -pyembed = { git = "https://github.com/indygreg/PyOxidizer.git", rev = "c772a1379c3026314eda1c8ea244b86c0658951d", default-features=false } + +[dependencies.pyembed] +git = "https://github.com/indygreg/PyOxidizer.git" +rev = "4697fb25918dfad6dc73288daeea501063963a08" +default-features = false [features] default = ["build-mode-pyoxidizer-exe"] jemalloc = ["jemallocator-global", "pyembed/jemalloc"] build-mode-pyoxidizer-exe = ["pyembed/build-mode-pyoxidizer-exe"] build-mode-prebuilt-artifacts = ["pyembed/build-mode-prebuilt-artifacts"] cpython-link-unresolved-static = ["pyembed/cpython-link-unresolved-static"] cpython-link-default = ["pyembed/cpython-link-default"] diff --git a/rust/hgcli/pyoxidizer.bzl b/rust/hgcli/pyoxidizer.bzl --- a/rust/hgcli/pyoxidizer.bzl +++ b/rust/hgcli/pyoxidizer.bzl @@ -1,98 +1,108 @@ ROOT = CWD + "/../.." +IS_WINDOWS = "windows" in BUILD_TARGET_TRIPLE + # Code to run in Python interpreter. RUN_CODE = "import hgdemandimport; hgdemandimport.enable(); from mercurial import dispatch; dispatch.run()" set_build_path(ROOT + "/build/pyoxidizer") def make_distribution(): return default_python_distribution() def make_distribution_windows(): return default_python_distribution(flavor = "standalone_dynamic") +def resource_callback(policy, resource): + # We use a custom resource routing policy to influence where things are loaded + # from. + # + # For Python modules and resources, we load from memory if they are in + # the standard library and from the filesystem if not. This is because + # parts of Mercurial and some 3rd party packages aren't yet compatible + # with memory loading. + # + # For Python extension modules, we load from the filesystem because + # this yields greatest compatibility. + if type(resource) in ("PythonModuleSource", "PythonPackageResource", "PythonPackageDistributionResource"): + if resource.is_stdlib: + resource.add_location = "in-memory" + else: + resource.add_location = "filesystem-relative:lib" + + elif type(resource) == "PythonExtensionModule": + resource.add_location = "filesystem-relative:lib" + def make_exe(dist): """Builds a Rust-wrapped Mercurial binary.""" + packaging_policy = dist.make_python_packaging_policy() + # Extension may depend on any Python functionality. Include all + # extensions. + packaging_policy.extension_module_filter = "all" + packaging_policy.resources_policy = "prefer-in-memory-fallback-filesystem-relative:lib" + packaging_policy.register_resource_callback(resource_callback) + config = PythonInterpreterConfig( raw_allocator = "system", run_eval = RUN_CODE, # We want to let the user load extensions from the file system filesystem_importer = True, # We need this to make resourceutil happy, since it looks for sys.frozen. sys_frozen = True, legacy_windows_stdio = True, ) exe = dist.to_python_executable( name = "hg", - resources_policy = "prefer-in-memory-fallback-filesystem-relative:lib", + packaging_policy = packaging_policy, config = config, - # Extension may depend on any Python functionality. Include all - # extensions. - extension_module_filter = "all", ) # Add Mercurial to resources. - for resource in dist.pip_install(["--verbose", ROOT]): - # This is a bit wonky and worth explaining. - # - # Various parts of Mercurial don't yet support loading package - # resources via the ResourceReader interface. Or, not having - # file-based resources would be too inconvenient for users. - # - # So, for package resources, we package them both in the - # filesystem as well as in memory. If both are defined, - # PyOxidizer will prefer the in-memory location. So even - # if the filesystem file isn't packaged in the location - # specified here, we should never encounter an errors as the - # resource will always be available in memory. - if type(resource) == "PythonPackageResource": - exe.add_filesystem_relative_python_resource(".", resource) - exe.add_in_memory_python_resource(resource) - else: - exe.add_python_resource(resource) + exe.add_python_resources(exe.pip_install(["--verbose", ROOT])) # On Windows, we install extra packages for convenience. - if "windows" in BUILD_TARGET_TRIPLE: + if IS_WINDOWS: exe.add_python_resources( - dist.pip_install(["-r", ROOT + "/contrib/packaging/requirements_win32.txt"]), + exe.pip_install(["-r", ROOT + "/contrib/packaging/requirements_win32.txt"]), ) return exe def make_manifest(dist, exe): m = FileManifest() m.add_python_resource(".", exe) return m def make_embedded_resources(exe): return exe.to_embedded_resources() register_target("distribution_posix", make_distribution) register_target("distribution_windows", make_distribution_windows) register_target("exe_posix", make_exe, depends = ["distribution_posix"]) register_target("exe_windows", make_exe, depends = ["distribution_windows"]) register_target( "app_posix", make_manifest, depends = ["distribution_posix", "exe_posix"], default = "windows" not in BUILD_TARGET_TRIPLE, ) register_target( "app_windows", make_manifest, depends = ["distribution_windows", "exe_windows"], default = "windows" in BUILD_TARGET_TRIPLE, ) resolve_targets() # END OF COMMON USER-ADJUSTED SETTINGS. # # Everything below this is typically managed by PyOxidizer and doesn't need # to be updated by people. -PYOXIDIZER_VERSION = "0.7.0" +PYOXIDIZER_VERSION = "0.8.0-pre" +PYOXIDIZER_COMMIT = "4697fb25918dfad6dc73288daeea501063963a08"