[gentoo-commits] proj/portage:master commit in: .builds/

2023-11-10 Thread Sam James
commit: 7c5a1f57386511558e7c9b60e6debaea42a1135b
Author: Oskari Pirhonen  gmail  com>
AuthorDate: Tue Oct 31 04:37:10 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Sat Nov 11 02:55:29 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=7c5a1f57

sr.ht ci: add some pytest options

At the time of writing, sourcehut VM's have 2 cores. Utilizing
pytest-xdist unsurprisingly cuts the time in half :)

Signed-off-by: Oskari Pirhonen  gmail.com>
Closes: https://github.com/gentoo/portage/pull/1175
Signed-off-by: Sam James  gentoo.org>

 .builds/ci.yml | 9 +
 1 file changed, 9 insertions(+)

diff --git a/.builds/ci.yml b/.builds/ci.yml
index cda3b6e072..6d04fdff9c 100644
--- a/.builds/ci.yml
+++ b/.builds/ci.yml
@@ -16,6 +16,15 @@ environment:
 # - '3.12'
 # Testing PyPy is currently broken, see bug #903709
 # - 'pypy3'
+  PYTEST_ADDOPTS: >
+-vv
+-ra
+-l
+-o console_output_style=count
+-o log_cli=true
+--log-cli-level=info
+-n logical
+--dist=worksteal
 tasks:
   - setup-python: |
   portage/.builds/setup-python.sh "${PYTHON_VERSIONS[@]}"



[gentoo-commits] proj/portage:master commit in: .builds/

2023-11-10 Thread Sam James
commit: 53211c8cc4bf06317f43edba521c529d7f53886c
Author: Oskari Pirhonen  gmail  com>
AuthorDate: Tue Oct 31 04:10:14 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Sat Nov 11 02:55:29 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=53211c8c

sr.ht ci: install into --destdir

Avoids failed privilege escalation from trying to install into
/usr/local.

Signed-off-by: Oskari Pirhonen  gmail.com>
Signed-off-by: Sam James  gentoo.org>

 .builds/ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.builds/ci.yml b/.builds/ci.yml
index 896840a3fc..cda3b6e072 100644
--- a/.builds/ci.yml
+++ b/.builds/ci.yml
@@ -34,7 +34,7 @@ tasks:
 
   - test-install: |
   for py in "${PYTHON_VERSIONS[@]}"; do
-time meson install -C "/tmp/build-$py"
+time meson install -C "/tmp/build-$py" --destdir 
"/tmp/install-root-$py"
   done
 
   - test-portage: |



[gentoo-commits] proj/portage:master commit in: .builds/

2023-11-10 Thread Sam James
commit: 4d93a7a14a78684215b72d5ecf60c99521a790c9
Author: Oskari Pirhonen  gmail  com>
AuthorDate: Tue Oct 31 03:01:28 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Sat Nov 11 02:55:29 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=4d93a7a1

sr.ht ci: install some missing packages

- pkg-config
- libpython
- pytest-xdist

  - with psutil to auto-detect logical cores

Signed-off-by: Oskari Pirhonen  gmail.com>
Signed-off-by: Sam James  gentoo.org>

 .builds/ci.yml  | 4 ++--
 .builds/setup-python.sh | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/.builds/ci.yml b/.builds/ci.yml
index 0a4034e1cd..896840a3fc 100644
--- a/.builds/ci.yml
+++ b/.builds/ci.yml
@@ -21,11 +21,11 @@ tasks:
   portage/.builds/setup-python.sh "${PYTHON_VERSIONS[@]}"
 
   - setup-tests: |
-  sudo apt-get install -y --no-install-recommends meson
+  sudo apt-get install -y --no-install-recommends meson pkg-config
   for py in "${PYTHON_VERSIONS[@]}"; do
 source ".venv-$py/bin/activate"
 # setuptools needed for 3.12+ because of 
https://github.com/mesonbuild/meson/issues/7702.
-pip install pytest setuptools
+pip install pytest pytest-xdist[psutil] setuptools
 printf "[binaries]\npython = '%s'\n" "$(command -v python)" \
 | tee "/tmp/native-$py.ini"
 meson setup --native-file "/tmp/native-$py.ini" "/tmp/build-$py" 
