From bed90e3e02479c3168027bfdb4e4830f80e355f1 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Thu, 13 Jul 2023 18:03:02 +0200 Subject: [PATCH] rdiff-backup: Fix version detection --- Rakefile | 59 ++++++++++++++++++++------------------------------------ 1 file changed, 21 insertions(+), 38 deletions(-) diff --git a/Rakefile b/Rakefile index 91fcd54..2f3b374 100644 --- a/Rakefile +++ b/Rakefile @@ -23,42 +23,6 @@ task :dmd, [:version] do |_, arguments| SlackBuilder::DmdTools.update_tools arguments[:version], dub_version, dscanner_version, dcd_version end -task :composer, [:version] do |_, arguments| - raise 'Version is not specified.' unless arguments.key? :version - - package = Package.new 'development/composer', - version: arguments[:version], - homepage: 'https://getcomposer.org/' - - uri = "https://getcomposer.org/download/#{arguments[:version]}/composer.phar" - checksum = SlackBuilder.download URI(uri), 'slackbuilds/development/composer/composer.phar' - write_info package, downloads: [Download.new(uri, checksum.hexdigest)] - update_slackbuild_version 'development/composer', arguments[:version] - - commit 'development/composer', arguments[:version] -end - -task 'universal-ctags', [:version] do |_, arguments| - raise 'Version is not specified.' unless arguments.key? :version - - package = Package.new 'development/universal-ctags', - version: arguments[:version], - homepage: 'https://ctags.io/', - requires: ['%README%'] - - uri = "https://github.com/universal-ctags/ctags/archive/#{arguments[:version]}/ctags-#{arguments[:version]}.tar.gz" - tarball = "slackbuilds/development/universal-ctags/ctags-#{arguments[:version]}.tar.gz" - checksum = SlackBuilder.download URI(uri), tarball - download = "https://download.dlackware.com/hosted-sources/universal-ctags/ctags-#{arguments[:version]}.tar.gz" - - write_info package, - downloads: [Download.new(download, checksum.hexdigest)] - update_slackbuild_version 'development/universal-ctags', arguments[:version] - sh 'scp', tarball, "#{CONFIG[:remote_path]}/universal-ctags" - - commit 'development/universal-ctags', arguments[:version] -end - task :hhvm, [:version] do |_, arguments| raise 'Version is not specified.' unless arguments.key? :version @@ -171,17 +135,36 @@ module SlackBuilder requires: ['%README%'] end end + + class Composer < Updater + def update(version) + package = Package.new 'development/composer', + version: version, + homepage: 'https://getcomposer.org/' + + uri = "https://getcomposer.org/download/#{version}/composer.phar" + checksum = SlackBuilder.download URI(uri), 'slackbuilds/development/composer/composer.phar' + write_info package, downloads: [Download.new(uri, checksum.hexdigest)] + update_slackbuild_version 'development/composer', version + + commit 'development/composer', version + end + end end php_transform = proc do |version| version.delete_prefix 'php-' if version.match?(/^php-8\.2\.[[:digit:]+]$/) end +rdiff_backup_transform = proc do |version| + version.delete_prefix 'v' if version.match?(/^v\d+\.\d+\.\d+/) +end + AUTO_UPDATABLE = { 'universal-ctags' => [SlackBuilder::GitHub.new('universal-ctags', 'ctags'), SlackBuilder::UniversalCtags.new], - 'composer' => [SlackBuilder::Packagist.new('composer', 'composer')], + 'composer' => [SlackBuilder::Packagist.new('composer', 'composer'), SlackBuilder::Composer.new], 'php82' => [SlackBuilder::GitHub.new('php', 'php-src', php_transform)], - 'rdiff-backup' => [SlackBuilder::GitHub.new('rdiff-backup', 'rdiff-backup')], + 'rdiff-backup' => [SlackBuilder::GitHub.new('rdiff-backup', 'rdiff-backup', rdiff_backup_transform)], 'librsync' => [SlackBuilder::GitHub.new('librsync', 'librsync')], 'jitsi-meet-desktop' => [SlackBuilder::GitHub.new('jitsi', 'jitsi-meet-electron')], 'dmd' => [SlackBuilder::LatestText.new('https://downloads.dlang.org/releases/LATEST')]