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

This commit is contained in:
2023-03-18 13:15:12 +01:00
parent a24f1b436e
commit 6b634b4055
3 changed files with 67 additions and 88 deletions

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,67 +109,23 @@ 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)
['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
private_class_method def self.upload_command(local_path, remote_path)
['scp', "slackbuilds/#{local_path}", CONFIG[:remote_path] + remote_path]
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}")
end
sh 'git', 'clone', repo, name_version
sh 'git', '-C', name_version, 'checkout', "#{tag_prefix}#{version}"
sh 'git', '-C', name_version, 'submodule', 'update', '--init', '--recursive'
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
sh 'tar', 'Jcvf', "slackbuilds/#{tarball}", name_version
rm_rf name_version
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)