Remove unused tasks
This commit is contained in:
parent
24e62c3439
commit
0023fe0337
110
Rakefile
110
Rakefile
@ -4,40 +4,106 @@
|
||||
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'pathname'
|
||||
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.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
|
||||
namespace :hhvm do
|
||||
def filter_set_hhvm_third_party_source_args(tokens)
|
||||
args = tokens[0]
|
||||
allowed_arguments = tokens[1..].each_slice(2)
|
||||
.filter do |key, _value|
|
||||
!key.end_with?('_URL') && !key.end_with?('_HASH')
|
||||
end
|
||||
|
||||
task :hhvm, [:version] do |_, arguments|
|
||||
raise 'Version is not specified.' unless arguments.key? :version
|
||||
allowed_arguments
|
||||
.flatten
|
||||
.prepend(" #{args}")
|
||||
.join("\n ")
|
||||
end
|
||||
|
||||
checksum = {}
|
||||
checksum[:hhvm] = SlackBuilder.clone 'https://github.com/facebook/hhvm.git',
|
||||
"development/hhvm/hhvm-#{arguments[:version]}.tar.xz", 'HHVM-'
|
||||
def split_set_hhvm_third_party_source_args(section_content)
|
||||
section_content
|
||||
.split("\n")
|
||||
.map do |line|
|
||||
hash_index = line.index '#'
|
||||
line = line[...hash_index] unless hash_index.nil?
|
||||
|
||||
line.strip
|
||||
end
|
||||
end
|
||||
|
||||
def rewrite_set_hhvm_third_party_source_args(contents)
|
||||
set_hhvm_start = contents.index 'SET_HHVM_THIRD_PARTY_SOURCE_ARGS('
|
||||
return nil if set_hhvm_start.nil?
|
||||
|
||||
section_contents = contents[set_hhvm_start + 'SET_HHVM_THIRD_PARTY_SOURCE_ARGS('.length..]
|
||||
set_hhvm_end = section_contents.index ')'
|
||||
|
||||
lines = split_set_hhvm_third_party_source_args section_contents[...set_hhvm_end]
|
||||
new_cmake_section = filter_set_hhvm_third_party_source_args lines.reject(&:blank?).join(' ').split
|
||||
|
||||
contents[...set_hhvm_start] +
|
||||
"SET_HHVM_THIRD_PARTY_SOURCE_ARGS(\n#{new_cmake_section}\n)\n" +
|
||||
section_contents[set_hhvm_end..]
|
||||
end
|
||||
|
||||
desc 'Generates diffs with removed download URLs'
|
||||
task :bundled_dependencies, [:version] do |_, arguments|
|
||||
run_on_source arguments[:version] do |third_party|
|
||||
c_make_lists = third_party + 'CMakeLists.txt'
|
||||
next unless c_make_lists.exist?
|
||||
|
||||
contents = c_make_lists.read
|
||||
rewritten_cmake = rewrite_set_hhvm_third_party_source_args contents
|
||||
next if rewritten_cmake.nil?
|
||||
|
||||
puts Open3.capture2('diff', '-Nur', c_make_lists.to_path, '-', stdin_data: rewritten_cmake).first
|
||||
end
|
||||
end
|
||||
|
||||
desc 'Generated SlackBuild code to prepare bundled dependencies'
|
||||
task :bundled_code, [:version] do |_, arguments|
|
||||
run_on_source arguments[:version] do |third_party|
|
||||
c_make_lists = third_party + 'CMakeLists.txt'
|
||||
next unless c_make_lists.exist?
|
||||
|
||||
contents = c_make_lists.read
|
||||
set_hhvm_start = contents.index 'SET_HHVM_THIRD_PARTY_SOURCE_ARGS('
|
||||
next if set_hhvm_start.nil?
|
||||
|
||||
set_hhvm_end = contents.index ')', set_hhvm_start
|
||||
set_hhvm_start += 'SET_HHVM_THIRD_PARTY_SOURCE_ARGS('.length
|
||||
set_hhvm_end -= 1
|
||||
contents = contents[set_hhvm_start..set_hhvm_end].split[1..].map(&:strip)
|
||||
|
||||
src = Pathname.new('third-party') +
|
||||
third_party.basename +
|
||||
"bundled_#{third_party.basename}-prefix" + 'src'
|
||||
bundled = src + "bundled_#{third_party.basename}"
|
||||
archive_name = contents[1][contents[1].rindex('/') + 1..-2]
|
||||
|
||||
puts "mkdir -p #{bundled}"
|
||||
puts "install -m 0644 -D $CWD/#{archive_name} #{src + archive_name}"
|
||||
puts "tar -zxvf $CWD/#{archive_name} -C #{bundled}"
|
||||
puts
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def run_on_source(version, &block)
|
||||
package = Package.new 'development/hhvm',
|
||||
version: arguments[:version],
|
||||
version: version,
|
||||
homepage: 'https://hhvm.com/',
|
||||
requires: %w[tbb glog libdwarf libmemcached dobule-conversion]
|
||||
repository = SlackBuilder.clone 'https://github.com/facebook/hhvm.git', package, 'HHVM-'
|
||||
|
||||
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
|
||||
(repository + 'third-party').each_child do |third_party|
|
||||
block.call third_party
|
||||
end
|
||||
end
|
||||
|
@ -416,12 +416,8 @@ main = do
|
||||
categories <- liftIO $ findCategory repository'
|
||||
liftIO $ print $ splitFileName . makeRelative repository' <$> categories
|
||||
pure Nothing
|
||||
CommitCommand packagePath version ->
|
||||
commit packagePath version >> pure Nothing
|
||||
ExistsCommand urlPath -> pure . Text.pack . show
|
||||
<$> remoteFileExists urlPath
|
||||
ArchiveCommand repo nameVersion tarball tagPrefix ->
|
||||
cloneAndArchive repo nameVersion tarball tagPrefix >> pure Nothing
|
||||
DownloadCommand url target
|
||||
| Just uri' <- mkURI url -> fmap (Text.pack . show)
|
||||
<$> download uri' target
|
||||
|
@ -21,9 +21,7 @@ import Options.Applicative
|
||||
|
||||
data SlackBuilderCommand
|
||||
= CategoryCommand Text
|
||||
| CommitCommand Text Text
|
||||
| ExistsCommand Text
|
||||
| ArchiveCommand Text Text String Text
|
||||
| DownloadCommand Text String
|
||||
| CloneCommand Text Text Text
|
||||
| DownloadAndDeployCommand Text Text
|
||||
@ -51,9 +49,7 @@ slackBuilderParser = info slackBuilderCommand fullDesc
|
||||
slackBuilderCommand :: Parser SlackBuilderCommand
|
||||
slackBuilderCommand = subparser
|
||||
$ command "category" (info categoryCommand mempty)
|
||||
<> command "commit" (info commitCommand mempty)
|
||||
<> command "exists" (info existsCommand mempty)
|
||||
<> command "archive" (info archiveCommand mempty)
|
||||
<> command "download" (info downloadCommand mempty)
|
||||
<> command "clone" (info cloneCommand mempty)
|
||||
<> command "deploy" (info deployCommand mempty)
|
||||
@ -61,15 +57,7 @@ slackBuilderCommand = subparser
|
||||
where
|
||||
categoryCommand = CategoryCommand
|
||||
<$> argument str (metavar "PKGNAM")
|
||||
commitCommand = CommitCommand
|
||||
<$> argument str (metavar "PATH")
|
||||
<*> argument str (metavar "VERSION")
|
||||
existsCommand = ExistsCommand <$> argument str (metavar "PATH")
|
||||
archiveCommand = ArchiveCommand
|
||||
<$> argument str (metavar "REPO")
|
||||
<*> argument str (metavar "NAME_VERSION")
|
||||
<*> argument str (metavar "TARBALL")
|
||||
<*> argument str (metavar "TAG_PREFIX")
|
||||
downloadCommand = DownloadCommand
|
||||
<$> argument str (metavar "URI")
|
||||
<*> argument str (metavar "TARGET")
|
||||
|
@ -37,21 +37,4 @@ module SlackBuilder
|
||||
private_class_method def self.upload_command(local_path, remote_path)
|
||||
['scp', "slackbuilds/#{local_path}", CONFIG[:remote_path] + remote_path]
|
||||
end
|
||||
|
||||
private_class_method def self.clone_and_archive(repo, name_version, tarball, tag_prefix = 'v')
|
||||
sh './bin/slackbuilder', 'archive', repo, name_version, tarball, tag_prefix
|
||||
end
|
||||
end
|
||||
|
||||
def write_info(package, downloads:)
|
||||
File.write "slackbuilds/#{package.path}/#{package.name}.info",
|
||||
info_template(package, downloads)
|
||||
end
|
||||
|
||||
def update_slackbuild_version(package_path, version)
|
||||
sh './bin/slackbuilder', 'slackbuild', package_path, version
|
||||
end
|
||||
|
||||
def commit(package_path, version)
|
||||
sh './bin/slackbuilder', 'commit', package_path, version
|
||||
end
|
||||
|
@ -21,82 +21,4 @@ class Package
|
||||
def name_version
|
||||
"#{name}-#{@version}"
|
||||
end
|
||||
|
||||
def self.parse(path, info_contents)
|
||||
current_line = String.new ''
|
||||
variables = {}
|
||||
|
||||
info_contents.each_line(chomp: true) do |file_line|
|
||||
current_line << file_line.delete_suffix('\\')
|
||||
next if file_line.end_with? '\\'
|
||||
|
||||
variables.store(*parse_pair(current_line))
|
||||
current_line.clear
|
||||
end
|
||||
from_hash path, variables
|
||||
end
|
||||
|
||||
private_class_method def self.parse_pair(current_line)
|
||||
variable_name, variable_value = current_line.split '='
|
||||
[variable_name, variable_value[1...-1].split]
|
||||
end
|
||||
|
||||
private_class_method def self.from_hash(path, variables)
|
||||
Package.new path,
|
||||
version: variables['VERSION'].join,
|
||||
homepage: variables['HOMEPAGE'].join,
|
||||
requires: variables['REQUIRES']
|
||||
end
|
||||
end
|
||||
|
||||
class Download
|
||||
attr_reader :download, :md5sum
|
||||
|
||||
def initialize(download, md5sum, is64: false)
|
||||
@download = download
|
||||
@md5sum = md5sum
|
||||
@is64 = is64
|
||||
end
|
||||
|
||||
def is64?
|
||||
@is64
|
||||
end
|
||||
end
|
||||
|
||||
def info_template(package, downloads)
|
||||
downloads64, downloads32 = downloads.partition(&:is64?)
|
||||
download32, md5sum32, download64, md5sum64 = download_entries downloads64, downloads32
|
||||
|
||||
<<~INFO_FILE
|
||||
PRGNAM="#{package.name}"
|
||||
VERSION="#{package.version}"
|
||||
HOMEPAGE="#{package.homepage}"
|
||||
DOWNLOAD="#{download32}"
|
||||
MD5SUM="#{md5sum32}"
|
||||
DOWNLOAD_x86_64="#{download64}"
|
||||
MD5SUM_x86_64="#{md5sum64}"
|
||||
REQUIRES="#{requires_entry package.requires}"
|
||||
MAINTAINER="Eugene Wissner"
|
||||
EMAIL="belka@caraus.de"
|
||||
INFO_FILE
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def requires_entry(requires)
|
||||
requires * ' '
|
||||
end
|
||||
|
||||
def download_entries(downloads64, downloads32)
|
||||
download32 =
|
||||
if downloads32.empty? && !downloads64.empty?
|
||||
'UNSUPPORTED'
|
||||
else
|
||||
downloads32.map(&:download) * " \\\n "
|
||||
end
|
||||
md5sum32 = downloads32.map(&:md5sum) * " \\\n "
|
||||
download64 = downloads64.map(&:download) * " \\\n "
|
||||
md5sum64 = downloads64.map(&:md5sum) * " \\\n "
|
||||
|
||||
[download32, md5sum32, download64, md5sum64]
|
||||
end
|
||||
|
@ -1,85 +0,0 @@
|
||||
# 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 'rake'
|
||||
require_relative '../lib/download'
|
||||
|
||||
module SlackBuilder
|
||||
module DmdTools
|
||||
extend Rake::FileUtilsExt
|
||||
|
||||
def self.update_dmd(version)
|
||||
tarball_name = "dmd.#{version}.linux.tar.xz"
|
||||
|
||||
uri = URI "http://downloads.dlang.org/releases/2.x/#{version}/#{tarball_name}"
|
||||
checksum = SlackBuilder.download(uri, "slackbuilds/development/dmd/#{tarball_name}")
|
||||
|
||||
package = Package.new 'development/dmd', version: version,
|
||||
homepage: 'https://dlang.org'
|
||||
|
||||
write_info package, downloads: [Download.new(uri.to_s, checksum)]
|
||||
|
||||
update_slackbuild_version 'development/dmd', package.version
|
||||
commit 'development/dmd', version
|
||||
end
|
||||
|
||||
def self.update_tools(version, dub_version, dscanner_version, dcd_version)
|
||||
checksum = collect_checksums(version, dub_version, dscanner_version, dcd_version)
|
||||
|
||||
package = Package.new 'development/d-tools',
|
||||
version: version,
|
||||
homepage: 'https://dlang.org',
|
||||
requires: ['dmd']
|
||||
|
||||
write_tools_info package, dub_version, dscanner_version, dcd_version, checksum
|
||||
update_tools_versions dub_version, dscanner_version, dcd_version
|
||||
|
||||
update_slackbuild_version 'development/d-tools', package.version
|
||||
commit 'development/d-tools', package.version
|
||||
end
|
||||
|
||||
private_class_method def self.write_tools_info(package, dub_version, dscanner_version, dcd_version, checksum)
|
||||
write_info package,
|
||||
downloads: [
|
||||
Download.new(SlackBuilder.hosted_sources("/d-tools/dub-#{dub_version}.tar.gz"), checksum[:dub]),
|
||||
Download.new(SlackBuilder.hosted_sources("/d-tools/tools-#{package.version}.tar.gz"), checksum[:tools]),
|
||||
Download.new(
|
||||
SlackBuilder.hosted_sources("/d-tools/D-Scanner-#{dscanner_version}.tar.xz"), checksum[:dscanner]
|
||||
),
|
||||
Download.new(SlackBuilder.hosted_sources("/d-tools/DCD-#{dcd_version}.tar.xz"), checksum[:dcd])
|
||||
]
|
||||
end
|
||||
|
||||
private_class_method def self.collect_checksums(version, dub_version, dscanner_version, dcd_version)
|
||||
checksum = {}
|
||||
|
||||
uri = URI "https://codeload.github.com/dlang/tools/tar.gz/v#{version}"
|
||||
checksum[:tools] = SlackBuilder.download_and_deploy uri, "development/d-tools/tools-#{version}.tar.gz"
|
||||
|
||||
uri = URI "https://codeload.github.com/dlang/dub/tar.gz/v#{dub_version}"
|
||||
checksum[:dub] = SlackBuilder.download_and_deploy uri, "development/d-tools/dub-#{dub_version}.tar.gz"
|
||||
|
||||
checksum[:dscanner] = SlackBuilder.clone 'https://github.com/dlang-community/D-Scanner.git',
|
||||
"development/d-tools/D-Scanner-#{dscanner_version}.tar.xz"
|
||||
checksum[:dcd] = SlackBuilder.clone 'https://github.com/dlang-community/DCD.git',
|
||||
"development/d-tools/DCD-#{dcd_version}.tar.xz"
|
||||
|
||||
checksum
|
||||
end
|
||||
|
||||
private_class_method def self.update_tools_versions(dub_version, dscanner_version, dcd_version)
|
||||
slackbuild_filename = 'slackbuilds/development/d-tools/d-tools.SlackBuild'
|
||||
slackbuild_contents = File.read(slackbuild_filename)
|
||||
.gsub(/^DUB_VERSION=\${DUB_VERSION:-.+/,
|
||||
"DUB_VERSION=${DUB_VERSION:-#{dub_version}}")
|
||||
.gsub(/^DSCANNER_VERSION=\${DSCANNER_VERSION:-.+/,
|
||||
"DSCANNER_VERSION=${DSCANNER_VERSION:-#{dscanner_version}}")
|
||||
.gsub(/^DCD_VERSION=\${DCD_VERSION:-.+/,
|
||||
"DCD_VERSION=${DCD_VERSION:-#{dcd_version}}")
|
||||
File.open(slackbuild_filename, 'w') { |file| file.puts slackbuild_contents }
|
||||
end
|
||||
end
|
||||
end
|
@ -1,104 +0,0 @@
|
||||
# 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 'pathname'
|
||||
|
||||
namespace :hhvm do
|
||||
def filter_set_hhvm_third_party_source_args(tokens)
|
||||
args = tokens[0]
|
||||
allowed_arguments = tokens[1..].each_slice(2)
|
||||
.filter do |key, _value|
|
||||
!key.end_with?('_URL') && !key.end_with?('_HASH')
|
||||
end
|
||||
|
||||
allowed_arguments
|
||||
.flatten
|
||||
.prepend(" #{args}")
|
||||
.join("\n ")
|
||||
end
|
||||
|
||||
def split_set_hhvm_third_party_source_args(section_content)
|
||||
section_content
|
||||
.split("\n")
|
||||
.map do |line|
|
||||
hash_index = line.index '#'
|
||||
line = line[...hash_index] unless hash_index.nil?
|
||||
|
||||
line.strip
|
||||
end
|
||||
end
|
||||
|
||||
def rewrite_set_hhvm_third_party_source_args(contents)
|
||||
set_hhvm_start = contents.index 'SET_HHVM_THIRD_PARTY_SOURCE_ARGS('
|
||||
return nil if set_hhvm_start.nil?
|
||||
|
||||
section_contents = contents[set_hhvm_start + 'SET_HHVM_THIRD_PARTY_SOURCE_ARGS('.length..]
|
||||
set_hhvm_end = section_contents.index ')'
|
||||
|
||||
lines = split_set_hhvm_third_party_source_args section_contents[...set_hhvm_end]
|
||||
new_cmake_section = filter_set_hhvm_third_party_source_args lines.reject(&:blank?).join(' ').split
|
||||
|
||||
contents[...set_hhvm_start] +
|
||||
"SET_HHVM_THIRD_PARTY_SOURCE_ARGS(\n#{new_cmake_section}\n)\n" +
|
||||
section_contents[set_hhvm_end..]
|
||||
end
|
||||
|
||||
desc 'Generates diffs with removed download URLs'
|
||||
task :bundled_dependencies, [:version] do |_, arguments|
|
||||
run_on_source arguments[:version] do |third_party|
|
||||
c_make_lists = third_party + 'CMakeLists.txt'
|
||||
next unless c_make_lists.exist?
|
||||
|
||||
contents = c_make_lists.read
|
||||
rewritten_cmake = rewrite_set_hhvm_third_party_source_args contents
|
||||
next if rewritten_cmake.nil?
|
||||
|
||||
puts Open3.capture2('diff', '-Nur', c_make_lists.to_path, '-', stdin_data: rewritten_cmake).first
|
||||
end
|
||||
end
|
||||
|
||||
desc 'Generated SlackBuild code to prepare bundled dependencies'
|
||||
task :bundled_code, [:version] do |_, arguments|
|
||||
run_on_source arguments[:version] do |third_party|
|
||||
c_make_lists = third_party + 'CMakeLists.txt'
|
||||
next unless c_make_lists.exist?
|
||||
|
||||
contents = c_make_lists.read
|
||||
set_hhvm_start = contents.index 'SET_HHVM_THIRD_PARTY_SOURCE_ARGS('
|
||||
next if set_hhvm_start.nil?
|
||||
|
||||
set_hhvm_end = contents.index ')', set_hhvm_start
|
||||
set_hhvm_start += 'SET_HHVM_THIRD_PARTY_SOURCE_ARGS('.length
|
||||
set_hhvm_end -= 1
|
||||
contents = contents[set_hhvm_start..set_hhvm_end].split[1..].map(&:strip)
|
||||
|
||||
src = Pathname.new('third-party') +
|
||||
third_party.basename +
|
||||
"bundled_#{third_party.basename}-prefix" + 'src'
|
||||
bundled = src + "bundled_#{third_party.basename}"
|
||||
archive_name = contents[1][contents[1].rindex('/') + 1..-2]
|
||||
|
||||
puts "mkdir -p #{bundled}"
|
||||
puts "install -m 0644 -D $CWD/#{archive_name} #{src + archive_name}"
|
||||
puts "tar -zxvf $CWD/#{archive_name} -C #{bundled}"
|
||||
puts
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def run_on_source(version, &block)
|
||||
package = Package.new 'development/hhvm',
|
||||
version: version,
|
||||
homepage: 'https://hhvm.com/',
|
||||
requires: %w[tbb glog libdwarf libmemcached dobule-conversion]
|
||||
repository = SlackBuilder.clone 'https://github.com/facebook/hhvm.git', package, 'HHVM-'
|
||||
|
||||
(repository + 'third-party').each_child do |third_party|
|
||||
block.call third_party
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user