mirror of
https://github.com/commercialhaskell/stackage-server.git
synced 2026-02-24 16:37:53 +01:00
remove unused (hackage) tarball handling code for StackageSdistR
I noticed this code seems unused since http://hackage.fpcomplete.com/package/ is 404
This commit is contained in:
parent
baddf10194
commit
c0bbed921b
@ -22,7 +22,7 @@ getPackageDepsR pname = do
|
|||||||
getSnapshotPackageDepsR :: SnapName -> PackageNameVersion -> Handler Html
|
getSnapshotPackageDepsR :: SnapName -> PackageNameVersion -> Handler Html
|
||||||
getSnapshotPackageDepsR snapName pnv = do
|
getSnapshotPackageDepsR snapName pnv = do
|
||||||
cacheSeconds $ 60 * 60
|
cacheSeconds $ 60 * 60
|
||||||
pnvToSnapshotPackageInfo snapName pnv (\_ _ -> notFound) $ \isSameVersion spi ->
|
pnvToSnapshotPackageInfo snapName pnv $ \isSameVersion spi ->
|
||||||
if isSameVersion
|
if isSameVersion
|
||||||
then helper Deps spi
|
then helper Deps spi
|
||||||
else redirect $
|
else redirect $
|
||||||
@ -40,7 +40,7 @@ getPackageRevDepsR pname = do
|
|||||||
getSnapshotPackageRevDepsR :: SnapName -> PackageNameVersion -> Handler Html
|
getSnapshotPackageRevDepsR :: SnapName -> PackageNameVersion -> Handler Html
|
||||||
getSnapshotPackageRevDepsR snapName pnv = do
|
getSnapshotPackageRevDepsR snapName pnv = do
|
||||||
cacheSeconds $ 60 * 60
|
cacheSeconds $ 60 * 60
|
||||||
pnvToSnapshotPackageInfo snapName pnv (\_ _ -> notFound) $ \isSameVersion spi ->
|
pnvToSnapshotPackageInfo snapName pnv $ \isSameVersion spi ->
|
||||||
if isSameVersion
|
if isSameVersion
|
||||||
then helper RevDeps spi
|
then helper RevDeps spi
|
||||||
else redirect $
|
else redirect $
|
||||||
|
|||||||
@ -8,24 +8,11 @@ import Import
|
|||||||
import Stackage.Database
|
import Stackage.Database
|
||||||
import Handler.Package (packagePage)
|
import Handler.Package (packagePage)
|
||||||
|
|
||||||
handlePNVTarball :: PackageNameP -> VersionP -> Handler TypedContent
|
|
||||||
handlePNVTarball name version =
|
|
||||||
redirect $
|
|
||||||
concat -- TODO: Should this be switched to HTTPS by now?
|
|
||||||
-- unfortunately using insecure HTTP for cabal's sake
|
|
||||||
[ "http://hackage.fpcomplete.com/package/"
|
|
||||||
, toPathPiece name
|
|
||||||
, "-"
|
|
||||||
, toPathPiece version
|
|
||||||
, ".tar.gz"
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
getStackageSdistR
|
getStackageSdistR
|
||||||
:: SnapName -> PackageNameVersion -> HandlerFor App TypedContent
|
:: SnapName -> PackageNameVersion -> HandlerFor App TypedContent
|
||||||
getStackageSdistR sname pnv =
|
getStackageSdistR sname pnv =
|
||||||
track "Handler.StackageSdist.getStackageSdistR" $
|
track "Handler.StackageSdist.getStackageSdistR" $
|
||||||
pnvToSnapshotPackageInfo sname pnv handlePNVTarball $ \isSameVersion spi ->
|
pnvToSnapshotPackageInfo sname pnv $ \isSameVersion spi ->
|
||||||
if isSameVersion
|
if isSameVersion
|
||||||
then packagePage (Just spi) (spiPackageName spi) >>= sendResponse
|
then packagePage (Just spi) (spiPackageName spi) >>= sendResponse
|
||||||
else redirect $
|
else redirect $
|
||||||
@ -36,17 +23,14 @@ getStackageSdistR sname pnv =
|
|||||||
pnvToSnapshotPackageInfo ::
|
pnvToSnapshotPackageInfo ::
|
||||||
SnapName
|
SnapName
|
||||||
-> PackageNameVersion
|
-> PackageNameVersion
|
||||||
-> (PackageNameP -> VersionP -> HandlerFor App b)
|
|
||||||
-> (Bool -> SnapshotPackageInfo -> HandlerFor App b)
|
-> (Bool -> SnapshotPackageInfo -> HandlerFor App b)
|
||||||
-> HandlerFor App b
|
-> HandlerFor App b
|
||||||
pnvToSnapshotPackageInfo sname pnv tarballHandler spiHandler =
|
pnvToSnapshotPackageInfo sname pnv spiHandler =
|
||||||
case pnv of
|
case pnv of
|
||||||
PNVName pname -> spiHelper sname pname >>= spiHandler False
|
PNVName pname -> spiHelper sname pname >>= spiHandler False
|
||||||
PNVNameVersion pname version ->
|
PNVNameVersion pname version ->
|
||||||
spiHelper sname pname >>= \spi -> spiHandler (version == spiVersion spi) spi
|
spiHelper sname pname >>= \spi -> spiHandler (version == spiVersion spi) spi
|
||||||
PNVTarball name version -> tarballHandler name version
|
|
||||||
|
|
||||||
|
|
||||||
spiHelper :: SnapName -> PackageNameP -> Handler SnapshotPackageInfo
|
spiHelper :: SnapName -> PackageNameP -> Handler SnapshotPackageInfo
|
||||||
spiHelper sname pname = getSnapshotPackageInfo sname pname >>= maybe notFound return
|
spiHelper sname pname = getSnapshotPackageInfo sname pname >>= maybe notFound return
|
||||||
|
|
||||||
|
|||||||
@ -180,8 +180,7 @@ newtype PackageSetIdent = PackageSetIdent { unPackageSetIdent :: Text }
|
|||||||
instance PersistFieldSql PackageSetIdent where
|
instance PersistFieldSql PackageSetIdent where
|
||||||
sqlType = sqlType . fmap unPackageSetIdent
|
sqlType = sqlType . fmap unPackageSetIdent
|
||||||
|
|
||||||
data PackageNameVersion = PNVTarball !PackageNameP !VersionP
|
data PackageNameVersion = PNVNameVersion !PackageNameP !VersionP
|
||||||
| PNVNameVersion !PackageNameP !VersionP
|
|
||||||
| PNVName !PackageNameP
|
| PNVName !PackageNameP
|
||||||
deriving (Read, Show, Eq, Ord)
|
deriving (Read, Show, Eq, Ord)
|
||||||
|
|
||||||
@ -254,13 +253,8 @@ instance ToMarkup PackageVersionRev where
|
|||||||
|
|
||||||
|
|
||||||
instance PathPiece PackageNameVersion where
|
instance PathPiece PackageNameVersion where
|
||||||
toPathPiece (PNVTarball x y) = T.concat [toPathPiece x, "-", toPathPiece y, ".tar.gz"]
|
|
||||||
toPathPiece (PNVNameVersion x y) = T.concat [toPathPiece x, "-", toPathPiece y]
|
toPathPiece (PNVNameVersion x y) = T.concat [toPathPiece x, "-", toPathPiece y]
|
||||||
toPathPiece (PNVName x) = toPathPiece x
|
toPathPiece (PNVName x) = toPathPiece x
|
||||||
fromPathPiece t'
|
|
||||||
| Just t <- T.stripSuffix ".tar.gz" t' = do
|
|
||||||
PackageIdentifierP name version <- fromPathPiece t
|
|
||||||
return $ PNVTarball name version
|
|
||||||
fromPathPiece t =
|
fromPathPiece t =
|
||||||
case T.breakOnEnd "-" t of
|
case T.breakOnEnd "-" t of
|
||||||
("", _) -> PNVName <$> fromPathPiece t
|
("", _) -> PNVName <$> fromPathPiece t
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user