universal-ctags: Finish migrating the updater
This commit is contained in:
parent
7c499bd3f7
commit
69b24c6cfa
16
app/Main.hs
16
app/Main.hs
@ -78,14 +78,17 @@ updatePackage Package{..} version = do
|
|||||||
}
|
}
|
||||||
Package.Updater _ downloadTemplate = latest
|
Package.Updater _ downloadTemplate = latest
|
||||||
|
|
||||||
|
repository' <- SlackBuilderT $ asks repository
|
||||||
uri' <- liftIO $ Package.renderDownloadWithVersion downloadTemplate version
|
uri' <- liftIO $ Package.renderDownloadWithVersion downloadTemplate version
|
||||||
let tarball = "slackbuilds/development/universal-ctags/ctags-#{version}.tar.gz"
|
let relativeTarball = Text.replace "#{version}" version
|
||||||
|
"development/universal-ctags/ctags-#{version}.tar.gz"
|
||||||
|
tarball = repository' </> Text.unpack relativeTarball
|
||||||
|
liftIO $ putStrLn
|
||||||
|
$ "Downloading " <> Text.unpack (URI.render uri') <> " to " <> tarball <> "."
|
||||||
checksum <- fromMaybe undefined <$> download uri' tarball
|
checksum <- fromMaybe undefined <$> download uri' tarball
|
||||||
download' <- liftIO
|
download' <- liftIO $ mkURI
|
||||||
$ mkURI
|
|
||||||
$ Text.replace "#{version}" version
|
$ Text.replace "#{version}" version
|
||||||
"https://download.dlackware.com/hosted-sources/universal-ctags/ctags-#{version}.tar.gz"
|
"https://download.dlackware.com/hosted-sources/universal-ctags/ctags-#{version}.tar.gz"
|
||||||
repository' <- SlackBuilderT $ asks repository
|
|
||||||
let infoFilePath = repository' </> Text.unpack packagePath
|
let infoFilePath = repository' </> Text.unpack packagePath
|
||||||
</> (Text.unpack name <.> "info")
|
</> (Text.unpack name <.> "info")
|
||||||
|
|
||||||
@ -93,8 +96,9 @@ updatePackage Package{..} version = do
|
|||||||
$ Package.infoTemplate package' [Package.Download download' checksum False]
|
$ Package.infoTemplate package' [Package.Download download' checksum False]
|
||||||
updateSlackBuildVersion packagePath version
|
updateSlackBuildVersion packagePath version
|
||||||
|
|
||||||
remotePath' <- SlackBuilderT $ asks remotePath
|
liftIO $ putStrLn
|
||||||
uploadCommand (Text.pack tarball) $ remotePath' <> "/universal-ctags"
|
$ "Upload the source tarball " <> Text.unpack relativeTarball
|
||||||
|
uploadCommand relativeTarball "/universal-ctags"
|
||||||
|
|
||||||
commit packagePath version
|
commit packagePath version
|
||||||
|
|
||||||
|
@ -77,8 +77,14 @@ commit :: Text -> Text -> SlackBuilderT ()
|
|||||||
commit packagePath version = do
|
commit packagePath version = do
|
||||||
branch' <- SlackBuilderT $ Text.unpack <$> asks branch
|
branch' <- SlackBuilderT $ Text.unpack <$> asks branch
|
||||||
repository' <- SlackBuilderT $ asks repository
|
repository' <- SlackBuilderT $ asks repository
|
||||||
|
signature' <- SlackBuilderT $ asks $ signature . maintainer
|
||||||
let message = Text.unpack
|
let message = Text.unpack
|
||||||
$ packagePath <> ": Updated for version " <> version
|
$ packagePath <> ": Updated for version " <> version
|
||||||
|
mainCommitArguments = ["-C", repository', "commit", "-m", message]
|
||||||
|
commitArguments =
|
||||||
|
if signature'
|
||||||
|
then mainCommitArguments <> ["-S"]
|
||||||
|
else mainCommitArguments
|
||||||
|
|
||||||
(checkoutExitCode, _, _) <- liftIO
|
(checkoutExitCode, _, _) <- liftIO
|
||||||
$ withFile "/dev/null" WriteMode
|
$ withFile "/dev/null" WriteMode
|
||||||
@ -89,7 +95,7 @@ commit packagePath version = do
|
|||||||
$ callProcess "git" ["-C", repository', "checkout", "-b", branch', "master"]
|
$ callProcess "git" ["-C", repository', "checkout", "-b", branch', "master"]
|
||||||
liftIO
|
liftIO
|
||||||
$ callProcess "git" ["-C", repository', "add", Text.unpack packagePath]
|
$ callProcess "git" ["-C", repository', "add", Text.unpack packagePath]
|
||||||
>> callProcess "git" ["-C", repository', "commit", "-S", "-m", message]
|
>> callProcess "git" commitArguments
|
||||||
where
|
where
|
||||||
testCheckout repository' branch' nullHandle =
|
testCheckout repository' branch' nullHandle =
|
||||||
let createCheckoutProcess = (proc "git" ["-C", repository', "checkout", branch'])
|
let createCheckoutProcess = (proc "git" ["-C", repository', "checkout", branch'])
|
||||||
|
@ -7,3 +7,4 @@ remote_path = "example.com:/srv/httpd/some/path"
|
|||||||
[maintainer]
|
[maintainer]
|
||||||
name = "Maintainer Name"
|
name = "Maintainer Name"
|
||||||
email = "maintainer@example.com"
|
email = "maintainer@example.com"
|
||||||
|
signature = false
|
||||||
|
@ -20,6 +20,7 @@ data Settings = Settings
|
|||||||
data MaintainerSettings = MaintainerSettings
|
data MaintainerSettings = MaintainerSettings
|
||||||
{ name :: !Text
|
{ name :: !Text
|
||||||
, email :: !Text
|
, email :: !Text
|
||||||
|
, signature :: !Bool
|
||||||
} deriving (Eq, Show)
|
} deriving (Eq, Show)
|
||||||
|
|
||||||
settingsCodec :: Toml.TomlCodec Settings
|
settingsCodec :: Toml.TomlCodec Settings
|
||||||
@ -35,3 +36,4 @@ maintainerSettingsCodec :: Toml.TomlCodec MaintainerSettings
|
|||||||
maintainerSettingsCodec = MaintainerSettings
|
maintainerSettingsCodec = MaintainerSettings
|
||||||
<$> Toml.text "name" .= name
|
<$> Toml.text "name" .= name
|
||||||
<*> Toml.text "email" .= email
|
<*> Toml.text "email" .= email
|
||||||
|
<*> Toml.bool "signature" .= signature
|
||||||
|
Loading…
Reference in New Issue
Block a user