diff --git a/.gitignore b/.gitignore index 38193a1..23dafa8 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,13 @@ /pcs-0.12.0a1.tar.gz /pcs-web-ui-0.1.20.tar.gz /pcs-web-ui-node-modules-0.1.20.tar.xz +/ffi-1.17.0.gem +/mustermann-3.0.3.gem +/nio4r-2.7.4.gem +/puma-6.4.3.gem +/rack-3.1.8.gem +/rackup-2.2.1.gem +/tilt-2.4.0.gem +/pcs-0.12.0b1.tar.gz +/pcs-web-ui-0.1.21.tar.gz +/pcs-web-ui-node-modules-0.1.21.tar.xz diff --git a/fix-tests-for-missing-webui.patch b/fix-tests-for-missing-webui.patch deleted file mode 100644 index d88f9ea..0000000 --- a/fix-tests-for-missing-webui.patch +++ /dev/null @@ -1,444 +0,0 @@ -From 525b102bd053a6653dff663845c98683fa78bbab Mon Sep 17 00:00:00 2001 -From: Ivan Devat -Date: Mon, 24 Jun 2024 17:19:58 +0200 -Subject: [PATCH] fix tests for missing webui - ---- - pcs_test/Makefile.am | 1 + - pcs_test/smoke.sh.in | 23 ++++++-- - pcs_test/tier0/daemon/app/fixtures_app.py | 53 +++---------------- - .../tier0/daemon/app/fixtures_app_webui.py | 28 ++++++++++ - pcs_test/tier0/daemon/app/test_app_gui.py | 37 ++++++++++--- - pcs_test/tier0/daemon/app/test_app_spa.py | 26 +++++++-- - pcs_test/tier0/daemon/test_env.py | 6 ++- - pcs_test/tier0/daemon/test_session.py | 25 ++++++--- - pcs_test/tools/misc.py | 9 ++++ - 9 files changed, 138 insertions(+), 70 deletions(-) - create mode 100644 pcs_test/tier0/daemon/app/fixtures_app_webui.py - -diff --git a/pcs_test/Makefile.am b/pcs_test/Makefile.am -index 4e71fcda..6c5932b3 100644 ---- a/pcs_test/Makefile.am -+++ b/pcs_test/Makefile.am -@@ -134,6 +134,7 @@ EXTRA_DIST = \ - tier0/common/test_tools.py \ - tier0/common/test_tools_xml_fromstring.py \ - tier0/daemon/app/fixtures_app.py \ -+ tier0/daemon/app/fixtures_app_webui.py \ - tier0/daemon/app/__init__.py \ - tier0/daemon/app/test_api_v0.py \ - tier0/daemon/app/test_api_v1.py \ -diff --git a/pcs_test/smoke.sh.in b/pcs_test/smoke.sh.in -index a4b3ac71..37eac345 100755 ---- a/pcs_test/smoke.sh.in -+++ b/pcs_test/smoke.sh.in -@@ -66,10 +66,25 @@ cat < ${pcsd_settings_conf_path} - EOF - cat ${pcsd_settings_conf_path} - pcs cluster start --all --wait --curl --insecure --data "username=${cluster_user}&password=${cluster_user_password}" --cookie-jar ${cookie_file} https://localhost:2224/ui/login --curl --insecure --cookie ${cookie_file} --header "X-Requested-With: XMLHttpRequest" --data "hidden[hidden_input]=&config[stonith-enabled]=false" https://localhost:2224/managec/${cluster_name}/update_cluster_settings > "${output_file}" --cat "${output_file}"; echo "" --[ "$(cat ${output_file})" = "Update Successful" ] -+ -+webui_http_code_response=$( -+ curl --insecure --silent --output /dev/null --write-out "%{http_code}" \ -+ https://localhost:2224/ui/ -+) -+if [ "$webui_http_code_response" = "200" ]; then -+ # Webui backend check -+ curl --insecure --data "username=${cluster_user}&password=${cluster_user_password}" --cookie-jar ${cookie_file} https://localhost:2224/ui/login -+ curl --insecure --cookie ${cookie_file} --header "X-Requested-With: XMLHttpRequest" --data "hidden[hidden_input]=&config[stonith-enabled]=false" https://localhost:2224/managec/${cluster_name}/update_cluster_settings > "${output_file}" -+ cat "${output_file}"; echo "" -+ [ "$(cat ${output_file})" = "Update Successful" ] -+elif [ "$webui_http_code_response" = "401" ]; then -+ curl --insecure https://localhost:2224/ui/ > "${output_file}" -+ cat "${output_file}"; echo "" -+ [ "$(cat "${output_file}")" = '{"notauthorized":"true"}' ] -+else -+ echo "Unexpected response from https://localhost:2224/ui/ - http code: '${webui_http_code_response}'" -+ exit 1 -+fi - - # Sanity check of API V1 - curl -kb "token=${token}" https://localhost:2224/api/v1/resource-agent-get-agents-list/v1 --data '{}' > "${output_file}" -diff --git a/pcs_test/tier0/daemon/app/fixtures_app.py b/pcs_test/tier0/daemon/app/fixtures_app.py -index 3c0d6a4f..56acf473 100644 ---- a/pcs_test/tier0/daemon/app/fixtures_app.py -+++ b/pcs_test/tier0/daemon/app/fixtures_app.py -@@ -1,16 +1,11 @@ - from pprint import pformat - from urllib.parse import urlencode - --from tornado.httputil import ( -- HTTPHeaders, -- parse_cookie, --) -+from tornado.httputil import HTTPHeaders - from tornado.testing import AsyncHTTPTestCase - from tornado.web import Application - - from pcs.daemon import ruby_pcsd --from pcs.daemon.app.webui import session --from pcs.daemon.app.webui.auth import PCSD_SESSION - - USER = "user" - GROUPS = ["group1", "group2"] -@@ -56,6 +51,13 @@ class AppTest(AsyncHTTPTestCase): - def fetch(self, path, raise_error=False, **kwargs): - if "follow_redirects" not in kwargs: - kwargs["follow_redirects"] = False -+ -+ if "is_ajax" in kwargs: -+ if "headers" not in kwargs: -+ kwargs["headers"] = {} -+ kwargs["headers"]["X-Requested-With"] = "XMLHttpRequest" -+ del kwargs["is_ajax"] -+ - response = super().fetch(path, raise_error=raise_error, **kwargs) - # "Strict-Transport-Security" header is expected in every response - self.assertTrue( -@@ -91,45 +93,6 @@ class AppTest(AsyncHTTPTestCase): - self.assert_headers_contains(response.headers, self.wrapper.headers) - self.assertEqual(response.body, self.wrapper.body) - -- --class AppUiTestMixin(AppTest): -- def setUp(self): -- self.session_storage = session.Storage(lifetime_seconds=10) -- super().setUp() -- -- def assert_session_in_response(self, response, sid=None): -- self.assertTrue("Set-Cookie" in response.headers) -- cookie = parse_cookie(response.headers["Set-Cookie"]) -- self.assertTrue(PCSD_SESSION, cookie) -- if sid: -- self.assertEqual(cookie[PCSD_SESSION], sid) -- return cookie[PCSD_SESSION] -- -- def fetch(self, path, raise_error=False, **kwargs): -- if "sid" in kwargs: -- if "headers" not in kwargs: -- kwargs["headers"] = {} -- kwargs["headers"]["Cookie"] = f"{PCSD_SESSION}={kwargs['sid']}" -- del kwargs["sid"] -- -- if "is_ajax" in kwargs: -- if "headers" not in kwargs: -- kwargs["headers"] = {} -- kwargs["headers"]["X-Requested-With"] = "XMLHttpRequest" -- del kwargs["is_ajax"] -- -- if "follow_redirects" not in kwargs: -- kwargs["follow_redirects"] = False -- -- return super().fetch(path, raise_error=raise_error, **kwargs) -- -- def create_login_session(self): -- return self.session_storage.login(USER) -- -- def assert_success_response(self, response, expected_body): -- self.assertEqual(response.code, 200) -- self.assertEqual(response.body.decode(), expected_body) -- - def assert_unauth_ajax(self, response): - self.assertEqual(response.code, 401) - self.assertEqual(response.body, b'{"notauthorized":"true"}') -diff --git a/pcs_test/tier0/daemon/app/fixtures_app_webui.py b/pcs_test/tier0/daemon/app/fixtures_app_webui.py -new file mode 100644 -index 00000000..e38ca3e7 ---- /dev/null -+++ b/pcs_test/tier0/daemon/app/fixtures_app_webui.py -@@ -0,0 +1,28 @@ -+try: -+ from pcs.daemon.app import webui -+except ImportError: -+ # You need to skip tests in tests that uses AppTest in the case webui -+ # is not there. -+ webui = None -+ -+from pcs_test.tier0.daemon.app import fixtures_app -+ -+ -+class AppTest(fixtures_app.AppTest): -+ def setUp(self): -+ self.session_storage = webui.session.Storage(lifetime_seconds=10) -+ super().setUp() -+ -+ def fetch(self, path, raise_error=False, **kwargs): -+ if "sid" in kwargs: -+ if "headers" not in kwargs: -+ kwargs["headers"] = {} -+ kwargs["headers"][ -+ "Cookie" -+ ] = f"{webui.auth.PCSD_SESSION}={kwargs['sid']}" -+ del kwargs["sid"] -+ -+ return super().fetch(path, raise_error=raise_error, **kwargs) -+ -+ def create_login_session(self): -+ return self.session_storage.login(fixtures_app.USER) -diff --git a/pcs_test/tier0/daemon/app/test_app_gui.py b/pcs_test/tier0/daemon/app/test_app_gui.py -index b3446fdb..2317eea5 100644 ---- a/pcs_test/tier0/daemon/app/test_app_gui.py -+++ b/pcs_test/tier0/daemon/app/test_app_gui.py -@@ -1,14 +1,24 @@ - import logging - from unittest import mock - -+from tornado.httputil import parse_cookie -+ - from pcs.daemon import ruby_pcsd - from pcs.daemon.app import sinatra_ui - from pcs.daemon.app.auth import UnixSocketAuthProvider --from pcs.daemon.app.webui import sinatra_ui as sinatra_ui_webui -+ -+try: -+ from pcs.daemon.app import webui -+except ImportError: -+ webui = None - from pcs.lib.auth.provider import AuthProvider - from pcs.lib.auth.types import AuthUser - --from pcs_test.tier0.daemon.app import fixtures_app -+from pcs_test.tier0.daemon.app import ( -+ fixtures_app, -+ fixtures_app_webui, -+) -+from pcs_test.tools.misc import skip_unless_webui_installed - - # Don't write errors to test output. - logging.getLogger("tornado.access").setLevel(logging.CRITICAL) -@@ -33,21 +43,28 @@ def patch_get_unix_socket_user(user): - auth_provider = AuthProvider(logging.getLogger("test logger")) - - --class AppTest(fixtures_app.AppUiTestMixin): -+@skip_unless_webui_installed() -+@patch_login_user() -+class SinatraAjaxProtectedSession(fixtures_app_webui.AppTest): - def setUp(self): - self.wrapper = fixtures_app.RubyPcsdWrapper(ruby_pcsd.SINATRA) - super().setUp() - -- --@patch_login_user() --class SinatraAjaxProtectedSession(AppTest): - def get_routes(self): -- return sinatra_ui_webui.get_routes( -+ return webui.sinatra_ui.get_routes( - self.session_storage, - auth_provider, - self.wrapper, - ) - -+ def assert_session_in_response(self, response, sid=None): -+ self.assertTrue("Set-Cookie" in response.headers) -+ cookie = parse_cookie(response.headers["Set-Cookie"]) -+ self.assertTrue(webui.auth.PCSD_SESSION, cookie) -+ if sid: -+ self.assertEqual(cookie[webui.auth.PCSD_SESSION], sid) -+ return cookie[webui.auth.PCSD_SESSION] -+ - def test_deal_without_authentication(self): - self.assert_unauth_ajax(self.get("/some-ajax", is_ajax=True)) - -@@ -63,7 +80,11 @@ class SinatraAjaxProtectedSession(AppTest): - - - @patch_login_user() --class SinatraAjaxProtectedUnixSocket(AppTest): -+class SinatraAjaxProtectedUnixSocket(fixtures_app.AppTest): -+ def setUp(self): -+ self.wrapper = fixtures_app.RubyPcsdWrapper(ruby_pcsd.SINATRA) -+ super().setUp() -+ - def get_routes(self): - return sinatra_ui.get_routes(auth_provider, self.wrapper) - -diff --git a/pcs_test/tier0/daemon/app/test_app_spa.py b/pcs_test/tier0/daemon/app/test_app_spa.py -index 89a5ab0e..6acf3c7d 100644 ---- a/pcs_test/tier0/daemon/app/test_app_spa.py -+++ b/pcs_test/tier0/daemon/app/test_app_spa.py -@@ -2,12 +2,22 @@ import logging - import os - from unittest import mock - --from pcs.daemon.app import webui -+try: -+ from pcs.daemon.app import webui -+except ImportError: -+ webui = None -+ - from pcs.lib.auth.provider import AuthProvider - from pcs.lib.auth.types import AuthUser - --from pcs_test.tier0.daemon.app import fixtures_app --from pcs_test.tools.misc import get_tmp_dir -+from pcs_test.tier0.daemon.app import ( -+ fixtures_app, -+ fixtures_app_webui, -+) -+from pcs_test.tools.misc import ( -+ get_tmp_dir, -+ skip_unless_webui_installed, -+) - - LOGIN_BODY = {"username": fixtures_app.USER, "password": fixtures_app.PASSWORD} - PREFIX = "/ui/" -@@ -16,7 +26,7 @@ PREFIX = "/ui/" - logging.getLogger("tornado.access").setLevel(logging.CRITICAL) - - --class AppTest(fixtures_app.AppUiTestMixin): -+class AppTest(fixtures_app_webui.AppTest): - def setUp(self): - self.public_dir = get_tmp_dir("tier0_daemon_app_spa") - self.spa_dir_path = os.path.join(self.public_dir.name, "ui") -@@ -41,7 +51,12 @@ class AppTest(fixtures_app.AppUiTestMixin): - auth_provider=AuthProvider(logging.Logger("test logger")), - ) - -+ def assert_success_response(self, response, expected_body): -+ self.assertEqual(response.code, 200) -+ self.assertEqual(response.body.decode(), expected_body) -+ - -+@skip_unless_webui_installed() - class Static(AppTest): - def test_index(self): - self.assert_success_response( -@@ -50,6 +65,7 @@ class Static(AppTest): - ) - - -+@skip_unless_webui_installed() - class Fallback(AppTest): - def setUp(self): - super().setUp() -@@ -65,6 +81,7 @@ class Fallback(AppTest): - ) - - -+@skip_unless_webui_installed() - class Login(AppTest): - def setUp(self): - super().setUp() -@@ -94,6 +111,7 @@ class Login(AppTest): - ) - - -+@skip_unless_webui_installed() - class Logout(AppTest): - def test_can_logout(self): - session1 = self.create_login_session() -diff --git a/pcs_test/tier0/daemon/test_env.py b/pcs_test/tier0/daemon/test_env.py -index 40f0c402..0eff3660 100644 ---- a/pcs_test/tier0/daemon/test_env.py -+++ b/pcs_test/tier0/daemon/test_env.py -@@ -8,7 +8,10 @@ from unittest import ( - from pcs import settings - from pcs.daemon import env - --from pcs_test.tools.misc import create_setup_patch_mixin -+from pcs_test.tools.misc import ( -+ create_setup_patch_mixin, -+ skip_unless_webui_installed, -+) - - - def webui_fallback(public_dir): -@@ -177,6 +180,7 @@ class Prepare(TestCase, create_setup_patch_mixin(env)): - {env.PCSD_DEBUG: "false"} - ) - -+ @skip_unless_webui_installed() - def test_errors_on_missing_paths(self): - self.path_exists.return_value = False - self.assert_environ_produces_modified_pcsd_env( -diff --git a/pcs_test/tier0/daemon/test_session.py b/pcs_test/tier0/daemon/test_session.py -index a893c01d..e8eff4cd 100644 ---- a/pcs_test/tier0/daemon/test_session.py -+++ b/pcs_test/tier0/daemon/test_session.py -@@ -1,23 +1,31 @@ - from contextlib import contextmanager - from unittest import TestCase - --from pcs.daemon.app.webui import session --from pcs.daemon.app.webui.session import Session -+try: -+ from pcs.daemon.app import webui -+except ImportError: -+ webui = None - --from pcs_test.tools.misc import create_setup_patch_mixin -+from pcs_test.tools.misc import ( -+ create_setup_patch_mixin, -+ skip_unless_webui_installed, -+) - - SID = "abc" - USER = "user" - GROUPS = ["group1", "group2"] - - --PatchSessionMixin = create_setup_patch_mixin(session) -+# If webui is None, the tests in this file using these mixins are skipped, -+# passing a dummy object instead to make this executable -+PatchSessionMixin = create_setup_patch_mixin(webui) if webui else object - - -+@skip_unless_webui_installed() - class SessionTest(TestCase, PatchSessionMixin): - def setUp(self): -- self.now = self.setup_patch("now", return_value=0) -- self.session = Session(SID, USER) -+ self.now = self.setup_patch("session.now", return_value=0) -+ self.session = webui.session.Session(SID, USER) - - def test_session_grows_older(self): - self.now.return_value = 10.1 -@@ -42,10 +50,11 @@ class SessionTest(TestCase, PatchSessionMixin): - session1.sid - - -+@skip_unless_webui_installed() - class StorageTest(TestCase, PatchSessionMixin): - def setUp(self): -- self.now = self.setup_patch("now", return_value=0) -- self.storage = session.Storage(lifetime_seconds=10) -+ self.now = self.setup_patch("session.now", return_value=0) -+ self.storage = webui.session.Storage(lifetime_seconds=10) - - def test_does_not_accept_foreign_sid(self): - self.assertIsNone(self.storage.get("unknown_sid")) -diff --git a/pcs_test/tools/misc.py b/pcs_test/tools/misc.py -index 28e03411..7a048a4d 100644 ---- a/pcs_test/tools/misc.py -+++ b/pcs_test/tools/misc.py -@@ -15,6 +15,11 @@ from pcs.cli.common.parse_args import InputModifiers - from pcs.common import str_tools - from pcs.lib.external import CommandRunner - -+try: -+ from pcs.daemon.app import webui -+except ImportError: -+ webui = None # type: ignore -+ - from pcs_test import TEST_ROOT - from pcs_test import settings as tests_settings - from pcs_test.tools.custom_mock import MockLibraryReportProcessor -@@ -292,6 +297,10 @@ def skip_unless_booth_resource_agent_installed(): - ) - - -+def skip_unless_webui_installed(): -+ return skipUnless(webui, "test requires webui which is not installed") -+ -+ - def create_patcher(target_prefix_or_module): - """ - Return function for patching tests with preconfigured target prefix --- -2.45.2 - diff --git a/pcs.spec b/pcs.spec index 691055a..e82a597 100644 --- a/pcs.spec +++ b/pcs.spec @@ -1,18 +1,17 @@ Name: pcs -Version: 0.12.0~a1 -Release: 4%{?dist} +Version: 0.12.0~b1 +Release: 1%{?dist} # https://docs.fedoraproject.org/en-US/packaging-guidelines/LicensingGuidelines/ # https://fedoraproject.org/wiki/Licensing:Main?rd=Licensing#Good_Licenses # GPL-2.0-only: pcs -# Apache-2.0: tornado # MIT: backports, childprocess, dacite, ethon, mustermann, rack, # rack-protection, rack-session, rack-test, rackup, sinatra, tilt # MIT and (BSD-2-Clause or GPL-2.0-or-later): nio4r -# BSD-2-Clause or Ruby: base64, ruby2_keywords, webrick +# BSD-2-Clause or Ruby: base64 # BSD-3-Clause: puma # BSD-3-Clause and MIT: ffi # curl OR LGPL-2.1-or-later: python-pycurl -License: GPL-2.0-only AND Apache-2.0 AND MIT AND BSD-3-Clause AND (BSD-2-Clause OR Ruby) AND (BSD-2-Clause OR GPL-2.0-or-later) AND (curl OR LGPL-2.1-or-later) +License: GPL-2.0-only AND MIT AND BSD-3-Clause AND (BSD-2-Clause OR Ruby) AND (BSD-2-Clause OR GPL-2.0-or-later) AND (curl OR LGPL-2.1-or-later) URL: https://github.com/ClusterLabs/pcs Group: System Environment/Base Summary: Pacemaker/Corosync Configuration System @@ -27,13 +26,12 @@ ExclusiveArch: x86_64 s390x ppc64le aarch64 %global pcs_source_name %{name}-%{version_or_commit} # ui_commit can be determined by hash, tag or branch -%global ui_commit 0.1.20 -%global ui_modules_version 0.1.20 +%global ui_commit 0.1.21 +%global ui_modules_version 0.1.21 %global ui_src_name pcs-web-ui-%{ui_commit} %global dacite_version 1.8.1 %global pyagentx_version 0.4.pcs.2 -%global tornado_version 6.4.0 %global pycurl_version 7.45.3 # During its initialization, PycURL checks that the actual libcurl version @@ -49,21 +47,19 @@ ExclusiveArch: x86_64 s390x ppc64le aarch64 %global version_rubygem_base64 0.2.0 %global version_rubygem_childprocess 5.0.0 %global version_rubygem_ethon 0.16.0 -%global version_rubygem_ffi 1.16.3 -%global version_rubygem_mustermann 3.0.0 -%global version_rubygem_nio4r 2.7.3 -%global version_rubygem_puma 6.4.2 -%global version_rubygem_rack 3.0.11 -%global version_rubygem_rack_protection 4.0.0 +%global version_rubygem_ffi 1.17.0 +%global version_rubygem_mustermann 3.0.3 +%global version_rubygem_nio4r 2.7.4 +%global version_rubygem_puma 6.4.3 +%global version_rubygem_rack 3.1.8 +%global version_rubygem_rack_protection 4.0.0 %global version_rubygem_rack_session 2.0.0 %global version_rubygem_rack_test 2.1.0 -%global version_rubygem_rackup 2.1.0 -%global version_rubygem_ruby2_keywords 0.0.5 +%global version_rubygem_rackup 2.2.1 %global version_rubygem_sinatra 4.0.0 -%global version_rubygem_tilt 2.3.0 -%global version_rubygem_webrick 1.8.1 +%global version_rubygem_tilt 2.4.0 -%global required_pacemaker_version 2.1.0 +%global required_pacemaker_version 3.0.0 %global pcs_bundled_dir pcs_bundled %global pcsd_public_dir pcsd/public @@ -71,9 +67,7 @@ ExclusiveArch: x86_64 s390x ppc64le aarch64 %global rubygem_bundle_dir pcsd/vendor/bundle %global rubygem_cache_dir %{rubygem_bundle_dir}/cache -%global ui_build_dir_standalone build_standalone -%global ui_build_dir_cockpit build_cockpit -%global ui_cockpit_dest ha-cluster +%global cockpit_dir %{_datadir}/cockpit/ %global ui_appstream_metainfo org.clusterlabs.cockpit_pcs_web_ui.metainfo.xml %global pkg_pcs_snmp pcs-snmp @@ -90,7 +84,6 @@ Source0: %{url}/archive/%{?v_prefix}%{version_or_commit}/%{pcs_source_name}.tar. Source21: https://github.com/konradhalas/dacite/archive/v%{dacite_version}/dacite-%{dacite_version}.tar.gz Source22: https://github.com/ondrejmular/pyagentx/archive/v%{pyagentx_version}/pyagentx-%{pyagentx_version}.tar.gz Source23: https://pypi.python.org/packages/source/p/pycurl/pycurl-%{pycurl_version}.tar.gz -Source24: https://github.com/tornadoweb/tornado/archive/v%{tornado_version}/tornado-%{tornado_version}.tar.gz Source61: https://rubygems.org/downloads/backports-%{version_rubygem_backports}.gem Source62: https://rubygems.org/downloads/base64-%{version_rubygem_base64}.gem @@ -105,10 +98,8 @@ Source70: https://rubygems.org/downloads/rack-protection-%{version_rubygem_rack_ Source71: https://rubygems.org/downloads/rack-session-%{version_rubygem_rack_session}.gem Source72: https://rubygems.org/downloads/rack-test-%{version_rubygem_rack_test}.gem Source73: https://rubygems.org/downloads/rackup-%{version_rubygem_rackup}.gem -Source74: https://rubygems.org/downloads/ruby2_keywords-%{version_rubygem_ruby2_keywords}.gem Source75: https://rubygems.org/downloads/sinatra-%{version_rubygem_sinatra}.gem Source76: https://rubygems.org/downloads/tilt-%{version_rubygem_tilt}.gem -Source77: https://rubygems.org/downloads/webrick-%{version_rubygem_webrick}.gem Source100: https://github.com/ClusterLabs/pcs-web-ui/archive/%{ui_commit}/%{ui_src_name}.tar.gz Source101: https://github.com/ClusterLabs/pcs-web-ui/releases/download/%{ui_commit}/pcs-web-ui-node-modules-%{ui_modules_version}.tar.xz @@ -117,7 +108,6 @@ Source101: https://github.com/ClusterLabs/pcs-web-ui/releases/download/%{ui_comm # pcs patches: <= 200 # Patch1: name.patch Patch1: do-not-support-cluster-setup-with-udp-u-transport.patch -Patch2: fix-tests-for-missing-webui.patch # ui patches: >200 # Patch201: name-web-ui.patch @@ -131,6 +121,8 @@ BuildRequires: automake BuildRequires: make # printf from coreutils is used in makefile, head is used in spec BuildRequires: coreutils +# find is used in Makefile and also somewhere else +BuildRequires: findutils # python for pcs BuildRequires: python3 >= 3.12 BuildRequires: python3-cryptography @@ -141,6 +133,7 @@ BuildRequires: python3-pip BuildRequires: python3-pyparsing # pcs build backend is setuptools BuildRequires: python3-setuptools +Buildrequires: python3-tornado # for building bundled python packages BuildRequires: python3-wheel # gcc for compiling custom rubygems and python extensions @@ -188,7 +181,7 @@ Requires: python3-cryptography Requires: python3-dateutil >= 2.7.0 Requires: python3-lxml Requires: python3-pyparsing -Requires: python3-setuptools +Requires: python3-tornado # ruby and gems for pcsd Requires: ruby >= 3.3.0 Requires: rubygems @@ -220,7 +213,6 @@ Requires: nss-tools Provides: bundled(dacite) = %{dacite_version} Provides: bundled(pycurl) = %{pycurl_version} -Provides: bundled(tornado) = %{tornado_version} Provides: bundled(backports) = %{version_rubygem_backports} Provides: bundled(base64) = %{version_rubygem_base64} @@ -235,10 +227,8 @@ Provides: bundled(rack_protection) = %{version_rubygem_rack_protection} Provides: bundled(rack_session) = %{version_rubygem_rack_session} Provides: bundled(rack_test) = %{version_rubygem_rack_test} Provides: bundled(rackup) = %{version_rubygem_rackup} -Provides: bundled(ruby2_keywords) = %{version_rubygem_ruby2_keywords} Provides: bundled(sinatra) = %{version_rubygem_sinatra} Provides: bundled(tilt) = %{version_rubygem_tilt} -Provides: bundled(webrick) = %{version_rubygem_webrick} # pcs-snmp subpackage definition @@ -332,8 +322,22 @@ update_times_patch(){ # * http://ftp.rpm.org/max-rpm/s1-rpm-inside-macros.html # * https://rpm-software-management.github.io/rpm/manual/autosetup.html # patch web-ui sources -%autosetup -D -T -b 100 -a 101 -S git -n %{ui_src_name} -N -%autopatch -p1 -m 201 +# -q limits verbosity of %setup macro. Only tar -xof is executed instead of tar +# -xvvof. This option has to be used as first. +# This option is used to suppress a listing of all node_modules files that is +# too long and exceeds capacity of CI log +# -n — Set Name of Build Directory +# -T — Do Not Perform Default Archive Unpacking +# -b — Unpack The nth Sources Before Changing Directory +# -a — Unpack The nth Sources After Changing Directory +# +# 1. unpack sources (-b 0) +# 2. then cd into sources tree (the setup macro itself) +# 3. then unpack node_modules into sources tree (-a 1). +%setup -q -T -b 100 -a 101 -n %{ui_src_name} +# patching is handled by applying the individual patches +# %%patch -P201 + # update_times_patch %%{PATCH201} # patch pcs sources @@ -341,7 +345,6 @@ update_times_patch(){ %autopatch -p1 -M 200 # update_times_patch %%{PATCH1} update_times_patch %{PATCH1} -update_times_patch %{PATCH2} # generate .tarball-version if building from an untagged commit, not a released version # autogen uses git-version-gen which uses .tarball-version for generating version number @@ -367,10 +370,8 @@ cp -f %SOURCE70 %{rubygem_cache_dir} cp -f %SOURCE71 %{rubygem_cache_dir} cp -f %SOURCE72 %{rubygem_cache_dir} cp -f %SOURCE73 %{rubygem_cache_dir} -cp -f %SOURCE74 %{rubygem_cache_dir} cp -f %SOURCE75 %{rubygem_cache_dir} cp -f %SOURCE76 %{rubygem_cache_dir} -cp -f %SOURCE77 %{rubygem_cache_dir} # 2) prepare python bundles @@ -378,12 +379,13 @@ mkdir -p %{pcs_bundled_dir}/src cp -f %SOURCE21 rpm/ cp -f %SOURCE22 rpm/ cp -f %SOURCE23 rpm/ -cp -f %SOURCE24 rpm/ + %build %define debug_package %{nil} +# We left off by setting up pcs, so we are in its directory now ./autogen.sh %{configure} --enable-local-build --enable-use-local-cache-only \ --enable-individual-bundling --enable-booth-enable-authfile-unset \ @@ -391,41 +393,36 @@ cp -f %SOURCE24 rpm/ PYTHON=%{__python3} ruby_CFLAGS="%{optflags}" ruby_LIBS="%{build_ldflags}" make all -# build pcs-web-ui -export BUILD_USE_CURRENT_NODE_MODULES=true +# Web UI installation +# Switch to web ui folder first +cd ../%{ui_src_name} +./autogen.sh +%{configure} \ + --disable-standalone \ + --with-cockpit-dir=%{cockpit_dir} +make all -## standalone -export BUILD_DIR=%{_builddir}/%{ui_src_name}/%{ui_build_dir_standalone} -make -C %{_builddir}/%{ui_src_name} build - -## cockpit -export BUILD_DIR=%{_builddir}/%{ui_src_name}/%{ui_build_dir_cockpit} -export BUILD_FOR_COCKPIT=true -make -C %{_builddir}/%{ui_src_name} build %install -rm -rf $RPM_BUILD_ROOT +rm -rf %{buildroot} pwd +# Install cockpit pcs-web-ui +cd ../%{ui_src_name} +%make_install +# Workaround - metainfo should be installed by make install +mkdir -p %{buildroot}%{_datadir}/metainfo +cp -r %{_builddir}/%{ui_src_name}/packages/app/%{ui_appstream_metainfo} \ + %{buildroot}%{_datadir}/metainfo/ + +# Install pcs +cd ../%{pcs_source_name} %make_install # RHEL-7716 - fix rubygem permissions - remove write access for owner's group # and other users -chmod --recursive g-w,o-w ${RPM_BUILD_ROOT}%{_libdir}/%{rubygem_bundle_dir} - -# install standalone pcs-web-ui -cp -r %{_builddir}/%{ui_src_name}/%{ui_build_dir_standalone} \ - ${RPM_BUILD_ROOT}%{_libdir}/%{pcsd_public_dir}/ui - -# install cockpit pcs-web-ui -mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/cockpit/%{ui_cockpit_dest} -mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/metainfo -cp -r %{_builddir}/%{ui_src_name}/%{ui_build_dir_cockpit}/* \ - ${RPM_BUILD_ROOT}%{_datadir}/cockpit/%{ui_cockpit_dest} - -cp -r %{_builddir}/%{ui_src_name}/packages/app/%{ui_appstream_metainfo} \ - ${RPM_BUILD_ROOT}%{_datadir}/metainfo/ +chmod --recursive g-w,o-w %{buildroot}%{_libdir}/%{rubygem_bundle_dir} # prepare license files mv %{rubygem_bundle_dir}/gems/backports-%{version_rubygem_backports}/LICENSE.txt backports_LICENSE.txt @@ -444,10 +441,8 @@ mv %{rubygem_bundle_dir}/gems/rack-protection-%{version_rubygem_rack_protection} mv %{rubygem_bundle_dir}/gems/rack-session-%{version_rubygem_rack_session}/license.md rack-session_license.md mv %{rubygem_bundle_dir}/gems/rack-test-%{version_rubygem_rack_test}/MIT-LICENSE.txt rack-test_MIT-LICENSE.txt mv %{rubygem_bundle_dir}/gems/rackup-%{version_rubygem_rackup}/license.md rackup_license.md -mv %{rubygem_bundle_dir}/gems/ruby2_keywords-%{version_rubygem_ruby2_keywords}/LICENSE ruby2_keywords_LICENSE mv %{rubygem_bundle_dir}/gems/sinatra-%{version_rubygem_sinatra}/LICENSE sinatra_LICENSE mv %{rubygem_bundle_dir}/gems/tilt-%{version_rubygem_tilt}/COPYING tilt_COPYING -mv %{rubygem_bundle_dir}/gems/webrick-%{version_rubygem_webrick}/LICENSE.txt webrick_LICENSE.txt cp %{pcs_bundled_dir}/src/dacite-*/LICENSE dacite_LICENSE cp %{pcs_bundled_dir}/src/dacite-*/README.md dacite_README.md @@ -460,9 +455,6 @@ cp %{pcs_bundled_dir}/src/pycurl-*/COPYING-LGPL pycurl_COPYING-LGPL cp %{pcs_bundled_dir}/src/pycurl-*/COPYING-MIT pycurl_COPYING-MIT cp %{pcs_bundled_dir}/src/pycurl-*/README.rst pycurl_README.rst -cp %{pcs_bundled_dir}/src/tornado-*/LICENSE tornado_LICENSE -cp %{pcs_bundled_dir}/src/tornado-*/README.rst tornado_README.rst - # We are not building debug package for pcs but we need to add MiniDebuginfo # to the bundled shared libraries from rubygem extensions in order to satisfy # rpminspect's binary stripping checker. @@ -471,24 +463,32 @@ cp %{pcs_bundled_dir}/src/tornado-*/README.rst tornado_README.rst find-debuginfo -j2 -m -i -S debugsourcefiles.list # find-debuginfo generated some files into /usr/lib/debug and # /usr/src/debug/ that we don't want in the package -rm -rf $RPM_BUILD_ROOT%{_libdir}/debug -rm -rf $RPM_BUILD_ROOT/usr/lib/debug -rm -rf $RPM_BUILD_ROOT%{_prefix}/src/debug +rm -rf %{buildroot}%{_libdir}/debug +rm -rf %{buildroot}/usr/lib/debug +rm -rf %{buildroot}%{_prefix}/src/debug # We can remove files required for gem compilation -rm -rf $RPM_BUILD_ROOT%{_libdir}/%{rubygem_bundle_dir}/gems/ffi-%{version_rubygem_ffi}/ext -rm -rf $RPM_BUILD_ROOT%{_libdir}/%{rubygem_bundle_dir}/gems/nio4r-%{version_rubygem_nio4r}/ext -rm -rf $RPM_BUILD_ROOT%{_libdir}/%{rubygem_bundle_dir}/gems/puma-%{version_rubygem_puma}/ext +rm -rf %{buildroot}%{_libdir}/%{rubygem_bundle_dir}/gems/ffi-%{version_rubygem_ffi}/ext +rm -rf %{buildroot}%{_libdir}/%{rubygem_bundle_dir}/gems/nio4r-%{version_rubygem_nio4r}/ext +rm -rf %{buildroot}%{_libdir}/%{rubygem_bundle_dir}/gems/puma-%{version_rubygem_puma}/ext # Sinatra contains example applications which are unnecessary (discovered by brp_mangle_shebangs) -rm -rf $RPM_BUILD_ROOT%{_libdir}/%{rubygem_bundle_dir}/gems/sinatra-%{version_rubygem_sinatra}/examples +rm -rf %{buildroot}%{_libdir}/%{rubygem_bundle_dir}/gems/sinatra-%{version_rubygem_sinatra}/examples # Puma contains an unnecessary rc init script (discovered by brp_mangle_shebangs) -rm -rf $RPM_BUILD_ROOT%{_libdir}/%{rubygem_bundle_dir}/gems/puma-%{version_rubygem_puma}/docs/jungle/rc.d +rm -rf %{buildroot}%{_libdir}/%{rubygem_bundle_dir}/gems/puma-%{version_rubygem_puma}/docs/jungle/rc.d + +# Remove unused rubygem executables with wrong shebangs (discovered by brp_mangle_shebangs) +rm -fv %{buildroot}/%{_libdir}/pcsd/vendor/bundle/gems/puma-*/bin/puma +rm -fv %{buildroot}/%{_libdir}/pcsd/vendor/bundle/gems/puma-*/bin/pumactl +rm -fv %{buildroot}/%{_libdir}/pcsd/vendor/bundle/gems/rackup-*/bin/rackup +rm -fv %{buildroot}/%{_libdir}/pcsd/vendor/bundle/gems/tilt-*/bin/tilt + + %check # Run validation of cockpit metainfo -appstream-util validate-relax --nonet ${RPM_BUILD_ROOT}%{_datadir}/metainfo/%{ui_appstream_metainfo} +appstream-util validate-relax --nonet %{buildroot}%{_datadir}/metainfo/%{ui_appstream_metainfo} # In the building environment LC_CTYPE is set to C which causes tests to fail # due to python prints a warning about it to stderr. The following environment @@ -514,8 +514,8 @@ run_all_tests(){ test_result_python=$? #run pcsd tests and remove them - GEM_HOME=$RPM_BUILD_ROOT%{_libdir}/%{rubygem_bundle_dir} ruby \ - -I$RPM_BUILD_ROOT%{_libdir}/pcsd \ + GEM_HOME=%{buildroot}%{_libdir}/%{rubygem_bundle_dir} ruby \ + -I%{buildroot}%{_libdir}/pcsd \ -Ipcsd/test \ pcsd/test/test_all_suite.rb test_result_ruby=$? @@ -562,12 +562,10 @@ run_all_tests %doc CHANGELOG.md %doc README.md %doc dacite_README.md -%doc tornado_README.rst %doc pycurl_README.rst %license COPYING # python dependency licenses %license dacite_LICENSE -%license tornado_LICENSE %license pycurl_COPYING-LGPL %license pycurl_COPYING-MIT # rubygem licenses @@ -587,10 +585,8 @@ run_all_tests %license rack-session_license.md %license rack-test_MIT-LICENSE.txt %license rackup_license.md -%license ruby2_keywords_LICENSE %license sinatra_LICENSE %license tilt_COPYING -%license webrick_LICENSE.txt %{python3_sitelib}/* %{_sbindir}/pcs %{_sbindir}/pcsd @@ -633,11 +629,20 @@ run_all_tests %license pyagentx_LICENSE.txt %files -n %{pkg_cockpit_ha_cluster} -%{_datadir}/cockpit/%{ui_cockpit_dest} +%{cockpit_dir} %{_datadir}/metainfo/%{ui_appstream_metainfo} %changelog +* Wed Nov 13 2024 Michal Pospíšil - 0.12.0~b1-1 +- Rebased to the latest sources (see CHANGELOG.md) + Resolves: RHEL-21047, RHEL-33386, RHEL-38483, RHEL-44432, RHEL-48220, RHEL-49520, RHEL-49521, RHEL-49524, RHEL-49527, RHEL-55723, RHEL-61747, RHEL-61889, RHEL-62719 +- Updated pcs-web-ui in cockpit-ha-cluster to 0.1.21 + Resolves: RHEL-30688, RHEL-30691, RHEL-30693, RHEL-30701, RHEL-47158, RHEL-52846, RHEL-53363 +- Updated bundled rubygems: ffi, mustermann, puma, rack, rackup, tilt +- Removed bundled rubygem webrick, ruby2_keywords +- New runtime dependency python3-tornado which has been bundled in previous versions + * Tue Oct 29 2024 Troy Dawson - 0.12.0~a1-4 - Bump release for October 2024 mass rebuild: Resolves: RHEL-64018 diff --git a/sources b/sources index 4133e86..9418806 100644 --- a/sources +++ b/sources @@ -1,24 +1,25 @@ SHA512 (dacite-1.8.1.tar.gz) = 4b40c0bdcf5490bcc77de9e7f04b7267642bcfd41e4168607a5457f38abe3ad4b3041d8a23cb43af76de14eabee45f900ad5ddf7af8f70a2be4850bccc2d3af1 SHA512 (ethon-0.16.0.gem) = 3b31affcee0d5a5be05b5497d4a8d13515f8393f54579a3a9c8de49f78d3f065bb92659434b023f0a8bf8e0cccfbc94b617695b93c4d3f744cccd1eff2e68905 SHA512 (ffi-1.16.3.gem) = b3d823a03055412a85ae3dbc10c3b50615614f0b66830e144ca47610b1f93f588ff693a95d364b4f686968b79bba91f9f9fa60b932479c6bf9ceb10e15575b98 -SHA512 (mustermann-3.0.0.gem) = c33d41281fe2ac80c0af0c5c31dbab2068c73b9da19a4b82b387bbe551019fc115675634d932a8e56b070c3a06a85d830c982a103e6c5193aff8647f599be6e3 SHA512 (pyagentx-0.4.pcs.2.tar.gz) = d4194fec9a3e5fefe3793d49b7fec1feafef294c7e613a06046c2993daeefc5cb39d7c5b2b402ff83e49b2d976953f862264288c758c0be09d997b5323cc558a SHA512 (pycurl-7.45.3.tar.gz) = 12a55070602a1fd22b160ad582a4001bdd28531d2b2ccd365ff0136bc13dd23af80b19488bdbbc60a902a3a362b64383b9ae6acce6ed328c74dcffc8a6a3f4ad SHA512 (rack-test-2.1.0.gem) = e349ce61c3d787e0a772980db697e92212d4d9592ce33f55516d1f85fba55cbe666496c76392679b057786d6dab603d74b83e7bb773ab54940343e36dbf05d6f SHA512 (ruby2_keywords-0.0.5.gem) = f6b9078b111e68c0017e0025ecdccb976c7a32f35c1a8adf9fd879db0c91f89eb9bd799f9527a846e28056f2a5fbf0f3610cda9538570288c493613c35c83a6f -SHA512 (tilt-2.3.0.gem) = 78a3de34e3d096e40cb245807bad07cc3ebfa192986addbd228c25153166808b379f3ce086ff68fa5959997946187fe8923e84100653b2b109007390969875b3 SHA512 (backports-3.25.0.gem) = 47a2ffb83030cb317e85a4f72a1c4a76a90324b8928ac73e1aa3404a22136661e9ce718bfdd937fbe07b9e05a338fcbd717bb505fb1dd91cfee570bbff9e3f72 SHA512 (base64-0.2.0.gem) = ee5cdc30e73e625c15cb674cdd16a839ad44ffb0a27d1363f94491b48d95da37a2976c34f6f616b722a35750a067eb2245c4746d7d36f8e9a9ecee68ff5540fb SHA512 (childprocess-5.0.0.gem) = 9ec340c86f4fd978b7a9925bcf90811ff3443f014469e4ff121e2c4758a4068823029ab413d1a57eb9de4a864435505b1edfa60a611709f2a5f99aaf08da422d -SHA512 (nio4r-2.7.3.gem) = 88c8f74fd5e7d4b3f037d04d7538940f2b3def76e0f86103bf9c585b9d97bad6ef8381d5b4c1eea7c06d20c0659d4d89d1a781a48a2754e32f81cfff810f443a -SHA512 (puma-6.4.2.gem) = 32bde41a8dbeaf998dc1cc11390ca393e96f12c8d253c023e04304cc1d631bf24a153e2d4183b6a20ae73a9b1daed9acec7f3c8fbb40090a42ca3f5f08f24aeb -SHA512 (rack-3.0.11.gem) = 77ea51d2a1584f58396cb864f9895ec47f36febaaf9bb806ebdb52d105ace8cac1a93144ac9769efbe1fff66f5bac555c7b949f62627cb80984d2ea31704d995 SHA512 (rack-protection-4.0.0.gem) = 5eb33e4829e5e0d320a14d169fd007111641e388f2b6e5f8de98d45dfd1e6705cdb4e1ce29524ebb6fb5afe14079b8e5370c9c389cb2befca4ca508da73165b3 SHA512 (rack-session-2.0.0.gem) = 827cd1acf20eb814adda7663f61755febd2e6acec6ee085dbc393b614a621f845dffa8f759e434055dbf029be370afeb921c8759c9e9e1fee17119830d9b2899 -SHA512 (rackup-2.1.0.gem) = f2b66902b04ddce5ca9389822118244c591b5c83766a55aee88550717c8e736b1eff967927b2c6c611205dde25bf5a862edfc587fda9cb88f31cc902171f85b1 SHA512 (sinatra-4.0.0.gem) = 1eb8c6e8966461d3fa463b5c87e8bc3cd58243fc997a104671e252b866bb653dfc16d7b9f677e016ae91cb30998d72f8778eb2b2254ce27cf304944a6bfa8c05 SHA512 (webrick-1.8.1.gem) = 3bf45e3a52190dccaa6e883923448b745a420eff2a1533eacdd2aed0e4c67f5c6d813c85606f8fc12952c004e4984fd97ebc3c361a42b49cebe5b84c8fc6e99d SHA512 (tornado-6.4.0.tar.gz) = dc584acc14d93c7109e4744b690641ae318ee9ad2c42a4c3560c315fa8654de3a64574c7187f5afdbde2906b7cccf5725f45462e710effb6f025e5ec1a3810d4 -SHA512 (pcs-0.12.0a1.tar.gz) = 1c455dcb24bc6ab0cac0c879f932d54ad8b36c0a937557a1e873ad9442e85ff81cae23c57236c6421cc5d1c36027d583b987e21a4ad80321728090498ef8f30c -SHA512 (pcs-web-ui-0.1.20.tar.gz) = 83117eafbe694b133228dfd8d7de30a7cc58693b8844f7d1af9c12c02618a7af8dd10c374b56c3e722d84c5691488f25bfc3389f22954935a2e6dd42b16c7b2c -SHA512 (pcs-web-ui-node-modules-0.1.20.tar.xz) = 94cd6a306a6784c3decc351b1469efe98beadd43efbfa7848ccc6146be32f704281432669589e2c666b431a32bd6caf101fa08fb05deaab2b58a8cda8b40b85d +SHA512 (ffi-1.17.0.gem) = 5cdaf19eaa499127607de7389f69b4927c7bd8a154a53071c53906050bc712b67c1fbc7b4b37fcf9a82fa6c79d705796032cd7ab61755646cfed0c2d279940a1 +SHA512 (mustermann-3.0.3.gem) = d205985a5da83d83248899642ed359056b0cdb511e77d51309319c2f8d8b6c84040e9e1d3a56b7f83a0b26aed4b344f4df371b310e419c20170f0a486e89ba6f +SHA512 (nio4r-2.7.4.gem) = 6c8280484066ffc39e98b99dfaf5a69fe2a28cafb380924f448673fda8b69b5d97f8b75b8345b91d92f6186f0664e09bec8e1c7c19c070219b030f554824d2ac +SHA512 (puma-6.4.3.gem) = e8baf137c5164f11b8563561405fc4218210707bfb15d0f21118d4be0fd0d071050c46357337a9c6fdda7ce230f3ae09ebfe9976f0a7a0243824bda7871d7a18 +SHA512 (rack-3.1.8.gem) = 7d7b3d8d40c3afc184de90c7602385854bc890ec13c98029e31db0134dbebd7655425334249c908bdb9e5fd1f15754872064611bbf1317a46c6082fd7cdf9b9d +SHA512 (rackup-2.2.1.gem) = e63c4dee6f1a677d507df0ae7bcebec88673e7a0a8d6621997949045db60801907038a148a0608f6e62864cb2ac056fca382f3438dc227b0fa7a3be52d56ea66 +SHA512 (tilt-2.4.0.gem) = 8cf5036017f501da8843340a9c574ee647074782dcb27ee0aa906fb96ad1e66b90dfb80159aa4c5e7605490058c5ae478bd0fe09f17ae50a2697327d02c814cc +SHA512 (pcs-0.12.0b1.tar.gz) = d6916416d6202a12ee7246ce79fe467d5b6e9e8924f0dd593418fc2f51e18d2814c1311eff7c5d6f24ba3f5bbaae77c4a1b87d613f7846d6509143cd53e8ce29 +SHA512 (pcs-web-ui-0.1.21.tar.gz) = 7d619457ba0e104cb96552057fedcb8a80e95be9aedd0e7decf37af7d424c0177ef6a6c0864654d16a60275ab109e29fe9c4b4d84efb620c560bf988e6c5898d +SHA512 (pcs-web-ui-node-modules-0.1.21.tar.xz) = fb69949224b5637cf7e825b3bd9694c98667513f54c044d06911cce7964ccdcc66530d46b9289f24995abaff9dd6ed62a805ab926773c595c150a70a80cc989b