From 15af5a78f0bca8c4a0839b932219d8b0fa223904 Mon Sep 17 00:00:00 2001 From: Denis 'GNUtoo' Carikli Date: Fri, 19 Aug 2022 14:18:38 +0200 Subject: libre: phoronix-test-suite: update to 10.8.3 TODO: it fails with the following error when running makepkg: ==> Starting package()... xdg-mime: No writable system mimetype directory found. Signed-off-by: Denis 'GNUtoo' Carikli --- .../0001-Don-t-download-online-tests.patch | 63 ----- libre/phoronix-test-suite/PKGBUILD | 96 +++---- .../phoronix-test-suite-fsdg.patch | 308 +++++++++++++++++++++ 3 files changed, 348 insertions(+), 119 deletions(-) delete mode 100644 libre/phoronix-test-suite/0001-Don-t-download-online-tests.patch create mode 100644 libre/phoronix-test-suite/phoronix-test-suite-fsdg.patch diff --git a/libre/phoronix-test-suite/0001-Don-t-download-online-tests.patch b/libre/phoronix-test-suite/0001-Don-t-download-online-tests.patch deleted file mode 100644 index 2ffabf21f..000000000 --- a/libre/phoronix-test-suite/0001-Don-t-download-online-tests.patch +++ /dev/null @@ -1,63 +0,0 @@ -From c6e3cf9dafab33d9484a38e211aafd8a5a26f927 Mon Sep 17 00:00:00 2001 -From: Denis 'GNUtoo' Carikli -Date: Sat, 8 Feb 2020 07:35:10 +0100 -Subject: [PATCH] Don't download online tests - -Signed-off-by: Denis 'GNUtoo' Carikli ---- - pts-core/objects/pts_openbenchmarking.php | 19 +------------------ - pts-core/user-agreement.txt | 2 +- - 2 files changed, 2 insertions(+), 19 deletions(-) - -diff --git a/pts-core/objects/pts_openbenchmarking.php b/pts-core/objects/pts_openbenchmarking.php -index ccfce89a1..50d629646 100644 ---- a/pts-core/objects/pts_openbenchmarking.php -+++ b/pts-core/objects/pts_openbenchmarking.php -@@ -463,7 +463,7 @@ class pts_openbenchmarking - } - public static function linked_repositories() - { -- $repos = array('local', 'pts', 'system', 'git'); -+ $repos = array('local'); - - if(PTS_IS_CLIENT && phodevi::is_windows()) - { -@@ -671,23 +671,6 @@ class pts_openbenchmarking - } - public static function phoromatic_server_ob_cache_request($type_request, $repo = null, $test = null) - { -- if(PTS_IS_CLIENT == false) -- { -- return null; -- } -- -- $archived_servers = pts_client::available_phoromatic_servers(); -- -- foreach($archived_servers as $archived_server) -- { -- $cache = pts_network::http_get_contents('http://' . $archived_server['ip'] . ':' . $archived_server['http_port'] . '/openbenchmarking-cache.php?' . $type_request . '&repo=' . $repo . '&test=' . $test); -- -- if(!empty($cache)) -- { -- return $cache; -- } -- } -- - return null; - } - public static function available_tests($download_tests = true, $all_versions = false, $append_versions = false, $show_deprecated_tests = false, $only_show_available_cached_tests = false) -diff --git a/pts-core/user-agreement.txt b/pts-core/user-agreement.txt -index 92a2eb2ce..eb77b11ab 100644 ---- a/pts-core/user-agreement.txt -+++ b/pts-core/user-agreement.txt -@@ -1,6 +1,6 @@ - Phoronix Test Suite User Agreement / Notices: - --- The Phoronix Test Suite is open-source and licensed under the GNU GPLv3. A copy of the GPLv3 license is included with this software or can also be found at https://www.gnu.org/licenses/gpl-3.0.en.html. However, some tests supported by the Phoronix Test Suite are not open-source software or require commercial software packages. -+- The Phoronix Test Suite is free software and licensed under the GNU GPLv3. A copy of the GPLv3 license is included with this software or can also be found at https://www.gnu.org/licenses/gpl-3.0.en.html. However, some tests originally supported by the Phoronix Test Suite are not free software and were removed in Parabola. - - - The Phoronix Test Suite contains tests which may stress your system and in some cases could exhibit stability problems of the system's hardware or software configuration. The Phoronix Test Suite is provided WITHOUT ANY WARRANTY. In no event shall OpenBenchmarking.org, Phoromatic, Phoronix Media, the Phoronix Test Suite, or any associated stakeholder be liable to any party for any direct or indirect damages for any use of OpenBenchmarking.org -- including, without limitation, any lost profits, business interruption, loss of programs, loss of programmed data, or otherwise. - --- -2.25.0 - diff --git a/libre/phoronix-test-suite/PKGBUILD b/libre/phoronix-test-suite/PKGBUILD index eed63d29c..ae8270497 100644 --- a/libre/phoronix-test-suite/PKGBUILD +++ b/libre/phoronix-test-suite/PKGBUILD @@ -2,16 +2,18 @@ # Maintainer: Fabio 'Lolix' Loli # Contributor: Sergej Pupykin # Contributor: Andreas Schönfelder +# Contributor: Denis 'GNUtoo' Carikli pkgname=phoronix-test-suite -pkgver=9.2.1 +pkgver=10.8.3 pkgrel=1 pkgrel+=.par1 -pkgdesc="The most comprehensive testing and benchmarking platform available for Linux without the nonfree tests" +pkgdesc="Testing and benchmarking tool with nonfree tests disabled (but still listed with 'phoronix-test-suite list-available-tests')" arch=(any) license=(GPL3) url="http://www.phoronix-test-suite.com/" -depends=(php) +depends=('make' 'gzip' 'php' 'sed' 'tar' 'which') +makedepends=('python') optdepends=('php-gd' 'sqlite3: required when running a Phoromatic server.' 'gcc-fortran: required for universe-cli test suite' @@ -22,66 +24,48 @@ optdepends=('php-gd' 'mesa-demos: required for universe-cli test suite' 'openmpi: required for universe-cli test suite') source=("$pkgname-$pkgver.tar.gz::https://github.com/phoronix-test-suite/phoronix-test-suite/archive/v${pkgver}.tar.gz" - "https://raw.githubusercontent.com/FabioLolix/AUR-artifacts/master/phoronix-test-suite-launcher.patch" - "0001-Don-t-download-online-tests.patch") -sha256sums=('28acbcb6c5b8eb27c20329cd1a5ea3f1a27abb69812c4b1eeade4b91c89fc7d8' - '577326343d0303a59fd469c3f9c9740e756dd59c0660c54363b62d6fd1cee26d' - 'SKIP') -options=(!strip) + "https://raw.githubusercontent.com/FabioLolix/AUR-artifacts/master/phoronix-test-suite-launcher.patch") +sha256sums=('752012b6e94897f03a219157fe1ba6c4198eb16a5ddf026811b739f1f89cfd9e' + '577326343d0303a59fd469c3f9c9740e756dd59c0660c54363b62d6fd1cee26d') -test_profiles=('build-apache-1.5.1' - 'build-eigen-1.0.0' - 'build-gcc-1.1.2' - 'build-llvm-1.1.0' - 'build-php-1.4.0') +# This patch comes from Guix at the commit +# 92121b8e9db9541b0fdf0e6e0b17e28e03a01277 ("gnu: Add +# phoronix-test-suite."). It disables tests that include nonfree +# software. I've already bugreported to Guix for tests like linux or +# gnupg which download nonfree software so they should be fixed at +# some point. If new problematic tests are found, since Guix is FSDG +# compliant, it is possible to bugreport there to get them fixed, and +# then to backport the fixed patch to Parabola. As I understand this +# phoronix-test-suite-fsdg.patch is also being upstreamed, so once is +# is upstream, it will be possible to directly send patches to fix +# issues upstream. +# +# Note that with this patch, while the tests are disabled, they still +# show up in phoronix-test-suite list-available-tests, but when trying +# to run them they fail to run. +source+=("phoronix-test-suite-fsdg.patch") +sha256sums+=('SKIP') -# Issues: -# build-firefox: source code not FSDG compliant -# build-imagemagick: TODO: rebuild the tarball from official source code -# build-linux-kernel: source code not FSDG compliant -# build-mplayer: TODO: make sure that it doesn't build with FAAC -# build-webkitfltk: TODO: review the project source code +options=(!strip) prepare() { cd "$srcdir/$pkgname-$pkgver" - patch phoronix-test-suite -i "${srcdir}/phoronix-test-suite-launcher.patch" - patch -p1 -i "${srcdir}/0001-Don-t-download-online-tests.patch" - # Only keep tests that meet the following requirements: - # - No dependencies on nonfree software - # - No binaries - # - Source comming from official projects potentially with additional patches - # to be able to understand what was changed. - mkdir -p ob-cache_/test-profiles/pts/ - for p in ${test_profiles[@]} ; do - # Local works with the current patch - # TODO: make it appear under pts - mv ob-cache/test-profiles/pts/${p} ob-cache_/test-profiles/local/ - done - rm -rf ob-cache - mv ob-cache_ ob-cache + + # Without that fix, running makepkg twice results in the following + # error: + # ==> Starting prepare()... + # The next patch would create the file delete-nonfree-metadata, + # which already exists! Skipping patch. + # [...] + # ==> ERROR: A failure occurred in prepare(). + # Aborting... + rm -f delete-nonfree-metadata + + patch -Np1 -i "${srcdir}/phoronix-test-suite-fsdg.patch" + patch -Np1 phoronix-test-suite -i "${srcdir}/phoronix-test-suite-launcher.patch" } package() { cd "$srcdir/$pkgname-$pkgver" - ./install-sh $pkgdir/usr - - rm -r "${pkgdir}"/usr/share/phoronix-test-suite/deploy - rm -rf "${pkgdir}"/usr/share/phoronix-test-suite/pts-core/external-test-dependencies/{dependency-handlers,scripts,xml}/{*.php,*.sh,*.xml} - - install -D "${srcdir}/phoronix-test-suite-${pkgver}"/pts-core/external-test-dependencies/dependency-handlers/arch_dependency_handler.php \ - "${pkgdir}"/usr/share/phoronix-test-suite/pts-core/external-test-dependencies/dependency-handlers/arch_dependency_handler.php - - install -D "${srcdir}/phoronix-test-suite-${pkgver}"/pts-core/external-test-dependencies/scripts/install-arch-packages.sh \ - "${pkgdir}"/usr/share/phoronix-test-suite/pts-core/external-test-dependencies/scripts/install-arch-packages.sh - - install -D "${srcdir}/phoronix-test-suite-${pkgver}"/pts-core/external-test-dependencies/xml/arch-packages.xml \ - "${pkgdir}"/usr/share/phoronix-test-suite/pts-core/external-test-dependencies/xml/arch-packages.xml - - install -D "${srcdir}/phoronix-test-suite-${pkgver}"/pts-core/external-test-dependencies/xml/generic-packages.xml \ - "${pkgdir}"/usr/share/phoronix-test-suite/pts-core/external-test-dependencies/xml/generic-packages.xml - - install "${srcdir}/phoronix-test-suite-${pkgver}"/phoronix-test-suite \ - "${pkgdir}"/usr/bin/phoronix-test-suite - - ln -s /usr/bin/phoronix-test-suite "$pkgdir/usr/bin/pts" + ./install-sh $pkgdir/usr --free-software-only } diff --git a/libre/phoronix-test-suite/phoronix-test-suite-fsdg.patch b/libre/phoronix-test-suite/phoronix-test-suite-fsdg.patch new file mode 100644 index 000000000..48d411e11 --- /dev/null +++ b/libre/phoronix-test-suite/phoronix-test-suite-fsdg.patch @@ -0,0 +1,308 @@ +Submitted upstream at https://github.com/phoronix-test-suite/phoronix-test-suite/pull/642. + +diff --git a/delete-nonfree-metadata b/delete-nonfree-metadata +new file mode 100755 +index 000000000..e25e3b48c +--- /dev/null ++++ b/delete-nonfree-metadata +@@ -0,0 +1,195 @@ ++#!/usr/bin/env python3 ++ ++# Copyright (C) 2022, Maxim Cournoyer ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++ ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++# Commentary: ++# ++# This script prunes the 'ob-cache' test metadata cache from any ++# nonfree test. This is useful for users who concerned with running ++# only free software or distributions complying with the Free Software ++# Distribution Guidelines (GNU FSDG, ++# https://www.gnu.org/distros/free-system-distribution-guidelines.html). ++import argparse ++import json ++import logging ++import pathlib ++import pprint ++import re ++import shutil ++import xml.etree.ElementTree as ET ++ ++ ++logger = logging.getLogger(__name__) ++logging.basicConfig(level='INFO', format='%(levelname)s: %(message)s') ++ ++ ++DEFAULT_ROOT_DIR = pathlib.Path(__file__).parent.resolve() ++# Global cache used to keep the test/suite definition licenses, keyed ++# by their test name key (e.g., 'caffe'). ++TEST_DEFINITION_LICENSES = {} ++ ++ ++def get_test_definitions(root_dir=DEFAULT_ROOT_DIR): ++ """Return the list of all test definition XML files.""" ++ return sorted(pathlib.Path(root_dir).glob('**/test-definition.xml')) ++ ++ ++def get_suite_definitions(root_dir=DEFAULT_ROOT_DIR): ++ return sorted(pathlib.Path(root_dir).glob('**/suite-definition.xml')) ++ ++ ++def get_index_files(root_dir=DEFAULT_ROOT_DIR): ++ return sorted(pathlib.Path(root_dir).glob('**/*.index')) ++ ++ ++def sanitize_index_files(index_files, nonfree_test_names): ++ """Remove non free test entries from `index_files`.""" ++ for index_file in index_files: ++ with index_file.open() as f: ++ index = json.load(f) ++ filtered_tests = {k: v for k, v in index['tests'].items() ++ if k not in nonfree_test_names} ++ index['tests'] = filtered_tests ++ if index['suites']: ++ filtered_suites = {k: v for k, v in index['suites'].items() ++ if k not in nonfree_test_names} ++ index['suites'] = filtered_suites ++ ++ with index_file.open('w') as f: ++ json.dump(index, f) ++ ++ ++def get_test_definition_license(test_definition_file, ++ root_dir=DEFAULT_ROOT_DIR): ++ """Return the licenses from `test_definition_file`, or None.""" ++ name = get_name_from_definition_file(test_definition_file) ++ if name in TEST_DEFINITION_LICENSES: ++ return TEST_DEFINITION_LICENSES[name] ++ ++ root = ET.parse(test_definition_file) ++ try: ++ license = next(root.iter('License')).text ++ except StopIteration: ++ # No license field; check if it extends another test. ++ try: ++ extended_test = next(root.iter('Extends')).text # e.g. 'pts/caffe' ++ extended_name = extended_test.split('/')[-1] ++ if extended_name in TEST_DEFINITION_LICENSES: ++ license = TEST_DEFINITION_LICENSES[extended_name] ++ else: ++ extended_definition_file = sorted( ++ pathlib.Path(root_dir).glob( ++ '**/test-profiles/' + extended_test ++ + '-*/test-definition.xml'))[-1] ++ license = get_test_definition_license(extended_definition_file, ++ root_dir) ++ except StopIteration: ++ logger.warning('could not find license for %s', ++ test_definition_file) ++ return None ++ ++ TEST_DEFINITION_LICENSES[name] = license ++ return license ++ ++ ++def is_test_definition_free(test_definition_file): ++ """True if `test_definition_file` has its license tag set to 'Free'.""" ++ license = get_test_definition_license(test_definition_file) ++ return license == 'Free' ++ ++ ++def is_suite_definition_free(suite_definition_file, nonfree_test_names): ++ """True if `suite_definition_file` is free. ++ ++ The suite definition is considered free when it doesn't reference ++ any test part of `nonfree_test_names`. ++ """ ++ root = ET.parse(suite_definition_file) ++ for test in root.iter('Test'): ++ test_name = test.text ++ name = test_name.split('/')[-1] # strip any prefix ++ if name in nonfree_test_names: ++ return False ++ ++ return True ++ ++ ++def get_name_from_definition_file(definition_file): ++ """Return the parent directory name of a definition file. ++ ++ The version information in stripped from the name.""" ++ parent_dir_name = pathlib.Path(definition_file).parent.name ++ # Strip the version from the name. ++ return re.search(r'^(.*)-', parent_dir_name).group(1) ++ ++ ++def get_default_user_config_file(root_dir): ++ return next(pathlib.Path(root_dir).glob('**/user-config-defaults.xml')) ++ ++ ++def disallow_refreshing_repositories(user_config_file): ++ """Set the 'AllowRefreshingRepositoryLists' option to FALSE.""" ++ config = ET.parse(user_config_file) ++ for option in config.iter('AllowRefreshingRepositoryLists'): ++ option.text = 'FALSE' ++ config.write(user_config_file) ++ ++ ++def main(root_dir): ++ # Gather data. ++ test_definitions = get_test_definitions(root_dir) ++ suite_definitions = get_suite_definitions(root_dir) ++ nonfree_test_definitions = [d for d in test_definitions ++ if not is_test_definition_free(d)] ++ nonfree_test_names = [get_name_from_definition_file(t) ++ for t in nonfree_test_definitions] ++ nonfree_suite_definitions = [ ++ s for s in suite_definitions ++ if not is_suite_definition_free(s, nonfree_test_names)] ++ nonfree_suite_names = [get_name_from_definition_file(s) ++ for s in nonfree_suite_definitions] ++ nonfree_definitions = nonfree_test_definitions + nonfree_suite_definitions ++ nonfree_definition_names = sorted(set(nonfree_test_names ++ + nonfree_suite_names)) ++ ++ # Delete nonfree definitions. ++ for nonfree_definition in nonfree_definitions: ++ shutil.rmtree(nonfree_definition.parent) ++ ++ # Delete nonfree entries in index files. ++ indexes = get_index_files(root_dir) ++ sanitize_index_files(indexes, nonfree_definition_names) ++ ++ logger.info('The following nonfree test suites were deleted:\n%s', ++ pprint.pformat([str(d) for d in nonfree_definitions])) ++ ++ # This is necessary to avoid downloading the ++ # OpenBenchmarking-provided tests metadata which includes all the ++ # tests, including teh proprietary ones. ++ user_config_file = get_default_user_config_file(root_dir) ++ disallow_refreshing_repositories(user_config_file) ++ logger.info('Disabled test metadata updates in default user config') ++ ++ ++if __name__ == '__main__': ++ parser = argparse.ArgumentParser( ++ description='Remove nonfree cached metadata') ++ parser.add_argument('--root-dir', type=str, ++ help='the Phoronix Test Suite root directory', ++ default=DEFAULT_ROOT_DIR) ++ args = parser.parse_args() ++ ++ main(args.root_dir) +diff --git a/documentation/phoronix-test-suite.md b/documentation/phoronix-test-suite.md +index c2e04ae4e..0c71ecf37 100644 +--- a/documentation/phoronix-test-suite.md ++++ b/documentation/phoronix-test-suite.md +@@ -817,7 +817,18 @@ The Phoronix Test Suite can be simply extracted from the downloaded *.tar.gz* or + + + ### Generic Installation +-Running *install-sh* from the root directory of the Phoronix Test Suite will install the software for system-wide access. By default the *phoronix-test-suite* executable is in */usr/bin/* , the Phoronix Test Suite files in */usr/share/phoronix-test-suite/* , and the documentation in / *usr/share/doc/phoronix-test-suite/* . Root access is required. The default installation prefix is /usr/ but can be adjusted as the first argument (example: *install-sh /home/user/* to install the Phoronix Test Suite in your home directory). ++Running *install-sh* from the root directory of the Phoronix Test ++Suite will install the software for system-wide access. By default the ++*phoronix-test-suite* executable is in */usr/bin/* , the Phoronix Test ++Suite files in */usr/share/phoronix-test-suite/* , and the ++documentation in / *usr/share/doc/phoronix-test-suite/* . Root access ++is required. The default installation prefix is /usr/ but can be ++adjusted as the first argument (example: *install-sh /home/user/* to ++install the Phoronix Test Suite in your home directory). Use the ++`--free-software-only` option of the `install-sh` script if you'd like ++to be offered only test profiles and suites relying on free software ++only. Note that this option disables the automatic fetching of new ++tests definitions from OpenBenchmarking.org. + + + ### Debian/Ubuntu Installation +@@ -937,6 +948,11 @@ If this option is set to *TRUE* , the system logs (i.e. dmesg, lspci, lsusb, Xor + #### AllowResultUploadsToOpenBenchmarking + This option defines whether to allow/support result uploads to OpenBenchmarking.org. If set to *FALSE* , the user will not be prompted to allow uploading of test results to the public site. + ++#### AllowRefreshingRepositoryLists ++This option defines whether to allow refreshing the test profiles ++(metadata) content from OpenBenchmarking.org. If set to *FALSE* , ++only the locally available test profiles will be used, and no updates ++will made to it. + + ## General Options + #### DefaultBrowser +diff --git a/install-sh b/install-sh +index f6228cde9..ff9bf9bd7 100755 +--- a/install-sh ++++ b/install-sh +@@ -1,4 +1,5 @@ + #!/bin/sh ++set -e + + # Phoronix Test Suite + # URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/ +@@ -28,6 +29,13 @@ else + INSTALL_PREFIX="$1" + fi + ++# XXX: Perhaps this should be the default? ++for arg in "$@"; do ++ if [ "$arg" = "--free-software-only" ]; then ++ FREE_SOFTWARE_ONLY=yes ++ fi ++done ++ + # Ensure the user is in the correct directory + if [ ! -f pts-core/phoronix-test-suite.php ] + then +@@ -114,6 +122,11 @@ else + + fi + ++# Post-installation process. ++if [ -n FREE_SOFTWARE_ONLY ]; then ++ ./delete-nonfree-metadata --root-dir="$DESTDIR$INSTALL_PREFIX/share/phoronix-test-suite/" ++fi ++ + echo -e "\nPhoronix Test Suite Installation Completed\n + Executable File: $INSTALL_PREFIX/bin/phoronix-test-suite + Documentation: $INSTALL_PREFIX/share/doc/phoronix-test-suite/ +@@ -124,4 +137,3 @@ then + echo "Installed to chroot: $DESTDIR" + echo "Please update your desktop and mime-database manually" + fi +- +diff --git a/pts-core/objects/pts_openbenchmarking.php b/pts-core/objects/pts_openbenchmarking.php +index 081f55c31..e9396ea36 100644 +--- a/pts-core/objects/pts_openbenchmarking.php ++++ b/pts-core/objects/pts_openbenchmarking.php +@@ -330,6 +330,11 @@ class pts_openbenchmarking + } + public static function refresh_repository_lists($repos = null, $force_refresh = false) + { ++ if(!pts_config::read_bool_config('PhoronixTestSuite/Options/OpenBenchmarking/AllowRefreshingRepositoryLists', true)) ++ { ++ return true; ++ } ++ + if($repos == null) + { + if($force_refresh == false) +diff --git a/pts-core/static/user-config-defaults.xml b/pts-core/static/user-config-defaults.xml +index 878c5137f..c9a67df5f 100644 +--- a/pts-core/static/user-config-defaults.xml ++++ b/pts-core/static/user-config-defaults.xml +@@ -6,6 +6,7 @@ + 3 + FALSE + TRUE ++ TRUE + + + -- cgit v1.2.2