# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at https://mozilla.org/MPL/2.0/. # frozen_string_literal: true require 'digest/md5' require 'net/http' require 'open3' require_relative 'config/config' require_relative 'lib/package' require_relative 'lib/download' require_relative 'lib/up2date' task :dmd, [:version] do |_, arguments| raise 'Version is not specified.' unless arguments.key? :version dub_version = '1.32.1' dscanner_version = '0.14.0' dcd_version = '0.15.2' SlackBuilder::DmdTools.update_dmd arguments[:version] 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 checksum = {} checksum[:hhvm] = SlackBuilder.clone 'https://github.com/facebook/hhvm.git', "development/hhvm/hhvm-#{arguments[:version]}.tar.xz", 'HHVM-' package = Package.new 'development/hhvm', version: arguments[:version], homepage: 'https://hhvm.com/', requires: %w[tbb glog libdwarf libmemcached dobule-conversion] write_info package, downloads: [ Download.new(SlackBuilder.hosted_sources("/hhvm/hhvm-#{package.version}.tar.xz"), checksum[:hhvm], is64: true) ] update_slackbuild_version 'development/hhvm', package.version end task 'php', [:version] do |_, arguments| raise 'Version is not specified.' unless arguments.key? :version package = Package.new 'development/php82', version: arguments[:version], homepage: 'https://www.php.net/', requires: ['postgresql'] uri = "https://www.php.net/distributions/php-#{arguments[:version]}.tar.xz" tarball = "slackbuilds/development/php82/php-#{arguments[:version]}.tar.xz" checksum = SlackBuilder.download URI(uri), tarball write_info package, downloads: [Download.new(uri, checksum)] update_slackbuild_version 'development/php82', arguments[:version] commit 'development/php82', arguments[:version] end task :webex do tarball = 'slackbuilds/network/webex/Webex.deb' uri = 'https://binaries.webex.com/WebexDesktop-Ubuntu-Official-Package/Webex.deb' checksum = SlackBuilder.download URI(uri), tarball last_stdout, = Open3.pipeline_r ['ar', 'p', tarball, 'control.tar.gz'], ['tar', 'zxO', './control'] version = last_stdout.read.lines .find { |line| line.start_with? 'Version: ' } .split.last package = Package.new 'network/webex', version: version, homepage: 'https://www.webex.com' write_info package, downloads: [Download.new(uri, checksum, is64: true)] update_slackbuild_version 'network/webex', package.version commit 'network/webex', package.version 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 php_transform = proc do |version| version.delete_prefix 'php-' if version.match?(/^php-8\.2\.[[:digit:]+]$/) end AUTO_UPDATABLE = { 'universal-ctags' => SlackBuilder::GitHub.new('universal-ctags', 'ctags'), 'composer' => SlackBuilder::Packagist.new('composer', 'composer'), 'php82' => SlackBuilder::GitHub.new('php', 'php-src', php_transform), 'rdiff-backup' => SlackBuilder::GitHub.new('rdiff-backup', 'rdiff-backup'), 'librsync' => SlackBuilder::GitHub.new('librsync', 'librsync'), 'jitsi-meet-desktop' => SlackBuilder::GitHub.new('jitsi', 'jitsi-meet-electron') }.freeze task :up2date do AUTO_UPDATABLE.each do |key, value| latest_version = SlackBuilder.check_for_latest key, value end end