'install': correctly handle arch for installed packages (#4)

This commit is contained in:
Jens Petersen 2023-05-09 15:04:46 +08:00
parent 105c1d8a57
commit e147802d98
2 changed files with 36 additions and 2 deletions

View File

@ -0,0 +1,30 @@
From cc718978053dad85ea79a99cc10f0368a1fa1ac3 Mon Sep 17 00:00:00 2001
From: Jens Petersen <juhpetersen@gmail.com>
Date: Tue, 9 May 2023 14:39:54 +0800
Subject: [PATCH] install: correctly handle arch for installed packages (#4)
---
src/Install.hs | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/Install.hs b/src/Install.hs
index 4571703..cfa6771 100644
--- a/src/Install.hs
+++ b/src/Install.hs
@@ -295,12 +295,14 @@ decideRpms yes listmode mstrategy select prefix nvras = do
where
installExists :: NVRA -> IO (Maybe (Existence, NVRA))
installExists nvra = do
- minstalled <- cmdMaybe "rpm" ["-q", rpmName nvra]
+ -- FIXME this will fail for noarch changes
+ -- FIXME check kernel
+ minstalled <- cmdMaybe "rpm" ["-q", rpmName nvra <.> rpmArch nvra]
let existence =
case minstalled of
Nothing -> NotInstalled
Just installed ->
- if installed == showNVRA nvra
+ if showNVRA nvra `elem` lines installed
then ExistingNVR
else ChangedNVR
return $

View File

@ -6,7 +6,7 @@
Name: koji-tool
Version: 1.0.1
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Koji CLI tool for querying tasks and installing builds
License: BSD-3-Clause
@ -14,6 +14,7 @@ Url: https://hackage.haskell.org/package/%{name}
# Begin cabal-rpm sources:
Source0: https://hackage.haskell.org/package/%{name}-%{version}/%{name}-%{version}.tar.gz
# End cabal-rpm sources
Patch0: https://github.com/juhp/koji-tool/commit/cc718978053dad85ea79a99cc10f0368a1fa1ac3.patch
# Begin cabal-rpm deps:
BuildRequires: ghc-Cabal-devel
@ -47,7 +48,7 @@ Koji is the RPM-based buildsystem of Fedora Linux and CentOS.
%prep
# Begin cabal-rpm setup:
%setup -q
%autosetup -p1
# End cabal-rpm setup
@ -81,6 +82,9 @@ mkdir -p %{buildroot}%{_datadir}/bash-completion/completions/
%changelog
* Tue May 9 2023 Jens Petersen <petersen@redhat.com> - 1.0.1-2
- 'install': correctly handle arch for installed packages (#4)
* Mon May 08 2023 Jens Petersen <petersen@redhat.com> - 1.0.1-1
- 'install' now supports multiple arch options (#4)
- 'find': interpret small number as a limit (default still 10 results)