ZeroInstall Tutorials¶
This is a collection of How-To tutorials for Zero Install.
Who is this for?
For anyone who wants to package software with ZeroInstall.
Contents¶
How To Publish Source Packages¶
To publish feeds, you need to setup a repository with 0repo. To do this, first complete the tutorial for how to setup your repository..
Start with a empty feed template xml
<?xml version="1.0"?>
<interface xmlns="http://zero-install.sourceforge.net/2004/injector/interface">
<name>NAME</name>
<summary>ONE LINE SUMMARY</summary>
<description>MULTI-LINE DESCRIPTION</description>
<homepage>URL TO PROJECT HOMEPAGE</homepage>
<feed-for interface="INTERFACE_URL"/>
<group released="DATE_STRING" stability="STABILITY_STRING" license="LICENSE_STRING">
<command name="compile" shell-command="COMPILE_CMD_HERE">
<compile:implementation xmlns:compile="http://zero-install.sourceforge.net/2006/namespaces/0compile"></compile:implementation>
</command>
<implementation arch="*-src" version="{version}">
<manifest-digest/>
<archive href="URL_TO_SOURCE_TARBALL"/>
</implementation>
</group>
</interface>
For example, for the snappy library you would create a feed template file snappy.xml.template
<?xml version="1.0"?>
<interface xmlns="http://zero-install.sourceforge.net/2004/injector/interface">
<name>snappy</name>
<summary>A fast compressor/decompressor</summary>
<description>
Snappy is a compression/decompression library. It does not aim for maximum compression, or compatibility with any other compression library; instead, it aims for very high speeds and reasonable compression. For instance, compared to the fastest mode of zlib, Snappy is an order of magnitude faster for most inputs, but the resulting compressed files are anywhere from 20% to 100% bigger. On a single core of a Core i7 processor in 64-bit mode, Snappy compresses at about 250 MB/sec or more and decompresses at about 500 MB/sec or more.
</description>
<homepage>https://code.google.com/p/snappy</homepage>
<feed-for interface="http://zeroinstall.dasgizmo.net/snappy.xml"/>
<group released="2013-02-05" stability="stable" license="OSI Approved :: BSD License">
<command name="compile" shell-command=""$SRCDIR/configure" --prefix="$DISTDIR" && make install">
<compile:implementation xmlns:compile="http://zero-install.sourceforge.net/2006/namespaces/0compile">
</compile:implementation>
</command>
<implementation arch="*-src" version="{version}">
<manifest-digest/>
<archive href="http://zeroinstall.dasgizmo.net/archives/snappy-{version}.tar.gz"/>
</implementation>
</group>
</interface>
Create a source feed file from the template file
0template snappy.xml.template version=1.1.0
This produces the file snappy-1.1.0.xml
Test that you can successfully build from source.
0compile -c setup snappy-1.1.0.xml
cd snappy-1.1.0
0compile -c setup
0compile build
Add as a new feed using 0repo.
Copy the feed file to the incoming
directory of your 0repo install.
cp snappy-1.1.0.xml $HOME/repo/incoming
cd $HOME/repo
0repo update
Now check that your feed catalog includes the new source package.
http://<your_0repo_base_url>/catalog.xml
TODO: include screenshot here
What to do next¶
At this point, you may want to package up the binary you compiled from source to provide others with a binary version for your platform. See the publish a binary package.
How To Publish Binary Packages¶
First, publish a source package by following the tutorial for how to publish a source package.
Test that you can successfully build from source.
0compile -c setup http://zeroinstall.dasgizmo.net/snappy.xml
cd snappy
0compile -c setup
0compile build
Create the binary package to be uploaded to the server and the xml snippet to add to the feed.
0compile publish http://zeroinstall.dasgizmo.net/archives
Copy the tarball to the server
cp snappy-linux-x86_64-1.1.0.tar.bz2 /var/www/zeroinstall/archives/
Next we need to update the repository feed file to include the new implementation.
Copy the "implementation" portion from the ``snappy-1.1.0.xml`` created when you ran the ``0compile publish`` command.
<group arch="Linux-x86_64">
<implementation id="sha1new=06c387ae0fafc56bf4d682dd8a7d7f4e49d6d274" released="2013-08-07" version="1.1.0">
<manifest-digest sha256new="VNEAOHELYHO74ZB4GGYLVK6PDHLGN46WODKEC5RSQAF2HZP23HFQ"/>
<archive extract="snappy-linux-x86_64-1.1.0" href="http://zeroinstall.dasgizmo.net/archives/snappy-linux-x86_64-1.1.0.tar.bz2" size="140408"/>
</implementation>
</group>
Next paste this snippet into the snappy.xml
feed in the feeds directory of your 0repo server (this assumes you followed the previous tutorial and a source feed already exists).
cd $HOME/repo/feeds
vim snappy.xml
# now paste the snippet you copied above so the file looks like this
<?xml version="1.0" ?>
<interface uri="http://zeroinstall.dasgizmo.net/snappy.xml" xmlns="http://zero-install.sourceforge.net/2004/injector/interface">
<name>snappy</name>
<summary>A fast compressor/decompressor</summary>
<description>
Snappy is a compression/decompression library. It does not aim for maximum compression, or compatibility with any other compression library; instead, it aims for very high speeds and reasonable compression. For instance, compared to the fastest mode of zlib, Snappy is an order of magnitude faster for most inputs, but the resulting compressed files are anywhere from 20% to 100% bigger. On a single core of a Core i7 processor in 64-bit mode, Snappy compresses at about 250 MB/sec or more and decompresses at about 500 MB/sec or more.
</description>
<homepage>https://code.google.com/p/snappy</homepage>
<group license="OSI Approved :: BSD License" released="2013-02-05" stability="stable">
<command name="compile" shell-command=""$SRCDIR/configure" --prefix="$DISTDIR" && make install">
<compile:implementation xmlns:compile="http://zero-install.sourceforge.net/2006/namespaces/0compile"></compile:implementation>
</command>
<implementation arch="*-src" id="sha1new=5e1616a6cc21024d1bb35957d9fabe55a2b79b83" version="1.1.0">
<manifest-digest sha256new="HPZOI5ZC5L6TJW5GENQUVXI2G57LUL2XACXKFOXRLTRJZ4QUVAZA"/>
<archive extract="snappy-1.1.0" href="http://zeroinstall.dasgizmo.net/archives/snappy-1.1.0.tar.gz" size="1719945"/>
</implementation>
<group arch="Linux-x86_64">
<implementation id="sha1new=06c387ae0fafc56bf4d682dd8a7d7f4e49d6d274" released="2013-08-07" version="1.1.0">
<manifest-digest sha256new="VNEAOHELYHO74ZB4GGYLVK6PDHLGN46WODKEC5RSQAF2HZP23HFQ"/>
<archive extract="snappy-linux-x86_64-1.1.0" href="http://zeroinstall.dasgizmo.net/archives/snappy-linux-x86_64-1.1.0.tar.bz2" size="140408"/>
</implementation>
</group>
</group>
</interface>
Next tell 0repo you modified the feed by committing the changes to the internal git repository.
git commit -a
Next tell 0repo to update the catalog
cd $HOME/repo
0repo update
Now if you check the feed url, you’ll see the source AND binary packages.
