slackbuilder/Rakefile

81 lines
2.6 KiB
Ruby

# 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.33.0'
dscanner_version = '0.15.2'
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 :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 :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
AUTO_UPDATABLE = {
'dmd' => [SlackBuilder::LatestText.new('https://downloads.dlang.org/releases/LATEST')]
}.freeze
task :up2date do
AUTO_UPDATABLE.each do |key, value|
repository, updater = value
latest_version = SlackBuilder.check_for_latest key, repository
next if latest_version.nil? || updater.nil?
puts "Would like to update #{key} to #{latest_version} (y/N)? "
updater.update latest_version if $stdin.gets.chomp.downcase.start_with? 'y'
end
end