rdiff-backup: Migrated

This commit is contained in:
Eugen Wissner 2023-10-13 19:34:02 +02:00
parent 5e161c3dad
commit 4105ffa91f
Signed by: belka
GPG Key ID: A27FDC1E8EE902C0
4 changed files with 22 additions and 57 deletions

View File

@ -64,27 +64,7 @@ task :webex do
commit 'network/webex', package.version commit 'network/webex', package.version
end end
task 'rdiff-backup', [:version] do |_, arguments|
raise 'Version is not specified.' unless arguments.key? :version
package = Package.new 'system/rdiff-backup',
version: arguments[:version],
homepage: 'https://rdiff-backup.net/',
requires: ['librsync']
uri = "https://github.com/rdiff-backup/rdiff-backup/releases/download/v#{arguments[:version]}/rdiff-backup-#{arguments[:version]}.tar.gz"
tarball = "system/rdiff-backup/rdiff-backup-#{arguments[:version]}.tar.gz"
checksum = SlackBuilder.download_and_deploy URI(uri), tarball
download = "https://download.dlackware.com/hosted-sources/rdiff-backup/rdiff-backup-#{arguments[:version]}.tar.gz"
write_info package, downloads: [Download.new(download, checksum)]
update_slackbuild_version 'system/rdiff-backup', arguments[:version]
commit 'system/rdiff-backup', arguments[:version]
end
AUTO_UPDATABLE = { AUTO_UPDATABLE = {
'rdiff-backup' => [SlackBuilder::GitHub.new('rdiff-backup', 'rdiff-backup', 'rdiff-backup')],
'dmd' => [SlackBuilder::LatestText.new('https://downloads.dlang.org/releases/LATEST')] 'dmd' => [SlackBuilder::LatestText.new('https://downloads.dlang.org/releases/LATEST')]
}.freeze }.freeze

View File

@ -93,7 +93,8 @@ autoUpdatable =
, transform = Nothing , transform = Nothing
} }
checkVersion x checkVersion x
| Text.isPrefixOf "php-8.2." x = Text.stripPrefix "php-" x | not $ Text.isInfixOf "RC" x
, Text.isPrefixOf "php-8.2." x = Text.stripPrefix "php-" x
| otherwise = Nothing | otherwise = Nothing
latest' = latestGitHub ghArguments checkVersion latest' = latestGitHub ghArguments checkVersion
template = Package.DownloadTemplate template = Package.DownloadTemplate
@ -127,6 +128,25 @@ autoUpdatable =
, name = "kitty" , name = "kitty"
, reupload = Just [RawCommand "go" ["mod", "vendor"]] , reupload = Just [RawCommand "go" ["mod", "vendor"]]
} }
, Package
{ latest =
let ghArguments = GhArguments
{ owner = "rdiff-backup"
, name = "rdiff-backup"
, transform = Nothing
}
latest' = latestGitHub ghArguments $ Text.stripPrefix "v"
template = Package.DownloadTemplate
$ Package.StaticPlaceholder "https://github.com/rdiff-backup/rdiff-backup/releases/download/v"
:| Package.VersionPlaceholder
: Package.StaticPlaceholder "/rdiff-backup-"
: Package.VersionPlaceholder
: [Package.StaticPlaceholder ".tar.gz"]
in Package.Updater latest' template
, category = "system"
, name = "rdiff-backup"
, reupload = Just mempty
}
] ]
up2Date :: SlackBuilderT () up2Date :: SlackBuilderT ()
@ -227,8 +247,6 @@ main = do
where where
executeCommand = \case executeCommand = \case
TextCommand textArguments -> latestText textArguments TextCommand textArguments -> latestText textArguments
GhCommand ghArguments@GhArguments{ transform }
-> latestGitHub ghArguments $ chooseTransformFunction transform
SlackBuildCommand packagePath version -> SlackBuildCommand packagePath version ->
updateSlackBuildVersion packagePath version >> pure Nothing updateSlackBuildVersion packagePath version >> pure Nothing
CommitCommand packagePath version -> CommitCommand packagePath version ->
@ -246,13 +264,3 @@ main = do
DownloadAndDeployCommand uri' tarball -> fmap (Text.pack . show) DownloadAndDeployCommand uri' tarball -> fmap (Text.pack . show)
<$> downloadAndDeploy uri' tarball <$> downloadAndDeploy uri' tarball
Up2DateCommand -> up2Date >> pure Nothing Up2DateCommand -> up2Date >> pure Nothing
chooseTransformFunction (Just "php") = phpTransform
chooseTransformFunction (Just "rdiff-backup") = Text.stripPrefix "v"
chooseTransformFunction _ = stripPrefix "v"
stripPrefix prefix string = Just
$ fromMaybe string
$ Text.stripPrefix prefix string
phpTransform version
| (majorPrefix, _patchVersion) <- Text.breakOnEnd "." version
, majorPrefix == "php-8.2." = Just $ Text.drop (Text.length "php-") version
| otherwise = Nothing

View File

@ -16,12 +16,11 @@ import Options.Applicative
, info , info
, fullDesc , fullDesc
, subparser , subparser
, command, optional , command,
) )
data SlackBuilderCommand data SlackBuilderCommand
= TextCommand TextArguments = TextCommand TextArguments
| GhCommand GhArguments
| SlackBuildCommand Text Text | SlackBuildCommand Text Text
| CommitCommand Text Text | CommitCommand Text Text
| ExistsCommand Text | ExistsCommand Text
@ -49,19 +48,12 @@ newtype TextArguments = TextArguments Text
textArguments :: Parser TextArguments textArguments :: Parser TextArguments
textArguments = TextArguments <$> argument str (metavar "URL") textArguments = TextArguments <$> argument str (metavar "URL")
ghArguments :: Parser GhArguments
ghArguments = GhArguments
<$> argument str (metavar "OWNER")
<*> argument str (metavar "NAME")
<*> optional (argument str (metavar "TRANSFORM"))
slackBuilderParser :: ParserInfo SlackBuilderCommand slackBuilderParser :: ParserInfo SlackBuilderCommand
slackBuilderParser = info slackBuilderCommand fullDesc slackBuilderParser = info slackBuilderCommand fullDesc
slackBuilderCommand :: Parser SlackBuilderCommand slackBuilderCommand :: Parser SlackBuilderCommand
slackBuilderCommand = subparser slackBuilderCommand = subparser
$ command "text" (info (TextCommand <$> textArguments) mempty) $ command "text" (info (TextCommand <$> textArguments) mempty)
<> command "github" (info (GhCommand <$> ghArguments) mempty)
<> command "slackbuild" (info slackBuildCommand mempty) <> command "slackbuild" (info slackBuildCommand mempty)
<> command "commit" (info commitCommand mempty) <> command "commit" (info commitCommand mempty)
<> command "exists" (info existsCommand mempty) <> command "exists" (info existsCommand mempty)

View File

@ -20,21 +20,6 @@ module SlackBuilder
end end
end end
# Reads the list fo tags from the GitHub API.
class GitHub < Repository
def initialize(owner, name, version_transform = nil)
super()
@owner = owner
@name = name
@version_transform = version_transform
end
def latest
`./bin/slackbuilder github #{@owner} #{@name} #{@version_transform}`.strip
end
end
# Reads a remote LATEST file. # Reads a remote LATEST file.
class LatestText < Repository class LatestText < Repository
def initialize(latest_url) def initialize(latest_url)