Replace eol ioncube with php82
Some checks reported warnings
test Test.
Some checks reported warnings
test Test.
This commit is contained in:
parent
a24f1b436e
commit
6b634b4055
39
Rakefile
39
Rakefile
@ -62,7 +62,7 @@ task :hhvm do
|
|||||||
raise 'Version is not specified.' unless arguments.key? :version
|
raise 'Version is not specified.' unless arguments.key? :version
|
||||||
|
|
||||||
checksum = {}
|
checksum = {}
|
||||||
checksum[:hhvm] = clone 'https://github.com/facebook/hhvm.git',
|
checksum[:hhvm] = SlackBuilder.clone 'https://github.com/facebook/hhvm.git',
|
||||||
"development/hhvm/hhvm-#{arguments[:version]}.tar.xz", 'HHVM-'
|
"development/hhvm/hhvm-#{arguments[:version]}.tar.xz", 'HHVM-'
|
||||||
|
|
||||||
package = Package.new 'development/hhvm',
|
package = Package.new 'development/hhvm',
|
||||||
@ -72,39 +72,28 @@ task :hhvm do
|
|||||||
|
|
||||||
write_info package,
|
write_info package,
|
||||||
downloads: [
|
downloads: [
|
||||||
Download.new(hosted_sources("/hhvm/hhvm-#{package.version}.tar.xz"), checksum[:hhvm], is64: true)
|
Download.new(SlackBuilder.hosted_sources("/hhvm/hhvm-#{package.version}.tar.xz"), checksum[:hhvm], is64: true)
|
||||||
]
|
]
|
||||||
|
|
||||||
update_slackbuild_version 'development/hhvm', package.version
|
update_slackbuild_version 'development/hhvm', package.version
|
||||||
end
|
end
|
||||||
|
|
||||||
task :ioncube do
|
task 'php', [:version] do |_, arguments|
|
||||||
raise 'Version is not specified.' unless arguments.key? :version
|
raise 'Version is not specified.' unless arguments.key? :version
|
||||||
|
|
||||||
tarball_name = {
|
package = Package.new 'development/php82',
|
||||||
'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' => SlackBuilder.download(uri['32'], "slackbuilds/development/ioncube-loader/#{tarball_name['32']}").hexdigest,
|
|
||||||
'64' => SlackBuilder.download(uri['64'], "slackbuilds/development/ioncube-loader/#{tarball_name['64']}").hexdigest
|
|
||||||
}
|
|
||||||
package = Package.new 'development/ioncube-loader',
|
|
||||||
version: arguments[:version],
|
version: arguments[:version],
|
||||||
homepage: 'https://www.ioncube.com'
|
homepage: 'https://www.php.net/',
|
||||||
|
requires: ['postgresql']
|
||||||
|
|
||||||
write_info package,
|
uri = "https://www.php.net/distributions/php-#{arguments[:version]}.tar.xz"
|
||||||
downloads: [
|
tarball = "slackbuilds/development/php82/php-#{arguments[:version]}.tar.xz"
|
||||||
Download.new(uri['32'], checksum['32']),
|
checksum = SlackBuilder.download URI(uri), tarball
|
||||||
Download.new(uri['64'], checksum['64'], is64: true)
|
|
||||||
]
|
|
||||||
|
|
||||||
update_slackbuild_version 'development/ioncube-loader', package.version
|
write_info package, downloads: [Download.new(uri, checksum)]
|
||||||
commit 'development/ioncube-loader', package.version
|
update_slackbuild_version 'development/php82', arguments[:version]
|
||||||
|
|
||||||
|
commit 'development/php82', arguments[:version]
|
||||||
end
|
end
|
||||||
|
|
||||||
task :webex do
|
task :webex do
|
||||||
@ -138,7 +127,7 @@ task 'rdiff-backup', [:version] do |_, arguments|
|
|||||||
|
|
||||||
uri = "https://github.com/rdiff-backup/rdiff-backup/releases/download/v#{arguments[:version]}/rdiff-backup-#{arguments[:version]}.tar.gz"
|
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"
|
tarball = "system/rdiff-backup/rdiff-backup-#{arguments[:version]}.tar.gz"
|
||||||
checksum = download_and_deploy URI(uri), tarball
|
checksum = SlackBuilder.download_and_deploy URI(uri), tarball
|
||||||
download = "https://download.dlackware.com/hosted-sources/rdiff-backup/rdiff-backup-#{arguments[:version]}.tar.gz"
|
download = "https://download.dlackware.com/hosted-sources/rdiff-backup/rdiff-backup-#{arguments[:version]}.tar.gz"
|
||||||
|
|
||||||
write_info package, downloads: [Download.new(download, checksum)]
|
write_info package, downloads: [Download.new(download, checksum)]
|
||||||
|
113
lib/download.rb
113
lib/download.rb
@ -14,19 +14,21 @@ require 'term/ansicolor'
|
|||||||
module SlackBuilder
|
module SlackBuilder
|
||||||
extend Rake::FileUtilsExt
|
extend Rake::FileUtilsExt
|
||||||
|
|
||||||
def self.clone(repo, package, tag_prefix = 'v')
|
def self.clone(repo, tarball, tag_prefix = 'v')
|
||||||
repository = Pathname.new('pkg') + package.name_version
|
name_version = File.basename tarball, '.tar.xz'
|
||||||
|
remote_path = tarball[tarball.index('/')..]
|
||||||
|
|
||||||
if repository.directory?
|
if remote_file_exists?(remote_path)
|
||||||
sh 'git', '-C', repository.to_path, 'remote', 'update', '--prune'
|
uri = URI hosted_sources(remote_path)
|
||||||
else
|
|
||||||
sh 'git', 'clone', repo, repository.to_path
|
return download(uri, "slackbuilds/#{tarball}").hexdigest
|
||||||
end
|
end
|
||||||
|
|
||||||
sh 'git', '-C', repository.to_path, 'checkout', "#{tag_prefix}#{package.version}"
|
clone_and_archive repo, name_version, tarball, tag_prefix
|
||||||
sh 'git', '-C', repository.to_path, 'submodule', 'update', '--init', '--recursive'
|
|
||||||
|
|
||||||
repository
|
sh(*upload_command(tarball, remote_path))
|
||||||
|
|
||||||
|
Digest::MD5.hexdigest File.read("slackbuilds/#{tarball}")
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.download(uri, target)
|
def self.download(uri, target)
|
||||||
@ -41,6 +43,33 @@ module SlackBuilder
|
|||||||
checksum
|
checksum
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def hosted_sources(absolute_url)
|
||||||
|
CONFIG[:download_url] + absolute_url
|
||||||
|
end
|
||||||
|
|
||||||
|
def remote_file_exists?(url)
|
||||||
|
uri = URI hosted_sources(url)
|
||||||
|
|
||||||
|
request = Net::HTTP.new uri.host, uri.port
|
||||||
|
request.use_ssl = true
|
||||||
|
response = request.request_head uri.path
|
||||||
|
|
||||||
|
response.code.to_i == 200
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.download_and_deploy(uri, tarball)
|
||||||
|
remote_path = tarball[tarball.index('/')..]
|
||||||
|
|
||||||
|
if SlackBuilder.remote_file_exists?(remote_path)
|
||||||
|
uri = URI hosted_sources(remote_path)
|
||||||
|
return download(uri, "slackbuilds/#{tarball}").hexdigest
|
||||||
|
end
|
||||||
|
|
||||||
|
checksum = download uri, "slackbuilds/#{tarball}"
|
||||||
|
sh(*upload_command(tarball, remote_path))
|
||||||
|
checksum.hexdigest
|
||||||
|
end
|
||||||
|
|
||||||
private_class_method def self.redirect_download(location, target)
|
private_class_method def self.redirect_download(location, target)
|
||||||
puts 'redirecting...'
|
puts 'redirecting...'
|
||||||
new_location = URI location
|
new_location = URI location
|
||||||
@ -80,67 +109,23 @@ module SlackBuilder
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def hosted_sources(absolute_url)
|
private_class_method def self.upload_command(local_path, remote_path)
|
||||||
CONFIG[:download_url] + absolute_url
|
['scp', "slackbuilds/#{local_path}", CONFIG[:remote_path] + remote_path]
|
||||||
end
|
|
||||||
|
|
||||||
def remote_file_exists?(url)
|
|
||||||
uri = URI hosted_sources(url)
|
|
||||||
|
|
||||||
request = Net::HTTP.new uri.host, uri.port
|
|
||||||
request.use_ssl = true
|
|
||||||
response = request.request_head uri.path
|
|
||||||
|
|
||||||
response.code.to_i == 200
|
|
||||||
end
|
|
||||||
|
|
||||||
def upload_command(local_path, remote_path)
|
|
||||||
['scp', "slackbuilds/#{local_path}", CONFIG[:remote_path] + remote_path]
|
|
||||||
end
|
|
||||||
|
|
||||||
def clone_and_archive(repo, name_version, tarball, tag_prefix = 'v')
|
|
||||||
_, _, version = name_version.rpartition '-'
|
|
||||||
|
|
||||||
rm_rf name_version
|
|
||||||
|
|
||||||
sh 'git', 'clone', repo, name_version
|
|
||||||
sh 'git', '-C', name_version, 'checkout', "#{tag_prefix}#{version}"
|
|
||||||
sh 'git', '-C', name_version, 'submodule', 'update', '--init', '--recursive'
|
|
||||||
|
|
||||||
sh 'tar', 'Jcvf', "slackbuilds/#{tarball}", name_version
|
|
||||||
rm_rf name_version
|
|
||||||
end
|
|
||||||
|
|
||||||
def clone(repo, tarball, tag_prefix = 'v')
|
|
||||||
name_version = File.basename tarball, '.tar.xz'
|
|
||||||
remote_path = tarball[tarball.index('/')..]
|
|
||||||
|
|
||||||
if remote_file_exists?(remote_path)
|
|
||||||
uri = URI hosted_sources(remote_path)
|
|
||||||
|
|
||||||
return download(uri, "slackbuilds/#{tarball}").hexdigest
|
|
||||||
end
|
end
|
||||||
|
|
||||||
clone_and_archive repo, name_version, tarball, tag_prefix
|
private_class_method def self.clone_and_archive(repo, name_version, tarball, tag_prefix = 'v')
|
||||||
|
_, _, version = name_version.rpartition '-'
|
||||||
|
|
||||||
sh(*upload_command(tarball, remote_path))
|
rm_rf name_version
|
||||||
|
|
||||||
Digest::MD5.hexdigest File.read("slackbuilds/#{tarball}")
|
sh 'git', 'clone', repo, name_version
|
||||||
end
|
sh 'git', '-C', name_version, 'checkout', "#{tag_prefix}#{version}"
|
||||||
|
sh 'git', '-C', name_version, 'submodule', 'update', '--init', '--recursive'
|
||||||
|
|
||||||
def download_and_deploy(uri, tarball)
|
sh 'tar', 'Jcvf', "slackbuilds/#{tarball}", name_version
|
||||||
remote_path = tarball[tarball.index('/')..]
|
rm_rf name_version
|
||||||
|
|
||||||
if remote_file_exists?(remote_path)
|
|
||||||
uri = URI hosted_sources(remote_path)
|
|
||||||
return SlackBuilder.download(uri, "slackbuilds/#{tarball}").hexdigest
|
|
||||||
end
|
end
|
||||||
|
|
||||||
checksum = SlackBuilder.download uri, "slackbuilds/#{tarball}"
|
|
||||||
sh(*upload_command(tarball, remote_path))
|
|
||||||
checksum.hexdigest
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def write_info(package, downloads:)
|
def write_info(package, downloads:)
|
||||||
@ -149,6 +134,8 @@ def write_info(package, downloads:)
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update_slackbuild_version(package_path, version)
|
def update_slackbuild_version(package_path, version)
|
||||||
|
raise TypeError, %(expected a version string, got "#{version}") unless version.is_a?(String)
|
||||||
|
|
||||||
name = package_path.split('/').last
|
name = package_path.split('/').last
|
||||||
slackbuild_filename = "slackbuilds/#{package_path}/#{name}.SlackBuild"
|
slackbuild_filename = "slackbuilds/#{package_path}/#{name}.SlackBuild"
|
||||||
slackbuild_contents = File.read(slackbuild_filename)
|
slackbuild_contents = File.read(slackbuild_filename)
|
||||||
|
Loading…
Reference in New Issue
Block a user