# 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' task :dmd, [:version] do |_, arguments| raise 'Version is not specified.' unless arguments.key? :version dub_version = '1.30.0' dscanner_version = '0.12.2' dcd_version = '0.13.6' 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 = 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 = 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 do raise 'Version is not specified.' unless arguments.key? :version checksum = {} checksum[:hhvm] = 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(hosted_sources("/hhvm/hhvm-#{package.version}.tar.xz"), checksum[:hhvm], is64: true) ] update_slackbuild_version 'development/hhvm', package.version end task :ioncube do raise 'Version is not specified.' unless arguments.key? :version tarball_name = { '32' => "ioncube_loaders_lin_x86_#{arguments[:version]}.tar.gz", '64' => "ioncube_loaders_lin_x86-64_#{arguments[:version]}.tar.gz" } uri = { '32' => URI("http://downloads3.ioncube.com/loader_downloads/#{tarball_name['32']}"), '64' => URI("http://downloads3.ioncube.com/loader_downloads/#{tarball_name['64']}") } checksum = { '32' => download(uri['32'], "slackbuilds/development/ioncube-loader/#{tarball_name['32']}").hexdigest, '64' => download(uri['64'], "slackbuilds/development/ioncube-loader/#{tarball_name['64']}").hexdigest } package = Package.new 'development/ioncube-loader', version: arguments[:version], homepage: 'https://www.ioncube.com' write_info package, downloads: [ Download.new(uri['32'], checksum['32']), Download.new(uri['64'], checksum['64'], is64: true) ] update_slackbuild_version 'development/ioncube-loader', package.version commit 'development/ioncube-loader', package.version end task :webex do tarball = 'slackbuilds/network/webex/Webex.deb' uri = 'https://binaries.webex.com/WebexDesktop-Ubuntu-Official-Package/Webex.deb' checksum = 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