Skip to content

Commit

Permalink
linux-firmware: move all mediatek WLAN/BT drivers to -network subpkg
Browse files Browse the repository at this point in the history
based on https://github.com/chimera-linux/cports/blob/339c0eef5be61397707170c6789e09fa4c3b5810/main/firmware-linux/template.py#L83-L86

this shouldn't break anything because `linux-firmware` depends on
`linux-firmware-network` already

fixes #43515
  • Loading branch information
classabbyamp committed Apr 18, 2023
1 parent 3e11c20 commit a1be2bf
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 97 deletions.
187 changes: 97 additions & 90 deletions srcpkgs/imhex/patches/no-update-check.patch
Original file line number Diff line number Diff line change
@@ -1,106 +1,113 @@
running the internal update checker is pointless when updates are managed by xbps
From 4b37a0b3cec38d5fee99795ad6a4d2e789827c5e Mon Sep 17 00:00:00 2001
From: classabbyamp <dev@placeviolette.net>
Date: Tue, 18 Apr 2023 05:27:07 -0400
Subject: [PATCH] build: Add option to disable update checking

--- a/plugins/builtin/source/content/welcome_screen.cpp
+++ b/plugins/builtin/source/content/welcome_screen.cpp
@@ -517,20 +517,6 @@
loadDefaultLayout();
});

- EventManager::subscribe<EventWindowInitialized>([] {
- // documentation of the value above the setting definition
- int showCheckForUpdates = ContentRegistry::Settings::read("hex.builtin.setting.general", "hex.builtin.setting.general.check_for_updates", 2);
- if (showCheckForUpdates == 2) {
- ContentRegistry::Settings::write("hex.builtin.setting.general", "hex.builtin.setting.general.check_for_updates", 0);
- View::showYesNoQuestionPopup("hex.builtin.welcome.check_for_updates_text"_lang,
- [] { // yes
- ContentRegistry::Settings::write("hex.builtin.setting.general", "hex.builtin.setting.general.check_for_updates", 1);
- ImGui::CloseCurrentPopup();
- }, [] { // no
- ImGui::CloseCurrentPopup();
- });
- }
- });

