Replace eol ioncube with php82
Some checks reported warnings
test Test.

This commit is contained in:
Eugen Wissner 2023-03-18 13:15:12 +01:00
parent a24f1b436e
commit 6b634b4055
Signed by: belka
GPG Key ID: A27FDC1E8EE902C0
3 changed files with 67 additions and 88 deletions

View File

@ -62,7 +62,7 @@ task :hhvm do
raise 'Version is not specified.' unless arguments.key? :version
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-'
package = Package.new 'development/hhvm',
@ -72,39 +72,28 @@ task :hhvm do
write_info package,
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
end
task :ioncube do
task 'php', [:version] do |_, arguments|
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' => 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',
package = Package.new 'development/php82',
version: arguments[:version],
homepage: 'https://www.ioncube.com'
homepage: 'https://www.php.net/',
requires: ['postgresql']
write_info package,
downloads: [
Download.new(uri['32'], checksum['32']),
Download.new(uri['64'], checksum['64'], is64: true)
]
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
update_slackbuild_version 'development/ioncube-loader', package.version
commit 'development/ioncube-loader', package.version
write_info package, downloads: [Download.new(uri, checksum)]
update_slackbuild_version 'development/php82', arguments[:version]
commit 'development/php82', arguments[:version]
end
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"
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"
write_info package, downloads: [Download.new(download, checksum)]

View File

@ -14,19 +14,21 @@ require 'term/ansicolor'
module SlackBuilder
extend Rake::FileUtilsExt
def self.clone(repo, package, tag_prefix = 'v')
repository = Pathname.new('pkg') + package.name_version
def self.clone(repo, tarball, tag_prefix = 'v')
name_version = File.basename tarball, '.tar.xz'
remote_path = tarball[tarball.index('/')..]
if repository.directory?
sh 'git', '-C', repository.to_path, 'remote', 'update', '--prune'
else
sh 'git', 'clone', repo, repository.to_path
if remote_file_exists?(remote_path)
uri = URI hosted_sources(remote_path)
return download(uri, "slackbuilds/#{tarball}").hexdigest
end
sh 'git', '-C', repository.to_path, 'checkout', "#{tag_prefix}#{package.version}"
sh 'git', '-C', repository.to_path, 'submodule', 'update', '--init', '--recursive'
clone_and_archive repo, name_version, tarball, tag_prefix
repository
sh(*upload_command(tarball, remote_path))
Digest::MD5.hexdigest File.read("slackbuilds/#{tarball}")
end
def self.download(uri, target)
@ -41,6 +43,33 @@ module SlackBuilder
checksum
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)
puts 'redirecting...'
new_location = URI location
@ -80,27 +109,12 @@ module SlackBuilder
end
end
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 upload_command(local_path, remote_path)
private_class_method def self.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')
private_class_method def self.clone_and_archive(repo, name_version, tarball, tag_prefix = 'v')
_, _, version = name_version.rpartition '-'
rm_rf name_version
@ -112,35 +126,6 @@ def clone_and_archive(repo, name_version, tarball, tag_prefix = 'v')
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
clone_and_archive repo, name_version, tarball, tag_prefix
sh(*upload_command(tarball, remote_path))
Digest::MD5.hexdigest File.read("slackbuilds/#{tarball}")
end
def download_and_deploy(uri, tarball)
remote_path = tarball[tarball.index('/')..]
if remote_file_exists?(remote_path)
uri = URI hosted_sources(remote_path)
return SlackBuilder.download(uri, "slackbuilds/#{tarball}").hexdigest
end
checksum = SlackBuilder.download uri, "slackbuilds/#{tarball}"
sh(*upload_command(tarball, remote_path))
checksum.hexdigest
end
def write_info(package, downloads:)
@ -149,6 +134,8 @@ def write_info(package, downloads:)
end
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
slackbuild_filename = "slackbuilds/#{package_path}/#{name}.SlackBuild"
slackbuild_contents = File.read(slackbuild_filename)

3
test.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
bundle install