Cross package maker. DEB/RPM generation or conversion. Derived from jordansissel/fpm.

⌈⌋ ⎇ branch:  cross package maker


Artifact [9d843d407b]

Artifact 9d843d407b9b88b8d4fa4d2d4a7cb5ef0eef6d99:

  • File lib/fpm/package/filter_appdata.rb — part of check-in [06c1480758] at 2014-12-22 12:35:32 on branch trunk — Add missing update(opts) parameter. (user: mario size: 1484)

#
# api: fpm
# title: AppData/AppStream
# description: Generates a pkg.appdata.xml for distribution package managers
# type: template
# depends: erb
# category: meta
# doc: http://en.wikipedia.org/wiki/AppStream, http://people.freedesktop.org/~hughsient/appdata/
# version: 0.2
#
# Creates a /usr/share/appdata/PKGNAME.appdata.xml file for consumption by
# distribution package managers.
#
#  → The point of which is to embed a shared screenshot and lookup user
#    reviews/ratings. (At least should benefit appcenter listings.)
#  → Only use this filter (-u appdata) if you're not already including a
#    custom appdata.xml file.
#  → See also the advised description style in the AppData spec.
#  → Primarily meant for desktop applications.
# 
# This plugin will write to the default usr/share/appdata/ location in the staging
# path regardless of --prefix.
#
# BUGS:
#  - Does not yet escape XML properly.
#  - Doesn't split up description into <p> and <ul> sections (or store lang=).
#  - Stub screenshot used, we might need a new --screenshot flag.
#

require "fpm/package"
require "fpm/util"
require "fileutils"
require "erb"

# create appdata.xml file
class FPM::Package::Filter_appdata < FPM::Package

  include ERB::Util

  def update(opts=nil)
    dest = "#{staging_path}/usr/share/appdata/#{name}.appdata.xml"
    FileUtils.mkdir_p(File.dirname(dest))
    File.open(dest, "w") do |xml|
      xml.write template("appstream.erb").result(binding)
    end
  end

end