From 2fea8590b0739e27a850d1517db004bd1ff8abe9 Mon Sep 17 00:00:00 2001 From: Junior Date: Aug 14 2024 13:53:23 +0000 Subject: [PATCH 1/3] bugfix: remove unantended message and fixed the flatpak update count --- diff --git a/check_for_updates.py b/check_for_updates.py index b10e871..6094815 100644 --- a/check_for_updates.py +++ b/check_for_updates.py @@ -33,18 +33,26 @@ def get_system_language(): else: return 'en' -def check_updates(): - # Set the environment variable +def count_flatpak_updates(): + env = os.environ.copy() + env['LANG'] = 'en_US.UTF-8' + # Run the flatpak update command with --appstream and --dry-run options + result = subprocess.run( + ["flatpak", "remote-ls", "--updates"], + capture_output=True, + text=True, + env=env + ) + return len(result.stdout.splitlines()) + +def count_pkcon_updates(): env = os.environ.copy() env['LANG'] = 'en_US.UTF-8' - - # Check for pkcon updates pkcon_updates = subprocess.run(['pkcon', 'get-updates'], capture_output=True, text=True, env=env) pkcon_update_lines = pkcon_updates.stdout.splitlines() pkcon_update_count = 0 results_found = False for line in pkcon_update_lines: - print(line) if results_found: pkcon_update_count += 1 if line.startswith('Results:'): @@ -52,11 +60,15 @@ def check_updates(): if line.startswith('There are no updates available at this time.'): results_found = False pkcon_update_count = 0 + return pkcon_update_count + +def check_updates(): + # Check for pkcon updates + pkcon_update_count = count_pkcon_updates() # Check for flatpak updates - flatpak_updates = subprocess.run(['flatpak', 'update', '--app', '--noninteractive'], capture_output=True, text=True, env=env) - flatpak_update_lines = flatpak_updates.stdout.splitlines() - flatpak_update_count = len([line for line in flatpak_update_lines if 'Info' not in line and any(char.isdigit() for char in line)]) + + flatpak_update_count = count_flatpak_updates() return pkcon_update_count, flatpak_update_count From 51d287ebabccef039fb180af37049757a6468364 Mon Sep 17 00:00:00 2001 From: Junior Date: Aug 14 2024 13:57:48 +0000 Subject: [PATCH 2/3] changed the author and removed empty line --- diff --git a/check_for_updates.py b/check_for_updates.py index 6094815..20d6bb7 100644 --- a/check_for_updates.py +++ b/check_for_updates.py @@ -67,7 +67,6 @@ def check_updates(): pkcon_update_count = count_pkcon_updates() # Check for flatpak updates - flatpak_update_count = count_flatpak_updates() return pkcon_update_count, flatpak_update_count diff --git a/checkupdate.spec b/checkupdate.spec index 6abceb9..82d10b8 100644 --- a/checkupdate.spec +++ b/checkupdate.spec @@ -40,5 +40,5 @@ install -m 0644 update_menu.py %{buildroot}%{_datadir}/checkupdate/ %license LICENSE %changelog -* Tue Oct 10 2023 Your Name - 2.0-1 +* Tue Oct 10 2023 Junior - 2.0-1 - Initial package for version 2.0 \ No newline at end of file From e45d88fd2a14cda7812f775de282dfd66952c14c Mon Sep 17 00:00:00 2001 From: Junior Date: Aug 14 2024 14:07:02 +0000 Subject: [PATCH 3/3] fixed the conflict at the spec file --- diff --git a/.tito/packages/checkupdate b/.tito/packages/checkupdate index c64d04b..f150741 100644 --- a/.tito/packages/checkupdate +++ b/.tito/packages/checkupdate @@ -1 +1 @@ -1.0.22-1 ./ +2.2-1 ./ diff --git a/checkupdate.spec b/checkupdate.spec index 82d10b8..465bd1a 100644 --- a/checkupdate.spec +++ b/checkupdate.spec @@ -1,9 +1,9 @@ Name: checkupdate -Version: 2.0 +Version: 2.2 Release: 1%{?dist} Summary: A tool to manage Fedora updates and integrate with Waybar License: GPLv3+ -URL: https://example.com/checkupdate +URL: https://pagure.io/checkupdate Source0: %{name}-%{version}.tar.gz BuildArch: noarch BuildRequires: python3-devel @@ -40,5 +40,16 @@ install -m 0644 update_menu.py %{buildroot}%{_datadir}/checkupdate/ %license LICENSE %changelog -* Tue Oct 10 2023 Junior - 2.0-1 +* Wed Aug 14 2024 Junior 2.2-1 +- fix at the script when no updates available (cjuniorfox@gmail.com) + +* Wed Aug 14 2024 Junior 2.1-1 +- LICENSE file (cjuniorfox@gmail.com) +- readded the spec file (cjuniorfox@gmail.com) +- removed the old scripts (cjuniorfox@gmail.com) +- gitignore for python (cjuniorfox@gmail.com) +- Updated the readme file (cjuniorfox@gmail.com) +- chore: creation of the new python scripts check_for_update.py and update_menu.py (cjuniorfox@gmail.com) + +* Wed Aug 14 2024 Junior - 2.0-1 - Initial package for version 2.0 \ No newline at end of file