portage

diff --git a/.builds/setup-python.sh b/.builds/setup-python.sh
index 72e63ad957..4099a02f06 100755
--- a/.builds/setup-python.sh
+++ b/.builds/setup-python.sh
@@ -9,8 +9,10 @@ install_versions=( "${install_versions[@]/#pythonpypy/pypy}" )
 
 sudo apt-get install -y --no-install-recommends \
 python-is-python3 \
+python3-dev \
 python3-venv \
 "${install_versions[@]}" \
+"${install_versions[@]/%/-dev}" \
 "${install_versions[@]/%/-venv}"
 
 for py in "$@"; do



[gentoo-commits] proj/portage:master commit in: .builds/

2023-11-10 Thread Sam James
commit: 17212caaf8673b250de1502610120e5fc322cd53
Author: Oskari Pirhonen  gmail  com>
AuthorDate: Tue Oct 31 02:50:01 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Sat Nov 11 02:55:29 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=17212caa

sr.ht ci: small housekeeping

- use venvs again
- use a separate native .ini for each python version
- move meson setup into setup-tests
- add (commented out) python 3.12
- print total elapsed test time for portage test suite

Signed-off-by: Oskari Pirhonen  gmail.com>
Signed-off-by: Sam James  gentoo.org>

 .builds/ci.yml | 16 
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/.builds/ci.yml b/.builds/ci.yml
index 2c1659c849..0a4034e1cd 100644
--- a/.builds/ci.yml
+++ b/.builds/ci.yml
@@ -12,6 +12,8 @@ environment:
 - '3.9'
 - '3.10'
 - '3.11'
+# Python 3.12 seems to (at least sometimes) timeout
+# - '3.12'
 # Testing PyPy is currently broken, see bug #903709
 # - 'pypy3'
 tasks:
@@ -21,18 +23,24 @@ tasks:
   - setup-tests: |
   sudo apt-get install -y --no-install-recommends meson
   for py in "${PYTHON_VERSIONS[@]}"; do
+source ".venv-$py/bin/activate"
 # setuptools needed for 3.12+ because of 
https://github.com/mesonbuild/meson/issues/7702.
-".venv-$py/bin/pip" install pytest setuptools
+pip install pytest setuptools
+printf "[binaries]\npython = '%s'\n" "$(command -v python)" \
+| tee "/tmp/native-$py.ini"
+meson setup --native-file "/tmp/native-$py.ini" "/tmp/build-$py" 
portage
+deactivate
   done
 
   - test-install: |
   for py in "${PYTHON_VERSIONS[@]}"; do
-echo -e "[binaries]\npython = '${PWD}/.venv-${py}/bin/python'" > 
/tmp/native.ini
-meson setup --native-file /tmp/native.ini "/tmp/build-$py" portage
-meson install -C "/tmp/build-$py"
+time meson install -C "/tmp/build-$py"
   done
 
   - test-portage: |
+  start_time=$EPOCHSECONDS
   for py in "${PYTHON_VERSIONS[@]}"; do
 meson test -C "/tmp/build-$py" --verbose
   done
+  end_time=$EPOCHSECONDS
+  printf "Total elapsed time: %d seconds\n" $((end_time - start_time))



[gentoo-commits] proj/portage:master commit in: .builds/

2023-07-08 Thread Sam James
commit: 9a41acc7ee5d39c390d9a09421ad2671acee0be8
Author: Oskari Pirhonen  gmail  com>
AuthorDate: Sat Jul  8 06:43:58 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Sun Jul  9 00:35:14 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=9a41acc7

sr.ht ci: install pytest

Ensure pytest exists on sourcehut builds before running Portage test
suite.

Signed-off-by: Oskari Pirhonen  gmail.com>
Closes: https://github.com/gentoo/portage/pull/1064
Signed-off-by: Sam James  gentoo.org>

 .builds/ci.yml | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/.builds/ci.yml b/.builds/ci.yml
