Skip to content

Commit c1b6f2d

Browse files
committed
Fix launchpad upload
Use a pip installed breezy and apply patches to make it work. The first is a bug in the code (missing import) the 2nd an incompatibility with Python3 where `sys.stdin` is a string buffer while a byte buffer is expected. `sys.stdin.buffer` can be used for that as done in later breezy versions.
1 parent 5c800e7 commit c1b6f2d

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

.github/workflows/synchronize-launchpad.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,22 @@ on:
1111

1212
jobs:
1313
upload:
14-
runs-on: ubuntu-22.04 # We need bzr < 3.3 for non-interactive login
14+
runs-on: ubuntu-latest
1515
steps:
1616
- name: Install dependencies
1717
run: |
18-
sudo apt-get -o Acquire::Retries=3 update
19-
sudo apt-get -o Acquire::Retries=3 install -y openssh-client git bzr-fastimport
18+
venv_dir="/tmp/venv"
19+
python -m venv "$venv_dir"
20+
. $venv_dir/bin/activate
21+
echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> "$GITHUB_ENV"
22+
echo "$venv_dir/bin" >> "$GITHUB_PATH"
23+
pip install Cython configobj 'pip<23.1' # Use a pip version that still allows the legacy installation for this breezy version
24+
pip install 'breezy[fastimport,git,launchpad]<3.3' # 3.3+ requires interactive login
25+
fastimport_dir=$venv_dir/lib/python*/site-packages/breezy/plugins/fastimport
26+
# Add missing import and use binary buffer of stdin for Python3 compat
27+
sed -i '1 i from breezy import controldir' $fastimport_dir/branch_updater.py
28+
sed -i 's/helpers.binary_stream(sys.stdin)/sys.stdin.buffer/' $fastimport_dir/cmds.py
29+
2030
2131
- uses: actions/checkout@v4
2232
with:
@@ -30,12 +40,12 @@ jobs:
3040

3141
- name: Synchronize bazaar and git
3242
run: |
33-
bzr init-repo bzr-repo
34-
(cd "$GITHUB_WORKSPACE" && git fast-export -M --all) | (cd bzr-repo && bzr fast-import -)
43+
brz init-repo bzr-repo
44+
(cd "$GITHUB_WORKSPACE" && git fast-export -M --all) | (cd bzr-repo && brz fast-import -)
3545
3646
- name: Login to launchpad
37-
run: bzr launchpad-login ${{ secrets.LAUNCHPAD_USER }}
47+
run: brz launchpad-login ${{ secrets.LAUNCHPAD_USER }}
3848

3949
- name: Upload to launchpad
4050
working-directory: bzr-repo/trunk
41-
run: bzr push --overwrite lp:~s25rttrteam/s25rttr/s25rttr-languages
51+
run: brz push --overwrite lp:~s25rttrteam/s25rttr/s25rttr-languages

0 commit comments

Comments
 (0)