summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/Main.hs16
-rw-r--r--app/SlackBuilder/Download.hs8
2 files changed, 17 insertions, 7 deletions
diff --git a/app/Main.hs b/app/Main.hs
index 5b888b4..3ea1539 100644
--- a/app/Main.hs
+++ b/app/Main.hs
@@ -78,14 +78,17 @@ updatePackage Package{..} version = do
}
Package.Updater _ downloadTemplate = latest
+ repository' <- SlackBuilderT $ asks repository
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
- download' <- liftIO
- $ mkURI
+ download' <- liftIO $ mkURI
$ Text.replace "#{version}" version
"https://download.dlackware.com/hosted-sources/universal-ctags/ctags-#{version}.tar.gz"
- repository' <- SlackBuilderT $ asks repository
let infoFilePath = repository' </> Text.unpack packagePath
</> (Text.unpack name <.> "info")
@@ -93,8 +96,9 @@ updatePackage Package{..} version = do
$ Package.infoTemplate package' [Package.Download download' checksum False]
updateSlackBuildVersion packagePath version
- remotePath' <- SlackBuilderT $ asks remotePath
- uploadCommand (Text.pack tarball) $ remotePath' <> "/universal-ctags"
+ liftIO $ putStrLn
+ $ "Upload the source tarball " <> Text.unpack relativeTarball
+ uploadCommand relativeTarball "/universal-ctags"
commit packagePath version
diff --git a/app/SlackBuilder/Download.hs b/app/SlackBuilder/Download.hs
index 5d4cb8d..d5bd7e8 100644
--- a/app/SlackBuilder/Download.hs
+++ b/app/SlackBuilder/Download.hs
@@ -77,8 +77,14 @@ commit :: Text -> Text -> SlackBuilderT ()
commit packagePath version = do
branch' <- SlackBuilderT $ Text.unpack <$> asks branch
repository' <- SlackBuilderT $ asks repository
+ signature' <- SlackBuilderT $ asks $ signature . maintainer
let message = Text.unpack
$ packagePath <> ": Updated for version " <> version
+ mainCommitArguments = ["-C", repository', "commit", "-m", message]
+ commitArguments =
+ if signature'
+ then mainCommitArguments <> ["-S"]
+ else mainCommitArguments
(checkoutExitCode, _, _) <- liftIO
$ withFile "/dev/null" WriteMode
@@ -89,7 +95,7 @@ commit packagePath version = do
$ callProcess "git" ["-C", repository', "checkout", "-b", branch', "master"]
liftIO
$ callProcess "git" ["-C", repository', "add", Text.unpack packagePath]
- >> callProcess "git" ["-C", repository', "commit", "-S", "-m", message]
+ >> callProcess "git" commitArguments
where
testCheckout repository' branch' nullHandle =
let createCheckoutProcess = (proc "git" ["-C", repository', "checkout", branch'])