2020-12-09 18:28:42 +01:00
|
|
|
# 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
|
|
|
|
|
|
|
|
class Package
|
|
|
|
attr_reader :path
|
|
|
|
attr_reader :version
|
|
|
|
attr_reader :homepage
|
|
|
|
attr_reader :requires
|
|
|
|
|
|
|
|
def initialize(path, version:, homepage:, requires: [])
|
|
|
|
@path = path
|
|
|
|
@version = version
|
|
|
|
@homepage = homepage
|
|
|
|
@requires = requires
|
|
|
|
end
|
|
|
|
|
|
|
|
def name
|
|
|
|
File.basename @path
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def info_template(package, download, md5sum)
|
|
|
|
<<~INFO_FILE
|
|
|
|
PRGNAM="#{package.name}"
|
|
|
|
VERSION="#{package.version}"
|
|
|
|
HOMEPAGE="#{package.homepage}"
|
|
|
|
DOWNLOAD="#{download * " \\\n "}"
|
|
|
|
MD5SUM="#{md5sum * " \\\n "}"
|
|
|
|
DOWNLOAD_x86_64=""
|
|
|
|
MD5SUM_x86_64=""
|
2021-01-10 12:12:35 +01:00
|
|
|
REQUIRES="#{package.requires.empty? ? '%README%' : package.requires * ' '}"
|
2020-12-09 18:28:42 +01:00
|
|
|
MAINTAINER="Eugene Wissner"
|
|
|
|
EMAIL="belka@caraus.de"
|
|
|
|
INFO_FILE
|
|
|
|
end
|