diff options
Diffstat (limited to 'gnu/packages/patches')
23 files changed, 1974 insertions, 763 deletions
diff --git a/gnu/packages/patches/azr3-remove-lash.patch b/gnu/packages/patches/azr3-remove-lash.patch new file mode 100644 index 0000000000..d5d481c5dd --- /dev/null +++ b/gnu/packages/patches/azr3-remove-lash.patch @@ -0,0 +1,191 @@ +Remove any reference to LASH, which has been abandoned and still requires the +use of Python 2. + +diff --git a/Makefile b/Makefile +index 7c9f4f0..f82ba75 100644 +--- a/Makefile ++++ b/Makefile +@@ -10,7 +10,7 @@ PACKAGE_WEBPAGE = "http://ll-plugins.nongnu.org/azr3/" + PACKAGE_BUGTRACKER = "https://savannah.nongnu.org/bugs/?group=ll-plugins" + PACKAGE_VC = "http://git.savannah.gnu.org/cgit/ll-plugins/azr3-jack.git/" + +-PKG_DEPS = gtkmm-2.4>=2.8.8 jack>=0.103.0 lash-1.0>=0.5.3 ++PKG_DEPS = gtkmm-2.4>=2.8.8 jack>=0.103.0 + + + PROGRAMS = azr3 +@@ -32,8 +32,8 @@ azr3_SOURCES = \ + drawbar.hpp drawbar.cpp \ + textbox.hpp textbox.cpp + azr3_SOURCEDIR = azr3 +-azr3_CFLAGS = `pkg-config --cflags gtkmm-2.4 jack lash-1.0` -DDATADIR=\"$(pkgdatadir)\" +-azr3_LDFLAGS = `pkg-config --libs gtkmm-2.4 jack lash-1.0` -lpthread ++azr3_CFLAGS = `pkg-config --cflags gtkmm-2.4 jack` -DDATADIR=\"$(pkgdatadir)\" ++azr3_LDFLAGS = `pkg-config --libs gtkmm-2.4 jack` -lpthread + azr3_cpp_CFLAGS = $(shell if pkg-config --atleast-version=0.107 jack ; then echo -include azr3/newjack.hpp; fi) + main_cpp_CFLAGS = -DPACKAGE_VERSION=\"$(PACKAGE_VERSION)\" + +diff --git a/azr3/main.cpp b/azr3/main.cpp +index 344fd03..fbe5671 100644 +--- a/azr3/main.cpp ++++ b/azr3/main.cpp +@@ -32,13 +32,6 @@ using namespace std; + + + Main::Main(int& argc, char**& argv) : m_ok(false) { +- +- /* this is a bit dumb, but the only way I know of to check whether we were +- started by lashd is to see if lash_extract_args() removes any arguments */ +- int old_argc = argc; +- lash_args_t* lash_args = lash_extract_args(&argc, &argv); +- m_started_by_lashd = (argc != old_argc); +- + // parse all non-LASH arguments + OptionParser op; + bool help(false); +@@ -166,10 +159,6 @@ Main::Main(int& argc, char**& argv) : m_ok(false) { + } + } + +- // initialise LASH +- if (!init_lash(lash_args, jack_get_client_name(m_jack_client))) +- return; +- + m_win->set_title("AZR-3"); + m_win->set_resizable(false); + m_win->add(*m_gui); +@@ -184,14 +173,11 @@ void Main::run() { + jack_activate(m_jack_client); + + // auto-connect JACK ports if desired +- if (!m_started_by_lashd) +- auto_connect(); ++ auto_connect(); + + Glib::signal_timeout(). + connect(sigc::bind_return(sigc::mem_fun(*this, &Main::check_changes), + true), 10); +- Glib::signal_timeout(). +- connect(sigc::mem_fun(*this, &Main::check_lash_events), 500); + m_kit->run(*m_win); + jack_deactivate(m_jack_client); + m_engine->deactivate(); +@@ -343,83 +329,7 @@ int Main::process(jack_nframes_t nframes) { + + return 0; + } +- +- +-bool Main::check_lash_events() { +- lash_event_t* event; +- bool go_on = true; +- while ((event = lash_get_event(m_lash_client))) { +- +- // save +- if (lash_event_get_type(event) == LASH_Save_File) { +- cerr<<"Received LASH Save command"<<endl; +- string dir(lash_event_get_string(event)); +- ofstream fout((dir + "/state").c_str()); +- fout<<int(m_program); +- for (uint32_t i = 0; i < 63; ++i) +- fout<<" "<<m_gui_controls[i]; +- fout<<endl; +- write_presets((dir + "/presets").c_str()); +- lash_send_event(m_lash_client, +- lash_event_new_with_type(LASH_Save_File)); +- } +- +- // restore +- else if (lash_event_get_type(event) == LASH_Restore_File) { +- cerr<<"Received LASH Restore command"<<endl; +- string dir(lash_event_get_string(event)); +- for (unsigned char i = 0; i < 128; ++i) +- m_presets[i].empty = true; +- load_presets((dir + "/presets").c_str()); +- m_gui->clear_programs(); +- for (unsigned char i = 0; i < 128; ++i) { +- if (!m_presets[i].empty) +- m_gui->add_program(i, m_presets[i].name.c_str()); +- } +- ifstream fin((dir + "/state").c_str()); +- int prog; +- fin>>prog; +- m_gui->set_program(prog); +- for (uint32_t p = 0; p < 63; ++p) { +- float tmp; +- fin>>tmp; +- m_gui->set_control(p, tmp); +- } +- lash_send_event(m_lash_client, +- lash_event_new_with_type(LASH_Restore_File)); +- } +- +- // quit +- else if (lash_event_get_type(event) == LASH_Quit) { +- cerr<<"Received LASH Quit command"<<endl; +- Gtk::Main::instance()->quit(); +- go_on = false; +- } +- +- lash_event_destroy(event); +- } +- return go_on; +-} +- +- +-bool Main::init_lash(lash_args_t* lash_args, const std::string& jack_name) { +- +- m_lash_client = lash_init(lash_args, "AZR-3", +- LASH_Config_File, LASH_PROTOCOL(2, 0)); +- if (m_lash_client) { +- lash_event_t* event = lash_event_new_with_type(LASH_Client_Name); +- lash_event_set_string(event, "AZR-3"); +- lash_send_event(m_lash_client, event); +- lash_jack_client_name(m_lash_client, jack_name.c_str()); +- Glib::signal_timeout(). +- connect(sigc::mem_fun(*this, &Main::check_lash_events), 500); +- } +- else +- cerr<<"Could not initialise LASH!"<<endl; +- return (m_lash_client != 0); +-} +- +- ++ + int Main::static_process(jack_nframes_t frames, void* arg) { + return static_cast<Main*>(arg)->process(frames); + } +diff --git a/azr3/main.hpp b/azr3/main.hpp +index 48a425c..0406295 100644 +--- a/azr3/main.hpp ++++ b/azr3/main.hpp +@@ -25,7 +25,6 @@ + #include <gtkmm.h> + #include <pthread.h> + #include <semaphore.h> +-#include <lash/lash.h> + + #include "azr3.hpp" + #include "azr3gui.hpp" +@@ -65,10 +64,6 @@ protected: + + int process(jack_nframes_t nframes); + +- bool check_lash_events(); +- +- bool init_lash(lash_args_t* lash_args, const std::string& jack_name); +- + void auto_connect(); + + static int static_process(jack_nframes_t frames, void* arg); +@@ -89,10 +84,8 @@ protected: + sem_t m_gui_changed; + float m_gui_controls[63]; + Preset m_presets[128]; +- lash_client_t* m_lash_client; + + bool m_ok; +- bool m_started_by_lashd; + std::string m_auto_midi; + std::string m_auto_audio; + diff --git a/gnu/packages/patches/azr3.patch b/gnu/packages/patches/azr3.patch index 5849383c5b..93e9b5b11a 100644 --- a/gnu/packages/patches/azr3.patch +++ b/gnu/packages/patches/azr3.patch @@ -68,9 +68,9 @@ The patch has been sent to the developer on 2016-09-26. Widget* eb = add_clickbox(m_fbox, 14, 319, 14, 44); eb->signal_button_press_event(). - connect(sigc::hide(bind(bind(mem_fun(*this, &AZR3GUI::change_mode), -- ref(m_fbox)), false))); +- sigc::ref(m_fbox)), false))); + connect(sigc::hide(sigc::bind(sigc::mem_fun(*this, &AZR3GUI::change_mode), -+ false, std::ref(m_fbox)))); ++ false, sigc::ref(m_fbox)))); m_fx_widgets.push_back(eb); // Mr Valve controls @@ -79,15 +79,15 @@ The patch has been sent to the developer on 2016-09-26. Widget* eb2 = add_clickbox(m_vbox, 14, 53, 14, 44); eb2->signal_button_press_event(). - connect(sigc::hide(bind(bind(mem_fun(*this, &AZR3GUI::change_mode), -- ref(m_fbox)), true))); +- sigc::ref(m_fbox)), true))); + connect(sigc::hide(sigc::bind(sigc::mem_fun(*this, &AZR3GUI::change_mode), -+ true, std::ref(m_fbox)))); ++ true, sigc::ref(m_fbox)))); // vibrato controls add_switch(m_vbox, n_1_vibrato, 39, 17, Switch::Green); @@ -352,9 +352,9 @@ knob->set_style(s); - if (port >= 0 && port < m_adj.size()) { + if (port < m_adj.size()) { knob->get_adjustment().signal_value_changed(). - connect(compose(bind<0>(mem_fun(*this, &AZR3GUI::control_changed), port), - mem_fun(knob->get_adjustment(), @@ -100,7 +100,7 @@ The patch has been sent to the developer on 2016-09-26. } @@ -382,8 +382,8 @@ db->set_style(s); - if (port >= 0 && port < m_adj.size()) { + if (port < m_adj.size()) { db->get_adjustment().signal_value_changed(). - connect(compose(bind<0>(mem_fun(*this, &AZR3GUI::control_changed), port), - mem_fun(db->get_adjustment(), &Adjustment::get_value))); diff --git a/gnu/packages/patches/bees-beesd-honor-destdir-on-installation.patch b/gnu/packages/patches/bees-beesd-honor-destdir-on-installation.patch new file mode 100644 index 0000000000..93817f42cf --- /dev/null +++ b/gnu/packages/patches/bees-beesd-honor-destdir-on-installation.patch @@ -0,0 +1,40 @@ +From 66b00f8a972ebb4da68f7aa0d0656f43ce2a2c3a Mon Sep 17 00:00:00 2001 +From: Hilton Chain <hako@ultrarare.space> +Date: Fri, 23 Dec 2022 11:04:46 +0800 +Subject: [PATCH] beesd: Honor DESTDIR on installation. + +Co-authored-by: Adam Faiz <adam.faiz@disroot.org> +Signed-off-by: Hilton Chain <hako@ultrarare.space> +--- + Defines.mk | 1 + + scripts/beesd.in | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/Defines.mk b/Defines.mk +index 9e8df40..e5394ba 100644 +--- a/Defines.mk ++++ b/Defines.mk +@@ -2,6 +2,7 @@ MAKE += PREFIX=$(PREFIX) LIBEXEC_PREFIX=$(LIBEXEC_PREFIX) ETC_PREFIX=$(ETC_PREFI + + define TEMPLATE_COMPILER = + sed $< >$@ \ ++ -e's#@DESTDIR@#$(DESTDIR)#' \ + -e's#@PREFIX@#$(PREFIX)#' \ + -e's#@ETC_PREFIX@#$(ETC_PREFIX)#' \ + -e's#@LIBEXEC_PREFIX@#$(LIBEXEC_PREFIX)#' +diff --git a/scripts/beesd.in b/scripts/beesd.in +index 174bb6c..35d04aa 100755 +--- a/scripts/beesd.in ++++ b/scripts/beesd.in +@@ -15,7 +15,7 @@ readonly AL128K="$((128*1024))" + readonly AL16M="$((16*1024*1024))" + readonly CONFIG_DIR=@ETC_PREFIX@/bees/ + +-readonly bees_bin=$(realpath @LIBEXEC_PREFIX@/bees) ++readonly bees_bin=$(realpath @DESTDIR@/@LIBEXEC_PREFIX@/bees) + + command -v "$bees_bin" &> /dev/null || ERRO "Missing 'bees' agent" + +-- +2.38.1 + diff --git a/gnu/packages/patches/diffoscope-fix-llvm-test.patch b/gnu/packages/patches/diffoscope-fix-llvm-test.patch deleted file mode 100644 index 1c1c344720..0000000000 --- a/gnu/packages/patches/diffoscope-fix-llvm-test.patch +++ /dev/null @@ -1,29 +0,0 @@ -From b7eeac09eb068083bdee1a3aa062d1e52a2fa61a Mon Sep 17 00:00:00 2001 -From: Tobias Geerinckx-Rice <me@tobias.gr> -Date: Mon, 4 Oct 2021 21:03:43 +0200 -Subject: [PATCH] gnu: diffoscope: Fix test_item3_deflate_llvm_bitcode. - -Taken verbatim from Nixpkgs[0]. Later extended for diffoscope >= 224. - -[0]: https://github.com/NixOS/nixpkgs/blob/589e03f109092a3ba97781fd0533110bf78a3f97/pkgs/tools/misc/diffoscope/fix-tests.patch ---- - tests/comparators/test_rlib.py | 3 --- - 1 file changed, 3 deletions(-) - -diff --git a/tests/comparators/test_rlib.py b/tests/comparators/test_rlib.py -index 8a20114d..64cea17f 100644 ---- a/tests/comparators/test_rlib.py -+++ b/tests/comparators/test_rlib.py -@@ -80,12 +80,6 @@ def rlib_dis_expected_diff(): - if actual_ver >= "7.0": - diff_file = "rlib_llvm_dis_expected_diff_7" - -- if actual_ver >= "10.0": -- diff_file = "rlib_llvm_dis_expected_diff_10" -- -- if actual_ver >= "15.0": -- diff_file = "rlib_llvm_dis_expected_diff_15" -- - return get_data(diff_file) - - diff --git a/gnu/packages/patches/emacs-libgit-use-system-libgit2.patch b/gnu/packages/patches/emacs-libgit-use-system-libgit2.patch deleted file mode 100644 index 4a5546b06b..0000000000 --- a/gnu/packages/patches/emacs-libgit-use-system-libgit2.patch +++ /dev/null @@ -1,88 +0,0 @@ -From de3c48d72ec7064e7f0522877fe759c729df0c50 Mon Sep 17 00:00:00 2001 -From: Maxim Cournoyer <maxim.cournoyer@gmail.com> -Date: Wed, 25 Mar 2020 11:32:18 -0400 -Subject: [PATCH] Allow using a system provided libgit2 library - -Setting the USE_SYSTEM_LIBGIT2 Make or CMake variable (through the -BUILD_OPTIONS variable) to any value enables using the system library. -The default behavior of using a bundled copy of libgit2 is unchanged. ---- - CMakeLists.txt | 9 +++++++-- - Makefile | 11 +++++++++++ - src/CMakeLists.txt | 9 +++++++-- - 3 files changed, 25 insertions(+), 4 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index a393d7c..75d6ca6 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -7,9 +7,14 @@ set(BUILD_SHARED_LIBS OFF CACHE BOOL "shared" FORCE) - set(BUILD_CLAR OFF CACHE BOOL "clar" FORCE) - set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DEGIT_DEBUG") - --add_subdirectory(libgit2) -+if(USE_SYSTEM_LIBGIT2) -+ find_package(PkgConfig REQUIRED) -+ pkg_check_modules(git2 REQUIRED IMPORTED_TARGET libgit2) -+else() -+ add_subdirectory(libgit2) -+ find_library(git2 libgit2.a) -+endif() - --find_library(git2 libgit2.a) - add_subdirectory(src) - - enable_testing() -diff --git a/Makefile b/Makefile -index 8199532..6a6a4e1 100644 ---- a/Makefile -+++ b/Makefile -@@ -13,6 +13,13 @@ ifeq ($(UNAME),MSYS) - BUILD_OPTIONS+= -G "MSYS Makefiles" - endif - -+# If the variable USE_SYSTEM_LIBGIT2 is set to *any* value, use the -+# system provided libgit2 library. -+USE_SYSTEM_LIBGIT2? := \ -+ $(if $(or $(USE_SYSTEM_LIBGIT2),\ -+ $(findstring USE_SYSTEM_LIBGIT2,$(BUILD_OPTIONS))),\ -+ true) -+ - ifeq "$(TRAVIS)" "true" - ## Makefile for Travis ################################################### - # -@@ -87,7 +94,11 @@ submodule-update: - @git submodule update - - libgit2: -+ifeq ($(USE_SYSTEM_LIBGIT2?),) - @git submodule update --init -+else -+ @echo "Using the system provided libgit2 library" -+endif - - CLEAN = $(ELCS) $(PKG)-autoloads.el build - -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index cfb5777..0dbad8a 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -13,8 +13,13 @@ if(WIN32) - set_target_properties(egit2 PROPERTIES PREFIX lib) - endif(WIN32) - --target_link_libraries(egit2 git2) --target_include_directories(egit2 SYSTEM PRIVATE "${libgit2_SOURCE_DIR}/include") -+if(USE_SYSTEM_LIBGIT2) -+ target_link_libraries(egit2 PRIVATE PkgConfig::git2) -+else() -+ target_link_libraries(egit2 git2) -+ target_include_directories( -+ egit2 SYSTEM PRIVATE "${libgit2_SOURCE_DIR}/include") -+endif() - - if(CMAKE_COMPILER_IS_GNUCC) - target_compile_options(egit2 PRIVATE -Wall -Wextra) --- -2.26.2 - diff --git a/gnu/packages/patches/emacs-telega-path-placeholder.patch b/gnu/packages/patches/emacs-telega-path-placeholder.patch index 5829edd22a..07ab8c1e66 100644 --- a/gnu/packages/patches/emacs-telega-path-placeholder.patch +++ b/gnu/packages/patches/emacs-telega-path-placeholder.patch @@ -1,18 +1,31 @@ -From bf95de21faa623e48bca00d6a2c9b33ab2c5d812 Mon Sep 17 00:00:00 2001 +From bfcd616f2870c8c3ffc9a526fcd574eb5e726a96 Mon Sep 17 00:00:00 2001 From: Andrew Tropin <andrew@trop.in> -Date: Wed, 8 Dec 2021 11:01:31 +0300 -Subject: [PATCH] Use absolute path for telega-server-command. +Date: Sat, 14 Jan 2023 09:33:34 +0400 +Subject: [PATCH] Add path placeholder for telega-server-command and etc-file. --- + telega-core.el | 2 +- telega-customize.el | 2 +- - telega-util.el | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) +diff --git a/telega-core.el b/telega-core.el +index 36f121e..f9f7976 100644 +--- a/telega-core.el ++++ b/telega-core.el +@@ -41,7 +41,7 @@ + + (defun telega-etc-file (filename) + "Return absolute path to FILENAME from etc/ directory in telega." +- (expand-file-name (concat "etc/" filename) telega--lib-directory)) ++ (concat "@TELEGA_SHARE@" "/" filename)) + + (defconst telega-spoiler-translation-table + (let ((table (make-char-table 'translation-table))) diff --git a/telega-customize.el b/telega-customize.el -index 0af343f..cc2938c 100644 +index 0efb001..77cec5f 100644 --- a/telega-customize.el +++ b/telega-customize.el -@@ -591,7 +591,7 @@ In range [1..3]. Use 1." +@@ -633,7 +633,7 @@ In range [1..3]. Use 1." :prefix "telega-server-" :group 'telega) @@ -21,19 +34,5 @@ index 0af343f..cc2938c 100644 "Command to run as telega server. It should be absolute path or binary file searchable in `exec-path'." :type 'string -diff --git a/telega-util.el b/telega-util.el -index 6340c27..01e3cb7 100644 ---- a/telega-util.el -+++ b/telega-util.el -@@ -587,7 +587,7 @@ N can't be 0." - - (defun telega-etc-file (filename) - "Return absolute path to FILENAME from etc/ directory in telega." -- (expand-file-name (concat "etc/" filename) telega--lib-directory)) -+ (concat "@TELEGA_SHARE@" "/" filename)) - - (defun telega-link-props (link-type link-to &optional face) - "Generate props for link button openable with `telega-link--button-action'." -- -2.34.0 - +2.38.1 diff --git a/gnu/packages/patches/gromacs-tinyxml2.patch b/gnu/packages/patches/gromacs-tinyxml2.patch index cc7d7459a8..6f11e174df 100644 --- a/gnu/packages/patches/gromacs-tinyxml2.patch +++ b/gnu/packages/patches/gromacs-tinyxml2.patch @@ -1,10 +1,7 @@ Unbundling tinyxml2 from gromacs and using our own, which is newer, broke gromacs build. -This patch fixes three issues: - -- cmake now errors out if using multiple target_link_libraries with mixed styles - of signatures. +This patch fixes this issue: - Error handling API changed, fix the testutils/refdata_xml.cpp code by using the new API: document.ErrorStr() & tinyxml2::XML_SUCCESS. @@ -15,22 +12,25 @@ there as long as they still keep the old version bundled. First hunk has already been requested for merging. Third is in discussion. Second will only be sent if third is OK'ed. -diff -ruN gromacs-2020.2/src/testutils/CMakeLists.txt gromacs-2020.2-fixed/src/testutils/CMakeLists.txt ---- gromacs-2020.2/src/testutils/CMakeLists.txt 2020-04-30 18:33:44.000000000 +0200 -+++ gromacs-2020.2-fixed/src/testutils/CMakeLists.txt 2020-05-01 22:52:16.356000000 +0200 -@@ -73,7 +73,7 @@ - - if(HAVE_TINYXML2) - include_directories(SYSTEM ${TinyXML2_INCLUDE_DIR}) -- target_link_libraries(testutils ${TinyXML2_LIBRARIES}) -+ target_link_libraries(testutils PRIVATE ${TinyXML2_LIBRARIES}) - else() - include_directories(BEFORE SYSTEM "../external/tinyxml2") +diff --git a/CMakeLists.txt b/CMakeLists.txt +index cd748c9..1e90c95 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -539,9 +539,6 @@ if(GMX_EXTERNAL_TINYXML2) + if(NOT HAVE_TINYXML2) + message(FATAL_ERROR "External TinyXML-2 could not be found, please adjust your search paths") + endif() +- if (TinyXML2_FOUND AND TinyXML2_VERSION VERSION_GREATER "6") +- message(FATAL_ERROR "External TinyXML-2 is later than the highest supported version 6. Please adjust your search paths to include a supported version") +- endif() endif() -diff -ruN gromacs-2020.2/src/testutils/refdata_xml.cpp gromacs-2020.2-fixed/src/testutils/refdata_xml.cpp ---- gromacs-2020.2/src/testutils/refdata_xml.cpp 2020-04-30 18:33:44.000000000 +0200 -+++ gromacs-2020.2-fixed/src/testutils/refdata_xml.cpp 2020-05-01 23:17:09.556000000 +0200 -@@ -206,21 +206,12 @@ + + option(GMX_EXTRAE "Add support for tracing using EXTRAE" OFF) +diff --git a/src/testutils/refdata_xml.cpp b/src/testutils/refdata_xml.cpp +index 0eb2209..57cebff 100644 +--- a/src/testutils/refdata_xml.cpp ++++ b/src/testutils/refdata_xml.cpp +@@ -206,21 +206,12 @@ ReferenceDataEntry::EntryPointer readReferenceDataFile(const std::string& path) document.LoadFile(path.c_str()); if (document.Error()) { @@ -56,7 +56,7 @@ diff -ruN gromacs-2020.2/src/testutils/refdata_xml.cpp gromacs-2020.2-fixed/src/ GMX_THROW(TestException("Reference data not parsed successfully: " + path + "\n." + errorString + "\n")); } -@@ -371,7 +362,7 @@ +@@ -371,7 +362,7 @@ void writeReferenceDataFile(const std::string& path, const ReferenceDataEntry& r XMLElementPtr rootElement = createRootElement(&document); createChildElements(rootElement, rootEntry); diff --git a/gnu/packages/patches/guile-continuation-stack-leak.patch b/gnu/packages/patches/guile-continuation-stack-leak.patch deleted file mode 100644 index 0e57b7bb4e..0000000000 --- a/gnu/packages/patches/guile-continuation-stack-leak.patch +++ /dev/null @@ -1,27 +0,0 @@ -This patch fixes a memory leak when capturing and resuming delimited -continuations intensively, as is the case with the Shepherd 0.9+: - - https://issues.guix.gnu.org/59021 - -diff --git a/libguile/vm.c b/libguile/vm.c -index 6fd5c554f..516bae773 100644 ---- a/libguile/vm.c -+++ b/libguile/vm.c -@@ -165,11 +165,13 @@ capture_stack (union scm_vm_stack_element *stack_top, - scm_t_dynstack *dynstack, uint32_t flags) - { - struct scm_vm_cont *p; -+ size_t stack_size; - -- p = scm_gc_malloc (sizeof (*p), "capture_vm_cont"); -- p->stack_size = stack_top - sp; -- p->stack_bottom = scm_gc_malloc (p->stack_size * sizeof (*p->stack_bottom), -- "capture_vm_cont"); -+ stack_size = stack_top - sp; -+ p = scm_gc_malloc (sizeof (*p) + stack_size * sizeof (*p->stack_bottom), -+ "capture_vm_cont"); -+ p->stack_size = stack_size; -+ p->stack_bottom = (void *) ((char *) p + sizeof (*p)); - p->vra = vra; - p->mra = mra; - p->fp_offset = stack_top - fp; diff --git a/gnu/packages/patches/guile-cross-compilation.patch b/gnu/packages/patches/guile-cross-compilation.patch deleted file mode 100644 index a594cb9421..0000000000 --- a/gnu/packages/patches/guile-cross-compilation.patch +++ /dev/null @@ -1,55 +0,0 @@ -When cross-compiling, get type sizes of the host system, not the build system. - -This is Guile commit 24b30130ca75653bdbacea84ce0443608379d630, which -fixes <https://issues.guix.gnu.org/54198>, with one difference: it uses -8 instead of SIZEOF_INTMAX_T, such that we do not need to modify -'configure.ac' to check for the size of 'intmax_t' and to run 'autoreconf' -(libguile/numbers.c expects SCM_SIZEOF_INTMAX_T = 8). - -diff --git a/libguile/gen-scmconfig.c b/libguile/gen-scmconfig.c -index 01b14f14d..691ebd0af 100644 ---- a/libguile/gen-scmconfig.c -+++ b/libguile/gen-scmconfig.c -@@ -1,4 +1,4 @@ --/* Copyright 2003-2013,2018,2020,2021 -+/* Copyright 2003-2013, 2018, 2020-2022 - Free Software Foundation, Inc. - - This file is part of Guile. -@@ -238,21 +238,21 @@ main (int argc, char *argv[]) - pf ("\n"); - pf ("/* Standard types. */\n"); - -- pf ("#define SCM_SIZEOF_CHAR %zu\n", sizeof (char)); -- pf ("#define SCM_SIZEOF_UNSIGNED_CHAR %zu\n", sizeof (unsigned char)); -- pf ("#define SCM_SIZEOF_SHORT %zu\n", sizeof (short)); -- pf ("#define SCM_SIZEOF_UNSIGNED_SHORT %zu\n", sizeof (unsigned short)); -- pf ("#define SCM_SIZEOF_LONG %zu\n", sizeof (long)); -- pf ("#define SCM_SIZEOF_UNSIGNED_LONG %zu\n", sizeof (unsigned long)); -- pf ("#define SCM_SIZEOF_INT %zu\n", sizeof (int)); -- pf ("#define SCM_SIZEOF_UNSIGNED_INT %zu\n", sizeof (unsigned int)); -- pf ("#define SCM_SIZEOF_SIZE_T %zu\n", sizeof (size_t)); -- pf ("#define SCM_SIZEOF_LONG_LONG %zu\n", sizeof (long long)); -- pf ("#define SCM_SIZEOF_UNSIGNED_LONG_LONG %zu\n", sizeof (unsigned long long)); -- pf ("#define SCM_SIZEOF_INTMAX %zu\n", sizeof (intmax_t)); -- pf ("#define SCM_SIZEOF_SCM_T_PTRDIFF %zu\n", sizeof (ptrdiff_t)); -- pf ("#define SCM_SIZEOF_INTPTR_T %zu\n", sizeof (intptr_t)); -- pf ("#define SCM_SIZEOF_UINTPTR_T %zu\n", sizeof (uintptr_t)); -+ pf ("#define SCM_SIZEOF_CHAR %d\n", SIZEOF_CHAR); -+ pf ("#define SCM_SIZEOF_UNSIGNED_CHAR %d\n", SIZEOF_UNSIGNED_CHAR); -+ pf ("#define SCM_SIZEOF_SHORT %d\n", SIZEOF_SHORT); -+ pf ("#define SCM_SIZEOF_UNSIGNED_SHORT %d\n", SIZEOF_UNSIGNED_SHORT); -+ pf ("#define SCM_SIZEOF_LONG %d\n", SIZEOF_LONG); -+ pf ("#define SCM_SIZEOF_UNSIGNED_LONG %d\n", SIZEOF_UNSIGNED_LONG); -+ pf ("#define SCM_SIZEOF_INT %d\n", SIZEOF_INT); -+ pf ("#define SCM_SIZEOF_UNSIGNED_INT %d\n", SIZEOF_UNSIGNED_INT); -+ pf ("#define SCM_SIZEOF_SIZE_T %d\n", SIZEOF_SIZE_T); -+ pf ("#define SCM_SIZEOF_LONG_LONG %d\n", SIZEOF_LONG_LONG); -+ pf ("#define SCM_SIZEOF_UNSIGNED_LONG_LONG %d\n", SIZEOF_UNSIGNED_LONG_LONG); -+ pf ("#define SCM_SIZEOF_INTMAX %d\n", 8); /* like SIZEOF_INTMAX_T */ -+ pf ("#define SCM_SIZEOF_SCM_T_PTRDIFF %d\n", SIZEOF_PTRDIFF_T); -+ pf ("#define SCM_SIZEOF_INTPTR_T %d\n", SIZEOF_INTPTR_T); -+ pf ("#define SCM_SIZEOF_UINTPTR_T %d\n", SIZEOF_UINTPTR_T); - - pf ("\n"); - pf ("/* same as POSIX \"struct timespec\" -- always defined */\n"); diff --git a/gnu/packages/patches/jami-libjami-headers-search.patch b/gnu/packages/patches/jami-libjami-headers-search.patch index 44e099a610..b3384ba563 100644 --- a/gnu/packages/patches/jami-libjami-headers-search.patch +++ b/gnu/packages/patches/jami-libjami-headers-search.patch @@ -20,9 +20,9 @@ Upstream status: https://review.jami.net/c/jami-client-qt/+/22973 src/libclient/qtwrapper/CMakeLists.txt | 2 +- 4 files changed, 9 insertions(+), 18 deletions(-) -diff --git a/client-qt/CMakeLists.txt b/CMakeLists.txt +diff --git a/CMakeLists.txt b/CMakeLists.txt index d0a8fd70..94ac6074 100644 ---- a/client-qt/CMakeLists.txt +--- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -118,7 +118,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${EXTRAS_DIR}/build/cmake/modules") @@ -33,9 +33,9 @@ index d0a8fd70..94ac6074 100644 endif() include(FindPython3) -diff --git a/client-qt/extras/build/cmake/modules/FindLibJami.cmake b/extras/build/cmake/modules/FindLibJami.cmake +diff --git a/extras/build/cmake/modules/FindLibJami.cmake b/extras/build/cmake/modules/FindLibJami.cmake index ddb05319..9ad20d2b 100644 ---- a/client-qt/extras/build/cmake/modules/FindLibJami.cmake +--- a/extras/build/cmake/modules/FindLibJami.cmake +++ b/extras/build/cmake/modules/FindLibJami.cmake @@ -20,28 +20,19 @@ @@ -78,9 +78,9 @@ index ddb05319..9ad20d2b 100644 -message(STATUS "Jami daemon headers are in " ${LIBJAMI_INCLUDE_DIRS}) +message(STATUS "Jami daemon headers are in " ${LIBJAMI_INCLUDE_DIR}) message(STATUS "Jami daemon library is at " ${LIBJAMI_LIB}) -diff --git a/client-qt/src/libclient/CMakeLists.txt b/src/libclient/CMakeLists.txt +diff --git a/src/libclient/CMakeLists.txt b/src/libclient/CMakeLists.txt index 2676c9c4..ac58ea2b 100644 ---- a/client-qt/src/libclient/CMakeLists.txt +--- a/src/libclient/CMakeLists.txt +++ b/src/libclient/CMakeLists.txt @@ -62,7 +62,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${EXTRAS_DIR}/build/cmake/modules") @@ -91,10 +91,10 @@ index 2676c9c4..ac58ea2b 100644 endif() string(SUBSTRING ${CMAKE_GENERATOR} 0 14 CMAKE_GENERATOR_SHORT) -diff --git a/client-qt/src/libclient/qtwrapper/CMakeLists.txt b/src/libclient/qtwrapper/CMakeLists.txt +diff --git a/src/libclient/qtwrapper/CMakeLists.txt b/src/libclient/qtwrapper/CMakeLists.txt index acee0d0c..ba68aac4 100644 ---- a/client-qt/src/libclient/qtwrapper/CMakeLists.txt -+++ b/client-qt/src/libclient/qtwrapper/CMakeLists.txt +--- a/src/libclient/qtwrapper/CMakeLists.txt ++++ b/src/libclient/qtwrapper/CMakeLists.txt @@ -46,7 +46,7 @@ else() endif() diff --git a/gnu/packages/patches/lirc-reproducible-build.patch b/gnu/packages/patches/lirc-reproducible-build.patch index 20f9344715..75aa480941 100644 --- a/gnu/packages/patches/lirc-reproducible-build.patch +++ b/gnu/packages/patches/lirc-reproducible-build.patch @@ -5,11 +5,22 @@ https://sourceforge.net/p/lirc/git/merge-requests/33/ https://sourceforge.net/p/lirc/git/merge-requests/34/ https://sourceforge.net/p/lirc/git/merge-requests/36/ -Index: lirc-0.10.1/tools/lirc-lsplugins.cpp -=================================================================== ---- lirc-0.10.1.orig/tools/lirc-lsplugins.cpp -+++ lirc-0.10.1/tools/lirc-lsplugins.cpp -@@ -415,10 +415,9 @@ static void print_header(void) +diff -Naur lirc-0.10.2a/python-pkg/lirc/database.py lirc-0.10.2/python-pkg/lirc/database.py +--- lirc-0.10.2a/python-pkg/lirc/database.py 1970-01-01 01:00:01.000000000 +0100 ++++ lirc-0.10.2/python-pkg/lirc/database.py 2023-01-20 14:23:29.414088668 +0100 +@@ -160,7 +160,7 @@ + d['device_hint'] = hint + + configs = {} +- for path in glob.glob(configdir + '/*.conf'): ++ for path in sorted(glob.glob(configdir + '/*.conf')): + with open(path) as f: + cf = yaml.load(f.read(), Loader = Loader) + configs[cf['config']['id']] = cf['config'] +diff -Naur lirc-0.10.2a/tools/lirc-lsplugins.cpp lirc-0.10.2/tools/lirc-lsplugins.cpp +--- lirc-0.10.2a/tools/lirc-lsplugins.cpp 1970-01-01 01:00:01.000000000 +0100 ++++ lirc-0.10.2/tools/lirc-lsplugins.cpp 2023-01-20 14:24:42.719085612 +0100 +@@ -413,10 +413,9 @@ static void print_yaml_header(void) { static const char* const YAML_HEADER = @@ -22,51 +33,3 @@ Index: lirc-0.10.1/tools/lirc-lsplugins.cpp printf("\ndrivers:\n"); } -Index: lirc-0.10.1/python-pkg/lirc/database.py -=================================================================== ---- lirc-0.10.1.orig/python-pkg/lirc/database.py -+++ lirc-0.10.1/python-pkg/lirc/database.py -@@ -156,7 +156,7 @@ class Database(object): - d['device_hint'] = hint - - configs = {} -- for path in glob.glob(configdir + '/*.conf'): -+ for path in sorted(glob.glob(configdir + '/*.conf')): - with open(path) as f: - cf = yaml.load(f.read()) - configs[cf['config']['id']] = cf['config'] -Index: lirc-0.10.1/tools/irdb-get -=================================================================== ---- lirc-0.10.1.orig/tools/irdb-get -+++ lirc-0.10.1/tools/irdb-get -@@ -9,7 +9,6 @@ import fnmatch - import os - import os.path - import sys --import time - import urllib.error # pylint: disable=no-name-in-module,F0401,E0611 - import urllib.request # pylint: disable=no-name-in-module,F0401,E0611 - -@@ -193,7 +192,7 @@ def do_yaml_config(): - lircmd_by_driver[driver].append("%s/%s" % (tokens[0], tokens[2])) - - print("#") -- print("# Created by 'irdb-get yaml-config' at " + time.ctime()) -+ print("# Created by 'irdb-get yaml-config'") - print("#") - print("\nlircd_by_driver:") - print_yaml_dict(lircd_by_driver) -Index: lirc-0.10.1/tools/lirc-make-devinput -=================================================================== ---- lirc-0.10.1.orig/tools/lirc-make-devinput -+++ lirc-0.10.1/tools/lirc-make-devinput -@@ -61,8 +61,7 @@ if test -n "$lirc_map"; then - fi - - --echo "# Generated by $(basename $0) on $(uname -r)" --echo "# Date: $(date)" -+echo "# Generated by $(basename $0)" - cat <<EOF - - begin remote diff --git a/gnu/packages/patches/petri-foo-0.1.87-fix-recent-file-not-exist.patch b/gnu/packages/patches/petri-foo-0.1.87-fix-recent-file-not-exist.patch new file mode 100644 index 0000000000..3e88487b07 --- /dev/null +++ b/gnu/packages/patches/petri-foo-0.1.87-fix-recent-file-not-exist.patch @@ -0,0 +1,24 @@ +diff -Naur a/gui/bank-ops.c b/gui/bank-ops.c +--- a/gui/bank-ops.c 2012-08-06 05:33:34.000000000 +0200 ++++ b/gui/bank-ops.c 2012-08-07 17:57:28.580145691 +0200 +@@ -393,6 +393,8 @@ + g_signal_connect_swapped(G_OBJECT(msg), "response", + G_CALLBACK(gtk_widget_destroy), msg); + gtk_widget_show (msg); ++ ++ gtk_recent_manager_remove_item(recent_manager, filename, NULL); + } + else + { +diff -Naur a/libpetrifui/dish_file.c b/libpetrifui/dish_file.c +--- a/libpetrifui/dish_file.c 2012-08-06 05:33:34.000000000 +0200 ++++ b/libpetrifui/dish_file.c 2012-08-07 17:56:09.063909801 +0200 +@@ -1440,7 +1440,7 @@ + + if (stat(path, &st) != 0) + { +- msg_log(MSG_ERROR, "file '%s' does not exist\n"); ++ msg_log(MSG_ERROR, "file '%s' does not exist\n", path); + return -1; + } + diff --git a/gnu/packages/patches/python-pypdf-annotate-tests-appropriately.patch b/gnu/packages/patches/python-pypdf-annotate-tests-appropriately.patch new file mode 100644 index 0000000000..14f1f73924 --- /dev/null +++ b/gnu/packages/patches/python-pypdf-annotate-tests-appropriately.patch @@ -0,0 +1,96 @@ +Origin: https://github.com/py-pdf/pypdf/commit/767047b98ee3ea7aca331cfbd63502a284bfed93 +From 767047b98ee3ea7aca331cfbd63502a284bfed93 Mon Sep 17 00:00:00 2001 +From: dkg <dkg@fifthhorseman.net> +Date: Sat, 14 Jan 2023 03:32:45 -0500 +Subject: [PATCH 03/14] Annotate tests appropriately (#1551) + +By annotating these tests, we can use pytest markers to skip external +tests and tests that depend on sample-files. +--- + tests/test_reader.py | 5 +++++ + tests/test_writer.py | 4 ++++ + 2 files changed, 9 insertions(+) + +diff --git a/tests/test_reader.py b/tests/test_reader.py +index 710e6c5..62eb7b7 100644 +--- a/tests/test_reader.py ++++ b/tests/test_reader.py +@@ -176,6 +176,7 @@ def test_get_outline(src, outline_elements): + assert len(outline) == outline_elements + + ++@pytest.mark.samples + @pytest.mark.parametrize( + ("src", "expected_images"), + [ +@@ -866,6 +867,7 @@ def test_get_fields(): + assert dict(fields["c1-1"]) == ({"/FT": "/Btn", "/T": "c1-1"}) + + ++@pytest.mark.external + def test_get_full_qualified_fields(): + url = "https://github.com/py-pdf/PyPDF2/files/10142389/fields_with_dots.pdf" + name = "fields_with_dots.pdf" +@@ -1214,6 +1216,7 @@ def test_zeroing_xref(): + len(reader.pages) + + ++@pytest.mark.external + def test_thread(): + url = "https://github.com/py-pdf/pypdf/files/9066120/UTA_OSHA_3115_Fall_Protection_Training_09162021_.pdf" + name = "UTA_OSHA.pdf" +@@ -1226,6 +1229,7 @@ def test_thread(): + assert len(reader.threads) >= 1 + + ++@pytest.mark.external + def test_build_outline_item(caplog): + url = "https://github.com/py-pdf/pypdf/files/9464742/shiv_resume.pdf" + name = "shiv_resume.pdf" +@@ -1253,6 +1257,7 @@ def test_build_outline_item(caplog): + assert "Unexpected destination 2" in exc.value.args[0] + + ++@pytest.mark.samples + @pytest.mark.parametrize( + ("src", "page_labels"), + [ +diff --git a/tests/test_writer.py b/tests/test_writer.py +index 60b4a17..20c4de0 100644 +--- a/tests/test_writer.py ++++ b/tests/test_writer.py +@@ -930,6 +930,7 @@ def test_startup_dest(): + pdf_file_writer.open_destination = None + + ++@pytest.mark.external + def test_iss471(): + url = "https://github.com/py-pdf/pypdf/files/9139245/book.pdf" + name = "book_471.pdf" +@@ -942,6 +943,7 @@ def test_iss471(): + ) + + ++@pytest.mark.external + def test_reset_translation(): + url = "https://corpora.tika.apache.org/base/docs/govdocs1/924/924666.pdf" + name = "tika-924666.pdf" +@@ -977,6 +979,7 @@ def test_threads_empty(): + assert thr == thr2 + + ++@pytest.mark.external + def test_append_without_annots_and_articles(): + url = "https://corpora.tika.apache.org/base/docs/govdocs1/924/924666.pdf" + name = "tika-924666.pdf" +@@ -993,6 +996,7 @@ def test_append_without_annots_and_articles(): + assert len(writer.threads) >= 1 + + ++@pytest.mark.external + def test_append_multiple(): + url = "https://corpora.tika.apache.org/base/docs/govdocs1/924/924666.pdf" + name = "tika-924666.pdf" +-- +2.39.1 + diff --git a/gnu/packages/patches/qtwayland-cleanup-callbacks.patch b/gnu/packages/patches/qtwayland-cleanup-callbacks.patch new file mode 100644 index 0000000000..b7618432cb --- /dev/null +++ b/gnu/packages/patches/qtwayland-cleanup-callbacks.patch @@ -0,0 +1,52 @@ +From 42cdc61a93cf2acb09936aebb5e431fdbc0a26c6 Mon Sep 17 00:00:00 2001 +From: Georges Basile Stavracas Neto <gbsneto@gnome.org> +Date: Thu, 27 May 2021 20:02:53 -0300 +Subject: [PATCH] Client: Always destroy frame callback in the actual callback + +It's good hygiene to destroy all frame callbacks. Destroy the +frame callback and cleanup the mFrameCallback class member in +the callback itself. The callback destruction happens before +calling handleFrameCallback() to avoid the theoretical case +where another frame callback is queued by handleFrameCallback(), +and then immediately destroyed in the callback handler. + +Change-Id: Ide6dc95e3402932c58bfc088a9d471fda821e9a1 +Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> +--- + src/client/qwaylandwindow.cpp | 14 +++++--------- + 1 file changed, 5 insertions(+), 9 deletions(-) + +diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp +index d83d51695..5561f58f7 100644 +--- a/src/client/qwaylandwindow.cpp ++++ b/src/client/qwaylandwindow.cpp +@@ -659,9 +659,13 @@ void QWaylandWindow::commit() + + const wl_callback_listener QWaylandWindow::callbackListener = { + [](void *data, wl_callback *callback, uint32_t time) { +- Q_UNUSED(callback); + Q_UNUSED(time); + auto *window = static_cast<QWaylandWindow*>(data); ++ ++ Q_ASSERT(callback == window->mFrameCallback); ++ wl_callback_destroy(callback); ++ window->mFrameCallback = nullptr; ++ + window->handleFrameCallback(); + } + }; +@@ -1366,11 +1370,6 @@ void QWaylandWindow::handleUpdate() + if (!mSurface) + return; + +- if (mFrameCallback) { +- wl_callback_destroy(mFrameCallback); +- mFrameCallback = nullptr; +- } +- + QMutexLocker locker(mFrameQueue.mutex); + struct ::wl_surface *wrappedSurface = reinterpret_cast<struct ::wl_surface *>(wl_proxy_create_wrapper(mSurface->object())); + wl_proxy_set_queue(reinterpret_cast<wl_proxy *>(wrappedSurface), mFrameQueue.queue); +-- +2.38.1 + diff --git a/gnu/packages/patches/qtwayland-dont-recreate-callbacks.patch b/gnu/packages/patches/qtwayland-dont-recreate-callbacks.patch new file mode 100644 index 0000000000..dda2b99844 --- /dev/null +++ b/gnu/packages/patches/qtwayland-dont-recreate-callbacks.patch @@ -0,0 +1,76 @@ +From cbc74ba6d7186457d8d07183272e952dee5f34f9 Mon Sep 17 00:00:00 2001 +From: Georges Basile Stavracas Neto <gbsneto@gnome.org> +Date: Thu, 27 May 2021 19:55:04 -0300 +Subject: [PATCH] Client: Don't always recreate frame callbacks + +The main QWaylandWindow method that is executed when handling updates is +QWaylandWindow::handleUpdate(). This method always, unconditionally queues +a frame callback, regardless of whether any other one is already queued. + +On some circumstances, e.g. when a window is hidden or completely obscured +by other windows, it stops receiving frame callbacks from the compositor. +However, QWaylandWindow would continue to request for them, which eventually +fills up the Wayland socket, and causes the application to crash. + +This can be avoided by checking if the platform window is already waiting +for a frame callback, before queueing another one. + +In QWaylandWindow::handleUpdate(), check if mWaitingForFrameCallback is true +before queueing frame callbacks, and early return if that's the case. + +The XDG-shell test needed to be updated for this: The mock compositor is +not responding to any frame callbacks, so the window will be unexposed, +no longer get paint events and therefore not trigger any commit. This +worked by accident before because we were issuing updates quickly enough +to reset the timer before it had a chance to unexpose the window. The +easiest fix is just to disable the dependency on frame callbacks in +this test, since that is clearly not what it's testing. + +Task-number: QTBUG-81504 +Change-Id: Ieacb05c7d5a5fcf662243d9177ebcc308cb9ca84 +Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> +Reviewed-by: Georges Basile Stavracas Neto <gbsneto@gnome.org> +Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> +--- + src/client/qwaylandwindow.cpp | 4 ++++ + tests/auto/client/xdgshell/tst_xdgshell.cpp | 2 ++ + 2 files changed, 6 insertions(+) + +diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp +index a708afce..d83d5169 100644 +--- a/src/client/qwaylandwindow.cpp ++++ b/src/client/qwaylandwindow.cpp +@@ -1357,6 +1357,10 @@ void QWaylandWindow::requestUpdate() + void QWaylandWindow::handleUpdate() + { + qCDebug(lcWaylandBackingstore) << "handleUpdate" << QThread::currentThread(); ++ ++ if (mWaitingForFrameCallback) ++ return; ++ + // TODO: Should sync subsurfaces avoid requesting frame callbacks? + QReadLocker lock(&mSurfaceLock); + if (!mSurface) +diff --git a/tests/auto/client/xdgshell/tst_xdgshell.cpp b/tests/auto/client/xdgshell/tst_xdgshell.cpp +index 1d2a2014..962093c7 100644 +--- a/tests/auto/client/xdgshell/tst_xdgshell.cpp ++++ b/tests/auto/client/xdgshell/tst_xdgshell.cpp +@@ -138,6 +138,7 @@ void tst_xdgshell::configureSize() + + void tst_xdgshell::configureStates() + { ++ QVERIFY(qputenv("QT_WAYLAND_FRAME_CALLBACK_TIMEOUT", "0")); + QRasterWindow window; + window.resize(64, 48); + window.show(); +@@ -186,6 +187,7 @@ void tst_xdgshell::configureStates() + QCOMPARE(window.windowStates(), Qt::WindowNoState); + QCOMPARE(window.frameGeometry().size(), windowedSize); + // QCOMPARE(window.frameGeometry().topLeft(), QPoint()); // TODO: this doesn't currently work when window decorations are enabled ++ QVERIFY(qunsetenv("QT_WAYLAND_FRAME_CALLBACK_TIMEOUT")); + } + + void tst_xdgshell::popup() +-- +2.38.1 + diff --git a/gnu/packages/patches/rw-igraph-0.10.patch b/gnu/packages/patches/rw-igraph-0.10.patch new file mode 100644 index 0000000000..3544196660 --- /dev/null +++ b/gnu/packages/patches/rw-igraph-0.10.patch @@ -0,0 +1,17 @@ +Fix the build when using igraph >= 0.10. +Retrieved from: https://sourceforge.net/p/rankwidth/tickets/2/. + +--- rw-0.9/simplerw.c.newigraph 2017-02-14 00:20:35.000000000 +0900 ++++ rw-0.9/simplerw.c 2022-09-11 19:39:47.033917305 +0900 +@@ -134,7 +134,11 @@ int read_graph(const char *format, const + igraph_destroy(&igraph); + return(-1); + } ++#if (IGRAPH_VERSION_MAJOR >= 1) || ((IGRAPH_VERSION_MAJOR == 0) && (IGRAPH_VERSION_MINOR >= 10)) ++ igraph_get_adjacency(&igraph, &imatrix, IGRAPH_GET_ADJACENCY_BOTH, NULL, IGRAPH_LOOPS_ONCE); ++#else + igraph_get_adjacency(&igraph, &imatrix, IGRAPH_GET_ADJACENCY_BOTH, 0); ++#endif + igraph_destroy(&igraph); + if(igraph_matrix_nrow(&imatrix) > MAX_VERTICES) + { diff --git a/gnu/packages/patches/timewarrior-time-sensitive-tests.patch b/gnu/packages/patches/timewarrior-time-sensitive-tests.patch new file mode 100644 index 0000000000..586d1aa261 --- /dev/null +++ b/gnu/packages/patches/timewarrior-time-sensitive-tests.patch @@ -0,0 +1,163 @@ +From: Gordon Ball <gordon@chronitis.net> +Date: Sat, 23 Nov 2019 18:59:39 +0000 +Subject: skip tests which are sensitive to server time + +--- + test/continue.t | 2 +- + test/export.t | 1 + + test/help.t | 1 + + test/lengthen.t | 1 + + test/move.t | 2 ++ + test/run_all | 2 +- + test/shorten.t | 1 + + test/summary.t | 3 +++ + test/tag.t | 1 + + test/tags.t | 1 + + 10 files changed, 13 insertions(+), 2 deletions(-) + +diff --git a/test/continue.t b/test/continue.t +index 917699e..428f714 100755 +--- a/test/continue.t ++++ b/test/continue.t +@@ -37,7 +37,7 @@ sys.path.append(os.path.dirname(os.path.abspath(__file__))) + + from basetest import Timew, TestCase + +- ++@unittest.skip("Time-of-day sensitive") + class TestContinue(TestCase): + def setUp(self): + """Executed before each test in the class""" +diff --git a/test/export.t b/test/export.t +index c6726e6..8b511ff 100755 +--- a/test/export.t ++++ b/test/export.t +@@ -62,6 +62,7 @@ class TestExport(TestCase): + expectedEnd=now_utc, + expectedTags=["foo"]) + ++ @unittest.skip("flaky") + def test_changing_exclusion_does_not_change_flattened_intervals(self): + """Changing exclusions does not change flattened intervals""" + now = datetime.now() +diff --git a/test/help.t b/test/help.t +index 786def0..9ecf5e6 100755 +--- a/test/help.t ++++ b/test/help.t +@@ -58,6 +58,7 @@ class TestHelp(TestCase): + code, out2, err2 = self.t("-h") + self.assertEqual(out1, out2) + ++ @unittest.skip("flaky") + def test_help_with_command_should_show_man_page(self): + """timew help with command should show man page""" + code, out, err = self.t("help start") +diff --git a/test/lengthen.t b/test/lengthen.t +index a6f1d77..f9ab54d 100755 +--- a/test/lengthen.t ++++ b/test/lengthen.t +@@ -55,6 +55,7 @@ class TestLengthen(TestCase): + code, out, err = self.t.runError("lengthen @1 10mins") + self.assertIn('Cannot lengthen open interval @1', err) + ++ @unittest.skip("time sensitive") + def test_lengthen_synthetic_interval(self): + """Lengthen a synthetic interval.""" + now = datetime.now() +diff --git a/test/move.t b/test/move.t +index 2d7fdd9..b2336f5 100755 +--- a/test/move.t ++++ b/test/move.t +@@ -145,6 +145,7 @@ class TestMove(TestCase): + expectedEnd="20170301T143000Z", + expectedTags=["bar"]) + ++ @unittest.skip("time sensitive") + def test_move_synthetic_interval_into_exclusion(self): + """Move a synthetic interval into exclusion""" + now = datetime.now() +@@ -175,6 +176,7 @@ class TestMove(TestCase): + expectedTags=[], + description="unmodified interval") + ++ @unittest.skip("time sensitive") + def test_move_synthetic_interval_away_from_exclusion(self): + """Move a synthetic interval away from exclusion""" + now = datetime.now() +diff --git a/test/run_all b/test/run_all +index ea7dd8f..afc6731 100755 +--- a/test/run_all ++++ b/test/run_all +@@ -14,7 +14,7 @@ from queue import Queue, Empty + from subprocess import call, Popen, PIPE + from threading import Thread + +-TIMEOUT = .2 ++TIMEOUT = 2. + + + def run_test(testqueue, outqueue, threadname): +diff --git a/test/shorten.t b/test/shorten.t +index 7058cc0..94e0067 100755 +--- a/test/shorten.t ++++ b/test/shorten.t +@@ -69,6 +69,7 @@ class TestShorten(TestCase): + self.t("move @1 20170308T113000") + self.t("shorten @1 5min") # Does not work. + ++ @unittest.skip("time sensitive") + def test_shorten_synthetic_interval(self): + """Shorten a synthetic interval.""" + now = datetime.now() +diff --git a/test/summary.t b/test/summary.t +index 6fd3352..f91e992 100755 +--- a/test/summary.t ++++ b/test/summary.t +@@ -192,6 +192,7 @@ W10 2017-03-09 Thu @4 Tag1 8:43:08 9:38:15 0:55:07 + 1:09:03 + """, out) + ++ @unittest.skip("fails w1-9") + def test_with_all_hint(self): + """Summary should work with :all hint""" + now = datetime.now() +@@ -236,6 +237,7 @@ W{5} {2:%Y-%m-%d} {2:%a} @1 BAZ 10:00:00 11:00:00 1:00:00 1:00:00 + self.assertIn("@1", out) + self.assertRegex(out, r'\s{30}0:00:02') + ++ @unittest.skip("fails w1-9") + def test_with_named_date_yesterday(self): + """Summary should work with 'yesterday'""" + now = datetime.now() +@@ -260,6 +262,7 @@ W{1} {0:%Y-%m-%d} {0:%a} @3 FOO 10:00:00 11:00:00 1:00:00 1:00:00 + {2} 1:00:00 + """.format(yesterday, week_yesterday, " " if two_digit_week is True else "", "-" if two_digit_week is True else ""), out) + ++ @unittest.skip("fails w1-9") + def test_with_named_date_today(self): + """Summary should work with 'today'""" + now = datetime.now() +diff --git a/test/tag.t b/test/tag.t +index 8b2f847..21b8c16 100755 +--- a/test/tag.t ++++ b/test/tag.t +@@ -178,6 +178,7 @@ class TestTag(TestCase): + self.assertClosedInterval(j[0], expectedTags=["bar", "foo", "one"]) + self.assertClosedInterval(j[1], expectedTags=["bar", "foo", "two"]) + ++ @unittest.skip("time sensitive") + def test_tag_synthetic_interval(self): + """Tag a synthetic interval.""" + now = datetime.now() +diff --git a/test/tags.t b/test/tags.t +index 6cfe143..4f84d06 100755 +--- a/test/tags.t ++++ b/test/tags.t +@@ -63,6 +63,7 @@ class TestTags(TestCase): + self.assertIn('foo', out) + self.assertIn('bar', out) + ++ @unittest.skip("time sensitive") + def test_tags_filtered(self): + """Test that tags command filtering excludes tags that are outside the filter range""" + self.t("track 20160101T0100 - 20160101T1000 foo") diff --git a/gnu/packages/patches/u-boot-patman-fix-help.patch b/gnu/packages/patches/u-boot-patman-fix-help.patch deleted file mode 100644 index 89bac06c2f..0000000000 --- a/gnu/packages/patches/u-boot-patman-fix-help.patch +++ /dev/null @@ -1,40 +0,0 @@ -Upstream status: https://patchwork.ozlabs.org/project/uboot/list/?series=333156 - -diff --git a/tools/patman/main.py b/tools/patman/main.py -index 5a7756a221..bf300c6e64 100755 ---- a/tools/patman/main.py -+++ b/tools/patman/main.py -@@ -7,6 +7,7 @@ - """See README for more information""" - - from argparse import ArgumentParser -+import importlib.resources - import os - import re - import shutil -@@ -163,11 +164,8 @@ elif args.cmd == 'send': - fd.close() - - elif args.full_help: -- tools.print_full_help( -- os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), -- 'README.rst') -- ) -- -+ with importlib.resources.path('patman', 'README.rst') as readme: -+ tools.print_full_help(str(readme)) - else: - # If we are not processing tags, no need to warning about bad ones - if not args.process_tags: -diff --git a/tools/patman/setup.py b/tools/patman/setup.py -index 43fdc00ce6..ce9bb4aa63 100644 ---- a/tools/patman/setup.py -+++ b/tools/patman/setup.py -@@ -7,6 +7,6 @@ setup(name='patman', - scripts=['patman'], - packages=['patman'], - package_dir={'patman': ''}, -- package_data={'patman': ['README']}, -+ package_data={'patman': ['README.rst']}, - classifiers=['Environment :: Console', - 'Topic :: Software Development']) diff --git a/gnu/packages/patches/u-boot-patman-get-maintainer.patch b/gnu/packages/patches/u-boot-patman-get-maintainer.patch deleted file mode 100644 index 4377f8394e..0000000000 --- a/gnu/packages/patches/u-boot-patman-get-maintainer.patch +++ /dev/null @@ -1,104 +0,0 @@ -Upstream status: https://patchwork.ozlabs.org/project/uboot/list/?series=333427 - -diff --git a/tools/patman/patman.rst b/tools/patman/patman.rst -index 7828899879..95b6c9c3f0 100644 ---- a/tools/patman/patman.rst -+++ b/tools/patman/patman.rst -@@ -88,7 +88,7 @@ To add your own, create a file `~/.patman` like this:: - Patman will also look for a `.patman` configuration file at the root - of the current project git repository, which makes it possible to - override the `project` settings variable or anything else in a --project-specific way. The values of this "local" configuration file -+project-specific way. The values of this "local" configuration file - take precedence over those of the "global" one. - - Aliases are recursive. -diff --git a/tools/patman/test_settings.py b/tools/patman/test_settings.py -index 9c14b4aaa3..c768a2fc64 100644 ---- a/tools/patman/test_settings.py -+++ b/tools/patman/test_settings.py -@@ -6,38 +6,62 @@ - import argparse - import contextlib - import os --import subprocess -+import sys - import tempfile - - from patman import settings -+from patman import tools - - - @contextlib.contextmanager - def empty_git_repository(): - with tempfile.TemporaryDirectory() as tmpdir: - os.chdir(tmpdir) -- subprocess.check_call(['git', 'init']) -+ tools.run('git', 'init', raise_on_error=True) - yield tmpdir - - -+@contextlib.contextmanager -+def cleared_command_line_args(): -+ old_value = sys.argv[:] -+ sys.argv = [sys.argv[0]] -+ try: -+ yield -+ finally: -+ sys.argv = old_value -+ -+ - def test_git_local_config(): -- with empty_git_repository(): -- with tempfile.NamedTemporaryFile() as global_config: -- global_config.write(b'[settings]\n' -- b'project=u-boot\n') -- global_config.flush() -- parser = argparse.ArgumentParser() -- parser.add_argument('-p', '--project', default='unknown') -- -- # Test "global" config is used. -- settings.Setup(parser, 'unknown', global_config.name) -- args, _ = parser.parse_known_args() -- assert args.project == 'u-boot' -- -- # Test local config can shadow it. -- with open('.patman', 'w', buffering=1) as f: -- f.write('[settings]\n' -- 'project=guix-patches\n') -- settings.Setup(parser, 'unknown', global_config.name) -- args, _ = parser.parse_known_args([]) -- assert args.project == 'guix-patches' -+ # Clearing the command line arguments is required, otherwise -+ # arguments passed to the test running such as in 'pytest -k -+ # filter' would be processed by _UpdateDefaults and fail. -+ with cleared_command_line_args(): -+ with empty_git_repository(): -+ with tempfile.NamedTemporaryFile() as global_config: -+ global_config.write(b'[settings]\n' -+ b'project=u-boot\n') -+ global_config.flush() -+ parser = argparse.ArgumentParser() -+ parser.add_argument('-p', '--project', default='unknown') -+ subparsers = parser.add_subparsers(dest='cmd') -+ send = subparsers.add_parser('send') -+ send.add_argument('--no-check', action='store_false', -+ dest='check_patch', default=True) -+ -+ # Test "global" config is used. -+ settings.Setup(parser, 'unknown', global_config.name) -+ args, _ = parser.parse_known_args([]) -+ assert args.project == 'u-boot' -+ send_args, _ = send.parse_known_args([]) -+ assert send_args.check_patch -+ -+ # Test local config can shadow it. -+ with open('.patman', 'w', buffering=1) as f: -+ f.write('[settings]\n' -+ 'project: guix-patches\n' -+ 'check_patch: False\n') -+ settings.Setup(parser, 'unknown', global_config.name) -+ args, _ = parser.parse_known_args([]) -+ assert args.project == 'guix-patches' -+ send_args, _ = send.parse_known_args([]) -+ assert not send_args.check_patch diff --git a/gnu/packages/patches/u-boot-patman-guix-integration.patch b/gnu/packages/patches/u-boot-patman-guix-integration.patch new file mode 100644 index 0000000000..3472656c99 --- /dev/null +++ b/gnu/packages/patches/u-boot-patman-guix-integration.patch @@ -0,0 +1,1244 @@ +These changes correspond to commits 9ff7500ace..3154de3dd6 already merged to +the u-boot-dm custodian repo (at +https://source.denx.de/u-boot/custodians/u-boot-dm/-/commits/next), scheduled +to be pulled after the next release. + +diff --git a/tools/patman/__init__.py b/tools/patman/__init__.py +index c9d3e35052..1b98ec7fee 100644 +--- a/tools/patman/__init__.py ++++ b/tools/patman/__init__.py +@@ -1,6 +1,6 @@ + # SPDX-License-Identifier: GPL-2.0+ + + __all__ = ['checkpatch', 'command', 'commit', 'control', 'cros_subprocess', +- 'func_test', 'get_maintainer', 'gitutil', 'main', 'patchstream', ++ 'func_test', 'get_maintainer', 'gitutil', '__main__', 'patchstream', + 'project', 'series', 'setup', 'settings', 'terminal', + 'test_checkpatch', 'test_util', 'tools', 'tout'] +diff --git a/tools/patman/main.py b/tools/patman/__main__.py +similarity index 89% +rename from tools/patman/main.py +rename to tools/patman/__main__.py +index 8067a288ab..749e6348b6 100755 +--- a/tools/patman/main.py ++++ b/tools/patman/__main__.py +@@ -7,6 +7,7 @@ + """See README for more information""" + + from argparse import ArgumentParser ++import importlib.resources + import os + import re + import sys +@@ -19,6 +20,7 @@ if __name__ == "__main__": + + # Our modules + from patman import control ++from patman import func_test + from patman import gitutil + from patman import project + from patman import settings +@@ -53,7 +55,8 @@ parser.add_argument('-H', '--full-help', action='store_true', dest='full_help', + default=False, help='Display the README file') + + subparsers = parser.add_subparsers(dest='cmd') +-send = subparsers.add_parser('send') ++send = subparsers.add_parser( ++ 'send', help='Format, check and email patches (default command)') + send.add_argument('-i', '--ignore-errors', action='store_true', + dest='ignore_errors', default=False, + help='Send patches email even if patch errors are found') +@@ -62,6 +65,12 @@ send.add_argument('-l', '--limit-cc', dest='limit', type=int, default=None, + send.add_argument('-m', '--no-maintainers', action='store_false', + dest='add_maintainers', default=True, + help="Don't cc the file maintainers automatically") ++send.add_argument( ++ '--get-maintainer-script', dest='get_maintainer_script', type=str, ++ action='store', ++ default=os.path.join(gitutil.get_top_level(), 'scripts', ++ 'get_maintainer.pl') + ' --norolestats', ++ help='File name of the get_maintainer.pl (or compatible) script.') + send.add_argument('-n', '--dry-run', action='store_true', dest='dry_run', + default=False, help="Do a dry run (create but don't email patches)") + send.add_argument('-r', '--in-reply-to', type=str, action='store', +@@ -94,9 +103,11 @@ send.add_argument('--smtp-server', type=str, + + send.add_argument('patchfiles', nargs='*') + +-test_parser = subparsers.add_parser('test', help='Run tests') +-test_parser.add_argument('testname', type=str, default=None, nargs='?', +- help="Specify the test to run") ++# Only add the 'test' action if the test data files are available. ++if os.path.exists(func_test.TEST_DATA_DIR): ++ test_parser = subparsers.add_parser('test', help='Run tests') ++ test_parser.add_argument('testname', type=str, default=None, nargs='?', ++ help="Specify the test to run") + + status = subparsers.add_parser('status', + help='Check status of patches in patchwork') +@@ -113,7 +124,7 @@ status.add_argument('-f', '--force', action='store_true', + argv = sys.argv[1:] + args, rest = parser.parse_known_args(argv) + if hasattr(args, 'project'): +- settings.Setup(gitutil, parser, args.project, '') ++ settings.Setup(parser, args.project) + args, rest = parser.parse_known_args(argv) + + # If we have a command, it is safe to parse all arguments +@@ -160,11 +171,8 @@ elif args.cmd == 'send': + fd.close() + + elif args.full_help: +- tools.print_full_help( +- os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), +- 'README.rst') +- ) +- ++ with importlib.resources.path('patman', 'README.rst') as readme: ++ tools.print_full_help(str(readme)) + else: + # If we are not processing tags, no need to warning about bad ones + if not args.process_tags: +diff --git a/tools/patman/checkpatch.py b/tools/patman/checkpatch.py +index d1b902dd96..012c0d895c 100644 +--- a/tools/patman/checkpatch.py ++++ b/tools/patman/checkpatch.py +@@ -211,7 +211,7 @@ def check_patch(fname, verbose=False, show_types=False, use_tree=False): + stdout: Full output of checkpatch + """ + chk = find_check_patch() +- args = [chk] ++ args = [chk, '--u-boot', '--strict'] + if not use_tree: + args.append('--no-tree') + if show_types: +diff --git a/tools/patman/control.py b/tools/patman/control.py +index bf426cf7bc..38e98dab84 100644 +--- a/tools/patman/control.py ++++ b/tools/patman/control.py +@@ -94,8 +94,8 @@ def check_patches(series, patch_files, run_checkpatch, verbose, use_tree): + + + def email_patches(col, series, cover_fname, patch_files, process_tags, its_a_go, +- ignore_bad_tags, add_maintainers, limit, dry_run, in_reply_to, +- thread, smtp_server): ++ ignore_bad_tags, add_maintainers, get_maintainer_script, limit, ++ dry_run, in_reply_to, thread, smtp_server): + """Email patches to the recipients + + This emails out the patches and cover letter using 'git send-email'. Each +@@ -123,6 +123,8 @@ def email_patches(col, series, cover_fname, patch_files, process_tags, its_a_go, + ignore_bad_tags (bool): True to just print a warning for unknown tags, + False to halt with an error + add_maintainers (bool): Run the get_maintainer.pl script for each patch ++ get_maintainer_script (str): The script used to retrieve which ++ maintainers to cc + limit (int): Limit on the number of people that can be cc'd on a single + patch or the cover letter (None if no limit) + dry_run (bool): Don't actually email the patches, just print out what +@@ -134,7 +136,7 @@ def email_patches(col, series, cover_fname, patch_files, process_tags, its_a_go, + smtp_server (str): SMTP server to use to send patches (None for default) + """ + cc_file = series.MakeCcFile(process_tags, cover_fname, not ignore_bad_tags, +- add_maintainers, limit) ++ add_maintainers, limit, get_maintainer_script) + + # Email the patches out (giving the user time to check / cancel) + cmd = '' +@@ -174,8 +176,8 @@ def send(args): + email_patches( + col, series, cover_fname, patch_files, args.process_tags, + its_a_go, args.ignore_bad_tags, args.add_maintainers, +- args.limit, args.dry_run, args.in_reply_to, args.thread, +- args.smtp_server) ++ args.get_maintainer_script, args.limit, args.dry_run, ++ args.in_reply_to, args.thread, args.smtp_server) + + def patchwork_status(branch, count, start, end, dest_branch, force, + show_comments, url): +diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py +index 7b92bc67be..c25a47bdeb 100644 +--- a/tools/patman/func_test.py ++++ b/tools/patman/func_test.py +@@ -6,7 +6,9 @@ + + """Functional tests for checking that patman behaves correctly""" + ++import contextlib + import os ++import pathlib + import re + import shutil + import sys +@@ -28,6 +30,21 @@ from patman.test_util import capture_sys_output + import pygit2 + from patman import status + ++PATMAN_DIR = pathlib.Path(__file__).parent ++TEST_DATA_DIR = PATMAN_DIR / 'test/' ++ ++ ++@contextlib.contextmanager ++def directory_excursion(directory): ++ """Change directory to `directory` for a limited to the context block.""" ++ current = os.getcwd() ++ try: ++ os.chdir(directory) ++ yield ++ finally: ++ os.chdir(current) ++ ++ + class TestFunctional(unittest.TestCase): + """Functional tests for checking that patman behaves correctly""" + leb = (b'Lord Edmund Blackadd\xc3\xabr <weasel@blackadder.org>'. +@@ -57,8 +74,7 @@ class TestFunctional(unittest.TestCase): + Returns: + str: Full path to file in the test directory + """ +- return os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), +- 'test', fname) ++ return TEST_DATA_DIR / fname + + @classmethod + def _get_text(cls, fname): +@@ -200,6 +216,8 @@ class TestFunctional(unittest.TestCase): + text = self._get_text('test01.txt') + series = patchstream.get_metadata_for_test(text) + cover_fname, args = self._create_patches_for_test(series) ++ get_maintainer_script = str(pathlib.Path(__file__).parent.parent.parent ++ / 'get_maintainer.pl') + ' --norolestats' + with capture_sys_output() as out: + patchstream.fix_patches(series, args) + if cover_fname and series.get('cover'): +@@ -207,7 +225,7 @@ class TestFunctional(unittest.TestCase): + series.DoChecks() + cc_file = series.MakeCcFile(process_tags, cover_fname, + not ignore_bad_tags, add_maintainers, +- None) ++ None, get_maintainer_script) + cmd = gitutil.email_patches( + series, cover_fname, args, dry_run, not ignore_bad_tags, + cc_file, in_reply_to=in_reply_to, thread=None) +@@ -502,6 +520,37 @@ complicated as possible''') + finally: + os.chdir(orig_dir) + ++ def test_custom_get_maintainer_script(self): ++ """Validate that a custom get_maintainer script gets used.""" ++ self.make_git_tree() ++ with directory_excursion(self.gitdir): ++ # Setup git. ++ os.environ['GIT_CONFIG_GLOBAL'] = '/dev/null' ++ os.environ['GIT_CONFIG_SYSTEM'] = '/dev/null' ++ tools.run('git', 'config', 'user.name', 'Dummy') ++ tools.run('git', 'config', 'user.email', 'dumdum@dummy.com') ++ tools.run('git', 'branch', 'upstream') ++ tools.run('git', 'branch', '--set-upstream-to=upstream') ++ tools.run('git', 'add', '.') ++ tools.run('git', 'commit', '-m', 'new commit') ++ ++ # Setup patman configuration. ++ with open('.patman', 'w', buffering=1) as f: ++ f.write('[settings]\n' ++ 'get_maintainer_script: dummy-script.sh\n' ++ 'check_patch: False\n') ++ with open('dummy-script.sh', 'w', buffering=1) as f: ++ f.write('#!/usr/bin/env python\n' ++ 'print("hello@there.com")\n') ++ os.chmod('dummy-script.sh', 0x555) ++ ++ # Finally, do the test ++ with capture_sys_output(): ++ output = tools.run(PATMAN_DIR / 'patman', '--dry-run') ++ # Assert the email address is part of the dry-run ++ # output. ++ self.assertIn('hello@there.com', output) ++ + def test_tags(self): + """Test collection of tags in a patchstream""" + text = '''This is a patch +diff --git a/tools/patman/get_maintainer.py b/tools/patman/get_maintainer.py +index e1d15ff6ab..f7011be1e4 100644 +--- a/tools/patman/get_maintainer.py ++++ b/tools/patman/get_maintainer.py +@@ -1,48 +1,61 @@ + # SPDX-License-Identifier: GPL-2.0+ + # Copyright (c) 2012 The Chromium OS Authors. ++# Copyright (c) 2022 Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com> + # + + import os ++import shlex ++import shutil + + from patman import command ++from patman import gitutil + +-def find_get_maintainer(try_list): +- """Look for the get_maintainer.pl script. + +- Args: +- try_list: List of directories to try for the get_maintainer.pl script ++def find_get_maintainer(script_file_name): ++ """Try to find where `script_file_name` is. + +- Returns: +- If the script is found we'll return a path to it; else None. ++ It searches in PATH and falls back to a path relative to the top ++ of the current git repository. + """ +- # Look in the list +- for path in try_list: +- fname = os.path.join(path, 'get_maintainer.pl') +- if os.path.isfile(fname): +- return fname ++ get_maintainer = shutil.which(script_file_name) ++ if get_maintainer: ++ return get_maintainer ++ ++ git_relative_script = os.path.join(gitutil.get_top_level(), ++ script_file_name) ++ if os.path.exists(git_relative_script): ++ return git_relative_script + +- return None + +-def get_maintainer(dir_list, fname, verbose=False): +- """Run get_maintainer.pl on a file if we find it. ++def get_maintainer(script_file_name, fname, verbose=False): ++ """Run `script_file_name` on a file. + +- We look for get_maintainer.pl in the 'scripts' directory at the top of +- git. If we find it we'll run it. If we don't find get_maintainer.pl +- then we fail silently. ++ `script_file_name` should be a get_maintainer.pl-like script that ++ takes a patch file name as an input and return the email addresses ++ of the associated maintainers to standard output, one per line. ++ ++ If `script_file_name` does not exist we fail silently. + + Args: +- dir_list: List of directories to try for the get_maintainer.pl script +- fname: Path to the patch file to run get_maintainer.pl on. ++ script_file_name: The file name of the get_maintainer.pl script ++ (or compatible). ++ fname: File name of the patch to process with get_maintainer.pl. + + Returns: + A list of email addresses to CC to. + """ +- get_maintainer = find_get_maintainer(dir_list) ++ # Expand `script_file_name` into a file name and its arguments, if ++ # any. ++ cmd_args = shlex.split(script_file_name) ++ file_name = cmd_args[0] ++ arguments = cmd_args[1:] ++ ++ get_maintainer = find_get_maintainer(file_name) + if not get_maintainer: + if verbose: + print("WARNING: Couldn't find get_maintainer.pl") + return [] + +- stdout = command.output(get_maintainer, '--norolestats', fname) ++ stdout = command.output(get_maintainer, *arguments, fname) + lines = stdout.splitlines() +- return [ x.replace('"', '') for x in lines ] ++ return [x.replace('"', '') for x in lines] +diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py +index ceaf2ce150..5e742102c2 100644 +--- a/tools/patman/gitutil.py ++++ b/tools/patman/gitutil.py +@@ -2,21 +2,19 @@ + # Copyright (c) 2011 The Chromium OS Authors. + # + +-import re + import os +-import subprocess + import sys + + from patman import command + from patman import settings + from patman import terminal +-from patman import tools + + # True to use --no-decorate - we check this in setup() + use_no_decorate = True + ++ + def log_cmd(commit_range, git_dir=None, oneline=False, reverse=False, +- count=None): ++ count=None): + """Create a command to perform a 'git log' + + Args: +@@ -49,6 +47,7 @@ def log_cmd(commit_range, git_dir=None, oneline=False, reverse=False, + cmd.append('--') + return cmd + ++ + def count_commits_to_branch(branch): + """Returns number of commits between HEAD and the tracking branch. + +@@ -68,13 +67,14 @@ def count_commits_to_branch(branch): + rev_range = '@{upstream}..' + pipe = [log_cmd(rev_range, oneline=True)] + result = command.run_pipe(pipe, capture=True, capture_stderr=True, +- oneline=True, raise_on_error=False) ++ oneline=True, raise_on_error=False) + if result.return_code: + raise ValueError('Failed to determine upstream: %s' % + result.stderr.strip()) + patch_count = len(result.stdout.splitlines()) + return patch_count + ++ + def name_revision(commit_hash): + """Gets the revision name for a commit + +@@ -91,6 +91,7 @@ def name_revision(commit_hash): + name = stdout.split(' ')[1].strip() + return name + ++ + def guess_upstream(git_dir, branch): + """Tries to guess the upstream for a branch + +@@ -109,7 +110,7 @@ def guess_upstream(git_dir, branch): + """ + pipe = [log_cmd(branch, git_dir=git_dir, oneline=True, count=100)] + result = command.run_pipe(pipe, capture=True, capture_stderr=True, +- raise_on_error=False) ++ raise_on_error=False) + if result.return_code: + return None, "Branch '%s' not found" % branch + for line in result.stdout.splitlines()[1:]: +@@ -121,6 +122,7 @@ def guess_upstream(git_dir, branch): + return name, "Guessing upstream as '%s'" % name + return None, "Cannot find a suitable upstream for branch '%s'" % branch + ++ + def get_upstream(git_dir, branch): + """Returns the name of the upstream for a branch + +@@ -135,10 +137,10 @@ def get_upstream(git_dir, branch): + """ + try: + remote = command.output_one_line('git', '--git-dir', git_dir, 'config', +- 'branch.%s.remote' % branch) ++ 'branch.%s.remote' % branch) + merge = command.output_one_line('git', '--git-dir', git_dir, 'config', +- 'branch.%s.merge' % branch) +- except: ++ 'branch.%s.merge' % branch) ++ except Exception: + upstream, msg = guess_upstream(git_dir, branch) + return upstream, msg + +@@ -149,7 +151,8 @@ def get_upstream(git_dir, branch): + return '%s/%s' % (remote, leaf), None + else: + raise ValueError("Cannot determine upstream branch for branch " +- "'%s' remote='%s', merge='%s'" % (branch, remote, merge)) ++ "'%s' remote='%s', merge='%s'" ++ % (branch, remote, merge)) + + + def get_range_in_branch(git_dir, branch, include_upstream=False): +@@ -168,6 +171,7 @@ def get_range_in_branch(git_dir, branch, include_upstream=False): + rstr = '%s%s..%s' % (upstream, '~' if include_upstream else '', branch) + return rstr, msg + ++ + def count_commits_in_range(git_dir, range_expr): + """Returns the number of commits in the given range. + +@@ -180,12 +184,13 @@ def count_commits_in_range(git_dir, range_expr): + """ + pipe = [log_cmd(range_expr, git_dir=git_dir, oneline=True)] + result = command.run_pipe(pipe, capture=True, capture_stderr=True, +- raise_on_error=False) ++ raise_on_error=False) + if result.return_code: + return None, "Range '%s' not found or is invalid" % range_expr + patch_count = len(result.stdout.splitlines()) + return patch_count, None + ++ + def count_commits_in_branch(git_dir, branch, include_upstream=False): + """Returns the number of commits in the given branch. + +@@ -201,6 +206,7 @@ def count_commits_in_branch(git_dir, branch, include_upstream=False): + return None, msg + return count_commits_in_range(git_dir, range_expr) + ++ + def count_commits(commit_range): + """Returns the number of commits in the given range. + +@@ -215,6 +221,7 @@ def count_commits(commit_range): + patch_count = int(stdout) + return patch_count + ++ + def checkout(commit_hash, git_dir=None, work_tree=None, force=False): + """Checkout the selected commit for this build + +@@ -231,10 +238,11 @@ def checkout(commit_hash, git_dir=None, work_tree=None, force=False): + pipe.append('-f') + pipe.append(commit_hash) + result = command.run_pipe([pipe], capture=True, raise_on_error=False, +- capture_stderr=True) ++ capture_stderr=True) + if result.return_code != 0: + raise OSError('git checkout (%s): %s' % (pipe, result.stderr)) + ++ + def clone(git_dir, output_dir): + """Checkout the selected commit for this build + +@@ -243,10 +251,11 @@ def clone(git_dir, output_dir): + """ + pipe = ['git', 'clone', git_dir, '.'] + result = command.run_pipe([pipe], capture=True, cwd=output_dir, +- capture_stderr=True) ++ capture_stderr=True) + if result.return_code != 0: + raise OSError('git clone: %s' % result.stderr) + ++ + def fetch(git_dir=None, work_tree=None): + """Fetch from the origin repo + +@@ -263,6 +272,7 @@ def fetch(git_dir=None, work_tree=None): + if result.return_code != 0: + raise OSError('git fetch: %s' % result.stderr) + ++ + def check_worktree_is_available(git_dir): + """Check if git-worktree functionality is available + +@@ -274,9 +284,10 @@ def check_worktree_is_available(git_dir): + """ + pipe = ['git', '--git-dir', git_dir, 'worktree', 'list'] + result = command.run_pipe([pipe], capture=True, capture_stderr=True, +- raise_on_error=False) ++ raise_on_error=False) + return result.return_code == 0 + ++ + def add_worktree(git_dir, output_dir, commit_hash=None): + """Create and checkout a new git worktree for this build + +@@ -290,10 +301,11 @@ def add_worktree(git_dir, output_dir, commit_hash=None): + if commit_hash: + pipe.append(commit_hash) + result = command.run_pipe([pipe], capture=True, cwd=output_dir, +- capture_stderr=True) ++ capture_stderr=True) + if result.return_code != 0: + raise OSError('git worktree add: %s' % result.stderr) + ++ + def prune_worktrees(git_dir): + """Remove administrative files for deleted worktrees + +@@ -305,7 +317,8 @@ def prune_worktrees(git_dir): + if result.return_code != 0: + raise OSError('git worktree prune: %s' % result.stderr) + +-def create_patches(branch, start, count, ignore_binary, series, signoff = True): ++ ++def create_patches(branch, start, count, ignore_binary, series, signoff=True): + """Create a series of patches from the top of the current branch. + + The patch files are written to the current directory using +@@ -321,9 +334,7 @@ def create_patches(branch, start, count, ignore_binary, series, signoff = True): + Filename of cover letter (None if none) + List of filenames of patch files + """ +- if series.get('version'): +- version = '%s ' % series['version'] +- cmd = ['git', 'format-patch', '-M' ] ++ cmd = ['git', 'format-patch', '-M'] + if signoff: + cmd.append('--signoff') + if ignore_binary: +@@ -341,9 +352,10 @@ def create_patches(branch, start, count, ignore_binary, series, signoff = True): + + # We have an extra file if there is a cover letter + if series.get('cover'): +- return files[0], files[1:] ++ return files[0], files[1:] + else: +- return None, files ++ return None, files ++ + + def build_email_list(in_list, tag=None, alias=None, warn_on_error=True): + """Build a list of email addresses based on an input list. +@@ -385,40 +397,43 @@ def build_email_list(in_list, tag=None, alias=None, warn_on_error=True): + raw += lookup_email(item, alias, warn_on_error=warn_on_error) + result = [] + for item in raw: +- if not item in result: ++ if item not in result: + result.append(item) + if tag: + return ['%s %s%s%s' % (tag, quote, email, quote) for email in result] + return result + ++ + def check_suppress_cc_config(): + """Check if sendemail.suppresscc is configured correctly. + + Returns: + True if the option is configured correctly, False otherwise. + """ +- suppresscc = command.output_one_line('git', 'config', 'sendemail.suppresscc', +- raise_on_error=False) ++ suppresscc = command.output_one_line( ++ 'git', 'config', 'sendemail.suppresscc', raise_on_error=False) + + # Other settings should be fine. + if suppresscc == 'all' or suppresscc == 'cccmd': + col = terminal.Color() + + print((col.build(col.RED, "error") + +- ": git config sendemail.suppresscc set to %s\n" % (suppresscc)) + +- " patman needs --cc-cmd to be run to set the cc list.\n" + +- " Please run:\n" + +- " git config --unset sendemail.suppresscc\n" + +- " Or read the man page:\n" + +- " git send-email --help\n" + +- " and set an option that runs --cc-cmd\n") ++ ": git config sendemail.suppresscc set to %s\n" ++ % (suppresscc)) + ++ " patman needs --cc-cmd to be run to set the cc list.\n" + ++ " Please run:\n" + ++ " git config --unset sendemail.suppresscc\n" + ++ " Or read the man page:\n" + ++ " git send-email --help\n" + ++ " and set an option that runs --cc-cmd\n") + return False + + return True + ++ + def email_patches(series, cover_fname, args, dry_run, warn_on_error, cc_fname, +- self_only=False, alias=None, in_reply_to=None, thread=False, +- smtp_server=None): ++ self_only=False, alias=None, in_reply_to=None, thread=False, ++ smtp_server=None, get_maintainer_script=None): + """Email a patch series. + + Args: +@@ -435,6 +450,7 @@ def email_patches(series, cover_fname, args, dry_run, warn_on_error, cc_fname, + thread: True to add --thread to git send-email (make + all patches reply to cover-letter or first patch in series) + smtp_server: SMTP server to use to send patches ++ get_maintainer_script: File name of script to get maintainers emails + + Returns: + Git command that was/would be run +@@ -487,9 +503,10 @@ send --cc-cmd cc-fname" cover p1 p2' + "git config sendemail.to u-boot@lists.denx.de") + return + cc = build_email_list(list(set(series.get('cc')) - set(series.get('to'))), +- '--cc', alias, warn_on_error) ++ '--cc', alias, warn_on_error) + if self_only: +- to = build_email_list([os.getenv('USER')], '--to', alias, warn_on_error) ++ to = build_email_list([os.getenv('USER')], '--to', ++ alias, warn_on_error) + cc = [] + cmd = ['git', 'send-email', '--annotate'] + if smtp_server: +@@ -565,7 +582,7 @@ def lookup_email(lookup_name, alias=None, warn_on_error=True, level=0): + if not alias: + alias = settings.alias + lookup_name = lookup_name.strip() +- if '@' in lookup_name: # Perhaps a real email address ++ if '@' in lookup_name: # Perhaps a real email address + return [lookup_name] + + lookup_name = lookup_name.lower() +@@ -581,7 +598,7 @@ def lookup_email(lookup_name, alias=None, warn_on_error=True, level=0): + return out_list + + if lookup_name: +- if not lookup_name in alias: ++ if lookup_name not in alias: + msg = "Alias '%s' not found" % lookup_name + if warn_on_error: + print(col.build(col.RED, msg)) +@@ -589,11 +606,12 @@ def lookup_email(lookup_name, alias=None, warn_on_error=True, level=0): + for item in alias[lookup_name]: + todo = lookup_email(item, alias, warn_on_error, level + 1) + for new_item in todo: +- if not new_item in out_list: ++ if new_item not in out_list: + out_list.append(new_item) + + return out_list + ++ + def get_top_level(): + """Return name of top-level directory for this git repo. + +@@ -608,6 +626,7 @@ def get_top_level(): + """ + return command.output_one_line('git', 'rev-parse', '--show-toplevel') + ++ + def get_alias_file(): + """Gets the name of the git alias file. + +@@ -615,7 +634,7 @@ def get_alias_file(): + Filename of git alias file, or None if none + """ + fname = command.output_one_line('git', 'config', 'sendemail.aliasesfile', +- raise_on_error=False) ++ raise_on_error=False) + if not fname: + return None + +@@ -625,6 +644,7 @@ def get_alias_file(): + + return os.path.join(get_top_level(), fname) + ++ + def get_default_user_name(): + """Gets the user.name from .gitconfig file. + +@@ -634,6 +654,7 @@ def get_default_user_name(): + uname = command.output_one_line('git', 'config', '--global', 'user.name') + return uname + ++ + def get_default_user_email(): + """Gets the user.email from the global .gitconfig file. + +@@ -643,17 +664,19 @@ def get_default_user_email(): + uemail = command.output_one_line('git', 'config', '--global', 'user.email') + return uemail + ++ + def get_default_subject_prefix(): + """Gets the format.subjectprefix from local .git/config file. + + Returns: + Subject prefix found in local .git/config file, or None if none + """ +- sub_prefix = command.output_one_line('git', 'config', 'format.subjectprefix', +- raise_on_error=False) ++ sub_prefix = command.output_one_line( ++ 'git', 'config', 'format.subjectprefix', raise_on_error=False) + + return sub_prefix + ++ + def setup(): + """Set up git utils, by reading the alias files.""" + # Check for a git alias file also +@@ -666,6 +689,7 @@ def setup(): + use_no_decorate = (command.run_pipe([cmd], raise_on_error=False) + .return_code == 0) + ++ + def get_head(): + """Get the hash of the current HEAD + +@@ -674,6 +698,7 @@ def get_head(): + """ + return command.output_one_line('git', 'show', '-s', '--pretty=format:%H') + ++ + if __name__ == "__main__": + import doctest + +diff --git a/tools/patman/patman b/tools/patman/patman +index 11a5d8e18a..5a427d1942 120000 +--- a/tools/patman/patman ++++ b/tools/patman/patman +@@ -1 +1 @@ +-main.py +\ No newline at end of file ++__main__.py +\ No newline at end of file +diff --git a/tools/patman/patman.rst b/tools/patman/patman.rst +index 8c5c9cc2cc..6113962fb4 100644 +--- a/tools/patman/patman.rst ++++ b/tools/patman/patman.rst +@@ -1,6 +1,7 @@ + .. SPDX-License-Identifier: GPL-2.0+ + .. Copyright (c) 2011 The Chromium OS Authors + .. Simon Glass <sjg@chromium.org> ++.. Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com> + .. v1, v2, 19-Oct-11 + .. revised v3 24-Nov-11 + .. revised v4 Independence Day 2020, with Patchwork integration +@@ -68,13 +69,28 @@ this once:: + + git config sendemail.aliasesfile doc/git-mailrc + +-For both Linux and U-Boot the 'scripts/get_maintainer.pl' handles figuring +-out where to send patches pretty well. ++For both Linux and U-Boot the 'scripts/get_maintainer.pl' handles ++figuring out where to send patches pretty well. For other projects, ++you may want to specify a different script to be run, for example via ++a project-specific `.patman` file:: ++ ++ # .patman configuration file at the root of some project ++ ++ [settings] ++ get_maintainer_script: etc/teams.scm get-maintainer ++ ++The `get_maintainer_script` option corresponds to the ++`--get-maintainer-script` argument of the `send` command. It is ++looked relatively to the root of the current git repository, as well ++as on PATH. It can also be provided arguments, as shown above. The ++contract is that the script should accept a patch file name and return ++a list of email addresses, one per line, like `get_maintainer.pl` ++does. + + During the first run patman creates a config file for you by taking the default + user name and email address from the global .gitconfig file. + +-To add your own, create a file ~/.patman like this:: ++To add your own, create a file `~/.patman` like this:: + + # patman alias file + +@@ -85,6 +101,12 @@ To add your own, create a file ~/.patman like this:: + wolfgang: Wolfgang Denk <wd@denx.de> + others: Mike Frysinger <vapier@gentoo.org>, Fred Bloggs <f.bloggs@napier.net> + ++As hinted above, Patman will also look for a `.patman` configuration ++file at the root of the current project git repository, which makes it ++possible to override the `project` settings variable or anything else ++in a project-specific way. The values of this "local" configuration ++file take precedence over those of the "global" one. ++ + Aliases are recursive. + + The checkpatch.pl in the U-Boot tools/ subdirectory will be located and +@@ -680,6 +702,16 @@ them: + + $ tools/patman/patman test + ++Note that since the test suite depends on data files only available in ++the git checkout, the `test` command is hidden unless `patman` is ++invoked from the U-Boot git repository. ++ ++Alternatively, you can run the test suite via Pytest: ++ ++.. code-block:: bash ++ ++ $ cd tools/patman && pytest ++ + Error handling doesn't always produce friendly error messages - e.g. + putting an incorrect tag in a commit may provide a confusing message. + +diff --git a/tools/patman/pytest.ini b/tools/patman/pytest.ini +new file mode 100644 +index 0000000000..df3eb518d0 +--- /dev/null ++++ b/tools/patman/pytest.ini +@@ -0,0 +1,2 @@ ++[pytest] ++addopts = --doctest-modules +diff --git a/tools/patman/series.py b/tools/patman/series.py +index 3075378ac1..2eeeef71dc 100644 +--- a/tools/patman/series.py ++++ b/tools/patman/series.py +@@ -235,7 +235,7 @@ class Series(dict): + print(col.build(col.RED, str)) + + def MakeCcFile(self, process_tags, cover_fname, warn_on_error, +- add_maintainers, limit): ++ add_maintainers, limit, get_maintainer_script): + """Make a cc file for us to use for per-commit Cc automation + + Also stores in self._generated_cc to make ShowActions() faster. +@@ -249,6 +249,8 @@ class Series(dict): + True/False to call the get_maintainers to CC maintainers + List of maintainers to include (for testing) + limit: Limit the length of the Cc list (None if no limit) ++ get_maintainer_script: The file name of the get_maintainer.pl ++ script (or compatible). + Return: + Filename of temp file created + """ +@@ -267,8 +269,9 @@ class Series(dict): + if type(add_maintainers) == type(cc): + cc += add_maintainers + elif add_maintainers: +- dir_list = [os.path.join(gitutil.get_top_level(), 'scripts')] +- cc += get_maintainer.get_maintainer(dir_list, commit.patch) ++ ++ cc += get_maintainer.get_maintainer(get_maintainer_script, ++ commit.patch) + for x in set(cc) & set(settings.bounces): + print(col.build(col.YELLOW, 'Skipping "%s"' % x)) + cc = list(set(cc) - set(settings.bounces)) +diff --git a/tools/patman/settings.py b/tools/patman/settings.py +index 903d6fcb0b..636983e32d 100644 +--- a/tools/patman/settings.py ++++ b/tools/patman/settings.py +@@ -1,18 +1,18 @@ + # SPDX-License-Identifier: GPL-2.0+ + # Copyright (c) 2011 The Chromium OS Authors. ++# Copyright (c) 2022 Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com> + # + + try: + import configparser as ConfigParser +-except: ++except Exception: + import ConfigParser + + import argparse + import os + import re + +-from patman import command +-from patman import tools ++from patman import gitutil + + """Default settings per-project. + +@@ -32,7 +32,8 @@ _default_settings = { + }, + } + +-class _ProjectConfigParser(ConfigParser.SafeConfigParser): ++ ++class _ProjectConfigParser(ConfigParser.ConfigParser): + """ConfigParser that handles projects. + + There are two main goals of this class: +@@ -83,14 +84,14 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser): + def __init__(self, project_name): + """Construct _ProjectConfigParser. + +- In addition to standard SafeConfigParser initialization, this also loads +- project defaults. ++ In addition to standard ConfigParser initialization, this also ++ loads project defaults. + + Args: + project_name: The name of the project. + """ + self._project_name = project_name +- ConfigParser.SafeConfigParser.__init__(self) ++ ConfigParser.ConfigParser.__init__(self) + + # Update the project settings in the config based on + # the _default_settings global. +@@ -102,31 +103,31 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser): + self.set(project_settings, setting_name, setting_value) + + def get(self, section, option, *args, **kwargs): +- """Extend SafeConfigParser to try project_section before section. ++ """Extend ConfigParser to try project_section before section. + + Args: +- See SafeConfigParser. ++ See ConfigParser. + Returns: +- See SafeConfigParser. ++ See ConfigParser. + """ + try: +- val = ConfigParser.SafeConfigParser.get( ++ val = ConfigParser.ConfigParser.get( + self, "%s_%s" % (self._project_name, section), option, + *args, **kwargs + ) + except (ConfigParser.NoSectionError, ConfigParser.NoOptionError): +- val = ConfigParser.SafeConfigParser.get( ++ val = ConfigParser.ConfigParser.get( + self, section, option, *args, **kwargs + ) + return val + + def items(self, section, *args, **kwargs): +- """Extend SafeConfigParser to add project_section to section. ++ """Extend ConfigParser to add project_section to section. + + Args: +- See SafeConfigParser. ++ See ConfigParser. + Returns: +- See SafeConfigParser. ++ See ConfigParser. + """ + project_items = [] + has_project_section = False +@@ -134,7 +135,7 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser): + + # Get items from the project section + try: +- project_items = ConfigParser.SafeConfigParser.items( ++ project_items = ConfigParser.ConfigParser.items( + self, "%s_%s" % (self._project_name, section), *args, **kwargs + ) + has_project_section = True +@@ -143,7 +144,7 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser): + + # Get top-level items + try: +- top_items = ConfigParser.SafeConfigParser.items( ++ top_items = ConfigParser.ConfigParser.items( + self, section, *args, **kwargs + ) + except ConfigParser.NoSectionError: +@@ -155,6 +156,7 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser): + item_dict.update(project_items) + return {(item, val) for item, val in item_dict.items()} + ++ + def ReadGitAliases(fname): + """Read a git alias file. This is in the form used by git: + +@@ -170,7 +172,7 @@ def ReadGitAliases(fname): + print("Warning: Cannot find alias file '%s'" % fname) + return + +- re_line = re.compile('alias\s+(\S+)\s+(.*)') ++ re_line = re.compile(r'alias\s+(\S+)\s+(.*)') + for line in fd.readlines(): + line = line.strip() + if not line or line[0] == '#': +@@ -190,7 +192,8 @@ def ReadGitAliases(fname): + + fd.close() + +-def CreatePatmanConfigFile(gitutil, config_fname): ++ ++def CreatePatmanConfigFile(config_fname): + """Creates a config file under $(HOME)/.patman if it can't find one. + + Args: +@@ -200,12 +203,12 @@ def CreatePatmanConfigFile(gitutil, config_fname): + None + """ + name = gitutil.get_default_user_name() +- if name == None: ++ if name is None: + name = input("Enter name: ") + + email = gitutil.get_default_user_email() + +- if email == None: ++ if email is None: + email = input("Enter email: ") + + try: +@@ -220,7 +223,8 @@ me: %s <%s> + [bounces] + nxp = Zhikang Zhang <zhikang.zhang@nxp.com> + ''' % (name, email), file=f) +- f.close(); ++ f.close() ++ + + def _UpdateDefaults(main_parser, config): + """Update the given OptionParser defaults based on config. +@@ -242,8 +246,8 @@ def _UpdateDefaults(main_parser, config): + # Find all the parsers and subparsers + parsers = [main_parser] + parsers += [subparser for action in main_parser._actions +- if isinstance(action, argparse._SubParsersAction) +- for _, subparser in action.choices.items()] ++ if isinstance(action, argparse._SubParsersAction) ++ for _, subparser in action.choices.items()] + + # Collect the defaults from each parser + defaults = {} +@@ -270,8 +274,9 @@ def _UpdateDefaults(main_parser, config): + # Set all the defaults and manually propagate them to subparsers + main_parser.set_defaults(**defaults) + for parser, pdefs in zip(parsers, parser_defaults): +- parser.set_defaults(**{ k: v for k, v in defaults.items() +- if k in pdefs }) ++ parser.set_defaults(**{k: v for k, v in defaults.items() ++ if k in pdefs}) ++ + + def _ReadAliasFile(fname): + """Read in the U-Boot git alias file if it exists. +@@ -298,6 +303,7 @@ def _ReadAliasFile(fname): + if bad_line: + print(bad_line) + ++ + def _ReadBouncesFile(fname): + """Read in the bounces file if it exists + +@@ -311,6 +317,7 @@ def _ReadBouncesFile(fname): + continue + bounces.add(line.strip()) + ++ + def GetItems(config, section): + """Get the items from a section of the config. + +@@ -323,31 +330,50 @@ def GetItems(config, section): + """ + try: + return config.items(section) +- except ConfigParser.NoSectionError as e: ++ except ConfigParser.NoSectionError: + return [] +- except: +- raise + +-def Setup(gitutil, parser, project_name, config_fname=''): ++ ++def Setup(parser, project_name, config_fname=None): + """Set up the settings module by reading config files. + ++ Unless `config_fname` is specified, a `.patman` config file local ++ to the git repository is consulted, followed by the global ++ `$HOME/.patman`. If none exists, the later is created. Values ++ defined in the local config file take precedence over those ++ defined in the global one. ++ + Args: +- parser: The parser to update ++ parser: The parser to update. + project_name: Name of project that we're working on; we'll look + for sections named "project_section" as well. +- config_fname: Config filename to read ('' for default) ++ config_fname: Config filename to read. An error is raised if it ++ does not exist. + """ + # First read the git alias file if available + _ReadAliasFile('doc/git-mailrc') + config = _ProjectConfigParser(project_name) +- if config_fname == '': ++ ++ if config_fname and not os.path.exists(config_fname): ++ raise Exception(f'provided {config_fname} does not exist') ++ ++ if not config_fname: + config_fname = '%s/.patman' % os.getenv('HOME') ++ has_config = os.path.exists(config_fname) ++ ++ git_local_config_fname = os.path.join(gitutil.get_top_level(), '.patman') ++ has_git_local_config = os.path.exists(git_local_config_fname) + +- if not os.path.exists(config_fname): +- print("No config file found ~/.patman\nCreating one...\n") +- CreatePatmanConfigFile(gitutil, config_fname) ++ # Read the git local config last, so that its values override ++ # those of the global config, if any. ++ if has_config: ++ config.read(config_fname) ++ if has_git_local_config: ++ config.read(git_local_config_fname) + +- config.read(config_fname) ++ if not (has_config or has_git_local_config): ++ print("No config file found.\nCreating ~/.patman...\n") ++ CreatePatmanConfigFile(config_fname) + + for name, value in GetItems(config, 'alias'): + alias[name] = value.split(',') +@@ -358,6 +384,7 @@ def Setup(gitutil, parser, project_name, config_fname=''): + + _UpdateDefaults(parser, config) + ++ + # These are the aliases we understand, indexed by alias. Each member is a list. + alias = {} + bounces = set() +diff --git a/tools/patman/setup.py b/tools/patman/setup.py +index 5643bf1503..2ff791da0f 100644 +--- a/tools/patman/setup.py ++++ b/tools/patman/setup.py +@@ -7,6 +7,6 @@ setup(name='patman', + scripts=['patman'], + packages=['patman'], + package_dir={'patman': ''}, +- package_data={'patman': ['README']}, ++ package_data={'patman': ['README.rst']}, + classifiers=['Environment :: Console', + 'Topic :: Software Development']) +diff --git a/tools/patman/test_settings.py b/tools/patman/test_settings.py +new file mode 100644 +index 0000000000..c768a2fc64 +--- /dev/null ++++ b/tools/patman/test_settings.py +@@ -0,0 +1,67 @@ ++# SPDX-License-Identifier: GPL-2.0+ ++# ++# Copyright (c) 2022 Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com> ++# ++ ++import argparse ++import contextlib ++import os ++import sys ++import tempfile ++ ++from patman import settings ++from patman import tools ++ ++ ++@contextlib.contextmanager ++def empty_git_repository(): ++ with tempfile.TemporaryDirectory() as tmpdir: ++ os.chdir(tmpdir) ++ tools.run('git', 'init', raise_on_error=True) ++ yield tmpdir ++ ++ ++@contextlib.contextmanager ++def cleared_command_line_args(): ++ old_value = sys.argv[:] ++ sys.argv = [sys.argv[0]] ++ try: ++ yield ++ finally: ++ sys.argv = old_value ++ ++ ++def test_git_local_config(): ++ # Clearing the command line arguments is required, otherwise ++ # arguments passed to the test running such as in 'pytest -k ++ # filter' would be processed by _UpdateDefaults and fail. ++ with cleared_command_line_args(): ++ with empty_git_repository(): ++ with tempfile.NamedTemporaryFile() as global_config: ++ global_config.write(b'[settings]\n' ++ b'project=u-boot\n') ++ global_config.flush() ++ parser = argparse.ArgumentParser() ++ parser.add_argument('-p', '--project', default='unknown') ++ subparsers = parser.add_subparsers(dest='cmd') ++ send = subparsers.add_parser('send') ++ send.add_argument('--no-check', action='store_false', ++ dest='check_patch', default=True) ++ ++ # Test "global" config is used. ++ settings.Setup(parser, 'unknown', global_config.name) ++ args, _ = parser.parse_known_args([]) ++ assert args.project == 'u-boot' ++ send_args, _ = send.parse_known_args([]) ++ assert send_args.check_patch ++ ++ # Test local config can shadow it. ++ with open('.patman', 'w', buffering=1) as f: ++ f.write('[settings]\n' ++ 'project: guix-patches\n' ++ 'check_patch: False\n') ++ settings.Setup(parser, 'unknown', global_config.name) ++ args, _ = parser.parse_known_args([]) ++ assert args.project == 'guix-patches' ++ send_args, _ = send.parse_known_args([]) ++ assert not send_args.check_patch diff --git a/gnu/packages/patches/u-boot-patman-local-conf.patch b/gnu/packages/patches/u-boot-patman-local-conf.patch deleted file mode 100644 index 3400982356..0000000000 --- a/gnu/packages/patches/u-boot-patman-local-conf.patch +++ /dev/null @@ -1,176 +0,0 @@ -Upstream status: https://patchwork.ozlabs.org/project/uboot/list/?series=333354 - -diff --git a/tools/patman/main.py b/tools/patman/main.py -index bf300c6e64..3616b28f27 100755 ---- a/tools/patman/main.py -+++ b/tools/patman/main.py -@@ -116,7 +116,7 @@ status.add_argument('-f', '--force', action='store_true', - argv = sys.argv[1:] - args, rest = parser.parse_known_args(argv) - if hasattr(args, 'project'): -- settings.Setup(gitutil, parser, args.project, '') -+ settings.Setup(parser, args.project) - args, rest = parser.parse_known_args(argv) - - # If we have a command, it is safe to parse all arguments -diff --git a/tools/patman/patman.rst b/tools/patman/patman.rst -index 8c5c9cc2cc..7828899879 100644 ---- a/tools/patman/patman.rst -+++ b/tools/patman/patman.rst -@@ -74,7 +74,7 @@ out where to send patches pretty well. - During the first run patman creates a config file for you by taking the default - user name and email address from the global .gitconfig file. - --To add your own, create a file ~/.patman like this:: -+To add your own, create a file `~/.patman` like this:: - - # patman alias file - -@@ -85,6 +85,12 @@ To add your own, create a file ~/.patman like this:: - wolfgang: Wolfgang Denk <wd@denx.de> - others: Mike Frysinger <vapier@gentoo.org>, Fred Bloggs <f.bloggs@napier.net> - -+Patman will also look for a `.patman` configuration file at the root -+of the current project git repository, which makes it possible to -+override the `project` settings variable or anything else in a -+project-specific way. The values of this "local" configuration file -+take precedence over those of the "global" one. -+ - Aliases are recursive. - - The checkpatch.pl in the U-Boot tools/ subdirectory will be located and -diff --git a/tools/patman/settings.py b/tools/patman/settings.py -index 903d6fcb0b..e8e2908f1f 100644 ---- a/tools/patman/settings.py -+++ b/tools/patman/settings.py -@@ -1,5 +1,6 @@ - # SPDX-License-Identifier: GPL-2.0+ - # Copyright (c) 2011 The Chromium OS Authors. -+# Copyright (c) 2022 Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com> - # - - try: -@@ -11,8 +12,7 @@ import argparse - import os - import re - --from patman import command --from patman import tools -+from patman import gitutil - - """Default settings per-project. - -@@ -190,7 +190,8 @@ def ReadGitAliases(fname): - - fd.close() - --def CreatePatmanConfigFile(gitutil, config_fname): -+ -+def CreatePatmanConfigFile(config_fname): - """Creates a config file under $(HOME)/.patman if it can't find one. - - Args: -@@ -328,26 +329,46 @@ def GetItems(config, section): - except: - raise - --def Setup(gitutil, parser, project_name, config_fname=''): -+def Setup(parser, project_name, config_fname=None): - """Set up the settings module by reading config files. - -+ Unless `config_fname` is specified, a `.patman` config file local -+ to the git repository is consulted, followed by the global -+ `$HOME/.patman`. If none exists, the later is created. Values -+ defined in the local config file take precedence over those -+ defined in the global one. -+ - Args: -- parser: The parser to update -+ parser: The parser to update. - project_name: Name of project that we're working on; we'll look - for sections named "project_section" as well. -- config_fname: Config filename to read ('' for default) -+ config_fname: Config filename to read. An error is raised if it -+ does not exist. - """ - # First read the git alias file if available - _ReadAliasFile('doc/git-mailrc') - config = _ProjectConfigParser(project_name) -- if config_fname == '': -+ -+ if config_fname and not os.path.exists(config_fname): -+ raise Exception(f'provided {config_fname} does not exist') -+ -+ if not config_fname: - config_fname = '%s/.patman' % os.getenv('HOME') -+ has_config = os.path.exists(config_fname) -+ -+ git_local_config_fname = os.path.join(gitutil.get_top_level(), '.patman') -+ has_git_local_config = os.path.exists(git_local_config_fname) - -- if not os.path.exists(config_fname): -- print("No config file found ~/.patman\nCreating one...\n") -- CreatePatmanConfigFile(gitutil, config_fname) -+ # Read the git local config last, so that its values override -+ # those of the global config, if any. -+ if has_config: -+ config.read(config_fname) -+ if has_git_local_config: -+ config.read(git_local_config_fname) - -- config.read(config_fname) -+ if not (has_config or has_git_local_config): -+ print("No config file found.\nCreating ~/.patman...\n") -+ CreatePatmanConfigFile(config_fname) - - for name, value in GetItems(config, 'alias'): - alias[name] = value.split(',') -diff --git a/tools/patman/test_settings.py b/tools/patman/test_settings.py -new file mode 100644 -index 0000000000..9c14b4aaa3 ---- /dev/null -+++ b/tools/patman/test_settings.py -@@ -0,0 +1,43 @@ -+# SPDX-License-Identifier: GPL-2.0+ -+# -+# Copyright (c) 2022 Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com> -+# -+ -+import argparse -+import contextlib -+import os -+import subprocess -+import tempfile -+ -+from patman import settings -+ -+ -+@contextlib.contextmanager -+def empty_git_repository(): -+ with tempfile.TemporaryDirectory() as tmpdir: -+ os.chdir(tmpdir) -+ subprocess.check_call(['git', 'init']) -+ yield tmpdir -+ -+ -+def test_git_local_config(): -+ with empty_git_repository(): -+ with tempfile.NamedTemporaryFile() as global_config: -+ global_config.write(b'[settings]\n' -+ b'project=u-boot\n') -+ global_config.flush() -+ parser = argparse.ArgumentParser() -+ parser.add_argument('-p', '--project', default='unknown') -+ -+ # Test "global" config is used. -+ settings.Setup(parser, 'unknown', global_config.name) -+ args, _ = parser.parse_known_args() -+ assert args.project == 'u-boot' -+ -+ # Test local config can shadow it. -+ with open('.patman', 'w', buffering=1) as f: -+ f.write('[settings]\n' -+ 'project=guix-patches\n') -+ settings.Setup(parser, 'unknown', global_config.name) -+ args, _ = parser.parse_known_args([]) -+ assert args.project == 'guix-patches' diff --git a/gnu/packages/patches/xf86-video-qxl-fix-build.patch b/gnu/packages/patches/xf86-video-qxl-fix-build.patch deleted file mode 100644 index 9ea50e4c91..0000000000 --- a/gnu/packages/patches/xf86-video-qxl-fix-build.patch +++ /dev/null @@ -1,101 +0,0 @@ -From 4b083ede3c4a827a84295ff223e34ee3c2e581b2 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?= - <zboszor@gmail.com> -Date: Sat, 28 Aug 2021 15:38:40 +0200 -Subject: [PATCH] Fix a build error with Xorg master -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Use xf86ReturnOptValBool() in get_bool_option() instead of -options[option_index].value.bool to fix a compiler error with -current Xorg xserver master branch. - -Also use xf86GetOptValInteger() in get_int_option() and -xf86GetOptValString() in get_str_option() for consistency. - -The change causes a slight performance drop during option parsing -because the passed-in index_value is no longer used as an index -into the options array. - -Instead, it's used as a token now for the standard option getter -functions which works since the index_value to the get_*_option() -functions are identical to the value of options[n].token in the -passed-in OptionInfoRec array. - -Also rename "int option_index" to "int token" for clarity in all -three functions. - -Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com> ---- - src/qxl_option_helpers.c | 13 +++++++------ - src/qxl_option_helpers.h | 6 +++--- - 2 files changed, 10 insertions(+), 9 deletions(-) - -diff --git a/src/qxl_option_helpers.c b/src/qxl_option_helpers.c -index 2aba677..7707b7c 100644 ---- a/src/qxl_option_helpers.c -+++ b/src/qxl_option_helpers.c -@@ -10,31 +10,32 @@ - - #include "qxl_option_helpers.h" - --int get_int_option(OptionInfoPtr options, int option_index, -+int get_int_option(OptionInfoPtr options, int token, - const char *env_name) - { -+ int value; - if (env_name && getenv(env_name)) { - return atoi(getenv(env_name)); - } -- return options[option_index].value.num; -+ return xf86GetOptValInteger(options, token, &value) ? value : 0; - } - --const char *get_str_option(OptionInfoPtr options, int option_index, -+const char *get_str_option(OptionInfoPtr options, int token, - const char *env_name) - { - if (getenv(env_name)) { - return getenv(env_name); - } -- return options[option_index].value.str; -+ return xf86GetOptValString(options, token); - } - --int get_bool_option(OptionInfoPtr options, int option_index, -+int get_bool_option(OptionInfoPtr options, int token, - const char *env_name) - { - const char* value = getenv(env_name); - - if (!value) { -- return options[option_index].value.bool; -+ return xf86ReturnOptValBool(options, token, FALSE); - } - if (strcmp(value, "0") == 0 || - strcasecmp(value, "off") == 0 || -diff --git a/src/qxl_option_helpers.h b/src/qxl_option_helpers.h -index 7c54c72..66d0a17 100644 ---- a/src/qxl_option_helpers.h -+++ b/src/qxl_option_helpers.h -@@ -4,13 +4,13 @@ - #include <xf86Crtc.h> - #include <xf86Opt.h> - --int get_int_option(OptionInfoPtr options, int option_index, -+int get_int_option(OptionInfoPtr options, int token, - const char *env_name); - --const char *get_str_option(OptionInfoPtr options, int option_index, -+const char *get_str_option(OptionInfoPtr options, int token, - const char *env_name); - --int get_bool_option(OptionInfoPtr options, int option_index, -+int get_bool_option(OptionInfoPtr options, int token, - const char *env_name); - - #endif // OPTION_HELPERS_H --- -GitLab - diff --git a/gnu/packages/patches/xf86-video-voodoo-pcitag.patch b/gnu/packages/patches/xf86-video-voodoo-pcitag.patch deleted file mode 100644 index 5cadef3928..0000000000 --- a/gnu/packages/patches/xf86-video-voodoo-pcitag.patch +++ /dev/null @@ -1,34 +0,0 @@ -From: Tobias Geerinckx-Rice <me@tobias.gr> -Date: Mon, 20 May 2019 04:52:33 +0200 -Subject: [PATCH] gnu: xf86-video-voodoo: Don't use PCITAG. - -Copied verbatim from upstream repository[0]. - -[0]: https://cgit.freedesktop.org/xorg/driver/-xf86-video-voodoo/patch/?id=9172ae566a0e85313fc80ab62b4455393eefe593 - -From 9172ae566a0e85313fc80ab62b4455393eefe593 Mon Sep 17 00:00:00 2001 -From: Dave Airlie <airlied@redhat.com> -Date: Mon, 22 Sep 2014 10:56:02 +1000 -Subject: don't use PCITAG in struct anymore - ---- - src/voodoo.h | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/src/voodoo.h b/src/voodoo.h -index bfed497..c3eb64e 100644 ---- a/src/voodoo.h -+++ b/src/voodoo.h -@@ -23,7 +23,9 @@ typedef struct { - - Bool Voodoo2; /* Set if Voodoo2 */ - pciVideoPtr PciInfo; /* PCI data */ -+#ifndef XSERVER_LIBPCIACCESS - PCITAG PciTag; -+#endif - CARD32 PhysBase; - - CARD32 Width; /* Current width */ --- -cgit v1.0 - |