ContentRegistry::Interface::addMenuItem("hex.builtin.menu.file", 1075, [&] {
if (ImGui::BeginMenu("hex.builtin.menu.file.open_recent"_lang, !s_recentProvidersUpdating && !s_recentProviders.empty())) {
--- a/plugins/builtin/source/content/settings_entries.cpp
+++ b/plugins/builtin/source/content/settings_entries.cpp
@@ -35,21 +35,6 @@

/* General */
This is aimed at use by linux distros, where package updates come from
a central location, and users shouldn't need to worry about updating
ImHex on their own. This disables parts of the ImHex UI that would not
be useful in that case.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index fc5c0e73..d2fbfab5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,6 +10,7 @@ option(IMHEX_PATTERNS_PULL_MASTER "Download latest files from master branch of t
option(IMHEX_IGNORE_BAD_COMPILER "Allow compiling with an unsupported compiler" OFF)
option(IMHEX_USE_GTK_FILE_PICKER "Use GTK file picker instead of xdg-desktop-portals" OFF)
option(IMHEX_DISABLE_STACKTRACE "Disables support for printing stack traces" OFF)
+option(IMHEX_DISABLE_UPDATE_CHECK "Disables built-in update check" OFF)

- /* Values of this setting :
- 0 - do not check for updates on startup
- 1 - check for updates on startup
- 2 - default value - ask the user if he wants to check for updates. This value should only be encountered on the first startup.
- */
- ContentRegistry::Settings::add("hex.builtin.setting.general", "hex.builtin.setting.general.check_for_updates", 2, [](auto name, nlohmann::json &setting) {
- static bool enabled = static_cast<int>(setting) == 1;
-
- if (ImGui::Checkbox(name.data(), &enabled)) {
- setting = static_cast<int>(enabled);
- return true;
- }
-
- return false;
- });
# Basic compiler and cmake configurations
set(CMAKE_CXX_STANDARD 23)
@@ -46,6 +47,10 @@ configurePackingResources()
setUninstallTarget()
addBundledLibraries()

ContentRegistry::Settings::add("hex.builtin.setting.general", "hex.builtin.setting.general.show_tips", 1, [](auto name, nlohmann::json &setting) {
static bool enabled = static_cast<int>(setting);
+if (NOT IMHEX_DISABLE_UPDATE_CHECK)
+ add_compile_definitions(HEX_UPDATE_CHECK)
+endif()
+
# Add ImHex sources
add_subdirectory(lib/libimhex)
add_subdirectory(main)
diff --git a/main/source/init/tasks.cpp b/main/source/init/tasks.cpp
index 4e83b079..2d993f00 100644
--- a/main/source/init/tasks.cpp
+++ b/main/source/init/tasks.cpp
@@ -29,46 +29,6 @@
@@ -29,6 +29,7 @@ namespace hex::init {

using namespace std::literals::string_literals;

- static bool checkForUpdates() {
- int showCheckForUpdates = ContentRegistry::Settings::read("hex.builtin.setting.general", "hex.builtin.setting.general.check_for_updates", 2);
-
- // Check if we should check for updates
- if (showCheckForUpdates == 1){
- HttpRequest request("GET", GitHubApiURL + "/releases/latest"s);
- request.setTimeout(2000);
-
- // Query the GitHub API for the latest release version
- auto response = request.execute().get();
- if (response.getStatusCode() != 200)
- return false;
-
- nlohmann::json releases;
- try {
- releases = nlohmann::json::parse(response.getData());
- } catch (std::exception &e) {
- return false;
- }
-
- // Check if the response is valid
- if (!releases.contains("tag_name") || !releases["tag_name"].is_string())
- return false;
-
- // Convert the current version string to a format that can be compared to the latest release
- auto versionString = std::string(IMHEX_VERSION);
- size_t versionLength = std::min(versionString.find_first_of('-'), versionString.length());
- auto currVersion = "v" + versionString.substr(0, versionLength);
-
- // Get the latest release version string
- auto latestVersion = releases["tag_name"].get<std::string_view>();
-
- // Check if the latest release is different from the current version
- if (latestVersion != currVersion)
- ImHexApi::System::impl::addInitArgument("update-available", latestVersion.data());
-
- }
- return true;
- }
-
+#ifdef HEX_UPDATE_CHECK
static bool checkForUpdates() {
int showCheckForUpdates = ContentRegistry::Settings::read("hex.builtin.setting.general", "hex.builtin.setting.general.check_for_updates", 2);

@@ -68,6 +69,7 @@ namespace hex::init {
}
return true;
}
+#endif

bool setupEnvironment() {
hex::log::debug("Using romfs: '{}'", romfs::name());

@@ -479,7 +439,6 @@
@@ -474,7 +476,9 @@ namespace hex::init {
#endif
{ "Loading settings", loadSettings, false },
{ "Loading plugins", loadPlugins, false },
- { "Checking for updates", checkForUpdates, true },
+#if HEX_UPDATE_CHECK
{ "Checking for updates", checkForUpdates, true },
+#endif
{ "Loading fonts", loadFonts, true },
};
}
@@ -487,4 +491,4 @@ namespace hex::init {
};
}

-}
\ No newline at end of file
+}
diff --git a/plugins/builtin/source/content/settings_entries.cpp b/plugins/builtin/source/content/settings_entries.cpp
index 60530d59..b462327e 100644
--- a/plugins/builtin/source/content/settings_entries.cpp
+++ b/plugins/builtin/source/content/settings_entries.cpp
@@ -45,6 +45,7 @@ namespace hex::plugin::builtin {
1 - check for updates on startup
2 - default value - ask the user if he wants to check for updates. This value should only be encountered on the first startup.
*/
+#ifdef HEX_UPDATE_CHECK
ContentRegistry::Settings::add("hex.builtin.setting.general", "hex.builtin.setting.general.check_for_updates", 2, [](auto name, nlohmann::json &setting) {
static bool enabled = static_cast<int>(setting) == 1;

@@ -55,6 +56,7 @@ namespace hex::plugin::builtin {

return false;
});
+#endif

ContentRegistry::Settings::add("hex.builtin.setting.general", "hex.builtin.setting.general.show_tips", 1, [](auto name, nlohmann::json &setting) {
static bool enabled = static_cast<int>(setting);
diff --git a/plugins/builtin/source/content/welcome_screen.cpp b/plugins/builtin/source/content/welcome_screen.cpp
index 5d54c7bd..993efecb 100644
--- a/plugins/builtin/source/content/welcome_screen.cpp
+++ b/plugins/builtin/source/content/welcome_screen.cpp
@@ -511,6 +511,7 @@ namespace hex::plugin::builtin {
loadDefaultLayout();
});

+#ifdef HEX_UPDATE_CHECK
EventManager::subscribe<EventWindowInitialized>([] {
// documentation of the value above the setting definition
auto showCheckForUpdates = ContentRegistry::Settings::read("hex.builtin.setting.general", "hex.builtin.setting.general.check_for_updates", 2);
@@ -526,6 +527,7 @@ namespace hex::plugin::builtin {
);
}
});
+#endif

// Clear project context if we go back to the welcome screen
EventManager::subscribe<EventProviderChanged>([](hex::prv::Provider *oldProvider, hex::prv::Provider *newProvider) {
--
2.40.0

5 changes: 3 additions & 2 deletions srcpkgs/imhex/template
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# Template file for 'imhex'
pkgname=imhex
version=1.28.0
revision=1
revision=2
build_wrksrc="ImHex"
build_style=cmake
build_helper=qemu
# XXX: when capstone v5 is out, -DUSE_SYSTEM_CAPSTONE=ON
configure_args="-DIMHEX_OFFLINE_BUILD=ON -DIMHEX_STRIP_RELEASE=OFF
-DUSE_SYSTEM_CURL=ON -DUSE_SYSTEM_FMT=ON -DUSE_SYSTEM_LLVM=ON
-DUSE_SYSTEM_YARA=ON -DUSE_SYSTEM_NLOHMANN_JSON=ON"
-DUSE_SYSTEM_YARA=ON -DUSE_SYSTEM_NLOHMANN_JSON=ON
-DIMHEX_DISABLE_UPDATE_CHECK=ON"
hostmakedepends="pkg-config clang-tools-extra"
makedepends="libcurl-devel fmt-devel llvm jansson-devel yara-devel json-c++
freetype-devel glfw-devel gtk+3-devel python3-devel file-devel mbedtls-devel
Expand Down
12 changes: 7 additions & 5 deletions srcpkgs/linux-firmware/template
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Template file for 'linux-firmware'
pkgname=linux-firmware
version=20230210
revision=1
depends="${pkgname}-amd>=${version}_${revision} ${pkgname}-network>=${version}_${revision}"
revision=2
depends="linux-firmware-amd>=${version}_${revision} linux-firmware-network>=${version}_${revision}"
short_desc="Binary firmware blobs for the Linux kernel"
maintainer="Érico Nogueira <ericonr@disroot.org>"
license="See /usr/share/licenses/${pkgname}"
license="See /usr/share/licenses/linux-firmware"

Check failure on line 8 in srcpkgs/linux-firmware/template

View workflow job for this annotation

GitHub Actions / Lint templates

Template Lint

use SPDX id for 'See /usr/share/licenses/linux-firmware' license or see Manual.md
homepage="https://www.kernel.org/"
distfiles="https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/snapshot/${pkgname}-${version}.tar.gz"
distfiles="https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/snapshot/linux-firmware-${version}.tar.gz"
checksum=ccc2ff9d475f368fa915e509fddb2c3815189f9461a008db1af0f096a2bfdbd3
python_version=3
nostrip=yes
Expand Down Expand Up @@ -93,7 +93,9 @@ linux-firmware-network_package() {
vmove usr/lib/firmware/kaweth
vmove usr/lib/firmware/libertas
vmove usr/lib/firmware/mrvl
vmove "usr/lib/firmware/mt*.bin"
vmove "usr/lib/firmware/mt7*.bin"
# don't move mediatek SoC firmware
( shopt -s extglob; vmove "usr/lib/firmware/mediatek/!(mt7986*|mt81*|sof*)" )
vmove usr/lib/firmware/ueagle-atm
vmove usr/lib/firmware/ti-connectivity
vmove usr/lib/firmware/dpaa2
Expand Down

0 comments on commit a1be2bf

Please sign in to comment.