index 18cdbe47a..797aea074 100644
--- a/.builds/ci.yml
+++ b/.builds/ci.yml
@@ -20,6 +20,13 @@ tasks:
   - setup-python: |
   portage/.builds/setup-python.sh "${PYTHON_VERSIONS[@]}"
 
+  - setup-tests: |
+  for py in "${PYTHON_VERSIONS[@]}"; do
+source ".venv-$py/bin/activate"
+pip install pytest
+deactivate
+  done
+
   - test-install: |
   for py in "${PYTHON_VERSIONS[@]}"; do
 source ".venv-$py/bin/activate"



[gentoo-commits] proj/portage:master commit in: .builds/, /

2023-05-26 Thread Sam James
commit: 54a8e14ddc8b79720bc37cc1bb98836361966976
Author: David Palao  gmail  com>
AuthorDate: Fri May 26 13:37:14 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Fri May 26 15:44:38 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=54a8e14d

tests: pre-commit: add pytest dep to pylint

Signed-off-by: David Palao  gmail.com>
Closes: https://github.com/gentoo/portage/pull/1047
Signed-off-by: Sam James  gentoo.org>

 .builds/lint.yml| 2 +-
 .pre-commit-config.yaml | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/.builds/lint.yml b/.builds/lint.yml
index 7d17f539e..2301c87be 100644
--- a/.builds/lint.yml
+++ b/.builds/lint.yml
@@ -24,7 +24,7 @@ tasks:
   - setup-pylint: |
   for py in "${PYTHON_VERSIONS[@]}"; do
 source ".venv-$py/bin/activate"
-pip install pylint
+pip install pylint pytest
 deactivate
   done
 

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 2d3ce16f4..e59f5e312 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -8,6 +8,8 @@ repos:
 rev: v2.15.10
 hooks:
   - id: pylint
+additional_dependencies:
+  - 'pytest'
   - repo: https://github.com/ikamensh/flynt/
 rev: '0.77'
 hooks:



[gentoo-commits] proj/portage:master commit in: .builds/

2023-04-07 Thread Sam James
commit: 80fc9ec1e9b72ecd7851b901116230398f77238e
Author: Oskari Pirhonen  gmail  com>
AuthorDate: Sat Apr  1 03:51:44 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Fri Apr  7 09:50:00 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=80fc9ec1

ci: run the portage tests on sourcehut

Run the Portage test suite for each Python version given in
PYTHON_VERSIONS in the sourcehut build manifest.

Currently skips PyPy tests, see bug #903709

Signed-off-by: Oskari Pirhonen  gmail.com>
Signed-off-by: Sam James  gentoo.org>

 .builds/ci.yml | 39 +++
 1 file changed, 39 insertions(+)

diff --git a/.builds/ci.yml b/.builds/ci.yml
new file mode 100644
index 0..18cdbe47a
--- /dev/null
+++ b/.builds/ci.yml
@@ -0,0 +1,39 @@
+# Maintainer: Oskari Pirhonen 
+
+image: ubuntu/jammy
+shell: true
+repositories:
+  # For more versions than just the default python3
+  deadsnakes: https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu jammy 
main "BA6932366A755776"
+  # Because Ubuntu have yet to fix: 
https://foss.hetapod.net/pypy/pypy/-/issues/3741
+  # pypy: https://ppa.launchpadcontent.net/pypy/ppa/ubuntu jammy main 
"251104D968854915"
+environment:
+  PYTHON_VERSIONS:
+- '3.7'
+- '3.8'
+- '3.9'
+- '3.10'
+- '3.11'
+# Testing PyPy is currently broken, see bug #903709
+# - 'pypy3'
+tasks:
+  - setup-python: |
+  portage/.builds/setup-python.sh "${PYTHON_VERSIONS[@]}"
+
+  - test-install: |
+  for py in "${PYTHON_VERSIONS[@]}"; do
+source ".venv-$py/bin/activate"
+pushd portage
+  time ./setup.py clean install
+popd
+deactivate
+  done
+
+  - test-portage: |
+  for py in "${PYTHON_VERSIONS[@]}"; do
+source ".venv-$py/bin/activate"
+pushd portage
+  ./setup.py clean test
+popd
+deactivate
+  done



