Merge pull request #317 from juhp/master

bump to lts-18 and fix ordering issue in snapshot diff
This commit is contained in:
Michael Snoyman 2023-06-28 22:32:47 +02:00 committed by GitHub
commit c6d4ec3e3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 28 additions and 34 deletions

View File

@ -20,6 +20,7 @@ To test the UI without real data, just run:
```
$ yesod devel
```
(install the yesod executable from yesod-bin).
## Testing with postgresql
Now, initially you need to run the cron job to create and populate the database:
@ -29,7 +30,7 @@ $ export PGSTRING=postgresql://postgres:password@localhost:5432/stackage
$ stack exec stackage-server-cron
```
Note that you need to modify the PGSTRING environment variable according to your actual database configuration. Also, you need to create an empty database before running the cron job. Note that it takes quites some time for it to load your database.
Note that you need to modify the PGSTRING environment variable according to your actual database configuration. Also, you need to create an empty database before running the cron job. Note that it takes quite some time for it to load your database.
After this, run the stackage server:

View File

@ -81,7 +81,7 @@ main = do
execParser $
info
(optsParser <*
abortOption ShowHelpText (long "help" <> short 'h' <> help "Display this message."))
abortOption (ShowHelpText Nothing) (long "help" <> short 'h' <> help "Display this message."))
(header "stackage-cron - Keep stackage.org up to date" <>
progDesc
"Uses github.com/commercialhaskell/stackage-snapshots repository as a source \

View File

@ -62,7 +62,7 @@ dependencies:
- zlib
- unordered-containers
- hashable
- Cabal
- Cabal >= 3.2
- mono-traversable
- process
- cmark-gfm

View File

@ -25,8 +25,8 @@ import qualified Data.IntMap.Strict as IntMap
import Data.Monoid (Any(..))
import Data.Streaming.Network (bindPortTCP)
import Data.Yaml (decodeFileEither)
import Database.Persist
import Database.Persist.Postgresql
import Database.Persist hiding (exists)
import Database.Persist.Postgresql hiding (exists)
import qualified Hoogle
import Network.AWS hiding (Request, Response)
import Network.AWS.Data.Text (toText)

View File

@ -38,6 +38,7 @@ import Distribution.Types.Library (exposedModules)
import Distribution.Types.PackageDescription (PackageDescription(package))
import Distribution.Types.VersionRange (VersionRange, intersectVersionRanges,
normaliseVersionRange, withinRange)
import Distribution.Utils.ShortText (fromShortText)
import Distribution.Version (simplifyVersionRange)
import RIO
import qualified RIO.Map as Map
@ -71,15 +72,15 @@ toPackageInfo ::
-> PackageInfo
toPackageInfo gpd mreadme mchangelog =
PackageInfo
{ piSynopsis = T.pack $ synopsis pd
, piDescription = renderHaddock (description pd)
{ piSynopsis = T.pack $ fromShortText $ synopsis pd
, piDescription = renderHaddock $ fromShortText (description pd)
, piReadme = maybe mempty (\(Readme bs isMarkdown) -> renderContent bs isMarkdown) mreadme
, piChangelog =
maybe mempty (\(Changelog bs isMarkdown) -> renderContent bs isMarkdown) mchangelog
, piAuthors = parseIdentitiesLiberally $ T.pack $ author pd
, piMaintainers = parseIdentitiesLiberally $ T.pack $ maintainer pd
, piAuthors = parseIdentitiesLiberally $ T.pack . fromShortText $ author pd
, piMaintainers = parseIdentitiesLiberally $ T.pack . fromShortText $ maintainer pd
, piHomepage =
case T.strip $ T.pack $ homepage pd of
case T.strip . T.pack . fromShortText $ homepage pd of
"" -> Nothing
x -> Just x
, piLicenseName = T.pack $ prettyShow $ license pd
@ -93,7 +94,7 @@ toPackageInfo gpd mreadme mchangelog =
else toHtml $ Textarea txt
getSynopsis :: GenericPackageDescription -> Text
getSynopsis = T.pack . synopsis . packageDescription
getSynopsis = T.pack . fromShortText . synopsis . packageDescription
extractModuleNames :: GenericPackageDescription -> [ModuleNameP]
extractModuleNames = maybe [] (coerce . exposedModules . condTreeData) . condLibrary

View File

@ -78,9 +78,10 @@ module Stackage.Database.Query
import qualified Data.Aeson as A
import qualified Data.List as L
import Database.Esqueleto
import Database.Esqueleto.Internal.Language (FromPreprocess)
import Database.Esqueleto.Internal.Sql
import Database.Esqueleto.Legacy
import Database.Esqueleto.Internal.Internal (FromPreprocess, SqlSelect,
unsafeSqlCastAs,
unsafeSqlFunction)
import Distribution.Types.PackageId (PackageIdentifier(PackageIdentifier))
import Distribution.PackageDescription (packageDescription)
import Distribution.Types.PackageDescription (PackageDescription(package))
@ -604,7 +605,7 @@ getSnapshotPackageLatestVersionQuery ::
PackageNameP -> ReaderT SqlBackend (RIO env) (Maybe SnapshotPackageInfo)
getSnapshotPackageLatestVersionQuery pname =
fmap snd . listToMaybe <$>
(snapshotPackageInfoQuery $ \_sp s pn v spiQ -> do
(snapshotPackageInfoQuery $ \_sp s pn _v spiQ -> do
where_ (pn ^. PackageNameName ==. val pname)
orderBy [desc (s ^. SnapshotId)]
limit 1

View File

@ -75,14 +75,14 @@ snapshotDiff
-> [(PackageNameP, VersionP)]
-> SnapshotDiff
snapshotDiff as0 bs0 =
SnapshotDiff $ map (second VersionChange) $ go (sortEm as0) (sortEm bs0)
SnapshotDiff $ map (second VersionChange) $ go (sortOn cmp as0) (sortOn cmp bs0)
where
sortEm = sortOn (toCaseFold . textDisplay . fst)
cmp = toCaseFold . textDisplay . fst
go as [] = map (second This) as
go [] bs = map (second That) bs
go (a:as) (b:bs) =
case compare (fst a) (fst b) of
case (compare `on` cmp) a b of
EQ
| snd a == snd b -> go as bs
| otherwise -> (fst a, These (snd a) (snd b)) : go as bs

View File

@ -55,7 +55,7 @@ import Data.Hashable (hashUsing, hashWithSalt)
import qualified Data.Text as T
import qualified Data.Text.Read as Reader
import Data.Typeable
import Database.Esqueleto.Internal.Language
import Database.Esqueleto.Internal.Internal
import Database.Persist
import Database.Persist.Sql (PersistFieldSql(sqlType))
import qualified Distribution.ModuleName as DT (components, fromComponents,

View File

@ -1,19 +1,10 @@
resolver: lts-16.31
resolver: lts-18.28
extra-deps:
- barrier-0.1.1@sha256:2021f84c3aba67bb635d72825d3bc0371942444dc014bc307b875071e29eea98,3931
- hackage-security-0.6.0.1
- hoogle-5.0.18
- yesod-gitrepo-0.3.0@sha256:7aad996935065726ce615c395d735cc01dcef3993b1788f670f6bfc866085e02,1191
- github: commercialhaskell/pantry
commit: c4e7c3dff9770e7937c93edfb6564dd6a1acd55e
- github: fpco/casa
commit: fc0ed26858bfc4f2966ed2dfb2871bae9266dda6
subdirs:
- casa-client
- casa-types
- github: yesodweb/persistent
commit: f66ed6f472ff3faa140db37bf4649e5b80be4c57
subdirs: [persistent]
- amazonka-1.6.1
- barrier-0.1.1
- classy-prelude-yesod-1.5.0
- unliftio-core-0.1.2.0
- yesod-gitrepo-0.3.0
drop-packages:
- Cabal