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

⌈⌋ branch:  cross package maker


Check-in [7827ad9b42]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:AppData filter (`-u appdata`) which creates a basic PKG.appdata.xml for distro application centers.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:7827ad9b42f55fc1f52e8c2570269df4a0e168e7
User & Date: mario 2014-12-15 19:26:13
Context
2014-12-15
19:55
Added html_escape (despite the name actually just escapes XML) to AppData template. check-in: b52e581a05 user: mario tags: trunk
19:26
AppData filter (`-u appdata`) which creates a basic PKG.appdata.xml for distro application centers. check-in: 7827ad9b42 user: mario tags: trunk
15:10
Trivial man page compression post-processor. check-in: ca8be4398b user: mario tags: trunk
Changes

Added lib/fpm/package/appdata.rb.



























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
39
40
41
42
43
44
45
#
# 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.1
#
# 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"

# create appdata.xml file
class FPM::Package::Appdata < FPM::Package
  def update
    dest = "#{staging_path}/usr/share/appdata/#{name}.appdata.xml"
    puts dest
    FileUtils.mkdir_p(File.dirname(dest))
    File.open(dest, "w") do |xml|
      xml.write template("appstream.erb").result(binding)
    end
    #safesystem("ls", "-l", dest)
  end
end

Added templates/appstream.erb.

















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?xml version="1.0" encoding="UTF-8"?>
<!-- Maintainer: <%= maintainer  %>, autogenerated by `fpm -u appdata` -->
<component type="desktop">
 <id><%= name %>.desktop</id>
 <metadata_license>CC0-1.0</metadata_license>
 <project_license><%= license %></project_license>
 <name><%= name %></name>
   <% summary, *description = (description or "no description given").split("\n") -%>
 <summary><%= summary %></summary>
 <description>
  <%=
    description[0,25].join("\n")  # should actually generate mini-html with <p> and <ul>+<li>
  %>
 </description>
 <screenshots>
  <screenshot type="default">
   <image>http://freshcode.club/img/nopreview.png</image>
   <caption>Main window..</caption>
  </screenshot>
 </screenshots>
 <url type="homepage"><%= url or "data:," %></url>
 <updatecontact><%= maintainer %></updatecontact>
 <!--project_group><%= category %></project_group-->
</component>