Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package resources for openSUSE:Factory checked in at 2024-12-09 21:11:02 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/resources (Old) and /work/SRC/openSUSE:Factory/.resources.new.29675 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "resources" Mon Dec 9 21:11:02 2024 rev:6 rq:1229064 version:1.7.1 Changes: -------- --- /work/SRC/openSUSE:Factory/resources/resources.changes 2024-12-03 20:47:25.935600324 +0100 +++ /work/SRC/openSUSE:Factory/.resources.new.29675/resources.changes 2024-12-09 21:12:16.322724240 +0100 @@ -1,0 +2,11 @@ +Sat Dec 7 00:20:26 UTC 2024 - Roman Gromov <phoenix91...@gmail.com> + +- Update to version 1.7.1 + + Bug fixes + - GPU, encoder and decoder usage stats for NVIDIA GPUs were + displayed as 0% most of the time + + Improvements + - Improved detection for VPN tunnels +- Removed cargo_audit from _service due that contains vendor now + +------------------------------------------------------------------- Old: ---- resources-1.7.0.tar.gz New: ---- resources-1.7.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ resources.spec ++++++ --- /var/tmp/diff_new_pack.YBvpKZ/_old 2024-12-09 21:12:17.342766918 +0100 +++ /var/tmp/diff_new_pack.YBvpKZ/_new 2024-12-09 21:12:17.342766918 +0100 @@ -20,7 +20,7 @@ %bcond_with test %define appid net.nokyan.Resources Name: resources -Version: 1.7.0 +Version: 1.7.1 Release: 0 Summary: Monitor your system processes License: GPL-3.0-or-later @@ -31,8 +31,8 @@ BuildRequires: cargo-packaging BuildRequires: desktop-file-utils BuildRequires: meson -BuildRequires: pkgconfig(gtk4) -BuildRequires: pkgconfig(libadwaita-1) >= 1.5.0 +BuildRequires: pkgconfig(gtk4) >= 4.10 +BuildRequires: pkgconfig(libadwaita-1) >= 1.6.0 Requires: dmidecode Requires: polkit ++++++ _service ++++++ --- /var/tmp/diff_new_pack.YBvpKZ/_old 2024-12-09 21:12:17.378768423 +0100 +++ /var/tmp/diff_new_pack.YBvpKZ/_new 2024-12-09 21:12:17.382768590 +0100 @@ -5,6 +5,5 @@ <param name="compression">zst</param> <param name="update">true</param> </service> - <service name="cargo_audit" mode="manual"/> </services> ++++++ resources-1.7.0.tar.gz -> resources-1.7.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/resources-1.7.0/.github/ISSUE_TEMPLATE/bug_report.yaml new/resources-1.7.1/.github/ISSUE_TEMPLATE/bug_report.yaml --- old/resources-1.7.0/.github/ISSUE_TEMPLATE/bug_report.yaml 2024-11-29 11:11:40.000000000 +0100 +++ new/resources-1.7.1/.github/ISSUE_TEMPLATE/bug_report.yaml 2024-12-06 01:43:40.000000000 +0100 @@ -23,31 +23,50 @@ required: false - type: textarea attributes: - label: Steps To Reproduce + label: Steps to Reproduce description: Steps to reproduce the behavior. placeholder: | - 1. Go to '...' - 2. Click on '....' - 3. Scroll down to '....' + 1. Go to 'â¦' + 2. Click on 'â¦' + 3. Scroll down to 'â¦' 4. See error validations: required: false - type: textarea attributes: + label: Debug Logs + description: | + Please run Resources once with debug logs enabled (if possible) and include the terminal output here. This helps us to get hardware and software information in a streamlined way. + You can do this by running `flatpak run --env=RUST_LOG=resources=debug net.nokyan.Resources` in your terminal if you've installed Resources using Flatpak. Otherwise run `RUST_LOG=resources=debug resources`. + Especially during process and app detection, personally identifiable information may be printed in the debug logs, please double-check that there's nothing inside that you don't want to be public. If your issue is unrelated to process/app detection, you can safely omit any messages that start with `DEBUG resources::utils::app`. + value: | + <details> + <summary>Expand logs</summary> + <!-- Please leave one blank line below for enabling the code block rendering. --> + + ``` + REPLACE THIS SENTENCE WITH THE TERMINAL OUTPUT OF THE AFOREMENTIONED COMMAND. + ``` + </details> + validations: + required: true +- type: textarea + attributes: label: Environment description: | - Please provide information about your environment. + Please provide information about your environment if you were not able to include debug logs as described above. placeholder: | - Program Version 3.3.2 (You can find this in the About dialog) + Resources version: 1.7.1 (you can find this in the 'About' dialog) Package type: Flatpak - System: Ubuntu 22.04 - Hardware info(if applicable): Intel i7-7700k, 32GB RAM, Nvidia GTX 1080 + Operating system: Ubuntu 22.04 + Hardware info: Intel i7-7700k, Nvidia GTX 1080, ⦠+ ⦠render: markdown validations: - required: true + required: false - type: textarea attributes: - label: Anything else? + label: Anything Else? description: | Links? References? Anything that will give us more context about the issue you are encountering! diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/resources-1.7.0/Cargo.lock new/resources-1.7.1/Cargo.lock --- old/resources-1.7.0/Cargo.lock 2024-11-29 11:11:40.000000000 +0100 +++ new/resources-1.7.1/Cargo.lock 2024-12-06 01:43:40.000000000 +0100 @@ -77,9 +77,9 @@ [[package]] name = "anyhow" -version = "1.0.93" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" +checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7" dependencies = [ "backtrace", ] @@ -184,9 +184,9 @@ [[package]] name = "cfg-expr" -version = "0.17.1" +version = "0.17.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c360837f8f19e2e4468275138f1c0dec1647d1e17bb7c0215fe3cd7530e93c25" +checksum = "8d4ba6e40bd1184518716a6e1a781bf9160e286d219ccdb8ab2612e74cfe4789" dependencies = [ "smallvec", "target-lexicon", @@ -206,9 +206,9 @@ [[package]] name = "clap" -version = "4.5.21" +version = "4.5.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb3b4b9e5a7c7514dfa52869339ee98b3156b0bfb4e8a77c4ff4babb64b1604f" +checksum = "3135e7ec2ef7b10c6ed8950f0f792ed96ee093fa088608f1c76e569722700c84" dependencies = [ "clap_builder", "clap_derive", @@ -216,9 +216,9 @@ [[package]] name = "clap_builder" -version = "4.5.21" +version = "4.5.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b17a95aa67cc7b5ebd32aa5370189aa0d79069ef1c64ce893bd30fb24bff20ec" +checksum = "30582fc632330df2bd26877bde0c1f4470d57c582bbc070376afcd04d8cb4838" dependencies = [ "anstream", "anstyle", @@ -240,9 +240,9 @@ [[package]] name = "clap_lex" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afb84c814227b90d6895e01398aee0d8033c00e7466aca416fb6a8e0eb19d8a7" +checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" [[package]] name = "colorchoice" @@ -403,9 +403,9 @@ [[package]] name = "event-listener-strategy" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f214dc438f977e6d4e3500aaa277f5ad94ca83fbbd9b1a15713ce2344ccc5a1" +checksum = "3c3e4e0dd3673c1139bf041f3008816d9cf2946bbfac2945c09e523b8d7b05b2" dependencies = [ "event-listener", "pin-project-lite", @@ -825,9 +825,9 @@ [[package]] name = "indexmap" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" dependencies = [ "equivalent", "hashbrown 0.15.2", @@ -852,10 +852,11 @@ [[package]] name = "js-sys" -version = "0.3.72" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" +checksum = "a865e038f7f6ed956f788f0d7d60c541fff74c7bd74272c5d4cf15c63743e705" dependencies = [ + "once_cell", "wasm-bindgen", ] @@ -952,15 +953,15 @@ [[package]] name = "libc" -version = "0.2.166" +version = "0.2.167" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2ccc108bbc0b1331bd061864e7cd823c0cab660bbe6970e66e2c0614decde36" +checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc" [[package]] name = "libloading" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" +checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" dependencies = [ "cfg-if", "windows-targets", @@ -1271,7 +1272,7 @@ [[package]] name = "process-data" -version = "1.7.0" +version = "1.7.1" dependencies = [ "anyhow", "glob", @@ -1327,7 +1328,7 @@ [[package]] name = "resources" -version = "1.7.0" +version = "1.7.1" dependencies = [ "anyhow", "async-channel", @@ -1522,9 +1523,9 @@ [[package]] name = "syn" -version = "2.0.89" +version = "2.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e" +checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31" dependencies = [ "proc-macro2", "quote", @@ -1710,9 +1711,9 @@ [[package]] name = "wasm-bindgen" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" +checksum = "d15e63b4482863c109d70a7b8706c1e364eb6ea449b201a76c5b89cedcec2d5c" dependencies = [ "cfg-if", "once_cell", @@ -1721,9 +1722,9 @@ [[package]] name = "wasm-bindgen-backend" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" +checksum = "8d36ef12e3aaca16ddd3f67922bc63e48e953f126de60bd33ccc0101ef9998cd" dependencies = [ "bumpalo", "log", @@ -1736,9 +1737,9 @@ [[package]] name = "wasm-bindgen-macro" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" +checksum = "705440e08b42d3e4b36de7d66c944be628d579796b8090bfa3471478a2260051" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1746,9 +1747,9 @@ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" +checksum = "98c9ae5a76e46f4deecd0f0255cc223cfa18dc9b261213b8aa0c7b36f61b3f1d" dependencies = [ "proc-macro2", "quote", @@ -1759,15 +1760,15 @@ [[package]] name = "wasm-bindgen-shared" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" +checksum = "6ee99da9c5ba11bd675621338ef6fa52296b76b83305e9b6e5c77d4c286d6d49" [[package]] name = "web-sys" -version = "0.3.72" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" +checksum = "a98bc3c33f0fe7e59ad7cd041b89034fa82a7c2d4365ca538dda6cdaf513863c" dependencies = [ "js-sys", "wasm-bindgen", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/resources-1.7.0/Cargo.toml new/resources-1.7.1/Cargo.toml --- old/resources-1.7.0/Cargo.toml 2024-11-29 11:11:40.000000000 +0100 +++ new/resources-1.7.1/Cargo.toml 2024-12-06 01:43:40.000000000 +0100 @@ -1,6 +1,6 @@ [package] name = "resources" -version = "1.7.0" +version = "1.7.1" authors = ["nokyan <nok...@tuta.io>"] edition = "2021" rust-version = "1.80.0" @@ -18,14 +18,14 @@ [dependencies] adw = { version = "0.7.1", features = ["v1_6"], package = "libadwaita" } -anyhow = { version = "1.0.93", features = ["backtrace"] } +anyhow = { version = "1.0.94", features = ["backtrace"] } async-channel = "2.3.1" -clap = { version = "4.5.21", features = ["derive"] } +clap = { version = "4.5.23", features = ["derive"] } gettext-rs = { version = "0.7.2", features = ["gettext-system"] } glob = "0.3.1" gtk = { version = "0.9.4", features = ["v4_10"], package = "gtk4" } lazy-regex = "3.3.0" -libc = { version = "0.2.162", features = ["extra_traits"] } +libc = { version = "0.2.167", features = ["extra_traits"] } log = "0.4.22" nix = { version = "0.29.0", default-features = false, features = [ "signal", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/resources-1.7.0/data/net.nokyan.Resources.desktop.in.in new/resources-1.7.1/data/net.nokyan.Resources.desktop.in.in --- old/resources-1.7.0/data/net.nokyan.Resources.desktop.in.in 2024-11-29 11:11:40.000000000 +0100 +++ new/resources-1.7.1/data/net.nokyan.Resources.desktop.in.in 2024-12-06 01:43:40.000000000 +0100 @@ -4,7 +4,7 @@ Type=Application Exec=resources Terminal=false -Categories=System +Categories=System; # Translators: Search terms to find this application. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon! Keywords=System;Resources;Monitor;Processes;Usage;Task;Manager;CPU;RAM;Memory;GPU; # Translators: Do NOT translate or transliterate this text (this is an icon file name)! diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/resources-1.7.0/data/net.nokyan.Resources.metainfo.xml.in.in new/resources-1.7.1/data/net.nokyan.Resources.metainfo.xml.in.in --- old/resources-1.7.0/data/net.nokyan.Resources.metainfo.xml.in.in 2024-11-29 11:11:40.000000000 +0100 +++ new/resources-1.7.1/data/net.nokyan.Resources.metainfo.xml.in.in 2024-12-06 01:43:40.000000000 +0100 @@ -80,6 +80,18 @@ </screenshot> </screenshots> <releases> + <release version="1.7.1" date="2024-12-06"> + <url type="details">https://github.com/nokyan/resources/releases/tag/v1.7.1</url> + <description translate="no"> + <p> + Resources 1.7.1 has been published including a hotfix for a critical bug and a small improvement for network interface detection: + </p> + <ul> + <li>GPU, encoder and decoder usage stats for NVIDIA GPUs were displayed as 0% most of the time</li> + <li>Improved detection for VPN tunnels</li> + </ul> + </description> + </release> <release version="1.7.0" date="2024-11-29"> <url type="details">https://github.com/nokyan/resources/releases/tag/v1.7.0</url> <description translate="no"> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/resources-1.7.0/lib/process_data/Cargo.toml new/resources-1.7.1/lib/process_data/Cargo.toml --- old/resources-1.7.0/lib/process_data/Cargo.toml 2024-11-29 11:11:40.000000000 +0100 +++ new/resources-1.7.1/lib/process_data/Cargo.toml 2024-12-06 01:43:40.000000000 +0100 @@ -1,6 +1,6 @@ [package] name = "process-data" -version = "1.7.0" +version = "1.7.1" authors = ["nokyan <nok...@tuta.io>"] edition = "2021" rust-version = "1.80.0" @@ -17,10 +17,10 @@ opt-level = 3 [dependencies] -anyhow = "1.0.93" +anyhow = "1.0.94" glob = "0.3.1" lazy-regex = "3.3.0" -libc = "0.2.166" +libc = "0.2.167" num_cpus = "1.16.0" nutype = { version = "0.5.0", features = ["serde"] } nvml-wrapper = "0.10.0" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/resources-1.7.0/meson.build new/resources-1.7.1/meson.build --- old/resources-1.7.0/meson.build 2024-11-29 11:11:40.000000000 +0100 +++ new/resources-1.7.1/meson.build 2024-12-06 01:43:40.000000000 +0100 @@ -1,7 +1,7 @@ project( 'resources', 'rust', - version: '1.7.0', + version: '1.7.1', meson_version: '>= 0.59', ) @@ -13,7 +13,7 @@ dependency('glib-2.0', version: '>= 2.66') dependency('gio-2.0', version: '>= 2.66') dependency('gtk4', version: '>= 4.10.0') -dependency('libadwaita-1', version: '>= 1.5.0') +dependency('libadwaita-1', version: '>= 1.6.0') glib_compile_resources = find_program('glib-compile-resources', required: true) glib_compile_schemas = find_program('glib-compile-schemas', required: true) @@ -37,10 +37,11 @@ if get_option('profile') == 'development' profile = 'Devel' vcs_tag = run_command('git', 'rev-parse', '--short', 'HEAD').stdout().strip() - if vcs_tag == '' + vcs_branch = run_command('git', 'rev-parse', '--abbrev-ref', 'HEAD').stdout().strip() + if vcs_tag == '' or vcs_branch == '' version_suffix = '-devel' else - version_suffix = '-@0@'.format(vcs_tag) + version_suffix = '-@0@/@1@'.format(vcs_branch, vcs_tag) endif application_id = '@0@.@1@'.format(base_id, profile) else diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/resources-1.7.0/po/nb.po new/resources-1.7.1/po/nb.po --- old/resources-1.7.0/po/nb.po 2024-11-29 11:11:40.000000000 +0100 +++ new/resources-1.7.1/po/nb.po 2024-12-06 01:43:40.000000000 +0100 @@ -9,7 +9,7 @@ "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-08-26 01:10+0200\n" -"PO-Revision-Date: 2024-09-03 10:58+0200\n" +"PO-Revision-Date: 2024-12-01 22:44+0100\n" "Last-Translator: Sunniva Løvstad <turtle@turtle.garden>\n" "Language-Team: \n" "Language: nb\n" @@ -17,7 +17,7 @@ "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Poedit 3.4.4\n" +"X-Generator: Poedit 3.5\n" #: data/net.nokyan.Resources.desktop.in.in:3 #: data/net.nokyan.Resources.metainfo.xml.in.in:4 src/application.rs:262 @@ -116,7 +116,7 @@ #: data/net.nokyan.Resources.metainfo.xml.in.in:75 msgid "Network Interface page in light theme" -msgstr "Nettverkgrensesnitt-fanen i lys drakt" +msgstr "Nettverksgrensesnitt-fanen i lys drakt" #: data/net.nokyan.Resources.metainfo.xml.in.in:79 msgid "Battery page in dark theme" @@ -134,7 +134,7 @@ #. One name per line, please do not remove previous names. #: src/application.rs:278 msgid "translator-credits" -msgstr "sunniva <turtle@turtle.garden>" +msgstr "Sunniva Løvstad <resources@turtle.garden>" #: src/application.rs:279 msgid "Icon by" @@ -248,7 +248,7 @@ #: data/resources/ui/dialogs/settings_dialog.ui:153 #: data/resources/ui/dialogs/settings_dialog.ui:235 msgid "Drive Write" -msgstr "Disklesingstotal" +msgstr "Diskskriving" #: src/ui/pages/applications/mod.rs:1156 src/ui/pages/processes/mod.rs:1332 #: data/resources/ui/dialogs/app_dialog.ui:118 @@ -292,7 +292,7 @@ #: src/ui/pages/applications/mod.rs:1453 src/ui/pages/processes/mod.rs:1879 msgid "Kill {}?" -msgstr "Drep {}?" +msgstr "Død {}?" #: src/ui/pages/applications/mod.rs:1454 src/ui/pages/processes/mod.rs:1880 msgid "Continue {}?" @@ -308,15 +308,15 @@ "implications. Use with caution." msgstr "" "à stoppe en app kan medføre alvorlige risikoer som tap av data og " -"sikkerhetskonsekvenser. Bruk med forsiktighet." +"sikkerhetskonsekvenser. Bruk med omhu." #: src/ui/pages/applications/mod.rs:1462 msgid "" "Killing an app can come with serious risks such as losing data and security " "implications. Use with caution." msgstr "" -"à drepe en app kan medføre alvorlige risikoer som tap av data og " -"sikkerhetskonsekvenser. Bruk med forsiktighet." +"à døde en app kan medføre alvorlige risikoer som tap av data og " +"sikkerhetskonsekvenser. Bruk med omhu." #: src/ui/pages/applications/mod.rs:1469 #: data/resources/ui/pages/applications.ui:22 @@ -348,7 +348,7 @@ #: src/ui/pages/battery.rs:244 msgid "Battery Charge" -msgstr "Akkulading" +msgstr "Ladning" #: src/ui/pages/battery.rs:251 data/resources/ui/pages/gpu.ui:55 msgid "Power Usage" @@ -370,11 +370,11 @@ #: src/ui/pages/drive.rs:274 msgid "Read Speed" -msgstr "Lesingshastighet" +msgstr "Lesehastighet" #: src/ui/pages/drive.rs:278 msgid "Write Speed" -msgstr "Skrivingshastighet" +msgstr "Skrivehastighet" #: src/ui/pages/drive.rs:432 src/ui/pages/drive.rs:442 msgid "Yes" @@ -498,15 +498,15 @@ "security implications. Use with caution." msgstr "" "à stoppe en prosess kan medføre alvorlige risikoer som tap av data og " -"sikkerhetskonsekvenser. Bruk med forsiktighet." +"sikkerhetskonsekvenser. Bruk med omhu." #: src/ui/pages/processes/mod.rs:1888 msgid "" "Killing a process can come with serious risks such as losing data and " "security implications. Use with caution." msgstr "" -"à drepe en prosess kan medføre alvorlige risikoer som tap av data og " -"sikkerhetskonsekvenser. Bruk med forsiktighet." +"à døde en prosess kan medføre alvorlige risikoer som tap av data og " +"sikkerhetskonsekvenser. Bruk med omhu." #: src/ui/pages/processes/mod.rs:1895 data/resources/ui/pages/processes.ui:22 #: data/resources/ui/pages/processes.ui:146 @@ -521,7 +521,7 @@ #: src/ui/pages/processes/mod.rs:1897 data/resources/ui/pages/processes.ui:6 #: data/resources/ui/pages/processes.ui:26 msgid "Kill Process" -msgstr "Drep prosess" +msgstr "Død prosess" #: src/ui/pages/processes/mod.rs:1898 data/resources/ui/pages/processes.ui:14 #: data/resources/ui/pages/processes.ui:34 @@ -550,7 +550,7 @@ #: src/ui/window.rs:999 msgid "Successfully killed {}" -msgstr "Drepte {}" +msgstr "Dødet {}" #: src/ui/window.rs:1000 msgid "Successfully continued {}" @@ -571,8 +571,8 @@ #: src/ui/window.rs:1019 msgid "There was a problem killing a process" msgid_plural "There were problems killing {} processes" -msgstr[0] "Det oppsto et problem med Ã¥ drepe en prosess" -msgstr[1] "Det oppsto et problem med Ã¥ drepe {} prosesser" +msgstr[0] "Det oppsto et problem med Ã¥ døde en prosess" +msgstr[1] "Det oppsto et problem med Ã¥ døde {} prosesser" #: src/ui/window.rs:1025 msgid "There was a problem continuing a process" @@ -590,7 +590,7 @@ #: src/ui/window.rs:1037 msgid "There was a problem killing {}" -msgstr "Det oppsto et problem med Ã¥ drepe {}" +msgstr "Det oppsto et problem med Ã¥ døde {}" #: src/ui/window.rs:1038 msgid "There was a problem continuing {}" @@ -1218,7 +1218,7 @@ #: data/resources/ui/shortcuts.ui:44 msgctxt "shortcut window" msgid "Kill App/Process" -msgstr "Drep app/prosess" +msgstr "Død app/prosess" #: data/resources/ui/shortcuts.ui:50 msgctxt "shortcut window" @@ -1242,7 +1242,7 @@ #: data/resources/ui/window.ui:6 msgid "Preferences" -msgstr "Brukervalg" +msgstr "Innstillnger" #: data/resources/ui/window.ui:10 msgid "Keyboard Shortcuts" @@ -1629,7 +1629,7 @@ #: data/resources/ui/pages/drive.ui:47 msgid "Total Written" -msgstr "Total skrivet" +msgstr "Total skrevet" #: data/resources/ui/pages/drive.ui:57 data/resources/ui/pages/memory.ui:72 msgid "Type" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/resources-1.7.0/src/application.rs new/resources-1.7.1/src/application.rs --- old/resources-1.7.0/src/application.rs 2024-11-29 11:11:40.000000000 +0100 +++ new/resources-1.7.1/src/application.rs 2024-12-06 01:43:40.000000000 +0100 @@ -1,4 +1,4 @@ -use log::info; +use log::{debug, info}; use adw::{prelude::*, subclass::prelude::*}; use glib::clone; @@ -8,6 +8,7 @@ use crate::i18n::i18n; use crate::ui::dialogs::settings_dialog::ResSettingsDialog; use crate::ui::window::MainWindow; +use crate::utils::os::OsInfo; use crate::utils::process::ProcessAction; mod imp { @@ -282,9 +283,19 @@ } pub fn run(&self) { - info!("Resources ({})", APP_ID); - info!("Version: {} ({})", VERSION, PROFILE); - info!("Datadir: {}", PKGDATADIR); + info!("Resources ({APP_ID})"); + info!("Version: {VERSION}"); + info!("Datadir: {PKGDATADIR}"); + + let os_info = OsInfo::get(); + debug!( + "Operating system: {}", + os_info.name.as_deref().unwrap_or("N/A") + ); + debug!( + "Kernel version: {}", + os_info.kernel_version.as_deref().unwrap_or("N/A") + ); if PROFILE == "Devel" { info!( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/resources-1.7.0/src/ui/pages/memory.rs new/resources-1.7.1/src/ui/pages/memory.rs --- old/resources-1.7.0/src/ui/pages/memory.rs 2024-11-29 11:11:40.000000000 +0100 +++ new/resources-1.7.1/src/ui/pages/memory.rs 2024-12-06 01:43:40.000000000 +0100 @@ -3,7 +3,7 @@ use crate::config::PROFILE; use crate::i18n::{i18n, i18n_f}; -use crate::utils::memory::{self, MemoryData, MemoryDevice}; +use crate::utils::memory::{MemoryData, MemoryDevice}; use crate::utils::units::convert_storage; use crate::utils::FiniteOr; @@ -192,7 +192,7 @@ imp.swap.set_title_label(&i18n("Swap")); imp.swap.graph().set_graph_color(0x94, 0x29, 0x7c); - if let Ok(memory_devices) = memory::get_memory_devices() { + if let Ok(memory_devices) = MemoryDevice::get() { self.setup_properties(memory_devices); } else { imp.properties.set_visible(false); @@ -275,7 +275,7 @@ self, move |_| { let imp = this.imp(); - if let Ok(memory_devices) = memory::pkexec_dmidecode() { + if let Ok(memory_devices) = MemoryDevice::pkexec_dmidecode() { this.setup_properties(memory_devices); imp.properties.set_visible(true); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/resources-1.7.0/src/ui/window.rs new/resources-1.7.1/src/ui/window.rs --- old/resources-1.7.0/src/ui/window.rs 2024-11-29 11:11:40.000000000 +0100 +++ new/resources-1.7.1/src/ui/window.rs 2024-12-06 01:43:40.000000000 +0100 @@ -44,6 +44,7 @@ use std::{cell::RefCell, collections::HashMap}; use crate::{ + config::VERSION, ui::{ pages::{ applications::ResApplications, cpu::ResCPU, memory::ResMemory, @@ -158,6 +159,9 @@ // Devel Profile if PROFILE == "Devel" { obj.add_css_class("devel"); + obj.set_title(Some( + &format!("{} ({})", obj.title().unwrap_or_default(), VERSION).trim(), + )); } // Load latest window state @@ -297,11 +301,9 @@ } } - fn init_gpu_pages(self: &MainWindow) -> Vec<Gpu> { + fn init_gpu_pages(self: &MainWindow, gpus: &[Gpu]) { let imp = self.imp(); - let gpus = Gpu::get_gpus().unwrap_or_default(); - for (i, gpu) in gpus.iter().enumerate() { let page = ResGPU::new(); @@ -325,8 +327,6 @@ .borrow_mut() .insert(gpu.pci_slot(), (gpu.clone(), added_page)); } - - gpus } fn init_npu_pages(self: &MainWindow) -> Vec<Npu> { @@ -366,6 +366,10 @@ let gpus = Gpu::get_gpus().unwrap_or_default(); + if !ARGS.disable_gpu_monitoring { + self.init_gpu_pages(&gpus); + } + imp.resources_sidebar.set_stack(&imp.content_stack); if SETTINGS.show_search_on_start() { @@ -397,7 +401,9 @@ if ARGS.disable_cpu_monitoring { self.remove_page(imp.cpu_page.child().downcast_ref().unwrap()); } else { - let cpu_info = cpu::cpu_info().context("unable to get CPUInfo").unwrap(); + let cpu_info = cpu::CpuInfo::get() + .context("unable to get CPUInfo") + .unwrap(); if let Some(model_name) = cpu_info.model_name.as_deref() { imp.processor_window_title.set_title(model_name); imp.processor_window_title.set_subtitle(&i18n("Processor")); @@ -411,10 +417,6 @@ imp.memory.init(); } - if !ARGS.disable_gpu_monitoring { - self.init_gpu_pages(); - } - if !ARGS.disable_npu_monitoring { self.init_npu_pages(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/resources-1.7.0/src/utils/cpu.rs new/resources-1.7.1/src/utils/cpu.rs --- old/resources-1.7.0/src/utils/cpu.rs 2024-11-29 11:11:40.000000000 +0100 +++ new/resources-1.7.1/src/utils/cpu.rs 2024-12-06 01:43:40.000000000 +0100 @@ -121,92 +121,94 @@ pub max_speed: Option<f64>, } -fn trade_mark_symbols<S: AsRef<str>>(s: S) -> String { - s.as_ref() - .replace("(R)", "®") - .replace("(tm)", "â¢") - .replace("(TM)", "â¢") -} +impl CpuInfo { + fn parse_lscpu<S: AsRef<str>>(lscpu_output: S) -> Self { + let lscpu_output = lscpu_output.as_ref(); + + let model_name = RE_LSCPU_MODEL_NAME + .captures(lscpu_output) + .and_then(|captures| { + captures + .get(1) + .map(|capture| Self::trade_mark_symbols(capture.as_str())) + }); + + let architecture = RE_LSCPU_ARCHITECTURE + .captures(lscpu_output) + .and_then(|captures| captures.get(1).map(|capture| capture.as_str().into())); + + let sockets = RE_LSCPU_SOCKETS + .captures(lscpu_output) + .and_then(|captures| { + captures + .get(1) + .and_then(|capture| capture.as_str().parse().ok()) + }); -fn parse_lscpu<S: AsRef<str>>(lscpu_output: S) -> CpuInfo { - let lscpu_output = lscpu_output.as_ref(); - - let model_name = RE_LSCPU_MODEL_NAME - .captures(lscpu_output) - .and_then(|captures| { + let logical_cpus = RE_LSCPU_CPUS.captures(lscpu_output).and_then(|captures| { captures .get(1) - .map(|capture| trade_mark_symbols(capture.as_str())) + .and_then(|capture| capture.as_str().parse().ok()) }); - let architecture = RE_LSCPU_ARCHITECTURE - .captures(lscpu_output) - .and_then(|captures| captures.get(1).map(|capture| capture.as_str().into())); - - let sockets = RE_LSCPU_SOCKETS - .captures(lscpu_output) - .and_then(|captures| { + let physical_cpus = RE_LSCPU_CORES.captures(lscpu_output).and_then(|captures| { captures .get(1) - .and_then(|capture| capture.as_str().parse().ok()) + .and_then(|capture| capture.as_str().parse::<usize>().ok()) + .map(|int| int.saturating_mul(sockets.unwrap_or(1))) }); - let logical_cpus = RE_LSCPU_CPUS.captures(lscpu_output).and_then(|captures| { - captures - .get(1) - .and_then(|capture| capture.as_str().parse().ok()) - }); - - let physical_cpus = RE_LSCPU_CORES.captures(lscpu_output).and_then(|captures| { - captures - .get(1) - .and_then(|capture| capture.as_str().parse::<usize>().ok()) - .map(|int| int.saturating_mul(sockets.unwrap_or(1))) - }); - - let virtualization = RE_LSCPU_VIRTUALIZATION - .captures(lscpu_output) - .and_then(|captures| captures.get(1).map(|capture| capture.as_str().into())); - - let max_speed = RE_LSCPU_MAX_MHZ - .captures(lscpu_output) - .and_then(|captures| { - captures.get(1).and_then(|capture| { - capture - .as_str() - .parse::<f64>() - .ok() - .map(|float| float * 1_000_000.0) - }) - }); + let virtualization = RE_LSCPU_VIRTUALIZATION + .captures(lscpu_output) + .and_then(|captures| captures.get(1).map(|capture| capture.as_str().into())); + + let max_speed = RE_LSCPU_MAX_MHZ + .captures(lscpu_output) + .and_then(|captures| { + captures.get(1).and_then(|capture| { + capture + .as_str() + .parse::<f64>() + .ok() + .map(|float| float * 1_000_000.0) + }) + }); + + Self { + model_name, + architecture, + logical_cpus, + physical_cpus, + sockets, + virtualization, + max_speed, + } + } - CpuInfo { - model_name, - architecture, - logical_cpus, - physical_cpus, - sockets, - virtualization, - max_speed, + fn trade_mark_symbols<S: AsRef<str>>(s: S) -> String { + s.as_ref() + .replace("(R)", "®") + .replace("(tm)", "â¢") + .replace("(TM)", "â¢") } -} -/// Returns a `CPUInfo` struct populated with values gathered from `lscpu`. -/// -/// # Errors -/// -/// Will return `Err` if the are problems during reading or parsing -/// of the `lscpu` command -pub fn cpu_info() -> Result<CpuInfo> { - String::from_utf8( - std::process::Command::new("lscpu") - .env("LC_ALL", "C") - .output() - .context("unable to run lscpu, is util-linux installed?")? - .stdout, - ) - .context("unable to parse lscpu output to UTF-8") - .map(parse_lscpu) + /// Returns a `CPUInfo` struct populated with values gathered from `lscpu`. + /// + /// # Errors + /// + /// Will return `Err` if the are problems during reading or parsing + /// of the `lscpu` command + pub fn get() -> Result<Self> { + String::from_utf8( + std::process::Command::new("lscpu") + .env("LC_ALL", "C") + .output() + .context("unable to run lscpu, is util-linux installed?")? + .stdout, + ) + .context("unable to parse lscpu output to UTF-8") + .map(Self::parse_lscpu) + } } /// Returns the frequency of the given CPU `core` @@ -309,8 +311,6 @@ use crate::utils::cpu::CpuInfo; - use super::parse_lscpu; - const LSCPU_OUTPUT: &str = concat!( "Architecture: x86_64\n", " CPU op-mode(s): 32-bit, 64-bit\n", @@ -345,7 +345,7 @@ #[test] fn lscpu_complex() { - let parsed = parse_lscpu(LSCPU_OUTPUT); + let parsed = CpuInfo::parse_lscpu(LSCPU_OUTPUT); let expected = CpuInfo { model_name: Some("UIM® Abacus⢠10".into()), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/resources-1.7.0/src/utils/gpu/mod.rs new/resources-1.7.1/src/utils/gpu/mod.rs --- old/resources-1.7.0/src/utils/gpu/mod.rs 2024-11-29 11:11:40.000000000 +0100 +++ new/resources-1.7.1/src/utils/gpu/mod.rs 2024-12-06 01:43:40.000000000 +0100 @@ -56,20 +56,11 @@ pub fn new(gpu: &Gpu) -> Self { let pci_slot = gpu.pci_slot(); - let usage_fraction = gpu - .usage() - .map(|usage| (usage / 100.0).clamp(0.0, 1.0)) - .ok(); + let usage_fraction = gpu.usage().map(|usage| usage.clamp(0.0, 1.0)).ok(); - let encode_fraction = gpu - .encode_usage() - .map(|usage| (usage / 100.0).clamp(0.0, 1.0)) - .ok(); + let encode_fraction = gpu.encode_usage().map(|usage| usage.clamp(0.0, 1.0)).ok(); - let decode_fraction = gpu - .decode_usage() - .map(|usage| (usage / 100.0).clamp(0.0, 1.0)) - .ok(); + let decode_fraction = gpu.decode_usage().map(|usage| usage.clamp(0.0, 1.0)).ok(); let total_vram = gpu.total_vram().ok(); let used_vram = gpu.used_vram().ok(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/resources-1.7.0/src/utils/memory.rs new/resources-1.7.1/src/utils/memory.rs --- old/resources-1.7.0/src/utils/memory.rs 2024-11-29 11:11:40.000000000 +0100 +++ new/resources-1.7.1/src/utils/memory.rs 2024-12-06 01:43:40.000000000 +0100 @@ -140,191 +140,194 @@ pub installed: bool, } -fn parse_dmidecode<S: AsRef<str>>(dmi: S) -> Vec<MemoryDevice> { - let mut devices = Vec::new(); +impl MemoryDevice { + fn parse_dmidecode<S: AsRef<str>>(dmi: S) -> Vec<Self> { + let mut devices = Vec::new(); + + let device_strings = dmi.as_ref().split("\n\n"); + + for device_string in device_strings { + if device_string.is_empty() { + continue; + } + let memory_device = Self { + speed_mts: RE_CONFIGURED_SPEED + .captures(device_string) + .or_else(|| RE_SPEED.captures(device_string)) + .map(|x| x[1].parse().unwrap()), + form_factor: RE_FORMFACTOR + .captures(device_string) + .map(|x| x[1].to_string()), + r#type: RE_TYPE.captures(device_string).map(|x| x[1].to_string()), + type_detail: RE_TYPE_DETAIL + .captures(device_string) + .map(|x| x[1].to_string()), + size: RE_SIZE + .captures(device_string) + .map(|x| x[1].parse::<u64>().unwrap() * BYTES_IN_GIB), + installed: RE_SPEED + .captures(device_string) + .map(|x| x[1].to_string()) + .is_some(), + }; - let device_strings = dmi.as_ref().split("\n\n"); - - for device_string in device_strings { - if device_string.is_empty() { - continue; + devices.push(memory_device); } - let memory_device = MemoryDevice { - speed_mts: RE_CONFIGURED_SPEED - .captures(device_string) - .or_else(|| RE_SPEED.captures(device_string)) - .map(|x| x[1].parse().unwrap()), - form_factor: RE_FORMFACTOR - .captures(device_string) - .map(|x| x[1].to_string()), - r#type: RE_TYPE.captures(device_string).map(|x| x[1].to_string()), - type_detail: RE_TYPE_DETAIL - .captures(device_string) - .map(|x| x[1].to_string()), - size: RE_SIZE - .captures(device_string) - .map(|x| x[1].parse::<u64>().unwrap() * BYTES_IN_GIB), - installed: RE_SPEED - .captures(device_string) - .map(|x| x[1].to_string()) - .is_some(), - }; - devices.push(memory_device); + devices } - devices -} + fn virtual_dmi() -> Vec<Self> { + let command = if *IS_FLATPAK { + Command::new(FLATPAK_SPAWN) + .args([ + "--host", + "udevadm", + "info", + "-p", + "/sys/devices/virtual/dmi/id", + ]) + .output() + } else { + Command::new("udevadm") + .args(["info", "-p", "/sys/devices/virtual/dmi/id"]) + .output() + }; -fn virtual_dmi() -> Vec<MemoryDevice> { - let command = if *IS_FLATPAK { - Command::new(FLATPAK_SPAWN) - .args([ - "--host", - "udevadm", - "info", - "-p", - "/sys/devices/virtual/dmi/id", - ]) - .output() - } else { - Command::new("udevadm") - .args(["info", "-p", "/sys/devices/virtual/dmi/id"]) - .output() - }; - - let virtual_dmi_output = command - .context("unable to execute udevadm") - .and_then(|output| { - String::from_utf8(output.stdout).context("unable to parse stdout of udevadm to UTF-8") - }) - .unwrap_or_default(); + let virtual_dmi_output = command + .context("unable to execute udevadm") + .and_then(|output| { + String::from_utf8(output.stdout) + .context("unable to parse stdout of udevadm to UTF-8") + }) + .unwrap_or_default(); - parse_virtual_dmi(virtual_dmi_output) -} + Self::parse_virtual_dmi(virtual_dmi_output) + } -fn parse_virtual_dmi<S: AsRef<str>>(dmi: S) -> Vec<MemoryDevice> { - let dmi = dmi.as_ref(); + fn parse_virtual_dmi<S: AsRef<str>>(dmi: S) -> Vec<Self> { + let dmi = dmi.as_ref(); - let devices_amount: usize = RE_NUM_MEMORY_DEVICES - .captures(dmi) - .and_then(|captures| captures.get(1)) - .and_then(|capture| capture.as_str().parse().ok()) - .unwrap_or(0); - - let mut devices = Vec::with_capacity(devices_amount); - - for i in 0..devices_amount { - let i = i.to_string(); - - let installed = Regex::new(&TEMPLATE_RE_PRESENT.replace('%', &i)) - .ok() - .and_then(|regex| regex.captures(dmi)) + let devices_amount: usize = RE_NUM_MEMORY_DEVICES + .captures(dmi) .and_then(|captures| captures.get(1)) - .and_then(|capture| capture.as_str().parse::<usize>().ok()) - .map_or(true, |int| int != 0); + .and_then(|capture| capture.as_str().parse().ok()) + .unwrap_or(0); + + let mut devices = Vec::with_capacity(devices_amount); - let speed = if installed { - Regex::new(&TEMPLATE_RE_CONFIGURED_SPEED_MTS.replace('%', &i)) + for i in 0..devices_amount { + let i = i.to_string(); + + let installed = Regex::new(&TEMPLATE_RE_PRESENT.replace('%', &i)) .ok() .and_then(|regex| regex.captures(dmi)) - .or_else(|| { - Regex::new(&TEMPLATE_RE_SPEED_MTS.replace('%', &i.to_string())) - .ok() - .and_then(|regex| regex.captures(dmi)) - }) .and_then(|captures| captures.get(1)) - .and_then(|capture| capture.as_str().parse().ok()) - } else { - None - }; + .and_then(|capture| capture.as_str().parse::<usize>().ok()) + .map_or(true, |int| int != 0); - let form_factor = Regex::new(&TEMPLATE_RE_FORM_FACTOR.replace('%', &i)) - .ok() - .and_then(|regex| regex.captures(dmi)) - .and_then(|captures| captures.get(1)) - .map(|capture| capture.as_str().to_string()); + let speed = if installed { + Regex::new(&TEMPLATE_RE_CONFIGURED_SPEED_MTS.replace('%', &i)) + .ok() + .and_then(|regex| regex.captures(dmi)) + .or_else(|| { + Regex::new(&TEMPLATE_RE_SPEED_MTS.replace('%', &i.to_string())) + .ok() + .and_then(|regex| regex.captures(dmi)) + }) + .and_then(|captures| captures.get(1)) + .and_then(|capture| capture.as_str().parse().ok()) + } else { + None + }; - let r#type = Regex::new(&TEMPLATE_RE_TYPE.replace('%', &i)) - .ok() - .and_then(|regex| regex.captures(dmi)) - .and_then(|captures| captures.get(1)) - .map(|capture| capture.as_str().to_string()) - .filter(|capture| capture != "<OUT OF SPEC>"); + let form_factor = Regex::new(&TEMPLATE_RE_FORM_FACTOR.replace('%', &i)) + .ok() + .and_then(|regex| regex.captures(dmi)) + .and_then(|captures| captures.get(1)) + .map(|capture| capture.as_str().to_string()); - let type_detail = Regex::new(&TEMPLATE_RE_TYPE_DETAIL.replace('%', &i)) - .ok() - .and_then(|regex| regex.captures(dmi)) - .and_then(|captures| captures.get(1)) - .map(|capture| capture.as_str().to_string()); + let r#type = Regex::new(&TEMPLATE_RE_TYPE.replace('%', &i)) + .ok() + .and_then(|regex| regex.captures(dmi)) + .and_then(|captures| captures.get(1)) + .map(|capture| capture.as_str().to_string()) + .filter(|capture| capture != "<OUT OF SPEC>"); - let size = Regex::new(&TEMPLATE_RE_SIZE.replace('%', &i)) - .ok() - .and_then(|regex| regex.captures(dmi)) - .and_then(|captures| captures.get(1)) - .and_then(|capture| capture.as_str().parse().ok()); + let type_detail = Regex::new(&TEMPLATE_RE_TYPE_DETAIL.replace('%', &i)) + .ok() + .and_then(|regex| regex.captures(dmi)) + .and_then(|captures| captures.get(1)) + .map(|capture| capture.as_str().to_string()); - devices.push(MemoryDevice { - speed_mts: speed, - form_factor, - r#type, - type_detail, - size, - installed, - }); - } + let size = Regex::new(&TEMPLATE_RE_SIZE.replace('%', &i)) + .ok() + .and_then(|regex| regex.captures(dmi)) + .and_then(|captures| captures.get(1)) + .and_then(|capture| capture.as_str().parse().ok()); - devices -} + devices.push(Self { + speed_mts: speed, + form_factor, + r#type, + type_detail, + size, + installed, + }); + } + + devices + } -pub fn get_memory_devices() -> Result<Vec<MemoryDevice>> { - let virtual_dmi = virtual_dmi(); - if virtual_dmi.is_empty() { - let output = Command::new("dmidecode") - .args(["-t", "17", "-q"]) - .output()?; - if output.status.code().unwrap_or(1) == 1 { - debug!("Unable to get memory information without elevated privileges"); - bail!("no permission") + pub fn get() -> Result<Vec<MemoryDevice>> { + let virtual_dmi = Self::virtual_dmi(); + if virtual_dmi.is_empty() { + let output = Command::new("dmidecode") + .args(["-t", "17", "-q"]) + .output()?; + if output.status.code().unwrap_or(1) == 1 { + debug!("Unable to get memory information without elevated privileges"); + bail!("no permission") + } + debug!("Memory information obtained using dmidecode (unprivileged)"); + Ok(Self::parse_dmidecode(String::from_utf8(output.stdout)?)) + } else { + debug!("Memory information obtained using udevadm"); + Ok(virtual_dmi) } - debug!("Memory information obtained using dmidecode (unprivileged)"); - Ok(parse_dmidecode(String::from_utf8(output.stdout)?)) - } else { - debug!("Memory information obtained using udevadm"); - Ok(virtual_dmi) } -} -pub fn pkexec_dmidecode() -> Result<Vec<MemoryDevice>> { - debug!("Using pkexec to get memory information (dmidecode)â¦"); - let output = if *IS_FLATPAK { - Command::new(FLATPAK_SPAWN) - .args([ - "--host", - "/usr/bin/pkexec", - "--disable-internal-agent", - &format!("{}/bin/dmidecode", FLATPAK_APP_PATH.as_str()), - "-t", - "17", - "-q", - ]) - .output()? - } else { - Command::new("pkexec") - .args(["--disable-internal-agent", "dmidecode", "-t", "17", "-q"]) - .output()? - }; - debug!("Memory information obtained using dmidecode (privileged)"); - Ok(parse_dmidecode(String::from_utf8(output.stdout)?.as_str())) + pub fn pkexec_dmidecode() -> Result<Vec<MemoryDevice>> { + debug!("Using pkexec to get memory information (dmidecode)â¦"); + let output = if *IS_FLATPAK { + Command::new(FLATPAK_SPAWN) + .args([ + "--host", + "/usr/bin/pkexec", + "--disable-internal-agent", + &format!("{}/bin/dmidecode", FLATPAK_APP_PATH.as_str()), + "-t", + "17", + "-q", + ]) + .output()? + } else { + Command::new("pkexec") + .args(["--disable-internal-agent", "dmidecode", "-t", "17", "-q"]) + .output()? + }; + debug!("Memory information obtained using dmidecode (privileged)"); + Ok(Self::parse_dmidecode( + String::from_utf8(output.stdout)?.as_str(), + )) + } } #[cfg(test)] mod test { use pretty_assertions::assert_eq; - use crate::utils::memory::{parse_virtual_dmi, MemoryDevice}; - - use super::parse_dmidecode; + use crate::utils::memory::MemoryDevice; const DMIDECODE_OUTPUT: &str = concat!( "Memory Device\n", @@ -399,7 +402,7 @@ #[test] fn valid_dmidecode_complex() { - let parsed = parse_dmidecode(DMIDECODE_OUTPUT); + let parsed = MemoryDevice::parse_dmidecode(DMIDECODE_OUTPUT); let expected = vec![ MemoryDevice { @@ -425,7 +428,7 @@ #[test] fn valid_udevadm_complex() { - let parsed = parse_virtual_dmi(UDEVADM_OUTPUT); + let parsed = MemoryDevice::parse_virtual_dmi(UDEVADM_OUTPUT); let expected = vec![ MemoryDevice { @@ -451,8 +454,8 @@ #[test] fn udevadm_dmidecode_equal() { - let dmidecode = parse_dmidecode(DMIDECODE_OUTPUT); - let udevadm = parse_virtual_dmi(UDEVADM_OUTPUT); + let dmidecode = MemoryDevice::parse_dmidecode(DMIDECODE_OUTPUT); + let udevadm = MemoryDevice::parse_virtual_dmi(UDEVADM_OUTPUT); assert_eq!(dmidecode, udevadm); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/resources-1.7.0/src/utils/mod.rs new/resources-1.7.1/src/utils/mod.rs --- old/resources-1.7.0/src/utils/mod.rs 2024-11-29 11:11:40.000000000 +0100 +++ new/resources-1.7.1/src/utils/mod.rs 2024-12-06 01:43:40.000000000 +0100 @@ -14,6 +14,7 @@ pub mod memory; pub mod network; pub mod npu; +pub mod os; pub mod pci; pub mod process; pub mod settings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/resources-1.7.0/src/utils/network.rs new/resources-1.7.1/src/utils/network.rs --- old/resources-1.7.0/src/utils/network.rs 2024-11-29 11:11:40.000000000 +0100 +++ new/resources-1.7.1/src/utils/network.rs 2024-12-06 01:43:40.000000000 +0100 @@ -15,11 +15,13 @@ const INTERFACE_TYPE_MAP: &[(&str, InterfaceType)] = &[ ("bn", InterfaceType::Bluetooth), ("br", InterfaceType::Bridge), + ("dae", InterfaceType::Vpn), ("docker", InterfaceType::Docker), ("eth", InterfaceType::Ethernet), ("en", InterfaceType::Ethernet), ("ib", InterfaceType::InfiniBand), ("sl", InterfaceType::Slip), + ("tun", InterfaceType::Vpn), ("veth", InterfaceType::VirtualEthernet), ("virbr", InterfaceType::VmBridge), ("vpn", InterfaceType::Vpn), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/resources-1.7.0/src/utils/os.rs new/resources-1.7.1/src/utils/os.rs --- old/resources-1.7.0/src/utils/os.rs 1970-01-01 01:00:00.000000000 +0100 +++ new/resources-1.7.1/src/utils/os.rs 2024-12-06 01:43:40.000000000 +0100 @@ -0,0 +1,38 @@ +use lazy_regex::{lazy_regex, Lazy, Regex}; + +use super::IS_FLATPAK; + +const PATH_OS_RELEASE: &str = "/etc/os-release"; +const PATH_OS_RELEASE_FLATPAK: &str = "/run/host/etc/os-release"; +const PATH_KERNEL_VERSION: &str = "/proc/sys/kernel/osrelease"; + +static RE_PRETTY_NAME: Lazy<Regex> = lazy_regex!("PRETTY_NAME=\"(.*)\""); + +pub struct OsInfo { + pub name: Option<String>, + pub kernel_version: Option<String>, +} + +impl OsInfo { + pub fn get() -> Self { + let os_path = if *IS_FLATPAK { + PATH_OS_RELEASE_FLATPAK + } else { + PATH_OS_RELEASE + }; + + let name = RE_PRETTY_NAME + .captures(&std::fs::read_to_string(os_path).unwrap_or_default()) + .and_then(|captures| captures.get(1)) + .map(|capture| capture.as_str().trim().to_string()); + + let kernel_version = std::fs::read_to_string(PATH_KERNEL_VERSION) + .ok() + .map(|s| s.trim().to_string()); + + OsInfo { + name, + kernel_version, + } + } +} ++++++ vendor.tar.zst ++++++ /work/SRC/openSUSE:Factory/resources/vendor.tar.zst /work/SRC/openSUSE:Factory/.resources.new.29675/vendor.tar.zst differ: char 7, line 1