<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Duncan Mac-Vicar &#187; suse</title>
	<atom:link href="http://duncan.mac-vicar.com/tag/suse/feed/" rel="self" type="application/rss+xml" />
	<link>http://duncan.mac-vicar.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Wed, 09 May 2012 14:47:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='duncan.mac-vicar.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Duncan Mac-Vicar &#187; suse</title>
		<link>http://duncan.mac-vicar.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://duncan.mac-vicar.com/osd.xml" title="Duncan Mac-Vicar" />
	<atom:link rel='hub' href='http://duncan.mac-vicar.com/?pushpress=hub'/>
		<item>
		<title>SUSE Manager, a year later retrospective</title>
		<link>http://duncan.mac-vicar.com/2012/05/03/suse-manager-a-year-later-retrospective/</link>
		<comments>http://duncan.mac-vicar.com/2012/05/03/suse-manager-a-year-later-retrospective/#comments</comments>
		<pubDate>Thu, 03 May 2012 15:07:06 +0000</pubDate>
		<dc:creator>duncan</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[spacewalk]]></category>
		<category><![CDATA[suse]]></category>
		<category><![CDATA[susemanager]]></category>
		<category><![CDATA[zypp]]></category>

		<guid isPermaLink="false">http://duncan.mac-vicar.com/?p=1562</guid>
		<description><![CDATA[It has been more than a year. Around March 2011 we shipped SUSE Manager 1.2 and enhanced the management story for our customers. Since then we have been very busy! Time to look back and see what we have done. This first post will describe the features we have been working on. In a future [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=duncan.mac-vicar.com&#038;blog=34913&#038;post=1562&#038;subd=duncan&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>It has been more than a year. Around March 2011 we shipped SUSE Manager 1.2 and enhanced the management story for our customers. Since then we have been very busy! Time to look back and see what we have done. This first post will describe the features we have been working on. In a future post I will address more details about our development process and relationship with Spacewalk.</p>
<p><a href="http://duncan.files.wordpress.com/2012/05/40_system_groups.png"><img class="alignnone  wp-image-1559" style="border:0 none;" title="SUSE Manager" src="http://duncan.files.wordpress.com/2012/05/40_system_groups.png?w=300&h=236" alt="SUSE Manager screenshot" width="300" height="236" /></a></p>
<h3>Setup reinvented</h3>
<p>SUSE shines not only in the <a href="http://www.marketwatch.com/story/suse-leads-with-most-certified-applications-across-linux-vendors-2012-04-25">number of certified enterprise applications</a> but also in the appliances area with tools like <a href="http://susestudio.com">SUSE Studio</a>. We allow our customers to build custom SUSE-based distributions with a few clicks.</p>
<p>When we set to build SUSE Manager as a product we decided to eat our own dog-food. After looking at the installation procedures of Spacewalk we found a natural way to make setting up SUSE Manager simple by using our existing technologies.</p>
<ul>
<li>Appliance form-factor: SUSE Manager is a simple bare-metal or virtual appliance. Just boot it, answer a few questions and you have a SUSE Manager server running.</li>
<li><a href="http://suse.gansert.net/?p=136">YaST-based setup and migration</a>: a first-boot work-flow assists you with any configuration and data migration.</li>
</ul>
<p><a href="http://duncan.files.wordpress.com/2012/05/18_db_setup.jpeg"><img class="alignnone size-medium wp-image-1570" style="border:0 none;" title="SUSE Manager first boot setup" src="http://duncan.files.wordpress.com/2012/05/18_db_setup.jpeg?w=300&h=220" alt="" width="300" height="220" /></a></p>
<h3>Creation of SUSE Manager-ready appliances from SUSE Studio</h3>
<p>Not all the cool stuff happens in SUSE Manager itself. The Studio team <a href="http://www.suse.com/blogs/from-studio-to-manager-with-a-click-of-your-mouse/">added a feature</a> that allows you to create appliances in <a href="http://susestudio.com">SUSE Studio</a> that are <em>SUSE Manager-ready</em>. This means once the image boots, it will automatically register itself to your SUSE Manager server and be ready to be managed.</p>
<p><a href="http://duncan.files.wordpress.com/2012/05/suse-manager.png"><img class="alignnone size-medium wp-image-1566" style="border:0 none;" title="Studio integration with SUSE Manager" src="http://duncan.files.wordpress.com/2012/05/suse-manager.png?w=300&h=137" alt="" width="300" height="137" /></a></p>
<p>James did a very nice demo at BrainShare creating an image in SUSE Studio, deploying it to a private OpenStack cloud directly from the Studio user interface, and having the machine automatically register itself to SUSE Manager after booting. <a href="http://www.youtube.com/watch?v=B59G-gl4COc#t=4m7s">Watch it here.</a></p>
<h3>Audit logging</h3>
<p>Regulatory and corporate auditing requirements require our customers to record what actions (and by whom) were done to the managed systems. We introduced <a href="http://www.suse.com/blogs/suse-manager-eases-the-buden-of-compliance/">an audit logging feature</a> that allows you to record actions to a remote log, database, xml files, etc.</p>
<p>Audit Log Keeper, the buffer that receives the actions from the application is not specific to SUSE Manager and any application can be integrated using XML-RPC. Keeper is open-source and <a title="Audit Log Keeper on github.com" href="https://github.com/SUSE/auditlog-keeper">available on github</a>.</p>
<h3>Deploying images from SUSE Studio</h3>
<p>SUSE Manager can deploy images to a physical host so that they run as virtual machines. If you are a SUSE customer, you will use Studio to create images. Creating in Studio, download the image, upload to SUSE Manager, deploy&#8230;? No way.</p>
<p>We added a <a href="http://www.suse.com/blogs/deploying-linux-images-can-be-fun/">feature to deploy the images from Studio directly</a> in the SUSE Manager user interface. The code is already being reviewed upstream.</p>
<p><a href="http://duncan.files.wordpress.com/2012/05/images.png"><img src="http://duncan.files.wordpress.com/2012/05/images.png?w=300&h=141" alt="" title="Browse SUSE Studio images from SUSE Manager" width="300" height="141" class="alignnone size-medium wp-image-1587" style="border:0 none;" /></a></p>
<h3>Code10 client support</h3>
<p>For our customers running SLE-10 we back-ported the Code11 ZYpp stack (including a very fast zypper using the <a href="http://libsolv.org">SAT solver</a>). The Code11 stack includes a <a href="http://doc.opensuse.org/projects/libzypp/12.1/zypp-plugins.html">plugin architecture</a> that we use to hook with the spacewalk agent in order to get the server-side repositories and keeps the managed server software inventory up-to-date.</p>
<h3>SUSE Linux Enterprise Point of Service</h3>
<p>Joe has been working with the SLEPOS team making sure that there is a story for them to work together. Check <a href="http://www.suse.com/blogs/suse-manager-and-point-of-service-a-dream-team">his blog post to know more.</a></p>
<h3>SUSE Manager Mobile (Android)</h3>
<p><a href="http://duncan.files.wordpress.com/2012/05/device-2012-05-02-105334.png"><img src="http://duncan.files.wordpress.com/2012/05/device-2012-05-02-105334.png?w=180&h=300" alt="" title="SUSE Manager Mobile" width="180" height="300" class="alignnone size-medium wp-image-1580" style="border:0 none;" /></a></p>
<p>During the last hack-week, part of the team took the mission to think how we could bring some of the SUSE Manager functionality to your mobile phone. We went beyond thinking and completed a prototype, which was <a href="www.youtube.com/watch?v=B59G-gl4COc#t=7m20s">presented at Brainshare</a>.</p>
<p>Today, we are releasing it, and you can <a href="https://play.google.com/store/apps/details?id=de.suse.android.susemanager.app&amp;feature=more_from_developer">get it for free from Google Play</a>. Have fun with it!.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/duncan.wordpress.com/1562/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/duncan.wordpress.com/1562/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/duncan.wordpress.com/1562/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/duncan.wordpress.com/1562/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/duncan.wordpress.com/1562/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/duncan.wordpress.com/1562/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/duncan.wordpress.com/1562/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/duncan.wordpress.com/1562/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/duncan.wordpress.com/1562/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/duncan.wordpress.com/1562/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/duncan.wordpress.com/1562/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/duncan.wordpress.com/1562/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/duncan.wordpress.com/1562/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/duncan.wordpress.com/1562/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=duncan.mac-vicar.com&#038;blog=34913&#038;post=1562&#038;subd=duncan&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://duncan.mac-vicar.com/2012/05/03/suse-manager-a-year-later-retrospective/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3b67365812827fa25df5093b38934a8f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">duncan</media:title>
		</media:content>

		<media:content url="http://duncan.files.wordpress.com/2012/05/40_system_groups.png?w=300" medium="image">
			<media:title type="html">SUSE Manager</media:title>
		</media:content>

		<media:content url="http://duncan.files.wordpress.com/2012/05/18_db_setup.jpeg?w=300" medium="image">
			<media:title type="html">SUSE Manager first boot setup</media:title>
		</media:content>

		<media:content url="http://duncan.files.wordpress.com/2012/05/suse-manager.png?w=300" medium="image">
			<media:title type="html">Studio integration with SUSE Manager</media:title>
		</media:content>

		<media:content url="http://duncan.files.wordpress.com/2012/05/images.png?w=300" medium="image">
			<media:title type="html">Browse SUSE Studio images from SUSE Manager</media:title>
		</media:content>

		<media:content url="http://duncan.files.wordpress.com/2012/05/device-2012-05-02-105334.png?w=180" medium="image">
			<media:title type="html">SUSE Manager Mobile</media:title>
		</media:content>
	</item>
		<item>
		<title>kvm setup for laptops with NetworkManager using bridges or openvswitch and NAT</title>
		<link>http://duncan.mac-vicar.com/2012/03/12/kvm-setup-for-laptops-with-networkmanager-using-bridges-or-openvswitch-and-nat/</link>
		<comments>http://duncan.mac-vicar.com/2012/03/12/kvm-setup-for-laptops-with-networkmanager-using-bridges-or-openvswitch-and-nat/#comments</comments>
		<pubDate>Mon, 12 Mar 2012 09:03:16 +0000</pubDate>
		<dc:creator>duncan</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[suse]]></category>

		<guid isPermaLink="false">http://duncan.mac-vicar.com/?p=1538</guid>
		<description><![CDATA[On my workstation I have a static network setup: I don&#8217;t give an ip to eth0 but configure dhcp to give the ip to a bridge br0 attached to eth0. Then qemu-kvm creates tap devices attached to the bridge, getting ip&#8217;s in the same network as the host. On my laptop I run NetworkManager, which [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=duncan.mac-vicar.com&#038;blog=34913&#038;post=1538&#038;subd=duncan&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>On my workstation I have a static network setup: I don&#8217;t give an ip to eth0 but configure dhcp to give the ip to a bridge br0 attached to eth0. Then qemu-kvm creates tap devices attached to the bridge, getting ip&#8217;s in the same network as the host.</p>
<p>On my laptop I run NetworkManager, which does not play well with bridges. It seems that in other distributions you can tell the network configuration to use NetworkManager for certain interfaces only (which is still not exactly what I want). After lot of reading, I found a configuration that fits my needs.</p>
<p>The idea is to create a bridge, and instead of having it attached to eth0 (which is controlled by NetworkManager), we create the bridge in a separate network and use NAT to have the VMs access the internet.</p>
<p>I <a href="http://patchwork.test.kernel.org/patch/2687/">found a script by Amos Kong that setups the network</a> (adapted to the paths of brctl in openSUSE):</p>
<p><pre class="brush: bash;">
#!/bin/bash

# Script used to add/remove setup of private bridge and dnsmasq
# @author Amos Kong 

brname='br0'

add_br()
{
    echo &quot;add new private bridge&quot;
    /sbin/brctl addbr $brname
    echo 1 &gt; /proc/sys/net/ipv6/conf/$brname/disable_ipv6
    echo 1 &gt; /proc/sys/net/ipv4/ip_forward
    /sbin/brctl stp $brname on
    /sbin/brctl setfd $brname 0
    ifconfig $brname 192.168.58.1
    ifconfig $brname up
    # add iptable entry as libvirt, then guest can access public network
    iptables -t nat -A POSTROUTING -s 192.168.58.254/24 ! -d 192.168.58.254/24 -j MASQUERADE
   /etc/init.d/dnsmasq stop
    /etc/init.d/tftpd-hpa stop 2&amp;gt;/dev/null
    dnsmasq --strict-order --bind-interfaces --listen-address 192.168.58.1 --dhcp-range 192.168.58.2,192.168.58.254 $tftp_cmd
}

del_br()
{
    echo &quot;cleanup bridge setup&quot;
    kill -9 `pgrep dnsmasq|tail -1`
    ifconfig $brname down
    /sbin/brctl delbr $brname
   iptables -t nat -D POSTROUTING -s 192.168.58.254/24 ! -d 192.168.58.254/24 -j MASQUERADE
}

# clean original setup first
del_br 2&gt;/dev/null

if [[ $# &gt; 0 ]];then
    if [[ $# = 2 ]];then
        # setup tftp function
       tftp_cmd=&quot; --enable-tftp --tftp-root $1 --dhcp-boot $2 --dhcp-no-override&quot;
    fi
    add_br
fi
</pre></p>
<p>Calling the script with no arguments will remove the bridge. Calling it with &#8220;1&#8243; as argument setups the bridge and NAT and also runs dnsmasq (dhcp server and dns cache: zypper install dnsmasq) on the bridge. Calling it with 2 will also setup a tftp server on the dnsmasq process.</p>
<p>Then you need a pair of scripts for qemu, which are called with the tap device as a parameter.</p>
<p><pre class="brush: bash;">
#!/bin/sh
switch='br0'
/sbin/ifconfig $1 0.0.0.0 up
/sbin/brctl addif ${switch} $1
/sbin/brctl setfd ${switch} 0
/sbin/brctl stp ${switch} off
</pre></p>
<p>And for bringing down the interface:</p>
<p><pre class="brush: bash;">
#!/bin/sh
switch='br0'
/sbin/ifconfig $1 0.0.0.0 down
/sbin/brctl delif ${switch} $1
</pre></p>
<p>Then you run the VM like:</p>
<p><pre class="brush: bash;">
qemu-kvm -boot c -drive file=./disk.qcow2,if=virtio -m 2500 -net nic,macaddr=XX:XX:XX:XX:XX:XX -net tap,script=script-ifup,downscript=script-ifdown &quot;$@&quot;
</pre></p>
<p>You can use the same setup with openvswitch. There is a package in the network project of the build service, but the package is tied to the xenserver configuration so I did not get it running. I redid the package based on the Debian one, which not only is separated in subpackages but does not assume you are running Xen. The package is available <a href="https://build.opensuse.org/package/binaries?package=openvswitch&amp;project=home%3Admacvicar%3Abranches%3Anetwork&amp;repository=openSUSE_12.1">here</a> until the submit request is accepted.</p>
<p>Then change on the setup script the brctl addbr line to use ovs-vsctl:</p>
<p><pre class="brush: bash; highlight: [4];">
add_br()
{
    echo &quot;add new private bridge&quot;
    ovs-vsctl add-br $brname
    echo 1 &gt; /proc/sys/net/ipv6/conf/$brname/disable_ipv6
    echo 1 &gt; /proc/sys/net/ipv4/ip_forward
    /sbin/brctl stp $brname on
    /sbin/brctl setfd $brname 0
    ...
</pre></p>
<p>And the for the qemu scripts, use ovs-vsctl add-port instead of brctl addif:</p>
<p><pre class="brush: bash; highlight: [4];">
#!/bin/sh
switch='br0'
/sbin/ifconfig $1 0.0.0.0 up
ovs-vsctl add-port ${switch} $1
/sbin/brctl setfd ${switch} 0
/sbin/brctl stp ${switch} off
</pre></p>
<p>And for bringing down the interface:</p>
<p><pre class="brush: bash; highlight: [4];">
#!/bin/sh
switch='br0'
/sbin/ifconfig $1 0.0.0.0 down
ovs-vsctl del-port ${switch} $1
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/duncan.wordpress.com/1538/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/duncan.wordpress.com/1538/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/duncan.wordpress.com/1538/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/duncan.wordpress.com/1538/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/duncan.wordpress.com/1538/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/duncan.wordpress.com/1538/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/duncan.wordpress.com/1538/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/duncan.wordpress.com/1538/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/duncan.wordpress.com/1538/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/duncan.wordpress.com/1538/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/duncan.wordpress.com/1538/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/duncan.wordpress.com/1538/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/duncan.wordpress.com/1538/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/duncan.wordpress.com/1538/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=duncan.mac-vicar.com&#038;blog=34913&#038;post=1538&#038;subd=duncan&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://duncan.mac-vicar.com/2012/03/12/kvm-setup-for-laptops-with-networkmanager-using-bridges-or-openvswitch-and-nat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3b67365812827fa25df5093b38934a8f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">duncan</media:title>
		</media:content>
	</item>
		<item>
		<title>On Java, Maven, JPP and rpm</title>
		<link>http://duncan.mac-vicar.com/2012/01/26/on-java-maven-jpp-and-rpm/</link>
		<comments>http://duncan.mac-vicar.com/2012/01/26/on-java-maven-jpp-and-rpm/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 10:06:39 +0000</pubDate>
		<dc:creator>duncan</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[rpm]]></category>
		<category><![CDATA[suse]]></category>

		<guid isPermaLink="false">http://duncan.mac-vicar.com/?p=1481</guid>
		<description><![CDATA[Java on Linux has been always a &#8220;special&#8221; topic. They don&#8217;t mix well. The mindset of Linux distributions is very different to the Java world when it comes to build software. This is understandable as they have different requirements. In the Java world, there is the concept of artifacts. You build org.foo.bar:bar-moo:1.1 once and it [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=duncan.mac-vicar.com&#038;blog=34913&#038;post=1481&#038;subd=duncan&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Java on Linux has been always a &#8220;special&#8221; topic. They don&#8217;t mix well.</p>
<p>The mindset of Linux distributions is very different to the Java world when it comes to build software. This is understandable as they have different requirements.</p>
<p>In the Java world, there is the concept of artifacts. You build org.foo.bar:bar-moo:1.1 once and it stays there forever, archived for anyone to use it. Tools like maven and ivy allow developers to specify in their source tree the specific dependencies of their components and those are grabbed from the network, the software built and then publish the output as a new artifact that others can grab.</p>
<p>Linux distributions on the other hand, bootstrap the complete stack from source. They don&#8217;t take the binary artifact from upstream but build it, and then use the binary they built to build the next. This seems to work pretty well for C, C++, and for Ruby, Python, let&#8217;s say it &#8220;works&#8221;.</p>
<p>When it comes to package Java software, Linux distributors find themselves in the following situation:</p>
<ul>
<li>If a buildable source tarball is provided then you are lucky.</li>
<li>If the buildable tarball is provided, it will either include a directory full of binary jars (the build dependencies) or it will have a very automatic build system grabbing them from the network.</li>
</ul>
<p>This clashes with Linux in various edges:</p>
<ul>
<li><strong>Linux distributions have normally one version of each component</strong>. The Java method works well if you bundle your dependencies inside your application, but not if everything is a reusable component. I have mixed feelings here. I think bundling your dependencies in the application for everything that is not part of the &#8220;base&#8221; system is the right approach. Updating them can break the application and trying to control this via QA only moves QA from the application developers to the distribution itself. When I ship apache-commons-collection as part of my Foobar Java application as a Java package, I am inviting everyone to use it, forcing myself to give support for it out of the context of the application.</li>
<li>
<p><strong>Distributions needs to build from source</strong>. Even if you get rid of the above requirement and you bundle all your dependencies, distributions want to build everything from source. This has technical and legal reasons. SUSE build system does very complex checks on every package that it builds. Those checks are part of the quality we sell to our customers. Other reasons are legal: I am still trying, for example, to build the <a href="http://www.playframework.org">Play!</a> framework. Even if it is BSD, <a href="http://groups.google.com/group/play-framework/browse_thread/thread/377549fe950175e5/463c8e762f38a49a?lnk=gst&amp;q=duncan#463c8e762f38a49a">it includes some .jars inside of unknown origin</a>. What would happen if one of these jars results to be proprietary?. Michael Vyskocil had a <a href="http://sourceforge.net/mailarchive/forum.php?thread_name=200808121025.47048.mvyskocil%40suse.cz&amp;forum_name=openproj-developers">similar issue with openproj and its bundled dependencies</a>.</p>
<p>Another reason to build from source is support. Enterprise distributions sell support and if a customer has a problem, we will fix it on our own and not wait for upstream to release a new version. Having a standardized way to build from source with our own fixes allows us to serve our customers. We can bundle jars in our application, but if a bug traces back to a jar we included, we would need to change the complete build description of the product in order to take this component. If we are able to rebuild this component at all. It already happened to us once with an XML-RPC library. And we were glad that it could be fixed by adding a patch to the rpm build description.</li>
<li><strong>Grabbing dependencies from the network</strong> just does not work. All packages are built without network access for security reasons.</li>
</ul>
<p>Because the Linux distributions know that they are not the center of the universe, they adapted. At the beginning things where still ok. Ant was very popular and basically you recursively packaged all build dependencies until you could build your package, in the same way:</p>
<ul>
<li>unpack</li>
<li>delete all binary jars</li>
<li>set CLASSPATH to the jars grabbed by the packaged build dependencies</li>
<li>call ant</li>
<li>install the jars</li>
</ul>
<p>Something like this:</p>
<p><code><br />
%prep<br />
%setup -q</p>
<p># remove all third party jars<br />
find . -iname '*.jar' | xargs rm -rf</p>
<p>%build<br />
export CLASSPATH=$(build-classpath foo)<br />
ant</p>
<p></code></p>
<p>Until this was true, the world was still fine. ant needed bootstrapping, but this was doable.</p>
<p>Until Maven&#8230;</p>
<p>Maven is at the same time revolutionary and one of the biggest atrocities I have seen when building software.</p>
<p>On the positive side:</p>
<ul>
<li>it defined a common convention for modules: groupId, artifactId, version.</li>
<li>it defined a standard layout for the source tree</li>
<li>it started a wave of convention over configuration that Java was always lacking</li>
</ul>
<p>on the negative side:</p>
<ul>
<li>it requires itself to build itself</li>
<li>it can&#8217;t build much itself, so it requires plugins to build anything</li>
<li>plugins require maven to be built, plus more dependencies, which are usually require maven to build, plus&#8230; plugins.</li>
</ul>
<p>All the above means that maven basically requires all the software it is supposed to build. Not the best design for a build system.</p>
<p>To make things worse, maven grabs dependencies from the network, which is what is disabled in our distro build process.</p>
<p>Fedora has done quite a progress providing a maven stack, by improving extending on the conventions the <a href="http://www.jpackage.org/">JPackage project</a> started for maven packages. This is implemented using what is called a <a href="http://fedoraproject.org/wiki/Java/JPPMavenReadme">&#8220;dependency map&#8221;</a>.</p>
<p>The approach works by installing some xml files per-package that map the maven artefact identifiers (groupId, artifactId) to a local jar in the system. Then maven itself is patched to include a resolver for artefacts with some properties:</p>
<ul>
<li>ignores multiple versions (usually in Linux you have one version installed)</li>
<li>resolves the artefact names to local installed jars. Every package uses macros to add stuff to the dependency map</li>
</ul>
<p>What I don&#8217;t like for this approach is:</p>
<p>Why would anyone in their sane mind use XML files to create mappings to files when you are in a UNIX-like OS and you have the filesystem and symbolic links?.</p>
<p>It is very explicit. It does not rely on a simple convention.</p>
<p>A second issue is how packages are built. This is SUSE specific. Fedora can bootstrap packages with circular dependencies by introducing a binary package A, build other dependencies until it can build a real A. Once a package is built, it stays in the buildsystem frozen as an artefact (just like the Java world).</p>
<p>In the <a href="http://build.opensuse.org">openSUSE Build Service</a>, the repository is always ready to bootstrap. For circular dependencies you create a package A-bootstrap that provides A and set the project config to prefer A. When A does not exist, A-bootstrap is grabbed, but as soon as A is there, it is preferred and used. When a package changes the packages depending on it are rebuilt automatically. This approach has several advantages, but makes hard to bootstrap a collection of packages where everything depends on everything.</p>
<p>In openSUSE, we have successfully build many maven dependent packages in the Java:base project without having a maven package by using the maven ant plugin to generate a tarball with ant build files.</p>
<p>This method does not work for every package, specially when files are generated, then one needs also to include those. But they may be good enough for solving our specific bootstrapping problem. The question is how many bootstrap packages would we need.</p>
<p>Another idea is to use package with binary jars for bootstrapping.</p>
<p>Fedora is not very happy with the current situation either, and they have been researching adding native support to <a href="http://fedoraproject.org/wiki/KojiMavenSupport">Koji to build maven packages.</a></P></p>
<p>In any case, I think there is room for improvement everywhere. I think the Maven infrastructure can be simplified taking into account that what maven contributed to the world was a (now) popular way to identify a module, and this is now being used also outside of Maven. <a href="http://ant.apache.org/ivy/">Apache Ivy</a>, <a href="https://github.com/harrah/xsbt/wiki">SBT</a>, <a href="http://gradle.org/">Gradle</a>, etc all support maven-style repositories and support refering to an artefact as groupId:artifactId:version.</p>
<p>Why not instead of a depmap just have:</p>
<pre>
/usr/share/java/foo.jar
/usr/share/java/org.bar/foo.jar -&gt; /usr/share/java/foo.jar
/usr/share/java/org.bar/foo.pom
</pre>
<p>And have the Maven patched resolved to just look there?</p>
<p>If you need parallel versions, then just</p>
<pre>
/usr/share/java/foo1.jar
/usr/share/java/foo2.jar
/usr/share/java/org.bar/1.0/foo.jar -&gt; /usr/share/java/foo1.jar
/usr/share/java/org.bar/2.0/foo.jar -&gt; /usr/share/java/foo2.jar
/usr/share/java/org.bar/1.0/foo.pom
/usr/share/java/org.bar/2.0/foo.pom
</pre>
<p>Or use the standard alternatives:</p>
<pre>
/usr/share/java/foo.jar -&gt; /etc/alternatives/foo.jar
</pre>
<p>The resolver would first look for the specific version described in the .pom file as /usr/share/java/$groupId/$version/$artifactId.ext. If it is not found, it could fallback to just look for /usr/share/java/$groupId/$artifactId.ext. This supports most cases where we just have one version for the system and exceptions for some packages where providing a specific version in parallel is also required. If the same jar is also known under a different groupId, well, then you create another symlink.</p>
<p>Then, build-classpath is enhanced so that in addition of being able to say &#8216;build-classpath commons-logging&#8217; you can also call &#8216;build-classpath commons-logging:commons-logging&#8217;. Identify every module by this convention.</p>
<p>The same with Provides: java(commons-logging:commons-logging). Fedora is already doing this as mvn(..), but is this maven specific?.</p>
<p>Why do we need xml files with maps, fragments of XML files that need to be updated at install and uninstall time?.</p>
<h3>Looking for a new solution&#8230;</h3>
<p>I discussed this with Fedora developers <a href="http://fedoraproject.org/wiki/User:Akurtakov">Alexander Kurtakov</a> and   <a href="http://fedoraproject.org/wiki/User:Sochotni">Stanislav Ochotnicky</a> and they mostly agreed with my concerns. They pointed me to Carlo de Wolf&#8217;s work <a href="https://github.com/wolfc/fedora-maven">on a similar solution</a>, but using a standard maven repository layout.</p>
<p>Carlo&#8217;s solution does not touch maven but is implemented as a plugin that gets loaded using a custom config file that is used when you call the wrapper script fmvn instead of mvn (for Fedora-Maven).</p>
<p>The whole solution as they described it has some extras like <a href="http://fpaste.org/iDer/">macros to symlink</a> the maven repository artifacts so that they can be found as artifacts in the <a href="http://fedoraproject.org/wiki/Java/JPPMavenReadme">JPP</a> layout. I am not sure if we need this. What I like from the solution alone:</p>
<ul>
<li>It does what you expect: uses only the local repository and ignores versions (uses latest) if the requested version is not found.</li>
<li>It does not require macros. We need to build stuff on released distros and it is no fun to introduce new rpm macros.</li>
<li>It does not require patching maven. fmvn is a separate package, providing the plugins and the wrapper script.</li>
<li>As soon as Carlo gets &#8220;mvn install&#8221; working, there is no need to manually install the jar/pom in the spec file. Just calling &#8220;fmvn install&#8221; should build and install it.</li>
</ul>
<p>I have been playing with Carlo&#8217;s plugins and it looks very promising. Fedora would need time to switch to a solution like this, but at SUSE we don&#8217;t have maven in our stack so we have nothing to lose and at the same time we can help serving as a test bed.</p>
<h3>The current plan&#8230;</h3>
<p>Not having the need to patch maven allows us to use a vanilla build of Maven for bootstrapping.</p>
<p>maven-bootstrap (upstream binary release, Provides: maven)<br />
fmvn-bootstrap (binary jars built locally with maven, Provides: fmvn)</p>
<p><em>Note: If you have more than one package with the same capability and want to use it in (Build)Requires, you will need to setup &#8220;Prefer:&#8221; in prjconf.<br />
</em><br />
We would like to build now maven using fmvn. Here is where the circular dependencies start. We need maven (provided by maven-bootstrap) and it dependencies, like plexus and a big bunch of maven plugins.</p>
<p>Here is where <a href="https://github.com/dmacvicar/pom2spec">pom2spec</a> comes to the rescue. This script allows to quickly create bootstrap packages from search.maven.org. It is based on <a href="http://lists.opensuse.org/opensuse-packaging/2011-08/msg00073.html">Pascal Bleser&#8217;s script</a>.</p>
<p>So lets say I need a bootstrap package for maven-compiler-plugin:</p>
<p><code><br />
org.apache.maven.plugins:maven-compiler-plugin : using version 2.3.2<br />
Writing maven-compiler-plugin-bin.spec<br />
Done<br />
Downloading maven-compiler-plugin-2.3.2.pom...<br />
######################################################################## 100.0%<br />
Downloading maven-compiler-plugin-2.3.2.jar...<br />
######################################################################## 100.0%<br />
t http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/2.3.2/maven-compiler-plugin-2.3.2.pom<br />
_ http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/2.3.2/maven-compiler-plugin-2.3.2.jar<br />
</code></p>
<p>Which generates the following files:</p>
<p><code><br />
maven-compiler-plugin-2.3.2.jar<br />
maven-compiler-plugin-2.3.2.pom<br />
maven-compiler-plugin-bin.spec<br />
<code></p>
<p>If I build it, I get an rpm with the following layout:</p>
<p><code><br />
/usr/share/java/maven-compiler-plugin.jar<br />
/usr/share/maven/repository/org/apache/maven/plugins/maven-compiler-plugin/maven-compiler-plugin-2.3.2.jar<br />
/usr/share/maven/repository/org/apache/maven/plugins/maven-compiler-plugin/maven-compiler-plugin-2.3.2.pom<br />
<code></p>
<p><em>/usr/share/java/maven-compiler-plugin.jar</em> is just a symlink to the real jar. This layout is enough for fmvn to find the artifact and also for legacy packages to just use build-class-path. It would still be better to enhance build-class-path to also accept groupId:artifactId keys and return the path to the jar.</p>
<p>The -bin suffix is to allow then the real package (built from source) to coexist in the same repository. The package with the -bin suffix also "Provides:" the package without the suffix so it can be used by dependent packages. Actually both "Provide:" <em>java(org.apache.maven.plugins:maven-compiler-plugin)</em> which is what a package that depends on it should "BuildRequire:".</p>
<p>Once Carlo's resolver works with "mvn install" I will try to build a repository following this method.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/duncan.wordpress.com/1481/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/duncan.wordpress.com/1481/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/duncan.wordpress.com/1481/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/duncan.wordpress.com/1481/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/duncan.wordpress.com/1481/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/duncan.wordpress.com/1481/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/duncan.wordpress.com/1481/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/duncan.wordpress.com/1481/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/duncan.wordpress.com/1481/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/duncan.wordpress.com/1481/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/duncan.wordpress.com/1481/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/duncan.wordpress.com/1481/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/duncan.wordpress.com/1481/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/duncan.wordpress.com/1481/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=duncan.mac-vicar.com&#038;blog=34913&#038;post=1481&#038;subd=duncan&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://duncan.mac-vicar.com/2012/01/26/on-java-maven-jpp-and-rpm/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3b67365812827fa25df5093b38934a8f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">duncan</media:title>
		</media:content>
	</item>
		<item>
		<title>Poor man&#8217;s rollback</title>
		<link>http://duncan.mac-vicar.com/2012/01/19/poor-mans-rollback/</link>
		<comments>http://duncan.mac-vicar.com/2012/01/19/poor-mans-rollback/#comments</comments>
		<pubDate>Thu, 19 Jan 2012 16:55:39 +0000</pubDate>
		<dc:creator>duncan</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[opensuse]]></category>
		<category><![CDATA[suse]]></category>
		<category><![CDATA[zypp]]></category>
		<category><![CDATA[zypper]]></category>

		<guid isPermaLink="false">http://duncan.mac-vicar.com/?p=1498</guid>
		<description><![CDATA[By Andrew Wafaa&#8216;s request. Save the package list: dmacvicar@piscola:~&#62; rpm -qa --queryformat="%{name}\n" &#62; 1 Do something&#8230; like uninstalling what was cool last week and it is not cool anymore: dmacvicar@piscola:~&#62; sudo zypper rm erlang Loading repository data... Reading installed packages... Resolving package dependencies... The following packages are going to be REMOVED: erlang rabbitmq-server 2 packages [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=duncan.mac-vicar.com&#038;blog=34913&#038;post=1498&#038;subd=duncan&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>By <a href="http://www.wafaa.eu/">Andrew Wafaa</a>&#8216;s <a href="https://twitter.com/#!/awafaa/status/160030399135883265">request</a>.</p>
<p>Save the package list:</p>
<p><code><br />
dmacvicar@piscola:~&gt; rpm -qa --queryformat="%{name}\n" &gt; 1<br />
</code></p>
<p>Do something&#8230; like uninstalling what was cool last week and it is not cool anymore:</p>
<p><code><br />
dmacvicar@piscola:~&gt; sudo zypper rm erlang<br />
Loading repository data...<br />
Reading installed packages...<br />
Resolving package dependencies...</p>
<p>The following packages are going to be REMOVED:<br />
  erlang rabbitmq-server </p>
<p>2 packages to remove.<br />
After the operation, 51.3 MiB will be freed.<br />
Continue? [y/n/?] (y): y<br />
Removing rabbitmq-server-2.2.0-1.2 [done]<br />
Removing erlang-R14B-1.2 [done]<br />
There are some running programs that use files deleted by recent upgrade. You may wish to restart some of them. Run 'zypper ps' to list these programs.<br />
</code></p>
<p>Save the new state:</p>
<p><code><br />
dmacvicar@piscola:~&gt; rpm -qa --queryformat="%{name}\n" &gt; 2<br />
</code></p>
<p>Now you need to know that zypper accepts + and &#8211; in its input. You can install and uninstall packages in one go:</p>
<p><code><br />
zypper in -- +pkg1 -pkg2 +pkg3 ...<br />
</code></p>
<p>So we can diff both files:</p>
<p><code><br />
dmacvicar@piscola:~&gt; diff -u 1 2<br />
--- 1	2012-01-19 17:23:26.640180000 +0100<br />
+++ 2	2012-01-19 17:24:43.196248000 +0100<br />
@@ -420,7 +420,6 @@<br />
 gnome-themes-accessibility<br />
 libeet1<br />
 icc-profiles-mini<br />
-rabbitmq-server<br />
 kde4-filesystem<br />
 gpg-pubkey<br />
 libiptcdata-lang<br />
@@ -3561,7 +3560,6 @@<br />
 perl-Config-General<br />
 PolicyKit-devel<br />
 gtk2-engine-aurora<br />
-erlang<br />
 libeet-devel<br />
 cyrus-sasl-gssapi<br />
 libimobiledevice2<br />
</code></p>
<p>Close to what we need. We remove the context lines by using -u0 and we remove the 3 first lines:</p>
<p><code><br />
dmacvicar@piscola:~&gt; diff -u0 1 2 | grep -Ev '^(@@|\+\+|--)'<br />
-rabbitmq-server<br />
-erlang<br />
</code></p>
<p>Now feed zypper with this to get your packages back:</p>
<p><code><br />
zypper in -- $(diff -u0 2 1 | grep -Ev '^(@@|\+\+|--)' | xargs)<br />
</code></p>
<p>Of course this only will work if you have all repositories. It is also useful to sync packages across computers (like you get a new laptop and need to setup it in a similar way).</p>
<p>openSUSE 12.1 rollback is implemented using btrfs via snapper, plus a zypp plugin that records a snapshot on every commit. It should be possible to write a Poor&#8217;s man version by recording the package list on every commit and then performing the above operation to go one or more steps back.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/duncan.wordpress.com/1498/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/duncan.wordpress.com/1498/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/duncan.wordpress.com/1498/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/duncan.wordpress.com/1498/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/duncan.wordpress.com/1498/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/duncan.wordpress.com/1498/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/duncan.wordpress.com/1498/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/duncan.wordpress.com/1498/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/duncan.wordpress.com/1498/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/duncan.wordpress.com/1498/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/duncan.wordpress.com/1498/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/duncan.wordpress.com/1498/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/duncan.wordpress.com/1498/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/duncan.wordpress.com/1498/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=duncan.mac-vicar.com&#038;blog=34913&#038;post=1498&#038;subd=duncan&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://duncan.mac-vicar.com/2012/01/19/poor-mans-rollback/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3b67365812827fa25df5093b38934a8f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">duncan</media:title>
		</media:content>
	</item>
		<item>
		<title>new ruby RPM bindings</title>
		<link>http://duncan.mac-vicar.com/2012/01/04/new-ruby-rpm-bindings/</link>
		<comments>http://duncan.mac-vicar.com/2012/01/04/new-ruby-rpm-bindings/#comments</comments>
		<pubDate>Wed, 04 Jan 2012 14:16:34 +0000</pubDate>
		<dc:creator>duncan</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[ffi]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[rpm]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[suse]]></category>

		<guid isPermaLink="false">http://duncan.mac-vicar.com/?p=1461</guid>
		<description><![CDATA[The original ruby-rpm bindings were originally written around the year 2002 for the Kondara Linux distribution. David Lutterkort adopted them to power various systems management pieces written in ruby, and later I did a couple of releases. After openSUSE 12.1 was released, the gem stopped building against the current rpm (4.9.x) and something needed to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=duncan.mac-vicar.com&#038;blog=34913&#038;post=1461&#038;subd=duncan&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The original <a title="ruby-rpm" href="http://rubygems.org/gems/ruby-rpm">ruby-rpm</a> bindings were originally written around the year 2002 for the Kondara Linux distribution. <a href="http://twitter.com/#!/lutterkort">David Lutterkort</a> adopted them to power various systems management pieces written in ruby, and later I did a couple of releases.</p>
<p>After openSUSE 12.1 was released, the gem stopped building against the current rpm (4.9.x) and something needed to be done. After studying the code a lot I figured out:</p>
<ul>
<li>API compatibility was important, as the goal was to keep some software running.</li>
<li>I did not want to add more #ifdefs to the code, as it was already supporting ancient rpm versions.</li>
<li>I wanted to avoid C where ruby could be used instead</li>
<li>I wanted <a href="http://rubydoc.info/github/dmacvicar/ruby-rpm-ffi/master/frames">good documentation</a> (I had added some to ruby-rpm in the latest releases)</li>
</ul>
<p>I decided to start fresh: target rpm 4.9.x first and later see if older rpms can be supported. I want to introduce an early release of the <a href="http://rubygems.org/gems/rpm">new rpm gem</a>.</p>
<h3>What does this milestone implement?</h3>
<ul>
<li>Querying rpm database</li>
<li>Querying packages</li>
</ul>
<h3>How is this gem different to the original ruby-rpm?</h3>
<ul>
<li>It is written in pure ruby, and uses FFI to access librpm</li>
<li>It is documented</li>
<li>It will be compatible with ruby-rpm. The testsuite is a continuation of the original</li>
<li>It is MIT licensed instead of GPL. <a href="http://twitter.com/#!/mrkn">Kenta Murata</a> gave me permission to re-license all the code I studied while writing the pure-ruby version</li>
</ul>
<h3>What is missing?</h3>
<ul>
<li>Only rpm 4.9.0 is supported for now. May be older versions work. I do know that <strong>4.4.x does not work.</strong></li>
<li>Not all APIs are covered yet, for example the RPM::Source class or methods to execute transactions (install, remove).</li>
</ul>
<h3>What did I learn on the way</h3>
<h4>The RPM API and compatibility</h4>
<p>The RPM API is quite scary. Part of it because the field it covers but also older rpm versions exposed lot of unnecesary stuff to the API. Comparing the API across versions shows that <a href="http://laiskiainen.org/">Panu</a> is doing an awesome job cleaning it up.</p>
<p>Because the mess in rpm 4.4.x, supporting older rpm versions will not be trivial. I realized very late that functions like headerNew are not even exposed as symbols in 4.4.x.</p>
<h4>FFI is great, but it is not there yet</h4>
<p>FFI is<a href="https://github.com/ffi/ffi/wiki/why-use-ffi"> advocated as a better way to access native code</a> from ruby interpreters. The true is that ruby never had any API to do that, and when you write ruby C extensions you are just playing with the MRI interpreter guts.</p>
<p>With FFI, each interpreter provides the FFI API and implements it. For example, JRuby may use JNI, and MRI may implement it as a C extension using the API we all already know.</p>
<p>However, after being unable to run the gem on rubinius because<a href="https://github.com/rubinius/rubinius/issues/682"> its FFI does not implement enums</a>, I realized the C compatibility layer most interpreters provide may be even more mature than FFI itself.</p>
<p>Also, because you are accessing the library symbols, you inherit another set of problems, like the inability to refer to anything that is not a symbol, like macros.</p>
<p>It is still better, but it needs time to mature. I am happy that I can write ruby code that interacts with the operating system without having to tie the code to an specific interpreter or platform.</p>
<p>Go grab the <a href="https://github.com/dmacvicar/ruby-rpm-ffi">source code</a> and send me a pull request!.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/duncan.wordpress.com/1461/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/duncan.wordpress.com/1461/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/duncan.wordpress.com/1461/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/duncan.wordpress.com/1461/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/duncan.wordpress.com/1461/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/duncan.wordpress.com/1461/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/duncan.wordpress.com/1461/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/duncan.wordpress.com/1461/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/duncan.wordpress.com/1461/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/duncan.wordpress.com/1461/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/duncan.wordpress.com/1461/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/duncan.wordpress.com/1461/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/duncan.wordpress.com/1461/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/duncan.wordpress.com/1461/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=duncan.mac-vicar.com&#038;blog=34913&#038;post=1461&#038;subd=duncan&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://duncan.mac-vicar.com/2012/01/04/new-ruby-rpm-bindings/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3b67365812827fa25df5093b38934a8f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">duncan</media:title>
		</media:content>
	</item>
		<item>
		<title>bicho 0.0.3 released</title>
		<link>http://duncan.mac-vicar.com/2011/12/09/bicho-0-0-3-released/</link>
		<comments>http://duncan.mac-vicar.com/2011/12/09/bicho-0-0-3-released/#comments</comments>
		<pubDate>Fri, 09 Dec 2011 13:27:50 +0000</pubDate>
		<dc:creator>duncan</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[bugzilla]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[suse]]></category>

		<guid isPermaLink="false">http://duncan.mac-vicar.com/?p=1453</guid>
		<description><![CDATA[Bicho is a ruby gem implementing access to bugzilla. It is a library but comes with a simple command line client. This release fixes some bugs and adds support for named queries. From the API, you can give a bug number or named query, or a combination of many of them: Named queries will be [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=duncan.mac-vicar.com&#038;blog=34913&#038;post=1453&#038;subd=duncan&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a title="Bicho on github" href="http://github.com/dmacvicar/bicho">Bicho</a> is a ruby gem implementing access to bugzilla. It is a library but comes with a simple command line client.</p>
<p>This <a title="Bicho on rubygems.org" href="http://rubygems.org/gems/bicho">release</a> fixes some bugs and adds support for named queries.</p>
<p>From the <a title="Bicho API docs" href="http://rubydoc.info/github/dmacvicar/bicho/v0.0.3/frames">API</a>, you can give a bug number or named query, or a combination of many of them:</p>
<p><pre class="brush: ruby;">
server.get(127043, 432423) =&gt; [....]
server.get(&quot;Named list&quot;) =&gt; [....]
server.get(&quot;Named list&quot;, 4423443) =&gt; [....]
</pre></p>
<p>Named queries will be &#8220;expanded&#8221; to a list of bugs.<br />
or from the command line</p>
<p><pre>
bicho -b https://user:pw@bugzilla.domain.com show query-name
</pre>
</p>
<p>If you are using Novell&#8217;s bugzilla, Bicho includes a plugin that automatically authenticates using your .oscrc credentials.</p>
<p>Be sure to also checkout <a title="Klaus twitter" href="http://twitter.com/#!/kkaempf">Klaus&#8217;s</a> <a title="dm-bugzilla-adapter" href="https://github.com/openSUSE/dm-bugzilla-adapter">bugzilla adapter for data-mapper</a>, which is also powered by Bicho.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/duncan.wordpress.com/1453/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/duncan.wordpress.com/1453/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/duncan.wordpress.com/1453/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/duncan.wordpress.com/1453/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/duncan.wordpress.com/1453/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/duncan.wordpress.com/1453/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/duncan.wordpress.com/1453/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/duncan.wordpress.com/1453/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/duncan.wordpress.com/1453/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/duncan.wordpress.com/1453/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/duncan.wordpress.com/1453/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/duncan.wordpress.com/1453/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/duncan.wordpress.com/1453/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/duncan.wordpress.com/1453/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=duncan.mac-vicar.com&#038;blog=34913&#038;post=1453&#038;subd=duncan&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://duncan.mac-vicar.com/2011/12/09/bicho-0-0-3-released/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3b67365812827fa25df5093b38934a8f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">duncan</media:title>
		</media:content>
	</item>
		<item>
		<title>Picasa 3.8 on Linux (and fix web albums login on the way)</title>
		<link>http://duncan.mac-vicar.com/2011/10/03/picasa-3-8-on-linux-and-fix-web-albums-login-on-the-way/</link>
		<comments>http://duncan.mac-vicar.com/2011/10/03/picasa-3-8-on-linux-and-fix-web-albums-login-on-the-way/#comments</comments>
		<pubDate>Mon, 03 Oct 2011 14:27:30 +0000</pubDate>
		<dc:creator>duncan</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[picasa]]></category>
		<category><![CDATA[suse]]></category>

		<guid isPermaLink="false">http://duncan.mac-vicar.com/?p=1446</guid>
		<description><![CDATA[Today I found myself with Picasa for Linux (3.0 beta) not allowing me to login to web albums, even if I could login without problems from the web browser. After googling a bit, it seems that Picasa 3.0 does not work anymore due to some Google+ related changes. On the other hand it looks like [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=duncan.mac-vicar.com&#038;blog=34913&#038;post=1446&#038;subd=duncan&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Today I found myself with Picasa for Linux (3.0 beta) not allowing me to login to web albums, even if I could login without problems from the web browser.</p>
<p>After googling a bit, it seems that Picasa 3.0 does not work anymore due to some Google+ related changes. On the other hand it looks like Picasa on Linux is abandoned  ie: 3.0 vs 3.8 on Windows.</p>
<p>Picasa 3.8 has some <a href="http://picasa.google.com/support/bin/answer.py?hl=en&amp;answer=93773">interesting new features</a>. Why not a Linux version? Picasa for Linux is no more than Picasa for Windows bundled with <a href="http://www.winehq.org/">wine</a> plus some minor changes. Ok, lets do one ourselves.</p>
<p>I started by unpacking the original rpm and replacing the &#8220;Picasa3&#8243; folder in &#8220;Program Files&#8221; with the tarred content of the &#8220;Program Files/Picasa3&#8243; resulting from installing Picasa 3.8 with wine. That worked, but it requires you to create this tarball.</p>
<p>Then I went one step further: why not trying installing the newer Picasa 3.8 inside the build section of the .spec file? Thanks to the <a href="http://wpkg.org/Picasa">wpkg project</a> I figured how to run the installer in unattended mode. The Build Service Tips &amp; Tricks page <a href="http://en.opensuse.org/openSUSE:Build_Service_Tips_and_Tricks#Building_a_package.2C_which_needs_an_X-Server_during_build">explains how to run something that requires an X server using XVfb</a>.</p>
<p>So the spec file first unpacks the original Linux rpm in the builroot. Then runs the Windows-based installer in unattended mode using a temporary wine prefix, and then copies the new installed Picasa over to the buildroot, replacing the files in the original rpm. We use the official rpm as a base because it contains a custom wine and some other Linux integrations, however it would be worth to see if it behaves better with newer wine versions.</p>
<p>You can find the resulting <a href="https://build.opensuse.org/package/show?package=picasa&amp;project=home%3Admacvicar">.spec file in my home project</a>.</p>
<p>I can&#8217;t redistribute the original rpm and the windows installer, so I include a fetch.sh (just like the spec file for the nvidia driver does) that will fetch those binary files.</p>
<p>To build it:</p>
<p><code><br />
osc co home:dmacvicar picasa<br />
# get the files I can't redistribute<br />
./fetch<br />
osc build openSUSE_Factory<br />
</code></p>
<p>Now install it and you should have Picasa 3.8 on Linux, which also solves the issue of login into Picasaweb:</p>
<p><a href="http://duncan.files.wordpress.com/2011/10/about-picassa.png"><img class="alignnone size-medium wp-image-1449" title="about-picassa" src="http://duncan.files.wordpress.com/2011/10/about-picassa.png?w=300&h=234" alt="" width="300" height="234" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/duncan.wordpress.com/1446/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/duncan.wordpress.com/1446/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/duncan.wordpress.com/1446/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/duncan.wordpress.com/1446/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/duncan.wordpress.com/1446/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/duncan.wordpress.com/1446/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/duncan.wordpress.com/1446/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/duncan.wordpress.com/1446/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/duncan.wordpress.com/1446/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/duncan.wordpress.com/1446/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/duncan.wordpress.com/1446/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/duncan.wordpress.com/1446/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/duncan.wordpress.com/1446/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/duncan.wordpress.com/1446/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=duncan.mac-vicar.com&#038;blog=34913&#038;post=1446&#038;subd=duncan&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://duncan.mac-vicar.com/2011/10/03/picasa-3-8-on-linux-and-fix-web-albums-login-on-the-way/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3b67365812827fa25df5093b38934a8f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">duncan</media:title>
		</media:content>

		<media:content url="http://duncan.files.wordpress.com/2011/10/about-picassa.png?w=300" medium="image">
			<media:title type="html">about-picassa</media:title>
		</media:content>
	</item>
		<item>
		<title>Factory and package guidelines</title>
		<link>http://duncan.mac-vicar.com/2011/09/19/factory-and-package-guidelines/</link>
		<comments>http://duncan.mac-vicar.com/2011/09/19/factory-and-package-guidelines/#comments</comments>
		<pubDate>Mon, 19 Sep 2011 13:46:18 +0000</pubDate>
		<dc:creator>duncan</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[suse]]></category>

		<guid isPermaLink="false">http://duncan.mac-vicar.com/?p=1436</guid>
		<description><![CDATA[I see some changes going into Factory that apply current packaging guidelines to packages. To summarize some of the cleanups you can find as submit requests: (no guarantee that those are actual guidelines. Check yourself) Remove redundant information: Remove norootforbuild comment Remove AutoReqProv: on (I guess because it is on by default) Remove Authors list [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=duncan.mac-vicar.com&#038;blog=34913&#038;post=1436&#038;subd=duncan&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I see some changes going into Factory that apply current packaging guidelines to packages.</p>
<p>To summarize some of the cleanups you can find as submit requests: (no guarantee that those are actual guidelines. <a href="http://en.opensuse.org/Portal:Packaging">Check yourself</a>)</p>
<li>Remove redundant information:<br />
<pre class="brush: diff;">
-# spec file for package dom4j (Version 1.6.1)
+# spec file for package dom4j
</pre>
</li>
</ul>
<li>Remove norootforbuild comment<br />
<pre class="brush: diff;">
-# norootforbuild
</pre>
</li>
<li>Remove AutoReqProv: on (I guess because it is on by default)<br />
<pre class="brush: diff;">
-AutoReqProv: on
</pre>
</li>
<li>Remove Authors list from description:<br />
<pre class="brush: diff;">
-Authors:
----------
-  Bob Esponja
-  Peter Parker
</pre>
</li>
<li>New macro for parallel builds:<br />
<pre class="brush: diff;">
-make %{?jobs:-j%jobs}
+make %{?_smp_mflags}
</pre>
</li>
<li>Put test runs in the %check section:<br />
<pre class="brush: diff;">
+%check
+
make check
</pre>
</li>
<li>Don&#8217;t clean the builroot yourself:<br />
<pre class="brush: diff;">
%install
-rm -rf $RPM_BUILD_ROOT
</pre>
</li>
<li>No clean section (is it now done automatically?:<br />
<pre class="brush: diff;">
-%clean
-rm -rf $RPM_BUILD_ROOT
-</pre>
</li>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/duncan.wordpress.com/1436/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/duncan.wordpress.com/1436/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/duncan.wordpress.com/1436/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/duncan.wordpress.com/1436/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/duncan.wordpress.com/1436/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/duncan.wordpress.com/1436/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/duncan.wordpress.com/1436/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/duncan.wordpress.com/1436/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/duncan.wordpress.com/1436/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/duncan.wordpress.com/1436/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/duncan.wordpress.com/1436/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/duncan.wordpress.com/1436/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/duncan.wordpress.com/1436/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/duncan.wordpress.com/1436/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=duncan.mac-vicar.com&#038;blog=34913&#038;post=1436&#038;subd=duncan&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://duncan.mac-vicar.com/2011/09/19/factory-and-package-guidelines/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3b67365812827fa25df5093b38934a8f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">duncan</media:title>
		</media:content>
	</item>
		<item>
		<title>proprietary drivers broken with Factory</title>
		<link>http://duncan.mac-vicar.com/2011/09/19/proprietary-drivers-broken-with-factory/</link>
		<comments>http://duncan.mac-vicar.com/2011/09/19/proprietary-drivers-broken-with-factory/#comments</comments>
		<pubDate>Mon, 19 Sep 2011 09:10:39 +0000</pubDate>
		<dc:creator>duncan</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[suse]]></category>

		<guid isPermaLink="false">http://duncan.mac-vicar.com/?p=1433</guid>
		<description><![CDATA[ld.so.conf seems to have changed to include /etc/ld.so.conf.d/*.conf. Unfortunately, proprietary drivers like the NVIDIA installed a file without the .conf extension. Therefore XOrg did not find the custom openGL library included by the driver. Tracked as bug 718734. home:dmacvicar:branches:X11:Drivers:Video contains a fixed nvidia-gfxG02 (Also updated to 280.13).<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=duncan.mac-vicar.com&#038;blog=34913&#038;post=1433&#038;subd=duncan&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>ld.so.conf seems to have changed to include /etc/ld.so.conf.d/*.conf.</p>
<p>Unfortunately, proprietary drivers like the NVIDIA installed a file without the .conf extension. Therefore XOrg did not find the custom openGL library included by the driver.</p>
<p>Tracked as <a href="http://bugzilla.novell.com/718734" title="bug 718734">bug 718734</a>.</p>
<p><a href="https://build.opensuse.org/project/show?project=home%3Admacvicar%3Abranches%3AX11%3ADrivers%3AVideo">home:dmacvicar:branches:X11:Drivers:Video</a> contains a fixed nvidia-gfxG02 (Also updated to 280.13).</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/duncan.wordpress.com/1433/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/duncan.wordpress.com/1433/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/duncan.wordpress.com/1433/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/duncan.wordpress.com/1433/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/duncan.wordpress.com/1433/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/duncan.wordpress.com/1433/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/duncan.wordpress.com/1433/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/duncan.wordpress.com/1433/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/duncan.wordpress.com/1433/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/duncan.wordpress.com/1433/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/duncan.wordpress.com/1433/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/duncan.wordpress.com/1433/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/duncan.wordpress.com/1433/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/duncan.wordpress.com/1433/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=duncan.mac-vicar.com&#038;blog=34913&#038;post=1433&#038;subd=duncan&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://duncan.mac-vicar.com/2011/09/19/proprietary-drivers-broken-with-factory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3b67365812827fa25df5093b38934a8f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">duncan</media:title>
		</media:content>
	</item>
		<item>
		<title>Realtime syntax checking with emacs</title>
		<link>http://duncan.mac-vicar.com/2011/08/30/realtime-syntax-checking-with-emacs/</link>
		<comments>http://duncan.mac-vicar.com/2011/08/30/realtime-syntax-checking-with-emacs/#comments</comments>
		<pubDate>Tue, 30 Aug 2011 10:22:33 +0000</pubDate>
		<dc:creator>duncan</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[suse]]></category>

		<guid isPermaLink="false">http://duncan.mac-vicar.com/?p=1418</guid>
		<description><![CDATA[Note: this post is a web cache recover of a November 2010 post that got lost with the blog crash. I updated it to add C/C++ autocompletion. One of the nice features of fat IDEs is that you get real time syntax checking. Some languages make it easy, some not. For example Eclipse has access [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=duncan.mac-vicar.com&#038;blog=34913&#038;post=1418&#038;subd=duncan&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><em><strong>Note: this post is a web cache recover of a November 2010 post that got lost with the blog crash. I updated it to add C/C++ autocompletion.</strong></em></p>
<p>One of the nice features of fat IDEs is that you get real time syntax checking. Some languages make it easy, some not.</p>
<p>For example Eclipse has access to the compiler as a service inside the IDE, and it checks the code as you type, even suggesting fixes.</p>
<p>I started to research what could be done on the emacs side to get a better experience, as when I am coding, I am usually thinking at the same time I write, and this means I make more syntax errors than the average guy.</p>
<p>So I found <a href="http://flymake.sourceforge.net/" title="flymake">flymake</a>, which is included by default in the emacs package. Copy pasting some snippets from the <a href="http://www.emacswiki.org/emacs/FlyMake" title="Emacs Wiki">emacs wiki</a> I got really nice real time checking for ruby:</p>
<p><a href="http://duncan.files.wordpress.com/2011/08/ruby-1.png"><img src="http://duncan.files.wordpress.com/2011/08/ruby-1.png?w=300&h=292" alt="" title="Ruby syntax checking" width="300" height="292" class="alignnone size-medium wp-image-1419" /></a></p>
<p>Going forward with python was easy. A flymake extension that uses pyflakes (a python checking program) was already available.</p>
<p><a href="http://duncan.files.wordpress.com/2011/08/python-1.png"><img src="http://duncan.files.wordpress.com/2011/08/python-1.png?w=300&h=292" alt="" title="Python syntax checking" width="300" height="292" class="alignnone size-medium wp-image-1421" /></a></p>
<p>It was with C/C++ where things started to get more complicated. Flymake has support for those hardcoded so that make with a special target is invoked. I wanted to check the current file only. Also gcc syntax errors are not that good.</p>
<p>So I started to modify the extensions I had seen to use <a href="http://clang.llvm.org/" title="clang">clang (and clang++)</a> from the <a href="http://www.llvm.org" title="LLVM Project">LLVM</a> project. Once it worked, I got nice error messages on C/C++ files:</p>
<p><a href="http://duncan.files.wordpress.com/2011/08/c-1.png"><img src="http://duncan.files.wordpress.com/2011/08/c-1.png?w=300&h=292" alt="" title="C/C++ Syntax checking" width="300" height="292" class="alignnone size-medium wp-image-1422" /></a></p>
<p>I was so happy to have this working on C++ that I needed more to challenge my new acquired mastery. So I decided to try it with <a href="http://doc.opensuse.org/projects/YaST/openSUSE11.1/tdg/Book-YCPLanguage.html" title="YCP language">ycp</a>. Not that I code with it that often, but I have colleagues who do. After adapting the extensions, here is the result:</p>
<p><a href="http://duncan.files.wordpress.com/2011/08/ycp-1.png"><img src="http://duncan.files.wordpress.com/2011/08/ycp-1.png?w=300&h=292" alt="" title="YCP Syntax checking" width="300" height="292" class="alignnone size-medium wp-image-1424" /></a></p>
<p>You can find all the required files on my <a href="https://github.com/dmacvicar/duncan-emacs-setup" title="Duncan emacs setup">emacs setup repository</a>. Follow custom.el which goes to custom-$lang.el to site-lisp/flymake-$lang.el.</p>
<p><strong>Update 20.11.2010:</strong></p>
<p>Thanks to <a href="http://mnemonikk.org/2010/11/05/using-flymake-to-check-erb-templates/">this post</a> I managed to get also Rails .erb templates working. Those are more tricky as they can’t be parsed directly by ruby, but they have to go first through erb -x and then through ruby -c. I ported the script to the style of loading (init and load functions) I was already using.</p>
<p><strong>Update 30.08.2011:</strong></p>
<p>Thanks to <a href="https://github.com/brianjcj/auto-complete-clang">this autocomplete extension</a>, I was able to setup autocompletion using clang for C/C++. Here is how it looks like:</p>
<p><a href="http://duncan.files.wordpress.com/2011/08/c-2.png"><img src="http://duncan.files.wordpress.com/2011/08/c-2.png?w=300&h=292" alt="" title="C++/C autocompletion" width="300" height="292" class="alignnone size-medium wp-image-1427" /></a></p>
<p>Next! ruby autocompletion.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/duncan.wordpress.com/1418/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/duncan.wordpress.com/1418/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/duncan.wordpress.com/1418/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/duncan.wordpress.com/1418/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/duncan.wordpress.com/1418/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/duncan.wordpress.com/1418/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/duncan.wordpress.com/1418/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/duncan.wordpress.com/1418/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/duncan.wordpress.com/1418/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/duncan.wordpress.com/1418/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/duncan.wordpress.com/1418/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/duncan.wordpress.com/1418/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/duncan.wordpress.com/1418/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/duncan.wordpress.com/1418/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=duncan.mac-vicar.com&#038;blog=34913&#038;post=1418&#038;subd=duncan&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://duncan.mac-vicar.com/2011/08/30/realtime-syntax-checking-with-emacs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3b67365812827fa25df5093b38934a8f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">duncan</media:title>
		</media:content>

		<media:content url="http://duncan.files.wordpress.com/2011/08/ruby-1.png?w=300" medium="image">
			<media:title type="html">Ruby syntax checking</media:title>
		</media:content>

		<media:content url="http://duncan.files.wordpress.com/2011/08/python-1.png?w=300" medium="image">
			<media:title type="html">Python syntax checking</media:title>
		</media:content>

		<media:content url="http://duncan.files.wordpress.com/2011/08/c-1.png?w=300" medium="image">
			<media:title type="html">C/C++ Syntax checking</media:title>
		</media:content>

		<media:content url="http://duncan.files.wordpress.com/2011/08/ycp-1.png?w=300" medium="image">
			<media:title type="html">YCP Syntax checking</media:title>
		</media:content>

		<media:content url="http://duncan.files.wordpress.com/2011/08/c-2.png?w=300" medium="image">
			<media:title type="html">C++/C autocompletion</media:title>
		</media:content>
	</item>
	</channel>
</rss>
