Replace hhvm updater

This commit is contained in:
Eugen Wissner 2021-05-04 07:47:24 +02:00
parent f0975ea4a1
commit 6e15f2340d
Signed by: belka
GPG Key ID: A27FDC1E8EE902C0
5 changed files with 82 additions and 93 deletions

View File

@ -27,8 +27,7 @@ task :dmd do
homepage: 'https://dlang.org'
write_info package,
download: [uri.to_s],
md5sum: [checksum[:dmd]]
downloads: [Download.new(uri.to_s, checksum[:dmd])]
update_slackbuild_version 'development/dmd', version
commit 'development/dmd', version
@ -52,17 +51,11 @@ task :dmd do
requires: ['dmd']
write_info package,
download: [
hosted_sources("/d-tools/dub-#{dub_version}.tar.gz"),
hosted_sources("/d-tools/tools-#{version}.tar.gz"),
hosted_sources("/d-tools/D-Scanner-#{dscanner_version}.tar.xz"),
hosted_sources("/d-tools/DCD-#{dcd_version}.tar.xz")
],
md5sum: [
checksum[:dub],
checksum[:tools],
checksum[:dscanner],
checksum[:dcd]
downloads: [
Download.new(hosted_sources("/d-tools/dub-#{dub_version}.tar.gz"), checksum[:dub]),
Download.new(hosted_sources("/d-tools/tools-#{version}.tar.gz"), checksum[:tools]),
Download.new(hosted_sources("/d-tools/D-Scanner-#{dscanner_version}.tar.xz"), checksum[:dscanner]),
Download.new(hosted_sources("/d-tools/DCD-#{dcd_version}.tar.xz"), checksum[:dcd])
]
slackbuild_filename = 'slackbuilds/development/d-tools/d-tools.SlackBuild'
@ -89,8 +82,7 @@ task :composer do
uri = URI "https://getcomposer.org/download/#{version}/composer.phar"
checksum = download uri, 'slackbuilds/development/composer/composer.phar'
write_info package,
download: ["https://getcomposer.org/download/#{version}/composer.phar"],
md5sum: [checksum.hexdigest]
downloads: [Download.new("https://getcomposer.org/download/#{version}/composer.phar", checksum.hexdigest)]
update_slackbuild_version 'development/composer', version
commit 'development/composer', version
@ -116,10 +108,10 @@ task 'universal-ctags' do
package = Package.new 'development/universal-ctags',
version: version,
homepage: 'https://ctags.io/'
download = "https://download.dlackware.com/hosted-sources/universal-ctags/ctags-#{ENV['COMMIT']}.tar.xz"
write_info package,
download: ["https://download.dlackware.com/hosted-sources/universal-ctags/ctags-#{ENV['COMMIT']}.tar.xz"],
md5sum: [checksum.hexdigest]
downloads: [Download.new(download, checksum.hexdigest)]
update_slackbuild_version 'development/universal-ctags', version
sh 'sed',
'-i',
@ -128,3 +120,23 @@ task 'universal-ctags' do
commit 'development/universal-ctags', version
end
task :hhvm do
version = '4.104.1'
checksum = {}
checksum[:hhvm] = clone 'https://github.com/facebook/hhvm.git',
"development/hhvm/hhvm-#{version}.tar.xz", 'HHVM-'
package = Package.new 'development/hhvm',
version: version,
homepage: 'https://hhvm.com/',
requires: %w[tbb glog libdwarf libmemcached dobule-conversion]
write_info package,
downloads: [
Download.new(hosted_sources("/hhvm/hhvm-#{version}.tar.xz"), checksum[:hhvm], is64: true)
]
update_slackbuild_version 'development/hhvm', version
end

View File

@ -4,4 +4,4 @@ CONFIG = {
remote_path: 'example.com:/srv/httpd/some/path',
download_url: 'https://example.com/some/path',
branch: 'user/nick/updates'
}
}.freeze

View File

@ -72,20 +72,20 @@ 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)
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 v#{version}"
sh "git -C #{name_version} submodule update --init --recursive"
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}"
sh 'tar', 'Jcvf', "slackbuilds/#{tarball}", name_version
rm_rf name_version
end
def clone(repo, tarball)
def clone(repo, tarball, tag_prefix = 'v')
name_version = File.basename tarball, '.tar.xz'
remote_path = tarball[tarball.index('/')..]
@ -95,7 +95,7 @@ def clone(repo, tarball)
return download(uri, "slackbuilds/#{tarball}").hexdigest
end
clone_and_archive repo, name_version, tarball
clone_and_archive repo, name_version, tarball, tag_prefix
sh(*upload_command(tarball, remote_path))
@ -115,9 +115,9 @@ def download_and_deploy(uri, tarball)
checksum.hexdigest
end
def write_info(package, download:, md5sum:)
def write_info(package, downloads:)
File.open "slackbuilds/#{package.path}/#{package.name}.info", 'w' do |file|
file.write info_template(package, download, md5sum)
file.write info_template(package, downloads)
end
end

View File

@ -19,17 +19,54 @@ class Package
end
end
def info_template(package, download, md5sum)
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="#{download * " \\\n "}"
MD5SUM="#{md5sum * " \\\n "}"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES="#{package.requires.empty? ? '%README%' : package.requires * ' '}"
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.empty? ? '%README%' : 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

View File

@ -1,60 +0,0 @@
#!/bin/bash
# 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/.
VERSION=${VERSION:-4.32.0}
set -e
git clone https://github.com/facebook/hhvm.git
mv hhvm hhvm-$VERSION
cd hhvm-$VERSION
git checkout HHVM-$VERSION
git submodule update --init --recursive
cd third-party
rm -rf libsqlite3 \
lz4 \
pcre
# libzip
cd ..
find -name "\.git*" -print0 | xargs -0 rm -rf
cd ..
tar Jcvf hhvm-$VERSION.tar.xz hhvm-$VERSION
rm -rf hhvm-$VERSION
scp hhvm-$VERSION.tar.xz caraus.de:/srv/httpd/dlackware/download/hosted-sources/hhvm
CHECKSUM=`md5sum hhvm-$VERSION.tar.xz | cut -d ' ' -f 1`
cat <<EOF > hhvm.info
PRGNAM="hhvm"
VERSION="$VERSION"
HOMEPAGE="https://hhvm.com/"
DOWNLOAD="UNSUPPORTED"
MD5SUM=""
DOWNLOAD_x86_64="https://download.dlackware.com/hosted-sources/hhvm/hhvm-${VERSION}.tar.xz"
MD5SUM_x86_64="$CHECKSUM"
REQUIRES="tbb glog dwarf oniguruma libmemcached krb5 lz4 libsodium"
MAINTAINER="Eugene Wissner"
EMAIL="belka@caraus.de"
EOF
rm -f slackbuilds/development/hhvm/*.tar.xz
mv \
hhvm.info \
hhvm-$VERSION.tar.xz \
slackbuilds/development/hhvm/
cd slackbuilds/development/hhvm
# Update version in the SlackBuild.
sed -i "s#^\(VERSION=\)\${VERSION:-.\+#\1\${VERSION:-$VERSION}#" hhvm.SlackBuild
BRANCH="hhvm${VERSION//.}"
git checkout master
git checkout -b $BRANCH
git add .
git commit -m "development/hhvm: Updated for version $VERSION"
#git push origin $BRANCH