packages feed

pkgtreediff 0.2.1 → 0.3

raw patch · 5 files changed

+70/−17 lines, 5 filesdep +Globdep ~http-directory

Dependencies added: Glob

Dependency ranges changed: http-directory

Files

CHANGELOG.md view
@@ -1,5 +1,12 @@ # Changelog +## 0.3 (2019-06-xx)+- add --pattern for href filename globbing+- use http-directory-0.1.4 for httpDirectory basic filtering++## 0.2.1 (2019-06-06)+- better recursion handling and href filtering+ ## 0.2 (2019-06-05) - print summary - add --ignore-arch
Main.hs view
@@ -21,6 +21,7 @@ import Network.HTTP.Directory import System.Directory (doesDirectoryExist, listDirectory) import System.FilePath ((</>))+import System.FilePath.Glob (compile, match) -- for warning import System.IO (hPutStrLn, stderr) @@ -33,7 +34,7 @@ main =   simpleCmdArgs (Just version) "Package tree comparison tool"   "pkgtreediff compares the packages in two OS trees" $-    compareDirs <$> recursiveOpt <*> ignoreVR <*> ignoreArch <*> modeOpt  <*> strArg "URL/DIR1" <*> strArg "URL/DIR2"+    compareDirs <$> recursiveOpt <*> ignoreVR <*> ignoreArch <*> modeOpt  <*> optional patternOpt <*> strArg "URL/DIR1" <*> strArg "URL/DIR2"  data Mode = AutoSummary | NoSummary | ShowSummary | Added | Deleted | Updated   deriving Eq@@ -43,7 +44,7 @@   flagWith' Added 'N' "new" "Show only added packages" <|>   flagWith' Deleted 'D' "deleted" "Show only removed packages" <|>   flagWith' Updated 'U' "updated" "Show only updated packages" <|>-  flagWith' ShowSummary 's' "show-summary" ("Show summary of changes (default for >" <> show summaryThreshold <> " changes)") <|>+  flagWith' ShowSummary 's' "show-summary" ("Show summary of changes (default when >" <> show summaryThreshold <> " changes)") <|>   flagWith AutoSummary NoSummary 'S' "no-summary" "Do not display summary"  ignoreArch :: Parser Bool@@ -60,11 +61,14 @@ recursiveOpt :: Parser Bool recursiveOpt = switchWith 'r' "recursive" "Recursive down into subdirectories" +patternOpt :: Parser String+patternOpt = strOptionWith 'p' "pattern" "PKGPATTERN" "Limit out to package glob matches"+ summaryThreshold :: Int summaryThreshold = 20 -compareDirs :: Bool -> Ignore -> Bool -> Mode -> String -> String -> IO ()-compareDirs recursive ignore igArch mode tree1 tree2 = do+compareDirs :: Bool -> Ignore -> Bool -> Mode -> Maybe String -> String -> String -> IO ()+compareDirs recursive ignore igArch mode mpattern tree1 tree2 = do   (ps1,ps2) <- getTrees tree1 tree2   let diff = diffPkgs ignore ps1 ps2   mapM_ T.putStrLn . mapMaybe (showPkgDiff mode) $ diff@@ -88,7 +92,7 @@      readPackages isUrl mmgr loc = do       fs <- (if isUrl then httpPackages True (fromJust mmgr) else dirPackages True) loc-      let ps = map ((if igArch then binToPkg else id) . readPkg) fs+      let ps = map ((if igArch then binToPkg else id) . readPkg) $ filter (maybe (const True) (match . compile) mpattern . T.unpack) fs       return $ sort (nub ps)      binToPkg :: Package -> Package@@ -97,13 +101,12 @@     httpPackages recurse mgr url = do       exists <- httpExists mgr url       fs <- if exists-               -- nub here because opensuse has dup img links-            then nub . filter (\ f -> f /= "../" && (not . isHttp) (T.unpack f) && not ("/" `T.isPrefixOf` f) && ("/" `T.isSuffixOf` f || ".rpm" `T.isSuffixOf` f)) <$> httpDirectory mgr url+            then filter (\ f -> "/" `T.isSuffixOf` f || ".rpm" `T.isSuffixOf` f) <$> httpDirectory mgr url             else error' $ "Could not get " <> url       if (recurse || recursive) && all isDir fs then concatMapM (httpPackages False mgr) (map ((url </>) . T.unpack) fs) else return $ filter (not . isDir) fs      dirPackages recurse dir = do-      fs <- sort <$> listDirectory dir+      fs <- sort . filter (".rpm" `isSuffixOf`) <$> listDirectory dir       alldirs <- mapM doesDirectoryExist fs       if (recurse || recursive) && and alldirs then concatMapM (dirPackages False) (map (dir </>) fs) else return $ filter (not . isDir) $ map T.pack fs @@ -171,7 +174,7 @@ showPkgDiff Updated (PkgArch p1 p2) = Just $ showArchChange p1 p2 showPkgDiff mode (PkgAdd p) | isDefault mode = Just $ "+ " <> showPkg p showPkgDiff mode (PkgDel p) | isDefault mode  = Just $ "- " <> showPkg p-showPkgDiff mode (PkgUpdate p1 p2) | isDefault mode = Just $ " " <> showPkgUpdate p1 p2+showPkgDiff mode (PkgUpdate p1 p2) | isDefault mode = Just $ showPkgUpdate p1 p2 showPkgDiff mode (PkgArch p1 p2) | isDefault mode = Just $ "! " <> showArchChange p1 p2 showPkgDiff _ _ = Nothing 
README.md view
@@ -8,11 +8,54 @@  ## Usage example -```-$ pkgtreediff treeurl1 treeurl2-+ newPackage v-- packageOld v'- updatedPackage: v1 -> v2+```bash session+$ pkgtreediff --ignore-release https://dl.fedoraproject.org/pub/fedora/linux/releases/{29,30}/Workstation/source/tree/Packages/+ ImageMagick.src: 6.9.9.38-3.fc29 -> 6.9.10.28-1.fc30+ LibRaw.src: 0.19.0-6.fc29 -> 0.19.2-3.fc30+ ModemManager.src: 1.8.0-4.fc29 -> 1.10.0-1.fc30+ NetworkManager.src: 1.12.4-1.fc29 -> 1.16.0-1.fc30+ NetworkManager-openvpn.src: 1.8.6-1.fc29 -> 1.8.10-1.fc30+ NetworkManager-ssh.src: 1.2.7-5.fc29 -> 1.2.9-1.fc30+ PackageKit.src: 1.1.11-1.fc29 -> 1.1.12-5.fc30+ PyYAML.src: 4.2-0.1.b4.fc29 -> 5.1-1.fc30+ SDL2.src: 2.0.8-6.fc29 -> 2.0.9-3.fc30+ abrt.src: 2.11.0-1.fc29 -> 2.12.0-2.fc30+ adobe-source-han-code-jp-fonts.src: 2.000-6.fc29 -> 2.011-2.fc30+ adobe-source-han-sans-cn-fonts.src: 1.004-8.fc29 -> 2.000-2.fc30+ adobe-source-han-sans-jp-fonts.src: 1.004-4.fc29 -> 2.000-2.fc30+ adobe-source-han-sans-kr-fonts.src: 1.004-4.fc29 -> 2.000-2.fc30+ adobe-source-han-sans-tw-fonts.src: 1.004-9.fc29 -> 2.000-2.fc30+ adobe-source-serif-pro-fonts.src: 2.000-5.fc29 -> 2.010.1.010-1.fc30+ adwaita-icon-theme.src: 3.30.0-1.fc29 -> 3.32.0-1.fc30+- aldusleaf-crimson-text-fonts.src  0.8-0.10.20130806.fc29+- almas-mongolian-title-fonts.src  1.0-11.fc29+ alsa-lib.src: 1.1.6-3.fc29 -> 1.1.8-2.fc30+:+:+ wpa_supplicant.src: 2.6-17.fc29 -> 2.7-5.fc30+ wpan-tools.src: 0.8-3.fc29 -> 0.9-2.fc30++ xdg-dbus-proxy.src  0.1.1-2.fc30+ xdg-desktop-portal.src: 1.0.2-1.fc29 -> 1.2.0-3.fc30+ xdg-desktop-portal-gtk.src: 1.0.2-1.fc29 -> 1.2.0-3.fc30+ xen.src: 4.11.0-7.fc29 -> 4.11.1-4.fc30+ xfsprogs.src: 4.17.0-3.fc29 -> 4.19.0-4.fc30+ xmlsec1.src: 1.2.25-5.fc29 -> 1.2.27-2.fc30+ xorg-x11-drv-ati.src: 18.0.1-2.fc29 -> 19.0.1-1.fc30+ xorg-x11-drv-libinput.src: 0.28.0-2.fc29 -> 0.28.2-1.fc30+ xorg-x11-server.src: 1.20.1-4.fc29 -> 1.20.4-3.fc30+ yelp.src: 3.30.0-1.fc29 -> 3.32.1-1.fc30+ yelp-xsl.src: 3.30.1-1.fc29 -> 3.32.1-1.fc30++ zchunk.src  1.1.1-3.fc30+ zenity.src: 3.30.0-1.fc29 -> 3.32.0-1.fc30+ zram.src: 0.2-1.fc29 -> 0.3-1.fc30+ zstd.src: 1.3.6-1.fc29 -> 1.3.8-2.fc30++Summary+Updated: 484+Added: 70+Deleted: 53+Arch changed: 0+Total packages: 1672 -> 1689 ```  ## Builds
TODO view
@@ -1,4 +1,3 @@ - refactor to library - compare with installed packages-- summary (total added, removed, updated) - deb trees?
pkgtreediff.cabal view
@@ -1,6 +1,6 @@ cabal-version:       1.18 name:                pkgtreediff-version:             0.2.1+version:             0.3 synopsis:            Package tree diff tool description:         Tool for comparing RPM package files in OS dist trees. homepage:            https://github.com/juhp/pkgtreediff@@ -30,7 +30,8 @@                      , base < 5                      , directory >= 1.2.5.0                      , filepath-                     , http-directory >= 0.1.3+                     , Glob+                     , http-directory >= 0.1.4                      , simple-cmd >= 0.1.4                      , simple-cmd-args                      , text