summaryrefslogtreecommitdiff
path: root/lib/package.rb
blob: 7bc81ecad40b842a6e2689cc299b075b8529591b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# 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=""
    REQUIRES="#{package.requires * ' '}"
    MAINTAINER="Eugene Wissner"
    EMAIL="belka@caraus.de"
  INFO_FILE
end