From aec125c378893a5e532cc31600f0300c581de691 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Dec 2023 16:09:14 +0000 Subject: [PATCH 01/46] Bump cachix/cachix-action from 12 to 13 Bumps [cachix/cachix-action](https://github.com/cachix/cachix-action) from 12 to 13. - [Release notes](https://github.com/cachix/cachix-action/releases) - [Commits](https://github.com/cachix/cachix-action/compare/v12...v13) --- updated-dependencies: - dependency-name: cachix/cachix-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/nix-flake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nix-flake.yml b/.github/workflows/nix-flake.yml index e036875c..dee4cc6d 100644 --- a/.github/workflows/nix-flake.yml +++ b/.github/workflows/nix-flake.yml @@ -23,7 +23,7 @@ jobs: extra_nix_config: | trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hackage-server.cachix.org-1:iw0iRh6+gsFIrxROFaAt5gKNgIHejKjIfyRdbpPYevY= substituters = https://hydra.iohk.io https://cache.nixos.org/ https://hackage-server.cachix.org/ - - uses: cachix/cachix-action@v12 + - uses: cachix/cachix-action@v13 with: # https://nix.dev/tutorials/continuous-integration-github-actions#setting-up-github-actions name: hackage-server From 92f0451595a11f193d957a697f0f68474204ce69 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Dec 2023 16:09:22 +0000 Subject: [PATCH 02/46] Bump cachix/install-nix-action from 23 to 24 Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 23 to 24. - [Release notes](https://github.com/cachix/install-nix-action/releases) - [Commits](https://github.com/cachix/install-nix-action/compare/v23...v24) --- updated-dependencies: - dependency-name: cachix/install-nix-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/nix-flake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nix-flake.yml b/.github/workflows/nix-flake.yml index e036875c..28ea79e6 100644 --- a/.github/workflows/nix-flake.yml +++ b/.github/workflows/nix-flake.yml @@ -18,7 +18,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - - uses: cachix/install-nix-action@v23 + - uses: cachix/install-nix-action@v24 with: extra_nix_config: | trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hackage-server.cachix.org-1:iw0iRh6+gsFIrxROFaAt5gKNgIHejKjIfyRdbpPYevY= From f939e97c50d773c1873c69d1c2d871a913b587ca Mon Sep 17 00:00:00 2001 From: Owen Shepherd Date: Sat, 30 Dec 2023 19:15:40 +0100 Subject: [PATCH 03/46] feat: Add support for sublibrary module listings --- datafiles/static/hackage.css | 8 ++++ src/Distribution/Server/Packages/Render.hs | 44 ++++++++++++++-------- src/Distribution/Server/Pages/Package.hs | 36 ++++++++++++------ 3 files changed, 62 insertions(+), 26 deletions(-) diff --git a/datafiles/static/hackage.css b/datafiles/static/hackage.css index a640d3d3..ce0e8810 100644 --- a/datafiles/static/hackage.css +++ b/datafiles/static/hackage.css @@ -1146,6 +1146,14 @@ a.deprecated[href]:visited { color: #61B01E; } +.lib-contents { + margin-left: 20px; +} + +.lib-contents > h3 { + margin: 0.7em 0; +} + /* Paginator */ #paginatorContainer { display: flex; diff --git a/src/Distribution/Server/Packages/Render.hs b/src/Distribution/Server/Packages/Render.hs index 8b40303e..9e6293c0 100644 --- a/src/Distribution/Server/Packages/Render.hs +++ b/src/Distribution/Server/Packages/Render.hs @@ -1,6 +1,7 @@ -- TODO: Review and possibly move elsewhere. This code was part of the -- RecentPackages (formerly "Check") feature, but that caused some cyclic -- dependencies. +{-# LANGUAGE TupleSections #-} module Distribution.Server.Packages.Render ( -- * Package render PackageRender(..) @@ -53,6 +54,7 @@ import Distribution.Utils.ShortText (fromShortText) import qualified Data.TarIndex as TarIndex import Data.TarIndex (TarIndex, TarEntryOffset) +import Data.Bifunctor (first, Bifunctor (..)) data ModSigIndex = ModSigIndex { modIndex :: ModuleForest, @@ -64,10 +66,10 @@ data ModSigIndex = ModSigIndex { -- This is why some fields of PackageDescription are preprocessed, and others aren't. data PackageRender = PackageRender { rendPkgId :: PackageIdentifier, + rendLibName :: LibraryName -> String, rendDepends :: [Dependency], rendExecNames :: [String], - rendLibraryDeps :: Maybe DependencyTree, - rendSublibraryDeps :: [(String, DependencyTree)], + rendLibraryDeps :: [(LibraryName, DependencyTree)], rendExecutableDeps :: [(String, DependencyTree)], rendLicenseName :: String, rendLicenseFiles :: [FilePath], @@ -78,7 +80,7 @@ data PackageRender = PackageRender { -- to test if a module actually has a corresponding documentation HTML -- file we can link to. If no 'TarIndex' is provided, it is assumed -- all links are dead. - rendModules :: Maybe TarIndex -> Maybe ModSigIndex, + rendModules :: Maybe TarIndex -> [(LibraryName, ModSigIndex)], rendHasTarball :: Bool, rendChangeLog :: Maybe (FilePath, ETag, TarEntryOffset, FilePath), rendReadme :: Maybe (FilePath, ETag, TarEntryOffset, FilePath), @@ -95,14 +97,13 @@ data PackageRender = PackageRender { doPackageRender :: Users.Users -> PkgInfo -> PackageRender doPackageRender users info = PackageRender - { rendPkgId = pkgInfoId info + { rendPkgId = packageId' , rendDepends = flatDependencies genDesc + , rendLibName = renderLibName , rendExecNames = map (unUnqualComponentName . exeName) (executables flatDesc) - , rendLibraryDeps = depTree libBuildInfo `fmap` condLibrary genDesc , rendExecutableDeps = (unUnqualComponentName *** depTree buildInfo) `map` condExecutables genDesc - , rendSublibraryDeps = (unUnqualComponentName *** depTree libBuildInfo) - `map` condSubLibraries genDesc + , rendLibraryDeps = second (depTree libBuildInfo) <$> allCondLibs genDesc , rendLicenseName = prettyShow (license desc) -- maybe make this a bit more human-readable , rendLicenseFiles = map getSymbolicPath $ licenseFiles desc , rendMaintainer = case fromShortText $ maintainer desc of @@ -144,17 +145,15 @@ doPackageRender users info = PackageRender then Buildable else NotBuildable - renderModules docindex - | Just lib <- library flatDesc - = let mod_ix = mkForest $ exposedModules lib + renderModules :: Maybe TarIndex -> [(LibraryName, ModSigIndex)] + renderModules docindex = flip fmap (allLibraries flatDesc) $ \lib -> + let mod_ix = mkForest $ exposedModules lib -- Assumes that there is an HTML per reexport ++ map moduleReexportName (reexportedModules lib) ++ virtualModules (libBuildInfo lib) - sig_ix = mkForest $ signatures lib - mkForest = moduleForest . map (\m -> (m, moduleHasDocs docindex m)) - in Just (ModSigIndex { modIndex = mod_ix, sigIndex = sig_ix }) - | otherwise - = Nothing + sig_ix = mkForest $ signatures lib + mkForest = moduleForest . map (\m -> (m, moduleHasDocs docindex m)) + in (libName lib, ModSigIndex { modIndex = mod_ix, sigIndex = sig_ix }) moduleHasDocs :: Maybe TarIndex -> ModuleName -> Bool moduleHasDocs Nothing = const False @@ -172,6 +171,21 @@ doPackageRender users info = PackageRender loc <- repoLocation r return (ty, loc, r) + packageId' :: PackageIdentifier + packageId' = pkgInfoId info + + packageName' :: String + packageName' = unPackageName $ pkgName packageId' + + renderLibName :: LibraryName -> String + renderLibName LMainLibName = packageName' + renderLibName (LSubLibName name) = + packageName' ++ ":" ++ unUnqualComponentName name + +allCondLibs :: GenericPackageDescription -> [(LibraryName, CondTree ConfVar [Dependency] Library)] +allCondLibs desc = maybeToList ((LMainLibName,) <$> condLibrary desc) + ++ (first LSubLibName <$> condSubLibraries desc) + type DependencyTree = CondTree ConfVar [Dependency] IsBuildable data IsBuildable = Buildable diff --git a/src/Distribution/Server/Pages/Package.hs b/src/Distribution/Server/Pages/Package.hs index 5813355e..f490a906 100644 --- a/src/Distribution/Server/Pages/Package.hs +++ b/src/Distribution/Server/Pages/Package.hs @@ -34,9 +34,10 @@ import Distribution.Utils.ShortText (fromShortText, ShortText) import Text.XHtml.Strict hiding (p, name, title, content) import qualified Text.XHtml.Strict -import Data.Maybe (fromMaybe, maybeToList, isJust, mapMaybe, catMaybes) +import Data.Bool (bool) +import Data.Maybe (fromMaybe, isJust, mapMaybe, catMaybes) import Data.List (intersperse, intercalate, partition) -import Control.Arrow (second) +import Control.Arrow (second, Arrow (..)) import System.FilePath.Posix ((), (<.>)) import qualified Documentation.Haddock.Markup as Haddock @@ -152,15 +153,19 @@ renderPackageFlags render docURL = whenNotNull xs a = if null xs then [] else a moduleSection :: PackageRender -> Maybe TarIndex -> URL -> Maybe PackageId -> Bool -> [Html] -moduleSection render mdocIndex docURL mPkgId quickNav = - maybeToList $ fmap msect (rendModules render mdocIndex) - where msect ModSigIndex{ modIndex = m, sigIndex = s } = toHtml $ +moduleSection render mdocIndex docURL mPkgId quickNav = case renderedModules of + [(LMainLibName, mods)] -> [msect mods] + renderedLibs -> concatMap renderNamedLib renderedLibs + + where msect (ModSigIndex{ modIndex = m, sigIndex = s }) = + let heading = bool h3 h2 containsSubLibraries in + toHtml $ (if not (null s) - then [ h2 << "Signatures" + then [ heading << "Signatures" , renderModuleForest docURL s ] else []) ++ (if not (null m) - then [ h2 << "Modules"] ++ + then [ heading << "Modules"] ++ [renderDocIndexLink] ++ [renderModuleForest docURL m ] else []) @@ -184,6 +189,18 @@ moduleSection render mdocIndex docURL mPkgId quickNav = concatLinks [h] = Just h concatLinks (h:hs) = (h +++) . ("] [" +++) <$> concatLinks hs + renderNamedLib :: (LibraryName, ModSigIndex) -> [Html] + renderNamedLib (name, mods) = + [ h2 << ("library " ++ rendLibName render name) + , thediv ! [theclass "lib-contents"] << msect mods + ] + + containsSubLibraries :: Bool + containsSubLibraries = map fst renderedModules == [LMainLibName] + + renderedModules :: [(LibraryName, ModSigIndex)] + renderedModules = rendModules render mdocIndex + tabulate :: [(String, Html)] -> Html tabulate items = table ! [theclass "properties"] << [tr << [th << t, td << d] | (t, d) <- items] @@ -223,11 +240,8 @@ renderDetailedDependencies pkgRender = tabulate $ map (second (fromMaybe noDeps . render)) targets where targets :: [(String, DependencyTree)] - targets = maybeToList library - ++ rendSublibraryDeps pkgRender + targets = (first (rendLibName pkgRender) <$> rendLibraryDeps pkgRender) ++ rendExecutableDeps pkgRender - where - library = (\lib -> ("library", lib)) `fmap` rendLibraryDeps pkgRender noDeps = list [toHtml "No dependencies"] From fc4ec438bf64881189d783bfc0e83cc1ab89837e Mon Sep 17 00:00:00 2001 From: Owen Shepherd Date: Mon, 1 Jan 2024 22:51:14 +0100 Subject: [PATCH 04/46] feat: Specify component types in detailed deps page With the advent of multiple sublibraries per package, it has become less clear what each component is, on the 'detailed dependencies' page. This changeset replaces the tabulated view of | component name | list of dependencies | | -------------- | -------------------- | | - lib 1 | - dep 1 | | | - dep 2 | | | | | - exe 1 | - dep 3 | With the more heirarchical: Libraries - lib 1 - dep 1 - dep 2 ... Executables - exe 1 - dep 3 This change is related to https://github.com/haskell/hackage-server/issues/1218 --- src/Distribution/Server/Features/Html.hs | 2 +- src/Distribution/Server/Packages/Render.hs | 10 ++++++-- src/Distribution/Server/Pages/Package.hs | 30 +++++++++++++--------- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/src/Distribution/Server/Features/Html.hs b/src/Distribution/Server/Features/Html.hs index 694093dc..bea91542 100644 --- a/src/Distribution/Server/Features/Html.hs +++ b/src/Distribution/Server/Features/Html.hs @@ -1461,7 +1461,7 @@ mkHtmlCandidates ServerEnv{..} utilities@HtmlUtilities{..} dependenciesPage :: Bool -> PackageRender -> URL -> Resource.XHtml dependenciesPage isCandidate render docURL = Resource.XHtml $ hackagePage (pkg ++ ": dependencies") $ - [h2 << heading, Pages.renderDetailedDependencies render] + [h1 << heading, Pages.renderDetailedDependencies render] ++ Pages.renderPackageFlags render docURL where pkg = display $ rendPkgId render diff --git a/src/Distribution/Server/Packages/Render.hs b/src/Distribution/Server/Packages/Render.hs index 9e6293c0..f57f81a1 100644 --- a/src/Distribution/Server/Packages/Render.hs +++ b/src/Distribution/Server/Packages/Render.hs @@ -67,10 +67,11 @@ data ModSigIndex = ModSigIndex { data PackageRender = PackageRender { rendPkgId :: PackageIdentifier, rendLibName :: LibraryName -> String, + rendComponentName :: ComponentName -> String, rendDepends :: [Dependency], rendExecNames :: [String], rendLibraryDeps :: [(LibraryName, DependencyTree)], - rendExecutableDeps :: [(String, DependencyTree)], + rendExecutableDeps :: [(ComponentName, DependencyTree)], rendLicenseName :: String, rendLicenseFiles :: [FilePath], rendMaintainer :: Maybe String, @@ -100,8 +101,9 @@ doPackageRender users info = PackageRender { rendPkgId = packageId' , rendDepends = flatDependencies genDesc , rendLibName = renderLibName + , rendComponentName = renderComponentName , rendExecNames = map (unUnqualComponentName . exeName) (executables flatDesc) - , rendExecutableDeps = (unUnqualComponentName *** depTree buildInfo) + , rendExecutableDeps = (CExeName *** depTree buildInfo) `map` condExecutables genDesc , rendLibraryDeps = second (depTree libBuildInfo) <$> allCondLibs genDesc , rendLicenseName = prettyShow (license desc) -- maybe make this a bit more human-readable @@ -182,6 +184,10 @@ doPackageRender users info = PackageRender renderLibName (LSubLibName name) = packageName' ++ ":" ++ unUnqualComponentName name + renderComponentName :: ComponentName -> String + renderComponentName (CLibName name) = renderLibName name + renderComponentName name@(CNotLibName _) = componentNameRaw name + allCondLibs :: GenericPackageDescription -> [(LibraryName, CondTree ConfVar [Dependency] Library)] allCondLibs desc = maybeToList ((LMainLibName,) <$> condLibrary desc) ++ (first LSubLibName <$> condSubLibraries desc) diff --git a/src/Distribution/Server/Pages/Package.hs b/src/Distribution/Server/Pages/Package.hs index f490a906..b58991ed 100644 --- a/src/Distribution/Server/Pages/Package.hs +++ b/src/Distribution/Server/Pages/Package.hs @@ -37,7 +37,7 @@ import qualified Text.XHtml.Strict import Data.Bool (bool) import Data.Maybe (fromMaybe, isJust, mapMaybe, catMaybes) import Data.List (intersperse, intercalate, partition) -import Control.Arrow (second, Arrow (..)) +import Control.Arrow (Arrow (..)) import System.FilePath.Posix ((), (<.>)) import qualified Documentation.Haddock.Markup as Haddock @@ -201,11 +201,6 @@ moduleSection render mdocIndex docURL mPkgId quickNav = case renderedModules of renderedModules :: [(LibraryName, ModSigIndex)] renderedModules = rendModules render mdocIndex -tabulate :: [(String, Html)] -> Html -tabulate items = table ! [theclass "properties"] << - [tr << [th << t, td << d] | (t, d) <- items] - - renderDependencies :: PackageRender -> (String, Html) renderDependencies render = ("Dependencies", summary +++ detailsLink) @@ -236,12 +231,23 @@ nonbreakingSpan :: Html -> Html nonbreakingSpan str = thespan ! [thestyle "white-space: nowrap"] << str renderDetailedDependencies :: PackageRender -> Html -renderDetailedDependencies pkgRender = - tabulate $ map (second (fromMaybe noDeps . render)) targets +renderDetailedDependencies pkgRender + = mconcat (mapMaybe renderComponentType componentsByType) + where - targets :: [(String, DependencyTree)] - targets = (first (rendLibName pkgRender) <$> rendLibraryDeps pkgRender) - ++ rendExecutableDeps pkgRender + componentsByType :: [(String, [(ComponentName, DependencyTree)])] + componentsByType = + [ ("Libraries", first CLibName <$> rendLibraryDeps pkgRender) + , ("Executables", rendExecutableDeps pkgRender) + ] + + renderComponentType :: (String, [(ComponentName, DependencyTree)]) -> Maybe Html + renderComponentType (_, []) = Nothing + renderComponentType (componentType, items) = Just $ mconcat + [ h2 << componentType + , flip foldMap items $ \(componentName, deptree) -> + h3 << rendComponentName pkgRender componentName +++ fromMaybe noDeps (render deptree) + ] noDeps = list [toHtml "No dependencies"] @@ -257,7 +263,7 @@ renderDetailedDependencies pkgRender = NotBuildable -> [strong << "buildable:" +++ " False"] list :: [Html] -> Html - list items = thediv ! [identifier "detailed-dependencies"] << unordList items + list items = unordList items ! [identifier "detailed-dependencies"] renderComponent :: CondBranch ConfVar [Dependency] IsBuildable -> Maybe Html From aa9ab982927f38129ade42cc9dddb5047b426769 Mon Sep 17 00:00:00 2001 From: Peter Becich Date: Wed, 10 Jan 2024 17:57:33 -0800 Subject: [PATCH 05/46] check `nix develop` shell in GitHub Action --- .github/workflows/nix-flake.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nix-flake.yml b/.github/workflows/nix-flake.yml index e036875c..05cf70e1 100644 --- a/.github/workflows/nix-flake.yml +++ b/.github/workflows/nix-flake.yml @@ -18,16 +18,20 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - - uses: cachix/install-nix-action@v23 + - uses: cachix/install-nix-action@v24 with: extra_nix_config: | trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hackage-server.cachix.org-1:iw0iRh6+gsFIrxROFaAt5gKNgIHejKjIfyRdbpPYevY= substituters = https://hydra.iohk.io https://cache.nixos.org/ https://hackage-server.cachix.org/ - - uses: cachix/cachix-action@v12 + - uses: cachix/cachix-action@v13 with: # https://nix.dev/tutorials/continuous-integration-github-actions#setting-up-github-actions name: hackage-server authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + + - name: "Check `nix develop` shell" + run: nix develop --check + - run: nix build - continue-on-error: false From c4655d2c4855964d40eee93c762e92f5499e51d4 Mon Sep 17 00:00:00 2001 From: Peter Becich Date: Thu, 11 Jan 2024 18:57:16 -0800 Subject: [PATCH 06/46] update Nix Flake --- .github/workflows/nix-flake.yml | 2 +- flake.lock | 35 +++++++++++++++++++++++-------- flake.nix | 37 ++++++++++++++++++++------------- 3 files changed, 49 insertions(+), 25 deletions(-) diff --git a/.github/workflows/nix-flake.yml b/.github/workflows/nix-flake.yml index 05cf70e1..feb0ad6d 100644 --- a/.github/workflows/nix-flake.yml +++ b/.github/workflows/nix-flake.yml @@ -9,7 +9,7 @@ on: jobs: nix: strategy: - fail-fast: false + fail-fast: true matrix: os: - ubuntu-latest diff --git a/flake.lock b/flake.lock index 7903bf04..b51f97fc 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1693611461, - "narHash": "sha256-aPODl8vAgGQ0ZYFIRisxYG5MOGSkIczvu2Cd8Gb9+1Y=", + "lastModified": 1704982712, + "narHash": "sha256-2Ptt+9h8dczgle2Oo6z5ni5rt/uLMG47UFTR1ry/wgg=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "7f53fdb7bdc5bb237da7fefef12d099e4fd611ca", + "rev": "07f6395285469419cf9d078f59b5b49993198c00", "type": "github" }, "original": { @@ -37,11 +37,11 @@ }, "haskell-flake": { "locked": { - "lastModified": 1694478711, - "narHash": "sha256-zW/saV4diypxwP56b8l93Nw8fR7tXLbOFku2I+xYCxU=", + "lastModified": 1704968632, + "narHash": "sha256-QUxzfOGRyDXhCnIYLyLQ5dF3SXQiBjA/XcrKuZhi0iI=", "owner": "srid", "repo": "haskell-flake", - "rev": "ddc704f3f62d3d3569ced794b534e8fd065c379c", + "rev": "c9c28dc5c27cb23b032f76b4bd4adc1fa715bcdc", "type": "github" }, "original": { @@ -50,13 +50,29 @@ "type": "github" } }, + "hoogle-input": { + "flake": false, + "locked": { + "lastModified": 1697376046, + "narHash": "sha256-xcGZ11ocdlB8ks20QAhtPZ+4ggmV4Om4CPHH/M6NjXk=", + "owner": "ndmitchell", + "repo": "hoogle", + "rev": "0be38ee5e078e31ef7eabeaba255aed12ce7055d", + "type": "github" + }, + "original": { + "owner": "ndmitchell", + "repo": "hoogle", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1694736714, - "narHash": "sha256-5xqXf2CfPiIHg2W7f+6odQ9c09L+jTVqGmxLB6qxPLc=", + "lastModified": 1705019030, + "narHash": "sha256-svV+kQEK5pDtRjkVibM4P1gd+kid9ne0mK0UECWpW2s=", "owner": "nixos", "repo": "nixpkgs", - "rev": "8b1c1ca2feb87ae8b7d9455d8dfe5361f249e4cf", + "rev": "80c10db7bc1a9198e3ca692144099174a56185e8", "type": "github" }, "original": { @@ -71,6 +87,7 @@ "flake-parts": "flake-parts", "flake-root": "flake-root", "haskell-flake": "haskell-flake", + "hoogle-input": "hoogle-input", "nixpkgs": "nixpkgs" } } diff --git a/flake.nix b/flake.nix index 3d79ffd0..a70e8255 100644 --- a/flake.nix +++ b/flake.nix @@ -5,6 +5,9 @@ haskell-flake.url = "github:srid/haskell-flake"; flake-root.url = "github:srid/flake-root"; flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs"; + + hoogle-input.url = "github:ndmitchell/hoogle"; + hoogle-input.flake = false; }; outputs = inputs@{ self, nixpkgs, flake-parts, ... }: @@ -21,24 +24,28 @@ haskellProjects.default = { settings = { hackage-server.check = false; + warp-tls.jailbreak = true; + tls-session-manager.jailbreak = true; + # http-client-tls.jailbreak = true; + # crypton-connection.jailbreak = true; heist.check = false; - fourmolu.check = false; - hw-prim.jailbreak = true; - hw-hspec-hedgehog.jailbreak = true; - hw-fingertree.jailbreak = true; + ap-normalize.check = false; + extensions.jailbreak = true; + # https://community.flake.parts/haskell-flake/dependency#nixpkgs + # tar = { super, ... }: + # { custom = _: super.tar_0_6_0_0; }; + # tasty = { super, ... }: + # { custom = _: super.tasty_1_5; }; }; packages = { - Cabal.source = "3.10.1.0"; - Cabal-syntax.source = "3.10.1.0"; - attoparsec-aeson.source = "2.1.0.0"; - hedgehog.source = "1.4"; - ormolu.source = "0.7.2.0"; - fourmolu.source = "0.13.1.0"; - tasty-hedgehog.source = "1.4.0.2"; - ghc-lib-parser.source = "9.6.2.20230523"; - ghc-lib-parser-ex.source = "9.6.0.2"; - hlint.source = "3.6.1"; - stylish-haskell.source = "0.14.5.0"; + # https://community.flake.parts/haskell-flake/dependency#path + hoogle.source = inputs.hoogle-input; + heist.source = "1.1.1.2"; + # tls-session-manager.source = "0.0.4"; + # warp-tls.source = "3.4.3"; + # http-io-streams.source = "0.1.6.3"; + tls.source = "1.9.0"; + # tasty.source = "1.5"; }; devShell = { tools = hp: { From 6b71d1659500aba50b6a1e48aa53039046720af8 Mon Sep 17 00:00:00 2001 From: Bodigrim Date: Sun, 7 Jan 2024 23:20:57 +0000 Subject: [PATCH 07/46] Migrate to tar-0.6 --- flake.nix | 4 +- hackage-server.cabal | 2 +- src/Data/TarIndex.hs | 2 +- src/Distribution/Client/Index.hs | 3 - .../Server/Features/Documentation.hs | 14 +++-- src/Distribution/Server/Packages/Index.hs | 2 - src/Distribution/Server/Packages/Unpack.hs | 56 ++++++++++++------- .../Server/Packages/UnpackTest.hs | 8 ++- tests/PackageTestMain.hs | 11 ++-- 9 files changed, 61 insertions(+), 41 deletions(-) diff --git a/flake.nix b/flake.nix index a70e8255..a3986f40 100644 --- a/flake.nix +++ b/flake.nix @@ -32,8 +32,8 @@ ap-normalize.check = false; extensions.jailbreak = true; # https://community.flake.parts/haskell-flake/dependency#nixpkgs - # tar = { super, ... }: - # { custom = _: super.tar_0_6_0_0; }; + tar = { super, ... }: + { custom = _: super.tar_0_6_0_0; }; # tasty = { super, ... }: # { custom = _: super.tasty_1_5; }; }; diff --git a/hackage-server.cabal b/hackage-server.cabal index 6bea36a2..19c1f76a 100644 --- a/hackage-server.cabal +++ b/hackage-server.cabal @@ -157,7 +157,7 @@ common defaults , network-bsd ^>= 2.8 , network-uri ^>= 2.6 , parsec ^>= 3.1.13 - , tar ^>= 0.5 + , tar ^>= 0.6 , unordered-containers ^>= 0.2.10 , vector ^>= 0.12 || ^>= 0.13.0.0 , zlib ^>= 0.6.2 diff --git a/src/Data/TarIndex.hs b/src/Data/TarIndex.hs index 4541e605..cd111d96 100644 --- a/src/Data/TarIndex.hs +++ b/src/Data/TarIndex.hs @@ -18,7 +18,7 @@ module Data.TarIndex ( import Data.SafeCopy (base, deriveSafeCopy) import Data.Typeable (Typeable) -import Codec.Archive.Tar (Entry(..), EntryContent(..), Entries(..), entryPath) +import Codec.Archive.Tar (Entry, GenEntry(..), GenEntryContent(..), Entries, GenEntries(..), entryPath) import qualified Data.StringTable as StringTable import Data.StringTable (StringTable) import qualified Data.IntTrie as IntTrie diff --git a/src/Distribution/Client/Index.hs b/src/Distribution/Client/Index.hs index daf3eb27..8d0ed999 100644 --- a/src/Distribution/Client/Index.hs +++ b/src/Distribution/Client/Index.hs @@ -16,9 +16,6 @@ module Distribution.Client.Index ( ) where import qualified Codec.Archive.Tar as Tar - ( read, Entries(..) ) -import qualified Codec.Archive.Tar.Entry as Tar - ( Entry(..), entryPath ) import Distribution.Package import Distribution.Text diff --git a/src/Distribution/Server/Features/Documentation.hs b/src/Distribution/Server/Features/Documentation.hs index c7313590..511a8ddb 100644 --- a/src/Distribution/Server/Features/Documentation.hs +++ b/src/Distribution/Server/Features/Documentation.hs @@ -27,6 +27,7 @@ import Distribution.Server.Features.BuildReports.BuildReport (PkgDetails(..), Bu import Data.TarIndex (TarIndex) import qualified Codec.Archive.Tar as Tar import qualified Codec.Archive.Tar.Check as Tar +import qualified Codec.Archive.Tar.Entry as Tar import Distribution.Text import Distribution.Package @@ -448,17 +449,20 @@ documentationFeature name checkDocTarball :: PackageId -> BSL.ByteString -> Either String () checkDocTarball pkgid = checkEntries - . fmapErr (either id show) . Tar.checkTarbomb (display pkgid ++ "-docs") - . fmapErr (either id show) . Tar.checkSecurity - . fmapErr (either id show) . Tar.checkPortability + . fmapErr (either id show) . chainChecks (Tar.checkEntryTarbomb (display pkgid ++ "-docs")) + . fmapErr (either id show) . chainChecks Tar.checkEntrySecurity + . fmapErr (either id show) . chainChecks Tar.checkEntryPortability + . fmapErr (either id show) . Tar.decodeLongNames . fmapErr show . Tar.read where fmapErr f = Tar.foldEntries Tar.Next Tar.Done (Tar.Fail . f) + chainChecks check = Tar.mapEntries (\entry -> maybe (Right entry) Left (check entry)) + checkEntries = Tar.foldEntries checkEntry (Right ()) Left checkEntry entry remainder - | Tar.entryPath entry == docMetaPath = checkDocMeta entry remainder - | otherwise = remainder + | Tar.entryTarPath entry == docMetaPath = checkDocMeta entry remainder + | otherwise = remainder checkDocMeta entry remainder = case Tar.entryContent entry of diff --git a/src/Distribution/Server/Packages/Index.hs b/src/Distribution/Server/Packages/Index.hs index 4adaf0b3..a822b325 100644 --- a/src/Distribution/Server/Packages/Index.hs +++ b/src/Distribution/Server/Packages/Index.hs @@ -10,9 +10,7 @@ module Distribution.Server.Packages.Index ( ) where import qualified Codec.Archive.Tar as Tar - ( write ) import qualified Codec.Archive.Tar.Entry as Tar - ( Entry(..), fileEntry, toTarPath, Ownership(..) ) import Distribution.Server.Packages.PackageIndex (PackageIndex) import qualified Distribution.Server.Packages.PackageIndex as PackageIndex import Distribution.Server.Framework.MemSize diff --git a/src/Distribution/Server/Packages/Unpack.hs b/src/Distribution/Server/Packages/Unpack.hs index f3881bb2..6e8303dc 100644 --- a/src/Distribution/Server/Packages/Unpack.hs +++ b/src/Distribution/Server/Packages/Unpack.hs @@ -138,10 +138,10 @@ tarPackageChecks lax now tarGzFile contents = do expectedDir = display pkgid selectEntry entry = case Tar.entryContent entry of - Tar.NormalFile bs _ -> Just (normalise (Tar.entryPath entry), NormalFile bs) - Tar.Directory -> Just (normalise (Tar.entryPath entry), Directory) - Tar.SymbolicLink linkTarget -> Just (normalise (Tar.entryPath entry), Link (Tar.fromLinkTarget linkTarget)) - Tar.HardLink linkTarget -> Just (normalise (Tar.entryPath entry), Link (Tar.fromLinkTarget linkTarget)) + Tar.NormalFile bs _ -> Just (normalise (Tar.entryTarPath entry), NormalFile bs) + Tar.Directory -> Just (normalise (Tar.entryTarPath entry), Directory) + Tar.SymbolicLink linkTarget -> Just (normalise (Tar.entryTarPath entry), Link linkTarget) + Tar.HardLink linkTarget -> Just (normalise (Tar.entryTarPath entry), Link linkTarget) _ -> Nothing files <- selectEntries explainTarError selectEntry entries return (pkgid, files) @@ -331,14 +331,14 @@ warn msg = tell [msg] runUploadMonad :: UploadMonad a -> Either String (a, [String]) runUploadMonad (UploadMonad m) = runIdentity . runExceptT . runWriterT $ m -selectEntries :: forall err a. +selectEntries :: forall tarPath linkTarget err a. (err -> String) - -> (Tar.Entry -> Maybe a) - -> Tar.Entries err + -> (Tar.GenEntry tarPath linkTarget -> Maybe a) + -> Tar.GenEntries tarPath linkTarget err -> UploadMonad [a] selectEntries formatErr select = extract [] where - extract :: [a] -> Tar.Entries err -> UploadMonad [a] + extract :: [a] -> Tar.GenEntries tarPath linkTarget err -> UploadMonad [a] extract _ (Tar.Fail err) = throwError (formatErr err) extract selected Tar.Done = return selected extract selected (Tar.Next entry entries) = @@ -352,18 +352,20 @@ data CombinedTarErrs = | TarBombError FilePath FilePath | FutureTimeError FilePath UTCTime UTCTime | PermissionsError FilePath Tar.Permissions + | LongNamesError Tar.DecodeLongNamesError tarballChecks :: Bool -> UTCTime -> FilePath -> Tar.Entries Tar.FormatError - -> Tar.Entries CombinedTarErrs + -> Tar.GenEntries FilePath FilePath CombinedTarErrs tarballChecks lax now expectedDir = (if not lax then checkFutureTimes now else id) . checkTarbomb expectedDir . (if not lax then checkUselessPermissions else id) . (if lax then ignoreShortTrailer else fmapTarError (either id PortabilityError) - . Tar.checkPortability) - . fmapTarError FormatError + . Tar.mapEntries (\entry -> maybe (Right entry) Left (Tar.checkEntryPortability entry))) + . fmapTarError (either FormatError LongNamesError) + . Tar.decodeLongNames where ignoreShortTrailer = Tar.foldEntries Tar.Next Tar.Done @@ -373,32 +375,39 @@ tarballChecks lax now expectedDir = fmapTarError f = Tar.foldEntries Tar.Next Tar.Done (Tar.Fail . f) checkFutureTimes :: UTCTime - -> Tar.Entries CombinedTarErrs - -> Tar.Entries CombinedTarErrs + -> Tar.GenEntries FilePath linkTarget CombinedTarErrs + -> Tar.GenEntries FilePath linkTarget CombinedTarErrs checkFutureTimes now = checkEntries checkEntry where -- Allow 30s for client clock skew now' = addUTCTime 30 now + + checkEntry :: Tar.GenEntry FilePath linkTarget -> Maybe CombinedTarErrs checkEntry entry | entryUTCTime > now' = Just (FutureTimeError posixPath entryUTCTime now') where entryUTCTime = posixSecondsToUTCTime (realToFrac (Tar.entryTime entry)) - posixPath = Tar.fromTarPathToPosixPath (Tar.entryTarPath entry) + posixPath = Tar.entryTarPath entry checkEntry _ = Nothing -checkTarbomb :: FilePath -> Tar.Entries CombinedTarErrs -> Tar.Entries CombinedTarErrs +checkTarbomb + :: FilePath + -> Tar.GenEntries FilePath linkTarget CombinedTarErrs + -> Tar.GenEntries FilePath linkTarget CombinedTarErrs checkTarbomb expectedTopDir = checkEntries checkEntry where checkEntry entry = - case splitDirectories (Tar.entryPath entry) of + case splitDirectories (Tar.entryTarPath entry) of (topDir:_) | topDir == expectedTopDir -> Nothing - _ -> Just $ TarBombError (Tar.entryPath entry) expectedTopDir + _ -> Just $ TarBombError (Tar.entryTarPath entry) expectedTopDir -checkUselessPermissions :: Tar.Entries CombinedTarErrs -> Tar.Entries CombinedTarErrs +checkUselessPermissions + :: Tar.GenEntries FilePath linkTarget CombinedTarErrs + -> Tar.GenEntries FilePath linkTarget CombinedTarErrs checkUselessPermissions = checkEntries checkEntry where @@ -410,11 +419,14 @@ checkUselessPermissions = where checkPermissions expected actual = if expected .&. actual /= expected - then Just $ PermissionsError (Tar.entryPath entry) actual + then Just $ PermissionsError (Tar.entryTarPath entry) actual else Nothing -checkEntries :: (Tar.Entry -> Maybe e) -> Tar.Entries e -> Tar.Entries e +checkEntries + :: (Tar.GenEntry tarPath linkTarget -> Maybe e) + -> Tar.GenEntries tarPath linkTarget e + -> Tar.GenEntries tarPath linkTarget e checkEntries checkEntry = Tar.foldEntries (\entry rest -> maybe (Tar.Next entry rest) Tar.Fail (checkEntry entry)) @@ -468,6 +480,10 @@ explainTarError (PermissionsError entryname mode) = where showMode :: Tar.Permissions -> String showMode m = printf "%.3o" (fromIntegral m :: Int) +explainTarError (LongNamesError err) = + "There is an error in the format of entries with long names in the tar file: " ++ show err + ++ ". Check that it is a valid tar file (e.g. 'tar -xtf thefile.tar'). " + ++ "You may need to re-create the package tarball and try again." quote :: String -> String quote s = "'" ++ s ++ "'" diff --git a/tests/Distribution/Server/Packages/UnpackTest.hs b/tests/Distribution/Server/Packages/UnpackTest.hs index 1d0fd0e6..5d9a0471 100644 --- a/tests/Distribution/Server/Packages/UnpackTest.hs +++ b/tests/Distribution/Server/Packages/UnpackTest.hs @@ -19,10 +19,14 @@ deriving instance Eq CombinedTarErrs -- | Test that check permissions does the right thing testPermissions :: FilePath -- ^ .tar.gz file to test - -> (Tar.Entry -> Maybe CombinedTarErrs) -- ^ Converter to create errors if necessary + -> (Tar.GenEntry FilePath FilePath -> Maybe CombinedTarErrs) -- ^ Converter to create errors if necessary -> Assertion testPermissions tarPath mangler = do entries <- Tar.read . GZip.decompress <$> BL.readFile tarPath - let mappedEntries = Tar.foldEntries Tar.Next Tar.Done (Tar.Fail . FormatError) entries + let mappedEntries = Tar.foldEntries + Tar.Next + Tar.Done + (Tar.Fail . either FormatError LongNamesError) + (Tar.decodeLongNames entries) when (checkEntries mangler mappedEntries /= checkUselessPermissions mappedEntries) $ assertFailure ("Permissions check did not match expected for: " ++ tarPath) diff --git a/tests/PackageTestMain.hs b/tests/PackageTestMain.hs index ec4f3865..bd5aecc1 100644 --- a/tests/PackageTestMain.hs +++ b/tests/PackageTestMain.hs @@ -9,6 +9,7 @@ import Data.Time (getCurrentTime) import Data.List (isInfixOf) import qualified Codec.Archive.Tar as Tar +import qualified Codec.Archive.Tar.Entry as Tar import qualified Codec.Compression.GZip as GZip import Distribution.Server.Packages.Unpack @@ -42,19 +43,19 @@ tarPermissions = (testPermissions "tests/permissions-tarballs/bad-dir-perms.tar.gz" badDirMangler) ] -goodMangler :: (Tar.Entry -> Maybe CombinedTarErrs) +goodMangler :: (Tar.GenEntry tarPath linkTarget -> Maybe CombinedTarErrs) goodMangler = const Nothing -badFileMangler :: (Tar.Entry -> Maybe CombinedTarErrs) +badFileMangler :: (Tar.GenEntry FilePath linkTarget -> Maybe CombinedTarErrs) badFileMangler entry = case Tar.entryContent entry of - (Tar.NormalFile _ _) -> Just $ PermissionsError (Tar.entryPath entry) 0o600 + (Tar.NormalFile _ _) -> Just $ PermissionsError (Tar.entryTarPath entry) 0o600 _ -> Nothing -badDirMangler :: (Tar.Entry -> Maybe CombinedTarErrs) +badDirMangler :: (Tar.GenEntry FilePath linkTarget -> Maybe CombinedTarErrs) badDirMangler entry = case Tar.entryContent entry of - Tar.Directory -> Just $ PermissionsError (Tar.entryPath entry) 0o700 + Tar.Directory -> Just $ PermissionsError (Tar.entryTarPath entry) 0o700 _ -> Nothing --------------------------------------------------------------------------- From 4ec595c8b3c6b8382fa1b376af8c8bf70dda580a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Jan 2024 16:03:07 +0000 Subject: [PATCH 08/46] Bump cachix/cachix-action from 13 to 14 Bumps [cachix/cachix-action](https://github.com/cachix/cachix-action) from 13 to 14. - [Release notes](https://github.com/cachix/cachix-action/releases) - [Commits](https://github.com/cachix/cachix-action/compare/v13...v14) --- updated-dependencies: - dependency-name: cachix/cachix-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/nix-flake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nix-flake.yml b/.github/workflows/nix-flake.yml index feb0ad6d..1a272671 100644 --- a/.github/workflows/nix-flake.yml +++ b/.github/workflows/nix-flake.yml @@ -23,7 +23,7 @@ jobs: extra_nix_config: | trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hackage-server.cachix.org-1:iw0iRh6+gsFIrxROFaAt5gKNgIHejKjIfyRdbpPYevY= substituters = https://hydra.iohk.io https://cache.nixos.org/ https://hackage-server.cachix.org/ - - uses: cachix/cachix-action@v13 + - uses: cachix/cachix-action@v14 with: # https://nix.dev/tutorials/continuous-integration-github-actions#setting-up-github-actions name: hackage-server From 729e6676115cfb4a6e3b9438b00f54a1269ef1b8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Jan 2024 16:03:14 +0000 Subject: [PATCH 09/46] Bump cachix/install-nix-action from 24 to 25 Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 24 to 25. - [Release notes](https://github.com/cachix/install-nix-action/releases) - [Commits](https://github.com/cachix/install-nix-action/compare/v24...v25) --- updated-dependencies: - dependency-name: cachix/install-nix-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/nix-flake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nix-flake.yml b/.github/workflows/nix-flake.yml index feb0ad6d..d4ae9408 100644 --- a/.github/workflows/nix-flake.yml +++ b/.github/workflows/nix-flake.yml @@ -18,7 +18,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - - uses: cachix/install-nix-action@v24 + - uses: cachix/install-nix-action@v25 with: extra_nix_config: | trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hackage-server.cachix.org-1:iw0iRh6+gsFIrxROFaAt5gKNgIHejKjIfyRdbpPYevY= From 9540c0ccf9343e7f8b7ef8e5fea4aff9500354b4 Mon Sep 17 00:00:00 2001 From: Peter Becich Date: Wed, 17 Jan 2024 22:02:40 -0800 Subject: [PATCH 10/46] auto-approve Dependabot --- .github/workflows/dependabot-auto-approve.yml | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/dependabot-auto-approve.yml diff --git a/.github/workflows/dependabot-auto-approve.yml b/.github/workflows/dependabot-auto-approve.yml new file mode 100644 index 00000000..fbfc8ba6 --- /dev/null +++ b/.github/workflows/dependabot-auto-approve.yml @@ -0,0 +1,22 @@ +# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#approve-a-pull-request +name: Dependabot auto-approve +on: pull_request + +permissions: + pull-requests: write + +jobs: + dependabot: + runs-on: ubuntu-latest + if: github.actor == 'dependabot[bot]' + steps: + - name: Dependabot metadata + id: metadata + uses: dependabot/fetch-metadata@v1 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + - name: Approve a PR + run: gh pr review --approve "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GH_TOKEN: ${{secrets.GITHUB_TOKEN}} From cf764e19514f351e1cfb8622df8123c59ee81903 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Jan 2024 16:51:22 +0000 Subject: [PATCH 11/46] Bump actions/cache from 3 to 4 Bumps [actions/cache](https://github.com/actions/cache) from 3 to 4. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/haskell-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 79a87d2c..660f16f8 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -191,7 +191,7 @@ jobs: $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all cabal-plan - name: restore cache - uses: actions/cache/restore@v3 + uses: actions/cache/restore@v4 with: key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} path: ~/.cabal/store @@ -221,7 +221,7 @@ jobs: rm -f cabal.project.local $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all - name: save cache - uses: actions/cache/save@v3 + uses: actions/cache/save@v4 if: always() with: key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} From c44fc6ec3e5ab19f21795bd30f0eae3152e6e47b Mon Sep 17 00:00:00 2001 From: Peter Becich Date: Sat, 27 Jan 2024 20:14:39 -0800 Subject: [PATCH 12/46] `nix flake update` --- flake.lock | 29 ++++++----------------------- flake.nix | 17 ----------------- 2 files changed, 6 insertions(+), 40 deletions(-) diff --git a/flake.lock b/flake.lock index b51f97fc..77842480 100644 --- a/flake.lock +++ b/flake.lock @@ -37,11 +37,11 @@ }, "haskell-flake": { "locked": { - "lastModified": 1704968632, - "narHash": "sha256-QUxzfOGRyDXhCnIYLyLQ5dF3SXQiBjA/XcrKuZhi0iI=", + "lastModified": 1706356277, + "narHash": "sha256-a4pla2tu/MYWa6psyfSvaLvom38AL8m+/QVe9pO5/XI=", "owner": "srid", "repo": "haskell-flake", - "rev": "c9c28dc5c27cb23b032f76b4bd4adc1fa715bcdc", + "rev": "db8b111a53f3584fb6d0b4c2d56ed37b68196302", "type": "github" }, "original": { @@ -50,29 +50,13 @@ "type": "github" } }, - "hoogle-input": { - "flake": false, - "locked": { - "lastModified": 1697376046, - "narHash": "sha256-xcGZ11ocdlB8ks20QAhtPZ+4ggmV4Om4CPHH/M6NjXk=", - "owner": "ndmitchell", - "repo": "hoogle", - "rev": "0be38ee5e078e31ef7eabeaba255aed12ce7055d", - "type": "github" - }, - "original": { - "owner": "ndmitchell", - "repo": "hoogle", - "type": "github" - } - }, "nixpkgs": { "locked": { - "lastModified": 1705019030, - "narHash": "sha256-svV+kQEK5pDtRjkVibM4P1gd+kid9ne0mK0UECWpW2s=", + "lastModified": 1706400827, + "narHash": "sha256-0Llt2cpAvMG6zCkb0gJuiAc2ZZztutAIaT04MweJMuY=", "owner": "nixos", "repo": "nixpkgs", - "rev": "80c10db7bc1a9198e3ca692144099174a56185e8", + "rev": "bc838f6bd7a7ceaa6cf8f7cad4815716d052fe81", "type": "github" }, "original": { @@ -87,7 +71,6 @@ "flake-parts": "flake-parts", "flake-root": "flake-root", "haskell-flake": "haskell-flake", - "hoogle-input": "hoogle-input", "nixpkgs": "nixpkgs" } } diff --git a/flake.nix b/flake.nix index a3986f40..a571c5ca 100644 --- a/flake.nix +++ b/flake.nix @@ -5,9 +5,6 @@ haskell-flake.url = "github:srid/haskell-flake"; flake-root.url = "github:srid/flake-root"; flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs"; - - hoogle-input.url = "github:ndmitchell/hoogle"; - hoogle-input.flake = false; }; outputs = inputs@{ self, nixpkgs, flake-parts, ... }: @@ -24,28 +21,14 @@ haskellProjects.default = { settings = { hackage-server.check = false; - warp-tls.jailbreak = true; - tls-session-manager.jailbreak = true; - # http-client-tls.jailbreak = true; - # crypton-connection.jailbreak = true; - heist.check = false; ap-normalize.check = false; - extensions.jailbreak = true; # https://community.flake.parts/haskell-flake/dependency#nixpkgs tar = { super, ... }: { custom = _: super.tar_0_6_0_0; }; - # tasty = { super, ... }: - # { custom = _: super.tasty_1_5; }; }; packages = { # https://community.flake.parts/haskell-flake/dependency#path - hoogle.source = inputs.hoogle-input; - heist.source = "1.1.1.2"; - # tls-session-manager.source = "0.0.4"; - # warp-tls.source = "3.4.3"; - # http-io-streams.source = "0.1.6.3"; tls.source = "1.9.0"; - # tasty.source = "1.5"; }; devShell = { tools = hp: { From 95a3c9ddb05a1d98bcd26f386e88df82855163b5 Mon Sep 17 00:00:00 2001 From: Gautier DI FOLCO Date: Thu, 8 Feb 2024 13:36:57 +0100 Subject: [PATCH 13/46] feature: add 'reporting vulnerabilities' link on package pages (haskell/security-advisories#7) --- datafiles/templates/Html/package-page.html.st | 1 + 1 file changed, 1 insertion(+) diff --git a/datafiles/templates/Html/package-page.html.st b/datafiles/templates/Html/package-page.html.st index cfa131b8..7b9ee221 100644 --- a/datafiles/templates/Html/package-page.html.st +++ b/datafiles/templates/Html/package-page.html.st @@ -32,6 +32,7 @@
[ $tags$ ] [ Propose Tags ] + [ Report a vulnerability ]
$if(isDeprecated)$ From f672a3d2a037931f2af44bf2cc40ff16c766581b Mon Sep 17 00:00:00 2001 From: Peter Becich Date: Thu, 7 Mar 2024 18:41:23 -0800 Subject: [PATCH 14/46] `nix flake update` --- flake.lock | 18 +++++++++--------- flake.nix | 4 +++- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/flake.lock b/flake.lock index 77842480..6075d613 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1704982712, - "narHash": "sha256-2Ptt+9h8dczgle2Oo6z5ni5rt/uLMG47UFTR1ry/wgg=", + "lastModified": 1709336216, + "narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "07f6395285469419cf9d078f59b5b49993198c00", + "rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2", "type": "github" }, "original": { @@ -37,11 +37,11 @@ }, "haskell-flake": { "locked": { - "lastModified": 1706356277, - "narHash": "sha256-a4pla2tu/MYWa6psyfSvaLvom38AL8m+/QVe9pO5/XI=", + "lastModified": 1709467224, + "narHash": "sha256-xnPTkLMqq78BiTqt6WXj2TXLupclJi+NEH84HDbQSPc=", "owner": "srid", "repo": "haskell-flake", - "rev": "db8b111a53f3584fb6d0b4c2d56ed37b68196302", + "rev": "9173cc45aeb72b7e7adfe0e5a53a425fe439e3ca", "type": "github" }, "original": { @@ -52,11 +52,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1706400827, - "narHash": "sha256-0Llt2cpAvMG6zCkb0gJuiAc2ZZztutAIaT04MweJMuY=", + "lastModified": 1709856773, + "narHash": "sha256-QJ3yNJLhfDZbln1HEhIGXmPlwqCk22MbyicFNfSVs3A=", "owner": "nixos", "repo": "nixpkgs", - "rev": "bc838f6bd7a7ceaa6cf8f7cad4815716d052fe81", + "rev": "a32bb438c0219345fc535b4f910da21fa4c4aaa2", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index a571c5ca..a8b1d18d 100644 --- a/flake.nix +++ b/flake.nix @@ -24,7 +24,9 @@ ap-normalize.check = false; # https://community.flake.parts/haskell-flake/dependency#nixpkgs tar = { super, ... }: - { custom = _: super.tar_0_6_0_0; }; + { custom = _: super.tar_0_6_1_0; }; + # tasty = { super, ... }: + # { custom = _: super.tasty_1_5; }; }; packages = { # https://community.flake.parts/haskell-flake/dependency#path From 66b13d99df352d62a737988914b54dce36a2907a Mon Sep 17 00:00:00 2001 From: Peter Becich Date: Thu, 7 Mar 2024 18:44:38 -0800 Subject: [PATCH 15/46] fix badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b6b65fbb..51cd6f01 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # hackage-server -[![Build status](https://github.com/haskell/hackage-server/actions/workflows/cabal.yml/badge.svg)](https://github.com/haskell/hackage-server/actions/workflows/cabal.yml) +[![Build status](https://github.com/haskell/hackage-server/actions/workflows/haskell-ci.yml/badge.svg)](https://github.com/haskell/hackage-server/actions/workflows/haskell-ci.yml) [![Build status](https://github.com/haskell/hackage-server/actions/workflows/nix-flake.yml/badge.svg)](https://github.com/haskell/hackage-server/actions/workflows/nix-flake.yml) This is the `hackage-server` code. This is what powers , and many other private hackage instances. The `master` branch is suitable for general usage. Specific policy and documentation for the central hackage instance exists in the `central-server` branch. From 4f22c4d85434d0304711ff6faa1d4e7154163410 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Sat, 9 Mar 2024 19:20:57 +0800 Subject: [PATCH 16/46] Make an exception for bzip2 licenses --- src/Distribution/Server/Packages/Unpack.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Distribution/Server/Packages/Unpack.hs b/src/Distribution/Server/Packages/Unpack.hs index 6e8303dc..be436ec8 100644 --- a/src/Distribution/Server/Packages/Unpack.hs +++ b/src/Distribution/Server/Packages/Unpack.hs @@ -519,6 +519,8 @@ isAcceptableLicense = either goSpdx goLegacy . licenseRaw goSimple (SPDX.ELicenseRef _) = False -- don't allow referenced licenses goSimple (SPDX.ELicenseIdPlus _) = False -- don't allow + licenses (use GPL-3.0-or-later e.g.) goSimple (SPDX.ELicenseId SPDX.CC0_1_0) = True -- CC0 isn't OSI approved, but we allow it as "PublicDomain", this is eg. PublicDomain in http://hackage.haskell.org/package/string-qq-0.0.2/src/LICENSE + goSimple (SPDX.ELicenseId SPDX.Bzip2_1_0_5) = True -- not OSI approved, but make an exception: https://github.com/haskell/hackage-server/issues/1294 + goSimple (SPDX.ELicenseId SPDX.Bzip2_1_0_6) = True -- same as above goSimple (SPDX.ELicenseId lid) = SPDX.licenseIsOsiApproved lid || SPDX.LId.licenseIsFsfLibre lid -- allow only OSI or FSF approved licenses. -- pre `cabal-version: 2.2` From 204b69a5ce1ceb993bd6f8478ca9bb673df28163 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Mar 2024 16:42:14 +0000 Subject: [PATCH 17/46] Bump cachix/install-nix-action from 25 to 26 Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 25 to 26. - [Release notes](https://github.com/cachix/install-nix-action/releases) - [Commits](https://github.com/cachix/install-nix-action/compare/v25...v26) --- updated-dependencies: - dependency-name: cachix/install-nix-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/nix-flake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nix-flake.yml b/.github/workflows/nix-flake.yml index 89160f29..7c1e51a9 100644 --- a/.github/workflows/nix-flake.yml +++ b/.github/workflows/nix-flake.yml @@ -18,7 +18,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - - uses: cachix/install-nix-action@v25 + - uses: cachix/install-nix-action@v26 with: extra_nix_config: | trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hackage-server.cachix.org-1:iw0iRh6+gsFIrxROFaAt5gKNgIHejKjIfyRdbpPYevY= From be8af5b967beb8791b64afced0bef64a4467a18c Mon Sep 17 00:00:00 2001 From: Peter Becich Date: Sat, 23 Mar 2024 13:00:09 -0700 Subject: [PATCH 18/46] `nix flake update` (#1301) * enable check test-suite DocTests causes errors * write-ghc-environment * extraConfigureFlags * `nix flake update` --- flake.lock | 12 ++++++------ flake.nix | 23 ++++++++++++++++++----- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/flake.lock b/flake.lock index 6075d613..87a6f490 100644 --- a/flake.lock +++ b/flake.lock @@ -37,11 +37,11 @@ }, "haskell-flake": { "locked": { - "lastModified": 1709467224, - "narHash": "sha256-xnPTkLMqq78BiTqt6WXj2TXLupclJi+NEH84HDbQSPc=", + "lastModified": 1711149116, + "narHash": "sha256-tccTtjRvxrhSJkCnmNwaPrq0DDM3UsM0uiDyW4uJXXc=", "owner": "srid", "repo": "haskell-flake", - "rev": "9173cc45aeb72b7e7adfe0e5a53a425fe439e3ca", + "rev": "6ae8a85071adfe08d70d9963c526947403c6c070", "type": "github" }, "original": { @@ -52,11 +52,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1709856773, - "narHash": "sha256-QJ3yNJLhfDZbln1HEhIGXmPlwqCk22MbyicFNfSVs3A=", + "lastModified": 1711152738, + "narHash": "sha256-Rku86xQ+1mttl4taD1Ywmt5CST5ZzTDNqd30TmgyHuU=", "owner": "nixos", "repo": "nixpkgs", - "rev": "a32bb438c0219345fc535b4f910da21fa4c4aaa2", + "rev": "39632d3d4c3bd91cf869737f54b9d1ff940ace16", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index a8b1d18d..04077e9c 100644 --- a/flake.nix +++ b/flake.nix @@ -19,18 +19,31 @@ # has only one. packages.default = config.packages.hackage-server; haskellProjects.default = { + basePackages = pkgs.haskell.packages.ghc98; settings = { + # https://github.com/srid/haskell-flake/discussions/196 hackage-server.check = false; - ap-normalize.check = false; + # hackage-server.cabalFlags.write-ghc-environment-files = true; + # hackage-server.cabalFlags.write-ghc-environment = "always"; + # hackage-server.extraConfigureFlags = [ "--write-ghc-environment=always" ]; + # https://community.flake.parts/haskell-flake/dependency#nixpkgs tar = { super, ... }: - { custom = _: super.tar_0_6_1_0; }; - # tasty = { super, ... }: - # { custom = _: super.tasty_1_5; }; + { custom = _: super.tar_0_6_2_0; }; + tls = { super, ... }: + { custom = _: super.tls_2_0_1; }; + tls-session-manager = { super, ... }: + { custom = _: super.tls-session-manager_0_0_5; }; + tasty = { super, ... }: + { custom = _: super.tasty_1_5; }; + logict.jailbreak = true; + integer-logarithms.jailbreak = true; + time-compat.jailbreak = true; + indexed-traversable-instances.jailbreak = true; }; packages = { # https://community.flake.parts/haskell-flake/dependency#path - tls.source = "1.9.0"; + # tls.source = "1.9.0"; }; devShell = { tools = hp: { From 5f94939bd5facc23acf080de21e6aed386143830 Mon Sep 17 00:00:00 2001 From: Peter Becich Date: Sat, 23 Mar 2024 13:41:40 -0700 Subject: [PATCH 19/46] fix Flake (#1302) --- flake.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/flake.nix b/flake.nix index 04077e9c..4287536c 100644 --- a/flake.nix +++ b/flake.nix @@ -23,6 +23,7 @@ settings = { # https://github.com/srid/haskell-flake/discussions/196 hackage-server.check = false; + threads.check = false; # hackage-server.cabalFlags.write-ghc-environment-files = true; # hackage-server.cabalFlags.write-ghc-environment = "always"; # hackage-server.extraConfigureFlags = [ "--write-ghc-environment=always" ]; From 3ce2fe81184f57a8975b65131849afeb382ebfed Mon Sep 17 00:00:00 2001 From: Peter Becich Date: Sat, 23 Mar 2024 15:01:44 -0700 Subject: [PATCH 20/46] fix Flake (#1303) --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 4287536c..0ff3254b 100644 --- a/flake.nix +++ b/flake.nix @@ -32,7 +32,7 @@ tar = { super, ... }: { custom = _: super.tar_0_6_2_0; }; tls = { super, ... }: - { custom = _: super.tls_2_0_1; }; + { custom = _: super.tls_2_0_1 // { check = false; }; }; tls-session-manager = { super, ... }: { custom = _: super.tls-session-manager_0_0_5; }; tasty = { super, ... }: From e36f96965e379f5c8e241fa23feefad5ec1cc0fd Mon Sep 17 00:00:00 2001 From: Peter Becich Date: Sat, 23 Mar 2024 16:05:25 -0700 Subject: [PATCH 21/46] fix Flake (#1304) --- flake.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index 0ff3254b..3631b7c0 100644 --- a/flake.nix +++ b/flake.nix @@ -31,8 +31,9 @@ # https://community.flake.parts/haskell-flake/dependency#nixpkgs tar = { super, ... }: { custom = _: super.tar_0_6_2_0; }; - tls = { super, ... }: - { custom = _: super.tls_2_0_1 // { check = false; }; }; + # tls = { super, ... }: + # { custom = _: super.tls_2_0_1 // { check = false; }; }; + tls.check = false; tls-session-manager = { super, ... }: { custom = _: super.tls-session-manager_0_0_5; }; tasty = { super, ... }: @@ -44,7 +45,7 @@ }; packages = { # https://community.flake.parts/haskell-flake/dependency#path - # tls.source = "1.9.0"; + tls.source = "2.0.1"; }; devShell = { tools = hp: { From 46758c7cd833514edfda9727c3b06e8a4f7dd220 Mon Sep 17 00:00:00 2001 From: Peter Becich Date: Sat, 23 Mar 2024 19:26:28 -0700 Subject: [PATCH 22/46] revert Flake update to f672a3d --- flake.lock | 12 ++++++------ flake.nix | 25 +++++-------------------- 2 files changed, 11 insertions(+), 26 deletions(-) diff --git a/flake.lock b/flake.lock index 87a6f490..6075d613 100644 --- a/flake.lock +++ b/flake.lock @@ -37,11 +37,11 @@ }, "haskell-flake": { "locked": { - "lastModified": 1711149116, - "narHash": "sha256-tccTtjRvxrhSJkCnmNwaPrq0DDM3UsM0uiDyW4uJXXc=", + "lastModified": 1709467224, + "narHash": "sha256-xnPTkLMqq78BiTqt6WXj2TXLupclJi+NEH84HDbQSPc=", "owner": "srid", "repo": "haskell-flake", - "rev": "6ae8a85071adfe08d70d9963c526947403c6c070", + "rev": "9173cc45aeb72b7e7adfe0e5a53a425fe439e3ca", "type": "github" }, "original": { @@ -52,11 +52,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1711152738, - "narHash": "sha256-Rku86xQ+1mttl4taD1Ywmt5CST5ZzTDNqd30TmgyHuU=", + "lastModified": 1709856773, + "narHash": "sha256-QJ3yNJLhfDZbln1HEhIGXmPlwqCk22MbyicFNfSVs3A=", "owner": "nixos", "repo": "nixpkgs", - "rev": "39632d3d4c3bd91cf869737f54b9d1ff940ace16", + "rev": "a32bb438c0219345fc535b4f910da21fa4c4aaa2", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 3631b7c0..a8b1d18d 100644 --- a/flake.nix +++ b/flake.nix @@ -19,33 +19,18 @@ # has only one. packages.default = config.packages.hackage-server; haskellProjects.default = { - basePackages = pkgs.haskell.packages.ghc98; settings = { - # https://github.com/srid/haskell-flake/discussions/196 hackage-server.check = false; - threads.check = false; - # hackage-server.cabalFlags.write-ghc-environment-files = true; - # hackage-server.cabalFlags.write-ghc-environment = "always"; - # hackage-server.extraConfigureFlags = [ "--write-ghc-environment=always" ]; - + ap-normalize.check = false; # https://community.flake.parts/haskell-flake/dependency#nixpkgs tar = { super, ... }: - { custom = _: super.tar_0_6_2_0; }; - # tls = { super, ... }: - # { custom = _: super.tls_2_0_1 // { check = false; }; }; - tls.check = false; - tls-session-manager = { super, ... }: - { custom = _: super.tls-session-manager_0_0_5; }; - tasty = { super, ... }: - { custom = _: super.tasty_1_5; }; - logict.jailbreak = true; - integer-logarithms.jailbreak = true; - time-compat.jailbreak = true; - indexed-traversable-instances.jailbreak = true; + { custom = _: super.tar_0_6_1_0; }; + # tasty = { super, ... }: + # { custom = _: super.tasty_1_5; }; }; packages = { # https://community.flake.parts/haskell-flake/dependency#path - tls.source = "2.0.1"; + tls.source = "1.9.0"; }; devShell = { tools = hp: { From b1523b3406a1153b88dd8389e2f8ab8328ef57fd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Mar 2024 16:54:56 +0000 Subject: [PATCH 23/46] Bump dependabot/fetch-metadata from 1 to 2 Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 1 to 2. - [Release notes](https://github.com/dependabot/fetch-metadata/releases) - [Commits](https://github.com/dependabot/fetch-metadata/compare/v1...v2) --- updated-dependencies: - dependency-name: dependabot/fetch-metadata dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/dependabot-auto-approve.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-auto-approve.yml b/.github/workflows/dependabot-auto-approve.yml index fbfc8ba6..6e7e31f8 100644 --- a/.github/workflows/dependabot-auto-approve.yml +++ b/.github/workflows/dependabot-auto-approve.yml @@ -12,7 +12,7 @@ jobs: steps: - name: Dependabot metadata id: metadata - uses: dependabot/fetch-metadata@v1 + uses: dependabot/fetch-metadata@v2 with: github-token: "${{ secrets.GITHUB_TOKEN }}" - name: Approve a PR From 7c8b019ee1bac046209ef37c795147141cb726e0 Mon Sep 17 00:00:00 2001 From: Janus Troelsen Date: Sun, 7 Apr 2024 16:58:20 -0600 Subject: [PATCH 24/46] Add Tested-With to package page --- datafiles/templates/Html/package-page.html.st | 9 +++++++++ src/Distribution/Server/Pages/PackageFromTemplate.hs | 12 +++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/datafiles/templates/Html/package-page.html.st b/datafiles/templates/Html/package-page.html.st index cfa131b8..bf935997 100644 --- a/datafiles/templates/Html/package-page.html.st +++ b/datafiles/templates/Html/package-page.html.st @@ -140,6 +140,15 @@ $package.buildDepends$ + $if(package.optional.hasTestedWith)$ + + Tested with + + $package.optional.testedWith$ + + + $endif$ + License $package.license$ diff --git a/src/Distribution/Server/Pages/PackageFromTemplate.hs b/src/Distribution/Server/Pages/PackageFromTemplate.hs index 6cf3e262..82ac3474 100644 --- a/src/Distribution/Server/Pages/PackageFromTemplate.hs +++ b/src/Distribution/Server/Pages/PackageFromTemplate.hs @@ -33,7 +33,7 @@ import Text.XHtml.Strict hiding (p, name, title, content) import qualified Text.XHtml.Strict as XHtml import Data.Maybe (maybeToList, fromMaybe, isJust) -import Data.List (intersperse) +import Data.List (intercalate, intersperse) import System.FilePath.Posix ((), takeFileName, dropTrailingPathSeparator) import Data.Time.Format (defaultTimeLocale, formatTime) @@ -228,6 +228,12 @@ packagePageTemplate render (vList $ map sourceRepositoryToHtml (sourceRepos desc)) ] ++ + [ templateVal "hasTestedWith" + (not $ null pkgTestedWith) + , templateVal "testedWith" + (intercalate ", " pkgTestedWith) + ] ++ + [ templateVal "hasSynopsis" (not . Short.null $ synopsis (rendOther render)) , templateVal "synopsis" @@ -238,6 +244,10 @@ packagePageTemplate render pkgid = rendPkgId render pkgVer = display $ pkgVersion pkgid pkgName = display $ packageName pkgid + pkgTestedWith = + [ display compilerFlavor ++ " " ++ display versionRange + | (compilerFlavor, versionRange) <- testedWith desc + ] desc = rendOther render From a62f180382c58c49101f61c0b940bbc13adbc6f2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 May 2024 16:44:38 +0000 Subject: [PATCH 25/46] Bump cachix/cachix-action from 14 to 15 Bumps [cachix/cachix-action](https://github.com/cachix/cachix-action) from 14 to 15. - [Release notes](https://github.com/cachix/cachix-action/releases) - [Commits](https://github.com/cachix/cachix-action/compare/v14...v15) --- updated-dependencies: - dependency-name: cachix/cachix-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/nix-flake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nix-flake.yml b/.github/workflows/nix-flake.yml index 7c1e51a9..702e759a 100644 --- a/.github/workflows/nix-flake.yml +++ b/.github/workflows/nix-flake.yml @@ -23,7 +23,7 @@ jobs: extra_nix_config: | trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hackage-server.cachix.org-1:iw0iRh6+gsFIrxROFaAt5gKNgIHejKjIfyRdbpPYevY= substituters = https://hydra.iohk.io https://cache.nixos.org/ https://hackage-server.cachix.org/ - - uses: cachix/cachix-action@v14 + - uses: cachix/cachix-action@v15 with: # https://nix.dev/tutorials/continuous-integration-github-actions#setting-up-github-actions name: hackage-server From 2fd51cd5c49e989322ff0caa1875aa7f87fc50c5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 May 2024 16:44:41 +0000 Subject: [PATCH 26/46] Bump cachix/install-nix-action from 26 to 27 Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 26 to 27. - [Release notes](https://github.com/cachix/install-nix-action/releases) - [Commits](https://github.com/cachix/install-nix-action/compare/v26...V27) --- updated-dependencies: - dependency-name: cachix/install-nix-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/nix-flake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nix-flake.yml b/.github/workflows/nix-flake.yml index 7c1e51a9..b7852915 100644 --- a/.github/workflows/nix-flake.yml +++ b/.github/workflows/nix-flake.yml @@ -18,7 +18,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - - uses: cachix/install-nix-action@v26 + - uses: cachix/install-nix-action@V27 with: extra_nix_config: | trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hackage-server.cachix.org-1:iw0iRh6+gsFIrxROFaAt5gKNgIHejKjIfyRdbpPYevY= From ec69e3a2223ecd817a813f194e2f0ed73c4df17f Mon Sep 17 00:00:00 2001 From: Peter Becich Date: Wed, 19 Jun 2024 21:09:56 -0700 Subject: [PATCH 27/46] check `nix develop` shell is working in GitHub Action --- .github/workflows/nix-flake.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/nix-flake.yml b/.github/workflows/nix-flake.yml index c3ec0b4f..99a80bc3 100644 --- a/.github/workflows/nix-flake.yml +++ b/.github/workflows/nix-flake.yml @@ -32,6 +32,9 @@ jobs: - name: "Check `nix develop` shell" run: nix develop --check + - name: "Check `nix develop` shell can run command" + run: nix develop --command "echo" + - run: nix build - continue-on-error: false From 0b0aab7cb2417e9ed5a63b60b991d0da6e3e7a73 Mon Sep 17 00:00:00 2001 From: Peter Becich Date: Wed, 19 Jun 2024 22:07:38 -0700 Subject: [PATCH 28/46] `nix flake update` --- flake.lock | 24 ++++++++++++------------ flake.nix | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/flake.lock b/flake.lock index 6075d613..542de04a 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1709336216, - "narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=", + "lastModified": 1717285511, + "narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2", + "rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8", "type": "github" }, "original": { @@ -22,11 +22,11 @@ }, "flake-root": { "locked": { - "lastModified": 1692742795, - "narHash": "sha256-f+Y0YhVCIJ06LemO+3Xx00lIcqQxSKJHXT/yk1RTKxw=", + "lastModified": 1713493429, + "narHash": "sha256-ztz8JQkI08tjKnsTpfLqzWoKFQF4JGu2LRz8bkdnYUk=", "owner": "srid", "repo": "flake-root", - "rev": "d9a70d9c7a5fd7f3258ccf48da9335e9b47c3937", + "rev": "bc748b93b86ee76e2032eecda33440ceb2532fcd", "type": "github" }, "original": { @@ -37,11 +37,11 @@ }, "haskell-flake": { "locked": { - "lastModified": 1709467224, - "narHash": "sha256-xnPTkLMqq78BiTqt6WXj2TXLupclJi+NEH84HDbQSPc=", + "lastModified": 1718653460, + "narHash": "sha256-8ana22BZaLp91gGvQq8YbfteJKFqza4qrqc6++bCnH4=", "owner": "srid", "repo": "haskell-flake", - "rev": "9173cc45aeb72b7e7adfe0e5a53a425fe439e3ca", + "rev": "569e28636c1aaee767a43741511fb36a6d3c284b", "type": "github" }, "original": { @@ -52,11 +52,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1709856773, - "narHash": "sha256-QJ3yNJLhfDZbln1HEhIGXmPlwqCk22MbyicFNfSVs3A=", + "lastModified": 1718842396, + "narHash": "sha256-9uvK+h2xF2fclkPRz2tlXtz++VNXot22isEVvWizA7Q=", "owner": "nixos", "repo": "nixpkgs", - "rev": "a32bb438c0219345fc535b4f910da21fa4c4aaa2", + "rev": "49f3b031c4e87e18acc2a68f15fdb56871a170df", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index a8b1d18d..c71960ba 100644 --- a/flake.nix +++ b/flake.nix @@ -24,13 +24,13 @@ ap-normalize.check = false; # https://community.flake.parts/haskell-flake/dependency#nixpkgs tar = { super, ... }: - { custom = _: super.tar_0_6_1_0; }; + { custom = _: super.tar_0_6_2_0; }; # tasty = { super, ... }: # { custom = _: super.tasty_1_5; }; }; packages = { # https://community.flake.parts/haskell-flake/dependency#path - tls.source = "1.9.0"; + # tls.source = "1.9.0"; }; devShell = { tools = hp: { From 081a1032980197487c9337526dc94daff3de6813 Mon Sep 17 00:00:00 2001 From: Peter Becich Date: Fri, 21 Jun 2024 19:25:19 -0700 Subject: [PATCH 29/46] fix quote color closes: https://github.com/haskell/hackage-server/issues/1298 --- datafiles/static/hackage.css | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/datafiles/static/hackage.css b/datafiles/static/hackage.css index ce0e8810..1c5081ef 100644 --- a/datafiles/static/hackage.css +++ b/datafiles/static/hackage.css @@ -267,9 +267,21 @@ pre + pre { margin-top: 0.5em; } +@media (prefers-color-scheme: dark) { + blockquote { + border-left: 3px solid #2f2842; + background-color: #252034; + } +} + +@media (prefers-color-scheme: light) { + blockquote { + border-left: 3px solid #c7a5d3; + background-color: #eee4f1; + } +} + blockquote { - border-left: 3px solid #c7a5d3; - background-color: #eee4f1; margin: 0.5em; padding: 0.0005em 0.3em 0.5em 0.5em; } From bc548b51111a8d0f9d2c87564bd840b2dbd40b7a Mon Sep 17 00:00:00 2001 From: Peter Becich Date: Sat, 22 Jun 2024 09:52:22 -0700 Subject: [PATCH 30/46] improve contrast ratio https://webaim.org/resources/contrastchecker/?fcolor=4C4771&bcolor=333333 --- datafiles/static/hackage.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datafiles/static/hackage.css b/datafiles/static/hackage.css index 1c5081ef..adc3bf2b 100644 --- a/datafiles/static/hackage.css +++ b/datafiles/static/hackage.css @@ -270,7 +270,7 @@ pre + pre { @media (prefers-color-scheme: dark) { blockquote { border-left: 3px solid #2f2842; - background-color: #252034; + background-color: #4c4771; } } From bb3b5adcf391a7a48ef145109cc3b2ede7b7a040 Mon Sep 17 00:00:00 2001 From: Peter Becich Date: Sat, 22 Jun 2024 10:39:30 -0700 Subject: [PATCH 31/46] simplify Nix workflow https://github.com/srid/haskell-flake/discussions/330 --- README.md | 63 ++++++++++++------------------------------------------- flake.nix | 23 ++++++++++++++++++-- 2 files changed, 34 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index 51cd6f01..32641317 100644 --- a/README.md +++ b/README.md @@ -13,65 +13,28 @@ You can use the Nix package manager to provide these dependencies, or install th ### Using the [Nix package manager](https://nixos.org/) and provided [Nix Flake](https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake.html) -If you have the Nix package manager installed, you can build and run `hackage-server` without manually installing any dependencies. +If you have the Nix package manager installed, you can build and run `hackage-server` without manually installing any dependencies: -This uses `flake.nix`, implemented with [`srid/haskell-flake`](https://github.com/srid/haskell-flake). + $ nix run -There are at least three ways to use this `flake.nix`. Clone this repository, enter the repository directory, then choose one of these options: - -#### [`nix develop`](https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-develop.html) - - nix develop - - (in develop shell) - $ cabal v2-run -- hackage-server init --static-dir=datafiles - - $ cabal v2-run -- hackage-server run --static-dir=datafiles --base-uri=http://127.0.0.1:8080 + 'state' state-dir already exists hackage-server: Ready! Point your browser at http://127.0.0.1:8080 + +If the required `state` directory does not already exist, `nix run` will create and initialize it. -Note the `init` command will create a new folder `state` in your working directory. - -If you have [direnv](https://direnv.net/), `direnv allow` will load this `nix develop` shell automatically. - -#### [`nix build`](https://nixos.org/manual/nix/stable/command-ref/nix-build.html) - - nix build - -This will produce a `hackage-server` executable in `result/`. - -For this executable, Hackage dependencies are not pulled from Hackage directly like usual. Hackage dependencies are provided by the [Nixpkgs](https://search.nixos.org/packages) [`haskell-updates`](https://github.com/NixOS/nixpkgs/tree/haskell-updates) branch, and a few [overrides in `flake.nix`](https://zero-to-flakes.com/haskell-flake/dependency#using-hackage-versions). - -#### [`nix run`](https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-run) - -`nix run` is more convenient to use than `nix build`. - -As with `nix build`, Hackage dependencies are not pulled from Hackage directly like usual. See caveat above. - -List the available [Flake Apps](https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-run#apps) with [`nix flake show`](https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake-show.html): - - $ nix flake show - ... - ├───apps - ... - │ │ ├───hackage-build: app - │ │ ├───hackage-import: app - │ │ ├───hackage-mirror: app - │ │ └───hackage-server: app - ... +The `flake.nix` is implemented with [`srid/haskell-flake`](https://github.com/srid/haskell-flake). -Run the `hackage-server` App: +Alternatively, open the [`nix develop`](https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-develop.html) shell: - nix run .#hackage-server -- init --static-dir=datafiles + $ nix develop - nix run .#hackage-server -- run --static-dir=datafiles --base-uri=http://127.0.0.1:8080 + (in develop shell) -The `.` refers to the `flake.nix` in your working directory. `#hackage-server` refers to the App specified in that `flake.nix`. - -`hackage-server` is the default App, so those commands can be shortened: + # if state directory does not already exist + $ cabal v2-run -- hackage-server init --static-dir=datafiles --state-dir=state - nix run . -- init --static-dir=datafiles - - nix run . -- run --static-dir=datafiles --base-uri=http://127.0.0.1:8080 + $ cabal v2-run -- hackage-server run --static-dir=datafiles --state-dir=state --base-uri=http://127.0.0.1:8080 + hackage-server: Ready! Point your browser at http://127.0.0.1:8080 ##### Not working diff --git a/flake.nix b/flake.nix index c71960ba..3d61c676 100644 --- a/flake.nix +++ b/flake.nix @@ -15,8 +15,27 @@ inputs.flake-root.flakeModule ]; perSystem = { self', system, lib, config, pkgs, ... }: { - # The "main" project. You can have multiple projects, but this template - # has only one. + apps.default = { + type = "app"; + program = + let + run-hackage-server = pkgs.writeShellApplication { + name = "run-hackage-server"; + runtimeInputs = [ config.packages.default ]; + text = '' + if [ ! -d "state" ]; then + hackage-server init --static-dir=datafiles --state-dir=state + else + echo "'state' state-dir already exists" + fi + hackage-server run \ + --static-dir=datafiles \ + --state-dir=state \ + --base-uri=http://127.0.0.1:8080 + ''; + }; + in "${lib.getExe run-hackage-server}"; + }; packages.default = config.packages.hackage-server; haskellProjects.default = { settings = { From abdde4433152151f042c61565ee6acb48dff2a75 Mon Sep 17 00:00:00 2001 From: Peter Becich Date: Sat, 22 Jun 2024 11:00:05 -0700 Subject: [PATCH 32/46] simple package mirroring workflow --- README.md | 13 ++++++++++++- flake.nix | 16 ++++++++++++++++ nix-default-servers.cfg | 9 +++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 nix-default-servers.cfg diff --git a/README.md b/README.md index 32641317..3a12efbf 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,18 @@ Alternatively, open the [`nix develop`](https://nixos.org/manual/nix/stable/comm $ cabal v2-run -- hackage-server run --static-dir=datafiles --state-dir=state --base-uri=http://127.0.0.1:8080 hackage-server: Ready! Point your browser at http://127.0.0.1:8080 -##### Not working +#### Populate the local package index + +This copies packages from real Hackage Server to local Hackage Server. + +Add the default `admin` user to the `mirrorers` group here: +http://localhost:8080/packages/mirrorers/ + +Then + + $ nix run .#mirror-hackage-server + +#### Not working Please note this App *cannot* be run [directly from GitHub](https://determinate.systems/posts/nix-run) like this: diff --git a/flake.nix b/flake.nix index 3d61c676..e37e52c4 100644 --- a/flake.nix +++ b/flake.nix @@ -36,6 +36,22 @@ }; in "${lib.getExe run-hackage-server}"; }; + apps.mirror-hackage-server = { + type = "app"; + program = + let + mirror-hackage-server = pkgs.writeShellApplication { + name = "mirror-hackage-server"; + runtimeInputs = [ config.packages.default ]; + text = '' + echo 'Copying packages from real Hackage Server into local Hackage Server.' + echo 'This assumes the local Hackage Server uses default credentials;' + echo 'otherwise, override in nix-default-servers.cfg' + hackage-mirror nix-default-servers.cfg + ''; + }; + in "${lib.getExe mirror-hackage-server}"; + }; packages.default = config.packages.hackage-server; haskellProjects.default = { settings = { diff --git a/nix-default-servers.cfg b/nix-default-servers.cfg new file mode 100644 index 00000000..b61d4382 --- /dev/null +++ b/nix-default-servers.cfg @@ -0,0 +1,9 @@ +source "hackage" + uri: http://hackage.haskell.org + type: secure + +target "mirror" + uri: http://admin:admin@localhost:8080 + type: hackage2 + + post-mirror-hook: "shell command to execute" From 7fd400b1c548b275ea925fcbdd7618a4160302d8 Mon Sep 17 00:00:00 2001 From: Peter Becich Date: Sat, 22 Jun 2024 23:38:37 -0700 Subject: [PATCH 33/46] more simplification of Nix Flake https://github.com/srid/haskell-flake/discussions/330#discussioncomment-9848411 --- flake.nix | 58 ++++++++++++++++++++++--------------------------------- 1 file changed, 23 insertions(+), 35 deletions(-) diff --git a/flake.nix b/flake.nix index e37e52c4..4064f78b 100644 --- a/flake.nix +++ b/flake.nix @@ -15,42 +15,30 @@ inputs.flake-root.flakeModule ]; perSystem = { self', system, lib, config, pkgs, ... }: { - apps.default = { - type = "app"; - program = - let - run-hackage-server = pkgs.writeShellApplication { - name = "run-hackage-server"; - runtimeInputs = [ config.packages.default ]; - text = '' - if [ ! -d "state" ]; then - hackage-server init --static-dir=datafiles --state-dir=state - else - echo "'state' state-dir already exists" - fi - hackage-server run \ - --static-dir=datafiles \ - --state-dir=state \ - --base-uri=http://127.0.0.1:8080 - ''; - }; - in "${lib.getExe run-hackage-server}"; + apps.default.program = pkgs.writeShellApplication { + name = "run-hackage-server"; + runtimeInputs = [ config.packages.default ]; + text = '' + if [ ! -d "state" ]; then + hackage-server init --static-dir=datafiles --state-dir=state + else + echo "'state' state-dir already exists" + fi + hackage-server run \ + --static-dir=datafiles \ + --state-dir=state \ + --base-uri=http://127.0.0.1:8080 + ''; }; - apps.mirror-hackage-server = { - type = "app"; - program = - let - mirror-hackage-server = pkgs.writeShellApplication { - name = "mirror-hackage-server"; - runtimeInputs = [ config.packages.default ]; - text = '' - echo 'Copying packages from real Hackage Server into local Hackage Server.' - echo 'This assumes the local Hackage Server uses default credentials;' - echo 'otherwise, override in nix-default-servers.cfg' - hackage-mirror nix-default-servers.cfg - ''; - }; - in "${lib.getExe mirror-hackage-server}"; + apps.mirror-hackage-server.program = pkgs.writeShellApplication { + name = "mirror-hackage-server"; + runtimeInputs = [ config.packages.default ]; + text = '' + echo 'Copying packages from real Hackage Server into local Hackage Server.' + echo 'This assumes the local Hackage Server uses default credentials;' + echo 'otherwise, override in nix-default-servers.cfg' + hackage-mirror nix-default-servers.cfg + ''; }; packages.default = config.packages.hackage-server; haskellProjects.default = { From d9ed57df55a058730b5b0684e2ded9ebbe197b7c Mon Sep 17 00:00:00 2001 From: Owen Shepherd Date: Wed, 3 Jan 2024 12:59:05 +0100 Subject: [PATCH 34/46] style: Apply input padding spacing tweaks This adds some padding to inputs, giving them a bit of a sense of space. --- datafiles/static/hackage.css | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/datafiles/static/hackage.css b/datafiles/static/hackage.css index ce0e8810..c808ba67 100644 --- a/datafiles/static/hackage.css +++ b/datafiles/static/hackage.css @@ -117,10 +117,28 @@ h4 { font-size: 100%; /* 13px */ } h5 { font-size: 100%; /* 13px */ } h6 { font-size: 100%; /* 13px */ } -select, input, button, textarea { +select, input, button, textarea, input::file-selector-button { font-size: 1rem; margin: 0.5em; - padding: 0.1em; + padding: 0.5em 0.8em; + border: 1px solid #444; + border-radius: 3px; + background: #eee; +} + +select:hover, input:hover, button:hover, textarea:hover, input::file-selector-button:hover { + background: #dcdcdc; +} + +input[type=file] { + background: none; + border: 0; +} + +@media (prefers-color-scheme: dark) { + select, input, button, textarea, input::file-selector-button { + border: 0; + } } table { From 6146b5fb30bee2f0c88a3fbdfe16232ff3e0191d Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Tue, 2 Jul 2024 19:28:50 +0200 Subject: [PATCH 35/46] Clean cabal.project --- cabal.project | 9 --------- 1 file changed, 9 deletions(-) diff --git a/cabal.project b/cabal.project index 292cfa64..5071ac32 100644 --- a/cabal.project +++ b/cabal.project @@ -6,15 +6,6 @@ packages: -- This project config requires cabal 2.4 or later --- If in doubt, use GHC 8.8 to build hackage-server; see --- 'tested-with' in 'hackage-server.cabal' for a list of currently --- CI-validated GHC versions --- --- with-compiler: ghc-8.8 - - -allow-newer: rss:time, rss:base - ----------------------------------------------------------------------------- -- Anti-constraints From a2bcceaa5b9319167ca732583b13ce2fd3593989 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Tue, 2 Jul 2024 19:31:56 +0200 Subject: [PATCH 36/46] Default library (hackage-server) instead of internal library lib-server --- hackage-server.cabal | 26 +++++++++++++------------- tests/DocTestMain.hs | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/hackage-server.cabal b/hackage-server.cabal index 19c1f76a..1ff6d1a9 100644 --- a/hackage-server.cabal +++ b/hackage-server.cabal @@ -173,7 +173,7 @@ common defaults other-extensions: CPP, TemplateHaskell -library lib-server +library import: defaults hs-source-dirs: src @@ -472,7 +472,7 @@ library lib-server common exe-defaults import: defaults - build-depends: lib-server + build-depends: hackage-server hs-source-dirs: exes ghc-options: -threaded -rtsopts @@ -493,7 +493,7 @@ executable hackage-mirror main-is: MirrorClient.hs build-depends: - -- version constraints inherited from lib-server + -- version constraints inherited from hackage-server , HTTP , hackage-security @@ -503,7 +503,7 @@ executable hackage-build main-is: BuildClient.hs build-depends: - -- version constraints inherited from lib-server + -- version constraints inherited from hackage-server , HTTP -- Runtime dependency only; @@ -523,7 +523,7 @@ executable hackage-import main-is: ImportClient.hs build-depends: - -- version constraints inherited from lib-server + -- version constraints inherited from hackage-server , HTTP , async , csv @@ -533,7 +533,7 @@ executable hackage-import common test-defaults import: defaults - build-depends: lib-server + build-depends: hackage-server hs-source-dirs: tests ghc-options: -threaded -rtsopts -fno-warn-orphans @@ -563,9 +563,9 @@ test-suite HighLevelTest -- so if this works, it's accidental! build-tool-depends: hackage-server:hackage-server - -- NOTE: lib-server is not a real dependency; it's only used to inherit version constraints + -- NOTE: hackage-server is not a real dependency; it's only used to inherit version constraints build-depends: - -- version constraints inherited from lib-server + -- version constraints inherited from hackage-server , HTTP , attoparsec-aeson >= 2.1.0.0 && < 2.3 , base64-bytestring @@ -640,9 +640,9 @@ test-suite CreateUserTest -- see note in 'Test-Suite HighLevelTest' build-tool-depends: hackage-server:hackage-server - -- NOTE: lib-server is not a real dependency; it's only used to inherit version constraints + -- NOTE: hackage-server is not a real dependency; it's only used to inherit version constraints build-depends: - -- version constraints inherited from lib-server + -- version constraints inherited from hackage-server , HTTP , base64-bytestring , random @@ -657,7 +657,7 @@ test-suite PackageTests other-modules: Distribution.Server.Packages.UnpackTest build-depends: - -- version constraints inherited from lib-server + -- version constraints inherited from hackage-server -- component-specific dependencies , tasty ^>= 1.5 , tasty-hunit ^>= 0.10 @@ -670,7 +670,7 @@ test-suite HashTests main-is: HashTestMain.hs build-depends: - -- version constraints inherited from lib-server + -- version constraints inherited from hackage-server , base16-bytestring , cereal , cryptohash-md5 @@ -686,7 +686,7 @@ test-suite DocTests type: exitcode-stdio-1.0 main-is: DocTestMain.hs build-depends: - , lib-server + , hackage-server , doctest-parallel ^>= 0.3.0 -- doctest-parallel-0.2.2 is the first to filter out autogen-modules diff --git a/tests/DocTestMain.hs b/tests/DocTestMain.hs index 5cb58708..94aa8c59 100644 --- a/tests/DocTestMain.hs +++ b/tests/DocTestMain.hs @@ -14,5 +14,5 @@ main = do args <- getArgs pkg <- findCabalPackage "hackage-server" -- Need to give the library name, otherwise the parser does not find it. - lib <- extractSpecificCabalLibrary (Just "lib-server") pkg + lib <- extractSpecificCabalLibrary Nothing pkg mainFromLibrary lib args From 66e7c9ec2ba99161df1d5724b727f1295c604bb8 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Tue, 2 Jul 2024 19:32:34 +0200 Subject: [PATCH 37/46] .cabal: remove outdated conditional --- hackage-server.cabal | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hackage-server.cabal b/hackage-server.cabal index 1ff6d1a9..44a73bad 100644 --- a/hackage-server.cabal +++ b/hackage-server.cabal @@ -162,10 +162,10 @@ common defaults , vector ^>= 0.12 || ^>= 0.13.0.0 , zlib ^>= 0.6.2 - ghc-options: -Wall -fwarn-tabs -fno-warn-unused-do-bind -fno-warn-deprecated-flags -funbox-strict-fields - - if impl(ghc >= 8.2) - ghc-options: -Werror=incomplete-patterns -Werror=missing-methods + ghc-options: + -funbox-strict-fields + -Wall -fwarn-tabs -fno-warn-unused-do-bind -fno-warn-deprecated-flags + -Werror=incomplete-patterns -Werror=missing-methods if impl(ghc >= 8.10) ghc-options: -Wno-unused-record-wildcards From c7f3edd6a838e67903c9d6e30cb97f4921adcfb8 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Tue, 2 Jul 2024 19:33:16 +0200 Subject: [PATCH 38/46] Tags feature: replace some clumsy code --- src/Distribution/Server/Features/Tags/State.hs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/Distribution/Server/Features/Tags/State.hs b/src/Distribution/Server/Features/Tags/State.hs index 0d7af506..f92a6734 100644 --- a/src/Distribution/Server/Features/Tags/State.hs +++ b/src/Distribution/Server/Features/Tags/State.hs @@ -20,8 +20,9 @@ import Control.Monad (liftM2) import Data.SafeCopy (base, deriveSafeCopy) import Data.Typeable (Typeable) import qualified Data.Char as Char +import Data.Functor ( (<&>) ) import Data.Maybe (fromMaybe) -import Data.List (foldl') +import Data.List (find, foldl') import Control.Monad.State (get, put, modify) import Control.Monad.Reader (ask, asks) import Control.DeepSeq @@ -87,13 +88,9 @@ lookupTagAlias tag return (Map.lookup tag m) getTagAlias :: Tag -> Query TagAlias Tag -getTagAlias tag - = do TagAlias m <- ask - if tag `elem` Map.keys m - then return tag - else if tag `Set.member` foldr Set.union Set.empty (Map.elems m) - then return $ head (Map.keys $ Map.filter (tag `Set.member`) m) - else return tag +getTagAlias tag = ask <&> \ (TagAlias m) -> + if Map.member tag m then tag + else maybe tag fst $ find (Set.member tag . snd) $ Map.toList m emptyPackageTags :: PackageTags emptyPackageTags = PackageTags Map.empty Map.empty Map.empty @@ -279,4 +276,3 @@ $(makeAcidic ''PackageTags ['tagsForPackage ,'lookupReviewTags ,'clearReviewTags ]) - From c322e12390fad241703f45afb39b06f323c2903e Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Tue, 2 Jul 2024 19:34:39 +0200 Subject: [PATCH 39/46] Support Cabal-3.12 and GHC 9.10 --- .github/workflows/haskell-ci.yml | 30 ++--- exes/Main.hs | 14 ++- hackage-server.cabal | 29 +++-- .../Server/Framework/Instances.hs | 107 +++++++++++++++--- src/Distribution/Server/Packages/Unpack.hs | 14 ++- .../Server/Util/CabalRevisions.hs | 13 ++- 6 files changed, 161 insertions(+), 46 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 660f16f8..9445af6b 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -8,9 +8,9 @@ # # For more information, see https://github.com/andreasabel/haskell-ci # -# version: 0.17.20231012 +# version: 0.19.20240630 # -# REGENDATA ("0.17.20231012",["github","hackage-server.cabal"]) +# REGENDATA ("0.19.20240630",["github","hackage-server.cabal"]) # name: Haskell-CI on: @@ -32,19 +32,24 @@ jobs: strategy: matrix: include: - - compiler: ghc-9.8.1 + - compiler: ghc-9.10.1 compilerKind: ghc - compilerVersion: 9.8.1 + compilerVersion: 9.10.1 setup-method: ghcup allow-failure: false - - compiler: ghc-9.6.3 + - compiler: ghc-9.8.2 compilerKind: ghc - compilerVersion: 9.6.3 + compilerVersion: 9.8.2 setup-method: ghcup allow-failure: false - - compiler: ghc-9.4.7 + - compiler: ghc-9.6.5 compilerKind: ghc - compilerVersion: 9.4.7 + compilerVersion: 9.6.5 + setup-method: ghcup + allow-failure: false + - compiler: ghc-9.4.8 + compilerKind: ghc + compilerVersion: 9.4.8 setup-method: ghcup allow-failure: false - compiler: ghc-9.2.8 @@ -74,11 +79,10 @@ jobs: apt-get update apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 mkdir -p "$HOME/.ghcup/bin" - curl -sL https://downloads.haskell.org/ghcup/0.1.19.5/x86_64-linux-ghcup-0.1.19.5 > "$HOME/.ghcup/bin/ghcup" + curl -sL https://downloads.haskell.org/ghcup/0.1.20.0/x86_64-linux-ghcup-0.1.20.0 > "$HOME/.ghcup/bin/ghcup" chmod a+x "$HOME/.ghcup/bin/ghcup" - "$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml; "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) - "$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false) + "$HOME/.ghcup/bin/ghcup" install cabal 3.12.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false) apt-get update apt-get install -y libbrotli-dev libgd-dev env: @@ -98,7 +102,7 @@ jobs: echo "HC=$HC" >> "$GITHUB_ENV" echo "HCPKG=$HCPKG" >> "$GITHUB_ENV" echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV" - echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.1.0 -vnormal+nowrap" >> "$GITHUB_ENV" + echo "CABAL=$HOME/.ghcup/bin/cabal-3.12.1.0 -vnormal+nowrap" >> "$GITHUB_ENV" HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))') echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV" echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" @@ -183,7 +187,7 @@ jobs: echo " ghc-options: -Werror=missing-methods" >> cabal.project cat >> cabal.project <> cabal.project.local + $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(Cabal|Cabal-syntax|hackage-server|parsec|process|text)$/; }' >> cabal.project.local cat cabal.project cat cabal.project.local - name: dump install plan diff --git a/exes/Main.hs b/exes/Main.hs index c8134631..b3ee4605 100644 --- a/exes/Main.hs +++ b/exes/Main.hs @@ -1,4 +1,7 @@ +{-# LANGUAGE CPP #-} + {-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns #-} + module Main where import qualified Distribution.Server as Server @@ -65,7 +68,11 @@ main :: IO () main = topHandler $ do hSetBuffering stdout LineBuffering args <- getArgs +#if !MIN_VERSION_Cabal(3,12,0) case commandsRun (globalCommand commands) commands args of +#else + commandsRun (globalCommand commands) commands args >>= \case +#endif CommandHelp help -> printHelp help CommandList opts -> printOptionsList opts CommandErrors errs -> printErrors errs @@ -79,6 +86,7 @@ main = topHandler $ do where printHelp help = getProgName >>= putStr . help + printOptionsList :: [String] -> IO () printOptionsList = putStr . unlines printErrors errs = do putStr (intercalate "\n" errs) @@ -154,7 +162,11 @@ optionVerbosity getter setter = "Control verbosity (n is 0--3, default verbosity level is 1)" getter setter (optArg "n" (fmap Flag Verbosity.flagToVerbosity) - (Flag Verbosity.verbose) + ( +#if MIN_VERSION_Cabal(3,12,0) + show Verbosity.verbose, +#endif + Flag Verbosity.verbose) (fmap (Just . showForCabal) . flagToList)) optionStateDir :: (a -> Flag FilePath) diff --git a/hackage-server.cabal b/hackage-server.cabal index 44a73bad..598555e2 100644 --- a/hackage-server.cabal +++ b/hackage-server.cabal @@ -28,9 +28,10 @@ license: BSD-3-Clause license-file: LICENSE tested-with: - GHC == 9.8.1 - GHC == 9.6.3 - GHC == 9.4.7 + GHC == 9.10.1 + GHC == 9.8.2 + GHC == 9.6.5 + GHC == 9.4.8 GHC == 9.2.8 GHC == 9.0.2 GHC == 8.10.7 @@ -129,13 +130,13 @@ common defaults -- see `cabal.project.local-ghc-${VERSION}` files build-depends: , array >= 0.5 && < 0.6 - , base >= 4.13 && < 4.20 + , base >= 4.13 && < 4.21 , binary >= 0.8 && < 0.9 , bytestring >= 0.10 && < 0.13 , containers >= 0.6.0 && < 0.8 , deepseq >= 1.4 && < 1.6 , directory >= 1.3 && < 1.4 - , filepath >= 1.4 && < 1.5 + , filepath >= 1.4 && < 1.6 , mtl >= 2.2.1 && < 2.4 -- we use Control.Monad.Except, introduced in mtl-2.2.1 , pretty >= 1.1 && < 1.2 @@ -148,19 +149,19 @@ common defaults -- other dependencies shared by most components build-depends: , aeson >= 2.1.0.0 && < 2.3 - , Cabal >= 3.10.1.0 && < 3.12 - , Cabal-syntax >= 3.10.1.0 && < 3.12 + , Cabal >= 3.10.1.0 && < 3.14 + , Cabal-syntax >= 3.10.1.0 && < 3.14 -- Cabal-syntax needs to be bound to constrain hackage-security -- see https://github.com/haskell/hackage-server/issues/1130 , fail ^>= 4.9.0 - , network >= 3 && < 3.2 + , network >= 3 && < 3.3 , network-bsd ^>= 2.8 , network-uri ^>= 2.6 , parsec ^>= 3.1.13 , tar ^>= 0.6 , unordered-containers ^>= 0.2.10 , vector ^>= 0.12 || ^>= 0.13.0.0 - , zlib ^>= 0.6.2 + , zlib ^>= 0.6.2 || ^>= 0.7.0.0 ghc-options: -funbox-strict-fields @@ -170,6 +171,7 @@ common defaults if impl(ghc >= 8.10) ghc-options: -Wno-unused-record-wildcards + default-extensions: LambdaCase, TupleSections other-extensions: CPP, TemplateHaskell @@ -407,7 +409,7 @@ library build-depends: , HStringTemplate ^>= 0.8 , HTTP ^>= 4000.3.16 || ^>= 4000.4.1 - , QuickCheck ^>= 2.14 + , QuickCheck >= 2.14 && < 2.16 , acid-state ^>= 0.16 , async ^>= 2.2.1 -- requires bumping http-io-streams @@ -438,7 +440,7 @@ library , haddock-library ^>= 1.11.0 -- haddock-library-1.11.0 changed type of markupOrderedList -- see https://github.com/haskell/hackage-server/issues/1128 - , happstack-server ^>= 7.7.1 || ^>= 7.8.0 + , happstack-server ^>= 7.7.1 || ^>= 7.8.0 || ^>= 7.9.0 , hashable ^>= 1.3 || ^>= 1.4 , hs-captcha ^>= 1.0 , hslogger ^>= 1.3.1 @@ -452,7 +454,7 @@ library , stm ^>= 2.5.0 , stringsearch ^>= 0.3.6.6 , tagged ^>= 0.8.5 - , xhtml ^>= 3000.2.0.0 + , xhtml >= 3000.2.0.0 && < 3000.4 , xmlgen ^>= 0.6 , xss-sanitize ^>= 0.3.6 @@ -611,6 +613,9 @@ benchmark RevDeps build-depends: , random ^>= 1.2 , gauge + -- gauge does not support base-4.20 + if impl(ghc >= 9.10) + buildable: False ghc-options: -with-rtsopts=-s other-modules: RevDepCommon diff --git a/src/Distribution/Server/Framework/Instances.hs b/src/Distribution/Server/Framework/Instances.hs index 27327866..2e12816b 100644 --- a/src/Distribution/Server/Framework/Instances.hs +++ b/src/Distribution/Server/Framework/Instances.hs @@ -117,6 +117,7 @@ instance SafeCopy VersionRange where 10 -> majorBoundVersion <$> safeGet -- since Cabal-2.0 _ -> fail "VersionRange.getCopy: bad tag" +-- !! KEEP IN SYNC with instance Arbitrary OS instance SafeCopy OS where errorTypeName _ = "OS" @@ -173,6 +174,7 @@ instance SafeCopy OS where #endif _ -> fail "SafeCopy OS getCopy: unexpected tag" +-- !! KEEP IN SYNC with instance Arbitrary Arch instance SafeCopy Arch where errorTypeName _ = "Arch" @@ -196,6 +198,12 @@ instance SafeCopy Arch where putCopy AArch64 = contain $ putWord8 17 putCopy S390X = contain $ putWord8 18 putCopy Wasm32 = contain $ putWord8 19 +#if MIN_VERSION_Cabal_syntax(3,12,0) + putCopy PPC64LE = contain $ putWord8 20 + putCopy Sparc64 = contain $ putWord8 21 + putCopy RISCV64 = contain $ putWord8 22 + putCopy LoongArch64 = contain $ putWord8 23 +#endif getCopy = contain $ do tag <- getWord8 @@ -220,8 +228,15 @@ instance SafeCopy Arch where 17 -> return AArch64 18 -> return S390X 19 -> return Wasm32 +#if MIN_VERSION_Cabal_syntax(3,12,0) + 20 -> return PPC64LE + 21 -> return Sparc64 + 22 -> return RISCV64 + 23 -> return LoongArch64 +#endif _ -> fail "SafeCopy Arch getCopy: unexpected tag" +-- !! KEEP IN SYNC with instance Arbitrary CompilerFlavor instance SafeCopy CompilerFlavor where errorTypeName _ = "CompilerFlavor" @@ -238,6 +253,9 @@ instance SafeCopy CompilerFlavor where putCopy (HaskellSuite s) = contain $ putWord8 10 >> safePut s putCopy GHCJS = contain $ putWord8 11 putCopy Eta = contain $ putWord8 12 +#if MIN_VERSION_Cabal_syntax(3,12,1) + putCopy MHS = contain $ putWord8 13 +#endif getCopy = contain $ do tag <- getWord8 @@ -255,6 +273,9 @@ instance SafeCopy CompilerFlavor where 10 -> return HaskellSuite <*> safeGet 11 -> return GHCJS 12 -> return Eta +#if MIN_VERSION_Cabal_syntax(3,12,1) + 13 -> return MHS +#endif _ -> fail "SafeCopy CompilerFlavor getCopy: unexpected tag" @@ -363,6 +384,7 @@ instance Parsec UTCTime where Just t -> return t where digit2 = replicateM 2 P.digit + ------------------- -- Arbitrary instances -- @@ -376,31 +398,88 @@ instance Arbitrary Version where instance Arbitrary PackageIdentifier where arbitrary = PackageIdentifier <$> arbitrary <*> arbitrary +-- !! KEEP IN SYNC with instance SafeCopy CompilerFlavor instance Arbitrary CompilerFlavor where - arbitrary = oneof [ pure OtherCompiler <*> vectorOf 3 (choose ('A', 'Z')) - , pure GHC, pure NHC, pure YHC, pure Hugs, pure HBC - , pure Helium, pure JHC, pure LHC, pure UHC ] + arbitrary = oneof + [ pure OtherCompiler <*> vectorOf 3 (choose ('A', 'Z')) + , pure GHC + , pure NHC + , pure YHC + , pure Hugs + , pure HBC + , pure Helium + , pure JHC + , pure LHC + , pure UHC + , pure HaskellSuite <*> vectorOf 3 (choose ('A', 'Z')) + , pure GHCJS + , pure Eta +#if MIN_VERSION_Cabal_syntax(3,12,1) + , pure MHS +#endif + ] instance Arbitrary CompilerId where arbitrary = CompilerId <$> arbitrary <*> arbitrary +-- !! KEEP IN SYNC with instance SafeCopy Arch instance Arbitrary Arch where - arbitrary = oneof [ pure OtherArch <*> vectorOf 3 (choose ('A', 'Z')) - , pure I386, pure X86_64, pure PPC, pure PPC64, pure Sparc - , pure Arm, pure Mips, pure SH, pure IA64, pure S390 - , pure Alpha, pure Hppa, pure Rs6000, pure M68k, pure Vax ] + arbitrary = oneof + [ pure OtherArch <*> vectorOf 3 (choose ('A', 'Z')) + , pure I386 + , pure X86_64 + , pure PPC + , pure PPC64 + , pure Sparc + , pure Arm + , pure Mips + , pure SH + , pure IA64 + , pure S390 + , pure Alpha + , pure Hppa + , pure Rs6000 + , pure M68k + , pure Vax + , pure JavaScript + , pure AArch64 + , pure S390X + , pure Wasm32 +#if MIN_VERSION_Cabal_syntax(3,12,0) + , pure PPC64LE + , pure Sparc64 + , pure RISCV64 + , pure LoongArch64 +#endif + ] +-- !! KEEP IN SYNC with instance SafeCopy OS instance Arbitrary OS where - arbitrary = oneof [ pure OtherOS <*> vectorOf 3 (choose ('A', 'Z')) - , pure Linux, pure Windows, pure OSX, pure FreeBSD - , pure OpenBSD, pure NetBSD, pure Solaris, pure AIX - , pure HPUX, pure IRIX, pure HaLVM, pure IOS + arbitrary = oneof + [ pure OtherOS <*> vectorOf 3 (choose ('A', 'Z')) + , pure Linux + , pure Windows + , pure OSX + , pure FreeBSD + , pure OpenBSD + , pure NetBSD + , pure Solaris + , pure AIX + , pure HPUX + , pure IRIX + , pure HaLVM + , pure IOS + , pure DragonFly + , pure Ghcjs + , pure Hurd + , pure Android + , pure Wasi #if MIN_VERSION_Cabal_syntax(3,11,0) - , pure Haiku + , pure Haiku #else - , pure $ OtherOS "haiku" + , pure $ OtherOS "haiku" #endif - ] + ] instance Arbitrary FlagName where arbitrary = mkFlagName <$> vectorOf 4 (choose ('a', 'z')) diff --git a/src/Distribution/Server/Packages/Unpack.hs b/src/Distribution/Server/Packages/Unpack.hs index 6e8303dc..000df5ea 100644 --- a/src/Distribution/Server/Packages/Unpack.hs +++ b/src/Distribution/Server/Packages/Unpack.hs @@ -292,9 +292,17 @@ extraChecks :: GenericPackageDescription -> UploadMonad () extraChecks genPkgDesc pkgId tarIndex = do let pkgDesc = flattenPackageDescription genPkgDesc - fileChecks <- checkPackageContent (tarOps pkgId tarIndex) pkgDesc - - let pureChecks = checkPackage genPkgDesc (Just pkgDesc) + fileChecks <- checkPackageContent (tarOps pkgId tarIndex) +-- The API change of checkPackage happened somewhere between 3.10 and 3.12. +#if !MIN_VERSION_Cabal(3,12,0) + pkgDesc +#else + genPkgDesc +#endif + let pureChecks = checkPackage genPkgDesc +#if !MIN_VERSION_Cabal(3,12,0) + (Just pkgDesc) +#endif checks = pureChecks ++ fileChecks isDistError (PackageDistSuspicious {}) = False -- just a warning isDistError (PackageDistSuspiciousWarn {}) = False -- just a warning diff --git a/src/Distribution/Server/Util/CabalRevisions.hs b/src/Distribution/Server/Util/CabalRevisions.hs index 9036cf9c..479f0c41 100644 --- a/src/Distribution/Server/Util/CabalRevisions.hs +++ b/src/Distribution/Server/Util/CabalRevisions.hs @@ -178,12 +178,19 @@ checkCabalFileRevision checkXRevision old new = do checkPackageChecks :: Check GenericPackageDescription checkPackageChecks pkg pkg' = - let checks = checkPackage pkg Nothing - checks' = filter notUpperBounds $ checkPackage pkg' Nothing + let checks = checkPackage pkg +-- The API change of checkPackage happened somewhere between 3.10 and 3.12. +#if !MIN_VERSION_Cabal(3,12,0) + Nothing +#endif + checks' = filter notUpperBounds $ checkPackage pkg' +#if !MIN_VERSION_Cabal(3,12,0) + Nothing +#endif -- if multiple upper bounds are missing, then the simple set subtraction might detect a change to -- just one, and fail. Ideally we'd perform a set subtraction directly on just the missing bounds -- warning contents. A simple second best is to discard this check for now. - notUpperBounds (PackageDistSuspiciousWarn (MissingUpperBounds _)) = False + notUpperBounds (PackageDistSuspiciousWarn MissingUpperBounds{}) = False notUpperBounds _ = True in case checks' \\ checks of [] -> return () From 54f3385b61b19684b3f44175e1e60602fa59e175 Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Wed, 3 Jul 2024 07:00:25 +0200 Subject: [PATCH 40/46] Commit to Cabal-3.12.1.0 Otherwise, the feature set of hackage-server will depend on the version of Cabal used to build it. --- hackage-server.cabal | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hackage-server.cabal b/hackage-server.cabal index 598555e2..71abc865 100644 --- a/hackage-server.cabal +++ b/hackage-server.cabal @@ -149,8 +149,8 @@ common defaults -- other dependencies shared by most components build-depends: , aeson >= 2.1.0.0 && < 2.3 - , Cabal >= 3.10.1.0 && < 3.14 - , Cabal-syntax >= 3.10.1.0 && < 3.14 + , Cabal >= 3.12.1.0 && < 3.14 + , Cabal-syntax >= 3.12.1.0 && < 3.14 -- Cabal-syntax needs to be bound to constrain hackage-security -- see https://github.com/haskell/hackage-server/issues/1130 , fail ^>= 4.9.0 From c0de63ce061a44109ca4049e199b205ae83eba80 Mon Sep 17 00:00:00 2001 From: Peter Becich Date: Fri, 19 Jul 2024 21:27:26 -0700 Subject: [PATCH 41/46] update Nix Flake with Cabal 3.12 --- flake.lock | 18 +++++++++--------- flake.nix | 8 +++++++- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/flake.lock b/flake.lock index 542de04a..74cda4c3 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1717285511, - "narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=", + "lastModified": 1719994518, + "narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8", + "rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7", "type": "github" }, "original": { @@ -37,11 +37,11 @@ }, "haskell-flake": { "locked": { - "lastModified": 1718653460, - "narHash": "sha256-8ana22BZaLp91gGvQq8YbfteJKFqza4qrqc6++bCnH4=", + "lastModified": 1720977934, + "narHash": "sha256-k9kwz2lpUqafRUpuCMgkv4AWtHEoJPCds1ZPRkyW2XE=", "owner": "srid", "repo": "haskell-flake", - "rev": "569e28636c1aaee767a43741511fb36a6d3c284b", + "rev": "cd449f1c04175efdf5b553302d22916640090066", "type": "github" }, "original": { @@ -52,11 +52,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1718842396, - "narHash": "sha256-9uvK+h2xF2fclkPRz2tlXtz++VNXot22isEVvWizA7Q=", + "lastModified": 1721434426, + "narHash": "sha256-l0+BnaUA4E6YtsxpeQOU9sAFUFTpHWXDSzEidaZ2HH0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "49f3b031c4e87e18acc2a68f15fdb56871a170df", + "rev": "06bb092d40771dc133be7dab3b664670cdae7e08", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 4064f78b..53c2058b 100644 --- a/flake.nix +++ b/flake.nix @@ -47,7 +47,13 @@ ap-normalize.check = false; # https://community.flake.parts/haskell-flake/dependency#nixpkgs tar = { super, ... }: - { custom = _: super.tar_0_6_2_0; }; + { custom = _: super.tar_0_6_3_0; }; + Cabal = { super, ... }: + { custom = _: super.Cabal_3_12_1_0; }; + Cabal-syntax = { super, ... }: + { custom = _: super.Cabal-syntax_3_12_1_0; }; + hackage-security = { super, ... }: + { custom = _: super.hackage-security_0_6_2_6; }; # tasty = { super, ... }: # { custom = _: super.tasty_1_5; }; }; From adfcbd90eec840f222eb9cc54cfc84567d89a91a Mon Sep 17 00:00:00 2001 From: Peter Becich Date: Sat, 20 Jul 2024 11:07:29 -0700 Subject: [PATCH 42/46] cabal-install --- flake.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/flake.nix b/flake.nix index 53c2058b..e6ca203c 100644 --- a/flake.nix +++ b/flake.nix @@ -52,6 +52,8 @@ { custom = _: super.Cabal_3_12_1_0; }; Cabal-syntax = { super, ... }: { custom = _: super.Cabal-syntax_3_12_1_0; }; + cabal-install = { super, ... }: + { custom = _: super.cabal-install_3_12_1_0; }; hackage-security = { super, ... }: { custom = _: super.hackage-security_0_6_2_6; }; # tasty = { super, ... }: @@ -60,6 +62,7 @@ packages = { # https://community.flake.parts/haskell-flake/dependency#path # tls.source = "1.9.0"; + # cabal-install.source = "3.12.1.0"; }; devShell = { tools = hp: { From e9831a70c63e9184827d91ed02f29b9fc21a27e9 Mon Sep 17 00:00:00 2001 From: Peter Becich Date: Thu, 25 Jul 2024 20:12:48 -0700 Subject: [PATCH 43/46] fix `nix develop` shell --- flake.lock | 12 ++++++------ flake.nix | 9 --------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/flake.lock b/flake.lock index 74cda4c3..a5c503a1 100644 --- a/flake.lock +++ b/flake.lock @@ -37,11 +37,11 @@ }, "haskell-flake": { "locked": { - "lastModified": 1720977934, - "narHash": "sha256-k9kwz2lpUqafRUpuCMgkv4AWtHEoJPCds1ZPRkyW2XE=", + "lastModified": 1721530802, + "narHash": "sha256-eUMmQKXjt4WQq+IBscftg/Y9bXWiOYhasfeH5Yb9Psc=", "owner": "srid", "repo": "haskell-flake", - "rev": "cd449f1c04175efdf5b553302d22916640090066", + "rev": "f8f38ecd259338167cc0c85fd541479297a315af", "type": "github" }, "original": { @@ -52,11 +52,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1721434426, - "narHash": "sha256-l0+BnaUA4E6YtsxpeQOU9sAFUFTpHWXDSzEidaZ2HH0=", + "lastModified": 1721952842, + "narHash": "sha256-B6Fm/e+2Iq1LB0ITtdaVS/lxkckCwPNpgBuduuv1HzY=", "owner": "nixos", "repo": "nixpkgs", - "rev": "06bb092d40771dc133be7dab3b664670cdae7e08", + "rev": "574f1a6205e63e9870c6e6132c393f9082d58d2a", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index e6ca203c..222b1924 100644 --- a/flake.nix +++ b/flake.nix @@ -48,21 +48,12 @@ # https://community.flake.parts/haskell-flake/dependency#nixpkgs tar = { super, ... }: { custom = _: super.tar_0_6_3_0; }; - Cabal = { super, ... }: - { custom = _: super.Cabal_3_12_1_0; }; - Cabal-syntax = { super, ... }: - { custom = _: super.Cabal-syntax_3_12_1_0; }; - cabal-install = { super, ... }: - { custom = _: super.cabal-install_3_12_1_0; }; hackage-security = { super, ... }: { custom = _: super.hackage-security_0_6_2_6; }; - # tasty = { super, ... }: - # { custom = _: super.tasty_1_5; }; }; packages = { # https://community.flake.parts/haskell-flake/dependency#path # tls.source = "1.9.0"; - # cabal-install.source = "3.12.1.0"; }; devShell = { tools = hp: { From ef574c06013809289a0669828387de2bd2dd5052 Mon Sep 17 00:00:00 2001 From: Peter Becich Date: Sat, 10 Aug 2024 23:45:17 -0700 Subject: [PATCH 44/46] remove unnecessary Nix cache https://github.com/haskell/hackage-server/issues/1325 --- .github/workflows/nix-flake.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nix-flake.yml b/.github/workflows/nix-flake.yml index 99a80bc3..75433999 100644 --- a/.github/workflows/nix-flake.yml +++ b/.github/workflows/nix-flake.yml @@ -21,8 +21,8 @@ jobs: - uses: cachix/install-nix-action@V27 with: extra_nix_config: | - trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hackage-server.cachix.org-1:iw0iRh6+gsFIrxROFaAt5gKNgIHejKjIfyRdbpPYevY= - substituters = https://hydra.iohk.io https://cache.nixos.org/ https://hackage-server.cachix.org/ + trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hackage-server.cachix.org-1:iw0iRh6+gsFIrxROFaAt5gKNgIHejKjIfyRdbpPYevY= + substituters = https://cache.nixos.org/ https://hackage-server.cachix.org/ - uses: cachix/cachix-action@v15 with: # https://nix.dev/tutorials/continuous-integration-github-actions#setting-up-github-actions From 4ebc59f42ddbbea9446b23e5493141d458a3f697 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 16:32:14 +0000 Subject: [PATCH 45/46] Bump cachix/install-nix-action from V27 to 28 Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from V27 to 28. This release includes the previously tagged commit. - [Release notes](https://github.com/cachix/install-nix-action/releases) - [Commits](https://github.com/cachix/install-nix-action/compare/V27...V28) --- updated-dependencies: - dependency-name: cachix/install-nix-action dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- .github/workflows/nix-flake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nix-flake.yml b/.github/workflows/nix-flake.yml index 75433999..54eae1a0 100644 --- a/.github/workflows/nix-flake.yml +++ b/.github/workflows/nix-flake.yml @@ -18,7 +18,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - - uses: cachix/install-nix-action@V27 + - uses: cachix/install-nix-action@V28 with: extra_nix_config: | trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hackage-server.cachix.org-1:iw0iRh6+gsFIrxROFaAt5gKNgIHejKjIfyRdbpPYevY= From 3d4b9211e1e763e85d6f76fc031e75706d1d4762 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 16:55:44 +0000 Subject: [PATCH 46/46] Bump cachix/install-nix-action from V28 to 30 Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from V28 to 30. This release includes the previously tagged commit. - [Release notes](https://github.com/cachix/install-nix-action/releases) - [Commits](https://github.com/cachix/install-nix-action/compare/V28...v30) --- updated-dependencies: - dependency-name: cachix/install-nix-action dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- .github/workflows/nix-flake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nix-flake.yml b/.github/workflows/nix-flake.yml index 54eae1a0..9c31aa48 100644 --- a/.github/workflows/nix-flake.yml +++ b/.github/workflows/nix-flake.yml @@ -18,7 +18,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - - uses: cachix/install-nix-action@V28 + - uses: cachix/install-nix-action@v30 with: extra_nix_config: | trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hackage-server.cachix.org-1:iw0iRh6+gsFIrxROFaAt5gKNgIHejKjIfyRdbpPYevY=