packages feed

dnf-repo 0.6.2 → 0.6.3

raw patch · 5 files changed

+35/−26 lines, 5 files

Files

ChangeLog.md view
@@ -1,5 +1,10 @@ # dnf-repo releases +## 0.6.3 (2026-05-27)+- fix 0.6.2 regression in dnf detection logic that defaulted to /usr/bin/dnf5+- with dnf5 `--save` no longer uses config-manager since+  `/etc/dnf/repos.override.d` is not supported yet+ ## 0.6.2 (2026-03-15) - `--save` now works without dnf using sed - munge "libNAME.so.X" to "libNAME.so.X()(64bit)" (hardcoded)
README.md view
@@ -22,7 +22,7 @@ `$ dnf-repo --version`  ```-0.6.2+0.6.3 ``` `$ dnf-repo --help` @@ -177,6 +177,11 @@  ## Building Use {cabal,stack,cabal-rpm} install.++## Known issues+Currently dnf5's `/etc/dnf/repos.override.d/` (set by config-manager) is+ignored, and as of 0.6.3 `dnf-repo --save` will edit .repo files directly+as dnf4 does.  ## Contributing dnf-repo is distributed under the GPL license version 3 or later.
dnf-repo.cabal view
@@ -1,5 +1,5 @@ name:                dnf-repo-version:             0.6.2+version:             0.6.3 synopsis:            A dnf wrapper with fine control of enabled repos description:         A command-line wrapper of the dnf package manager to
src/Main.hs view
@@ -113,6 +113,7 @@ -- FIXME both enabling and disabled at the same time -- FIXME confirm repos if many -- FIXME --disable-non-cores (modular,testing,cisco, etc)+-- FIXME support dnf5 /etc/dnf/repos.override.d/99-config_manager.repo runMain :: Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Maybe Bool -> Bool         -> [Mode] -> [String] -> IO () runMain dryrun quiet debug listrepos save dnf4 mweakdeps exact modes args = do@@ -169,22 +170,25 @@           Just _ -> return $ Just Dnf4           Nothing -> error' "dnf-3 not found"       else do-        mdnf <- maybeM (checkSystemPathFile "dnf") (return . Just) $-                checkSystemPathFile "dnf5"-        case mdnf of+        mdnf5 <- checkSystemPathFile "dnf5"+        case mdnf5 of           Just _ -> return $ Just Dnf5-          Nothing -> return Nothing+          Nothing -> do+            mdnf3 <- checkSystemPathFile "dnf-3"+            case mdnf3 of+              Just _ -> return $ Just Dnf4+              Nothing -> return Nothing     when save $       if null actions         then putStrLn "no changes to save"         else do-        let changes = concatMap (saveRepo mpkgmgr) actions+        let changes = concatMap (saveRepo (mpkgmgr == Just Dnf4)) actions         unless (null changes) $ do           ok <- yesNo $ "Save changed repo" +-+ "enabled state" ++ ['s' | length changes > 1]-          when ok $ do-            case mpkgmgr of-              Just dnf -> doSudo dryrun debug (pkgMgrCmd dnf) $ "config-manager" : changes-              Nothing -> doSudo dryrun debug "sh" ["-c", unwords $ "sed" : "-i" : map show changes ++ ["/etc/yum.repos.d/*.repo"]]+          when ok $+            if mpkgmgr == Just Dnf4+            then doSudo dryrun debug (pkgMgrCmd Dnf4) $ "config-manager" : changes+            else doSudo dryrun debug "sh" ["-c", unwords $ "sed" : "-i" : map show changes ++ ["/etc/yum.repos.d/*.repo"]]     if null args       then       when (null actions || listrepos) $ do
src/State.hs view
@@ -150,26 +150,21 @@ changeRepo _ = Nothing  data PkgMgr = Dnf5 | Dnf4+  deriving Eq  pkgMgrCmd :: PkgMgr -> String pkgMgrCmd Dnf5 = "dnf5" pkgMgrCmd Dnf4 = "dnf-3" -saveRepo :: Maybe PkgMgr -> ChangeEnable -> [String]-saveRepo pkgmgr (Disable r True) =-  case pkgmgr of-    Just dnf ->-      case dnf of-        Dnf4 -> ["--disable", r]-        Dnf5 -> ["setopt", r ++ ".enabled=0"]-    Nothing -> ["/^\\[" ++ r  ++ "\\]/,/^\\[/ s/^enabled=1/enabled=0/"]-saveRepo pkgmgr (Enable r True) =-  case pkgmgr of-    Just dnf ->-      case dnf of-        Dnf4 -> ["--enable", r]-        Dnf5 -> ["setopt", r ++ ".enabled=1"]-    Nothing -> ["/^\\[" ++ r  ++ "\\]/,/^\\[/ s/^enabled=0/enabled=1/"]+saveRepo :: Bool -> ChangeEnable -> [String]+saveRepo dnf4 (Disable r True) =+  if dnf4+  then ["--disable", r]+  else ["/^\\[" ++ r  ++ "\\]/,/^\\[/ s/^enabled=1/enabled=0/"]+saveRepo dnf4 (Enable r True) =+  if dnf4+  then ["--enable", r]+  else ["/^\\[" ++ r  ++ "\\]/,/^\\[/ s/^enabled=0/enabled=1/"] saveRepo _ _ = []  expiring :: ChangeEnable -> Maybe String