[gentoo-commits] proj/portage:master commit in: .builds/

2023-04-07 Thread Sam James
commit: c7c532ccb84c6e562807b6b8335361a11412d839
Author: Oskari Pirhonen  gmail  com>
AuthorDate: Sat Apr  1 04:49:31 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Fri Apr  7 09:50:00 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=c7c532cc

ci: add basic pypy support to setup-python.sh

Install pypy by specifying 'pypy3' in the PYTHON_VERSIONS.

... and fix indents and ensure system python has venv module

Signed-off-by: Oskari Pirhonen  gmail.com>
Signed-off-by: Sam James  gentoo.org>

 .builds/setup-python.sh | 23 +++
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/.builds/setup-python.sh b/.builds/setup-python.sh
index be113ce8e..72e63ad95 100755
--- a/.builds/setup-python.sh
+++ b/.builds/setup-python.sh
@@ -4,17 +4,24 @@
 set -ex
 
 install_versions=( "${@/#/python}" )
+# Fix any pypy versions
+install_versions=( "${install_versions[@]/#pythonpypy/pypy}" )
 
 sudo apt-get install -y --no-install-recommends \
-python-is-python3 \
-"${install_versions[@]}" \
-"${install_versions[@]/%/-venv}"
+python-is-python3 \
+python3-venv \
+"${install_versions[@]}" \
+"${install_versions[@]/%/-venv}"
 
-for py in "${@}"; do
-  "python$py" -m venv ".venv-$py"
-  source ".venv-$py/bin/activate"
-  pip install --upgrade pip
-  deactivate
+for py in "$@"; do
+if [[ "$py" != pypy* ]]; then
+"python$py" -m venv ".venv-$py"
+else
+"$py" -m venv ".venv-$py"
+fi
+source ".venv-$py/bin/activate"
+pip install --upgrade pip
+deactivate
 done
 
 python -m venv .venv



[gentoo-commits] proj/portage:master commit in: .builds/

2023-04-07 Thread Sam James
commit: 2d2e547ee0928c943cbc17753a182974bd5ae09e
Author: Oskari Pirhonen  gmail  com>
AuthorDate: Wed Mar 29 02:33:58 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Fri Apr  7 09:49:59 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=2d2e547e

ci: run black on sourcehut

Runs the black portion of the lint tasks on sourcehut builds.

Signed-off-by: Oskari Pirhonen  gmail.com>
Signed-off-by: Sam James  gentoo.org>

 .builds/lint.yml | 20 
 1 file changed, 20 insertions(+)

diff --git a/.builds/lint.yml b/.builds/lint.yml
new file mode 100644
index 0..a294a3ad6
--- /dev/null
+++ b/.builds/lint.yml
@@ -0,0 +1,20 @@
+# Maintainer: Oskari Pirhonen 
+
+image: ubuntu/lts
+shell: true
+tasks:
+  - setup-lint-env: |
+  sudo apt-get update
+  sudo apt-get install -y --no-install-recommends python-is-python3 
python3-venv
+  python -m venv .venv
+  source .venv/bin/activate
+  pip install --upgrade pip
+  pip install black
+
+  - black: |
+  source .venv/bin/activate
+  cd portage
+  STRAGGLERS="$(find bin runtests -type f -not -name '*.py' -not -name 
'*.sh' | \
+  xargs grep -l '#!/usr/bin/env python' | \
+  tr '\n' ' ')"
+  black --check --diff --color . $STRAGGLERS



[gentoo-commits] proj/portage:master commit in: .builds/

2023-04-07 Thread Sam James
commit: 9dca151ad11df75a1842afd2bee9bad9c9ee0c37
Author: Oskari Pirhonen  gmail  com>
AuthorDate: Thu Mar 30 04:53:51 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Fri Apr  7 09:49:59 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=9dca151a

ci: NIH actions/setup-python for sourcehut

Use the deadsnakes PPA and PYTHON_VERSIONS env var to control which
version of python get installed. Use a separate setup-python script in
.builds/ to avoid duplicate code. And having to remember to update it in
more than one place for changes.

