Support x86-64 only downloads
This commit is contained in:
parent
6a063b2cc4
commit
eb68629653
@ -1,3 +1,4 @@
|
||||
-- | Configuration file.
|
||||
module SlackBuilder.Config
|
||||
( Settings(..)
|
||||
, MaintainerSettings(..)
|
||||
|
@ -1,3 +1,4 @@
|
||||
-- | Info file parsing and printing.
|
||||
module SlackBuilder.Info
|
||||
( PackageInfo(..)
|
||||
, generate
|
||||
@ -113,7 +114,7 @@ generate pkg = Lazy.Text.toStrict $ Text.Builder.toLazyText builder
|
||||
builder = "PRGNAM=\"" <> Text.Builder.fromString (pkgname pkg) <> "\"\n"
|
||||
<> "VERSION=\"" <> Text.Builder.fromText (version pkg) <> "\"\n"
|
||||
<> "HOMEPAGE=\"" <> Text.Builder.fromText (homepage pkg) <> "\"\n"
|
||||
<> generateMultiEntry "DOWNLOAD" (render <$> downloads pkg)
|
||||
<> downloadEntry
|
||||
<> generateMultiEntry "MD5SUM" (digestToText <$> checksums pkg)
|
||||
<> generateMultiEntry "DOWNLOAD_x86_64" (render <$> downloadX64 pkg)
|
||||
<> generateMultiEntry "MD5SUM_x86_64" (digestToText <$> checksumX64 pkg)
|
||||
@ -122,6 +123,10 @@ generate pkg = Lazy.Text.toStrict $ Text.Builder.toLazyText builder
|
||||
<> "EMAIL=\"" <> Text.Builder.fromText (email pkg) <> "\"\n"
|
||||
fromByteStringWords = Text.Builder.fromText
|
||||
. Text.unwords . fmap Text.decodeUtf8
|
||||
downloadEntry
|
||||
| null $ downloads pkg
|
||||
, not $ null $ downloadX64 pkg = "DOWNLOAD=\"UNSUPPORTED\"\n"
|
||||
| otherwise = generateMultiEntry "DOWNLOAD" $ render <$> downloads pkg
|
||||
|
||||
generateMultiEntry :: Text -> [Text] -> Text.Builder
|
||||
generateMultiEntry name entries = Text.Builder.fromText name
|
||||
|
@ -1,3 +1,4 @@
|
||||
-- | Transformers and exceptions.
|
||||
module SlackBuilder.Trans
|
||||
( SlackBuilderException(..)
|
||||
, SlackBuilderT(..)
|
||||
|
28
src/Main.hs
28
src/Main.hs
@ -49,7 +49,7 @@ import System.Console.ANSI
|
||||
)
|
||||
import System.Directory (listDirectory, doesDirectoryExist)
|
||||
import Control.Monad (filterM)
|
||||
import Data.List (isPrefixOf, isSuffixOf)
|
||||
import Data.List (isPrefixOf, isSuffixOf, partition)
|
||||
|
||||
autoUpdatable :: [Package]
|
||||
autoUpdatable =
|
||||
@ -78,7 +78,7 @@ autoUpdatable =
|
||||
template = Package.DownloadTemplate
|
||||
$ Package.StaticPlaceholder "https://getcomposer.org/download/"
|
||||
:| [Package.VersionPlaceholder, Package.StaticPlaceholder "/composer.phar"]
|
||||
in Package.Updater latest' $ downloadWithTemplate template
|
||||
in Package.Updater latest' $ downloadWithTemplate template False
|
||||
, category = "development"
|
||||
, name = "composer"
|
||||
, downloaders = mempty
|
||||
@ -95,7 +95,7 @@ autoUpdatable =
|
||||
$ Package.StaticPlaceholder "https://github.com/jitsi/jitsi-meet-electron/releases/download/v"
|
||||
:| Package.VersionPlaceholder
|
||||
: [Package.StaticPlaceholder "/jitsi-meet-x86_64.AppImage"]
|
||||
in Package.Updater latest' $ downloadWithTemplate template
|
||||
in Package.Updater latest' $ downloadWithTemplate template False
|
||||
, category = "network"
|
||||
, name = "jitsi-meet-desktop"
|
||||
, downloaders = mempty
|
||||
@ -116,7 +116,7 @@ autoUpdatable =
|
||||
$ Package.StaticPlaceholder "https://www.php.net/distributions/php-"
|
||||
:| Package.VersionPlaceholder
|
||||
: [Package.StaticPlaceholder ".tar.xz"]
|
||||
in Package.Updater latest' $ downloadWithTemplate template
|
||||
in Package.Updater latest' $ downloadWithTemplate template False
|
||||
, category = "development"
|
||||
, name = "php82"
|
||||
, downloaders = mempty
|
||||
@ -176,7 +176,7 @@ autoUpdatable =
|
||||
template = Package.DownloadTemplate $ pure
|
||||
$ Package.StaticPlaceholder
|
||||
"https://binaries.webex.com/WebexDesktop-Ubuntu-Official-Package/Webex.deb"
|
||||
in Package.Updater latest' $ downloadWithTemplate template
|
||||
in Package.Updater latest' $ downloadWithTemplate template True
|
||||
, category = "network"
|
||||
, name = "webex"
|
||||
, downloaders = mempty
|
||||
@ -213,7 +213,7 @@ autoUpdatable =
|
||||
: Package.StaticPlaceholder "/dmd."
|
||||
: Package.VersionPlaceholder
|
||||
: [Package.StaticPlaceholder ".linux.tar.xz"]
|
||||
in Package.Updater latest' $ downloadWithTemplate template
|
||||
in Package.Updater latest' $ downloadWithTemplate template False
|
||||
, category = "development"
|
||||
, name = "dmd"
|
||||
, downloaders = mempty
|
||||
@ -244,7 +244,7 @@ autoUpdatable =
|
||||
dscannerURI = [uri|https://github.com/dlang-community/D-Scanner.git|]
|
||||
dcdURI = [uri|https://github.com/dlang-community/DCD.git|]
|
||||
in Map.fromList
|
||||
[ ("DUB", Package.Updater latestDub $ downloadWithTemplate dubTemplate)
|
||||
[ ("DUB", Package.Updater latestDub $ downloadWithTemplate dubTemplate False)
|
||||
, ("DSCANNER", Package.Updater latestDscanner $ cloneFromGit dscannerURI "v")
|
||||
, ("DCD", Package.Updater latestDcd $ cloneFromGit dcdURI "v")
|
||||
]
|
||||
@ -327,8 +327,8 @@ cloneFromGit repo tagPrefix packagePath version = do
|
||||
(flip . flip Package.Download) (fromJust checksum) False
|
||||
<$> liftIO (mkURI $ "https://download.dlackware.com/hosted-sources/" <> name' <> "/" <> downloadFileName)
|
||||
|
||||
downloadWithTemplate :: Package.DownloadTemplate -> Text -> Text -> SlackBuilderT Package.Download
|
||||
downloadWithTemplate downloadTemplate packagePath version = do
|
||||
downloadWithTemplate :: Package.DownloadTemplate -> Bool -> Text -> Text -> SlackBuilderT Package.Download
|
||||
downloadWithTemplate downloadTemplate is64' packagePath version = do
|
||||
repository' <- SlackBuilderT $ asks repository
|
||||
uri' <- liftIO $ Package.renderDownloadWithVersion downloadTemplate version
|
||||
let downloadFileName = URI.unRText
|
||||
@ -336,11 +336,12 @@ downloadWithTemplate downloadTemplate packagePath version = do
|
||||
relativeTarball = packagePath <> "/" <> downloadFileName
|
||||
tarball = repository' </> Text.unpack relativeTarball
|
||||
checksum <- fromJust <$> download uri' tarball
|
||||
pure $ Package.Download uri' checksum False
|
||||
pure $ Package.Download uri' checksum is64'
|
||||
|
||||
reuploadWithTemplate :: Package.DownloadTemplate -> [CmdSpec] -> Text -> Text -> SlackBuilderT Package.Download
|
||||
reuploadWithTemplate downloadTemplate commands packagePath version = do
|
||||
Package.Download{ download = uri', md5sum = checksum } <- downloadWithTemplate downloadTemplate packagePath version
|
||||
Package.Download{ download = uri', md5sum = checksum } <-
|
||||
downloadWithTemplate downloadTemplate False packagePath version
|
||||
let downloadFileName = URI.unRText
|
||||
$ NonEmpty.last $ snd $ fromJust $ URI.uriPath uri'
|
||||
relativeTarball = packagePath <> "/" <> downloadFileName
|
||||
@ -398,13 +399,16 @@ updatePackage package@Package{..} version info = do
|
||||
repository' <- SlackBuilderT $ asks repository
|
||||
mainDownload <- renderAndDownload package version
|
||||
moreDownloads <- traverse (updateDownload package) downloaders
|
||||
let allDownloads = mainDownload : toList (fst <$> moreDownloads)
|
||||
let (downloads64, allDownloads) = partition (getField @"is64")
|
||||
$ mainDownload : toList (fst <$> moreDownloads)
|
||||
let infoFilePath = repository' </> Text.unpack packagePath
|
||||
</> (Text.unpack name <.> "info")
|
||||
package' = info
|
||||
{ version = version
|
||||
, downloads = getField @"download" <$> allDownloads
|
||||
, checksums = getField @"md5sum" <$> allDownloads
|
||||
, downloadX64 = getField @"download" <$> downloads64
|
||||
, checksumX64 = getField @"md5sum" <$> downloads64
|
||||
}
|
||||
liftIO $ Text.IO.writeFile infoFilePath $ generate package'
|
||||
updateSlackBuildVersion packagePath version $ snd <$> moreDownloads
|
||||
|
Loading…
Reference in New Issue
Block a user