Signed-off-by: Oskari Pirhonen  gmail.com>
Signed-off-by: Sam James  gentoo.org>

 .builds/lint.yml| 23 +--
 .builds/setup-python.sh | 23 +++
 2 files changed, 40 insertions(+), 6 deletions(-)

diff --git a/.builds/lint.yml b/.builds/lint.yml
index a294a3ad6..675fde757 100644
--- a/.builds/lint.yml
+++ b/.builds/lint.yml
@@ -1,15 +1,25 @@
 # Maintainer: Oskari Pirhonen 
 
-image: ubuntu/lts
+image: ubuntu/jammy
 shell: true
+repositories:
+  # For more versions than just the default python3
+  deadsnakes: https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu jammy 
main "BA6932366A755776"
+environment:
+  PYTHON_VERSIONS:
+- '3.7'
+- '3.8'
+- '3.9'
+- '3.10'
+- '3.11'
 tasks:
-  - setup-lint-env: |
-  sudo apt-get update
-  sudo apt-get install -y --no-install-recommends python-is-python3 
python3-venv
-  python -m venv .venv
+  - setup-python: |
+  portage/.builds/setup-python.sh "${PYTHON_VERSIONS[@]}"
+
+  - setup-black: |
   source .venv/bin/activate
-  pip install --upgrade pip
   pip install black
+  deactivate
 
   - black: |
   source .venv/bin/activate
@@ -18,3 +28,4 @@ tasks:
   xargs grep -l '#!/usr/bin/env python' | \
   tr '\n' ' ')"
   black --check --diff --color . $STRAGGLERS
+  deactivate

diff --git a/.builds/setup-python.sh b/.builds/setup-python.sh
new file mode 100755
index 0..be113ce8e
--- /dev/null
+++ b/.builds/setup-python.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+# Maintainer: Oskari Pirhonen 
+
+set -ex
+
+install_versions=( "${@/#/python}" )
+
+sudo apt-get install -y --no-install-recommends \
+python-is-python3 \
+"${install_versions[@]}" \
+"${install_versions[@]/%/-venv}"
+
+for py in "${@}"; do
+  "python$py" -m venv ".venv-$py"
+  source ".venv-$py/bin/activate"
+  pip install --upgrade pip
+  deactivate
+done
+
+python -m venv .venv
+source .venv/bin/activate
+pip install --upgrade pip
+deactivate



[gentoo-commits] proj/portage:master commit in: .builds/

2023-04-07 Thread Sam James
commit: 060ac0415092f432136d2e5664003a5d7e1e5509
Author: Oskari Pirhonen  gmail  com>
AuthorDate: Fri Mar 31 05:30:10 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Fri Apr  7 09:49:59 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=060ac041

ci: run pylint on sourcehut

Run the pylint portion of the lint tasks (for each version given in
PYTHON_VERSIONS) on sourcehut builds.

Signed-off-by: Oskari Pirhonen  gmail.com>
Signed-off-by: Sam James  gentoo.org>

 .builds/lint.yml | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/.builds/lint.yml b/.builds/lint.yml
index 675fde757..7d17f539e 100644
--- a/.builds/lint.yml
+++ b/.builds/lint.yml
@@ -21,11 +21,27 @@ tasks:
   pip install black
   deactivate
 
+  - setup-pylint: |
+  for py in "${PYTHON_VERSIONS[@]}"; do
+source ".venv-$py/bin/activate"
+pip install pylint
+deactivate
+  done
+
   - black: |
   source .venv/bin/activate
   cd portage
   STRAGGLERS="$(find bin runtests -type f -not -name '*.py' -not -name 
'*.sh' | \
   xargs grep -l '#!/usr/bin/env python' | \
   tr '\n' ' ')"
-  black --check --diff --color . $STRAGGLERS
+  time black --check --diff --color . $STRAGGLERS
   deactivate
+
+  - pylint: |
+  for py in "${PYTHON_VERSIONS[@]}"; do
+source ".venv-$py/bin/activate"
+pushd portage
+  time ./run-pylint
+popd
+deactivate
+  done