<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-9113231689788545980</atom:id><lastBuildDate>Thu, 26 Jan 2012 16:58:56 +0000</lastBuildDate><category>mobile</category><category>linux</category><category>gsoc</category><category>packaging</category><category>java</category><category>personal</category><category>tool</category><category>photography</category><category>en</category><category>bug</category><category>security</category><category>howto</category><category>programming</category><category>song</category><category>rpmlint</category><category>fedora</category><category>privacy</category><category>reply</category><category>projects</category><category>open source</category><category>game</category><category>lyrics</category><category>kde</category><category>rpm</category><category>video fosdem2011 java packaging guide</category><category>pyqt</category><category>fedora git fedpkg patch bug</category><category>git</category><category>python</category><category>software</category><category>software engineering</category><category>kernel</category><category>script</category><category>windows</category><category>macro</category><category>network</category><category>qt</category><category>automation</category><category>review</category><category>lock-in</category><category>json</category><category>rant</category><category>google</category><category>problem</category><title>Ins and Outs of Inputs</title><description>We receive them, we give them...</description><link>http://inputvalidation.blogspot.com/</link><managingEditor>noreply@blogger.com (Stanislav Ochotnický)</managingEditor><generator>Blogger</generator><openSearch:totalResults>59</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/InsAndOutsOfInputs" /><feedburner:info uri="insandoutsofinputs" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/</creativeCommons:license><feedburner:emailServiceId>InsAndOutsOfInputs</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item><guid isPermaLink="false">tag:blogger.com,1999:blog-9113231689788545980.post-8657477722248156996</guid><pubDate>Thu, 26 Jan 2012 16:58:00 +0000</pubDate><atom:updated>2012-01-26T17:58:56.272+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">tool</category><category domain="http://www.blogger.com/atom/ns#">packaging</category><category domain="http://www.blogger.com/atom/ns#">git</category><category domain="http://www.blogger.com/atom/ns#">fedora</category><category domain="http://www.blogger.com/atom/ns#">automation</category><title>Auto-tag Fedora package git repo from koji builds</title><description>&lt;div align="justify"&gt;
I often browse through various Fedora packages and miss having git
tags in package repositories corresponding with builds done in koji.

Therefore I created following simple bash script that will create git
tags in current git repo (if it's a Fedora package).

&lt;pre class="console"&gt;
#!/bin/bash

giturl=`fedpkg giturl`
if [ $? -ne 0 ];then
    echo "This doesn't look like fedora package directory"
    exit 1
fi

pkgname=`echo "${giturl}" |\
         sed -e 's|git://pkgs.fedoraproject.org/\(.*\)?.*|\1|'`
# make sure we are up-to-date
git fetch

# go through last 3 releases (incl. rawhide)
for dist in f15 f16 f17;do
    builds=`koji list-tagged "${dist}" "${pkgname}" | \
        grep "${pkgname}" | awk '{print $1}'`
    for build in $builds;do
        # task urls sometimes have ".git" suffix
        git_sha=`koji buildinfo "${build}" | grep '^Task:' | \
            sed -e "s|.*${pkgname}\(\.git\)*:\(.*\))|\2|"`
        version=`echo $build | sed -e "s:${pkgname}-::"`
        echo BUILD: $pkgname\($version\) = $git_sha
        git tag "${version}" "${git_sha}"
    done
done
&lt;/pre&gt;

Enjoy!
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9113231689788545980-8657477722248156996?l=inputvalidation.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=0QpL347amU4:9AE2qnh3YhQ:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=0QpL347amU4:9AE2qnh3YhQ:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=0QpL347amU4:9AE2qnh3YhQ:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=0QpL347amU4:9AE2qnh3YhQ:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=0QpL347amU4:9AE2qnh3YhQ:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=0QpL347amU4:9AE2qnh3YhQ:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=0QpL347amU4:9AE2qnh3YhQ:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=0QpL347amU4:9AE2qnh3YhQ:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/InsAndOutsOfInputs/~4/0QpL347amU4" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/InsAndOutsOfInputs/~3/0QpL347amU4/auto-tag-fedora-package-git-repo-from.html</link><author>noreply@blogger.com (Stanislav Ochotnický)</author><thr:total>0</thr:total><feedburner:origLink>http://inputvalidation.blogspot.com/2012/01/auto-tag-fedora-package-git-repo-from.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-9113231689788545980.post-726788235311777675</guid><pubDate>Fri, 11 Nov 2011 15:15:00 +0000</pubDate><atom:updated>2011-11-11T16:22:03.230+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">projects</category><category domain="http://www.blogger.com/atom/ns#">tool</category><category domain="http://www.blogger.com/atom/ns#">packaging</category><category domain="http://www.blogger.com/atom/ns#">fedora</category><category domain="http://www.blogger.com/atom/ns#">python</category><category domain="http://www.blogger.com/atom/ns#">json</category><category domain="http://www.blogger.com/atom/ns#">review</category><title>fedora-review - Package reviews made easier</title><description>&lt;div align="justify"&gt;
&lt;div&gt;
For package to be included in default Fedora repositories, it has to
go through process called package review. If you've done a few package
reviews you know big chunks of this process are repeated ad-nausea in
every review.
&lt;/div&gt;

&lt;div class="para"&gt;
  There have been quite a few tools aimed at automating and
  simplifying this process. However they all had one major flaw. They
  have been designed for reviewing specific class of packages, be it
  Perl, Python or generic C/C++ packages. Few us us decided to change
  this.
&lt;/div&gt;

&lt;div class="para"&gt;
  We used Tim Lauridsen's &lt;a
  href="https://github.com/timlau/FedoraReview"&gt;FedoraReview&lt;/a&gt;
  package as a base for our work and started adding new features and
  tweaks. Current work has a &lt;a
  href="https://fedorahosted.org/FedoraReview/"&gt;website&lt;/a&gt; on
  fedorahosted where you'll find all important information.
  Full feature list would be quite long, but I'll list a few
  major things:

  &lt;ul&gt;
  &lt;li&gt;Bugzilla integration&lt;/li&gt;
  &lt;li&gt;Mock integration&lt;/li&gt;
  &lt;li&gt;JSON api for external plugins (more info further down)&lt;/li&gt;
  &lt;li&gt;Several automated tests&lt;/li&gt;
  &lt;/ul&gt;
&lt;/div&gt;

&lt;div class="para"&gt;
  The tool runs all checks/tests on spec file and rpms and writes
  output into a text file. Snippet of the output looks like this:

  &lt;pre class="console"&gt;
Package Review
==============

Key:
- = N/A
x = Check
! = Problem
? = Not evaluated



==== Generic ====
...
[ ]: MUST License field in the package spec file matches the actual license.
[ ]: MUST License file installed when any subpackage combination is installed.
[!]: MUST Package consistently uses macros (instead of hard-coded directory names).
        Using both %{buildroot} and $RPM_BUILD_ROOT
...
[x]: SHOULD Spec use %global instead of %define.
...

==== Java ====
[!]: MUST If package uses "-Dmaven.local.depmap" explain why it was needed in a comment
[!]: MUST If package uses "-Dmaven.test.skip=true" explain why it was needed in a comment

Issues:
[!]: MUST Package consistently uses macros (instead of hard-coded directory names).
        Using both %{buildroot} and $RPM_BUILD_ROOT
[!]: MUST If package uses "-Dmaven.local.depmap" explain why it was needed in a comment
[!]: MUST If package uses "-Dmaven.test.skip=true" explain why it was needed in a comment
  &lt;/pre&gt;
&lt;/div&gt;

&lt;div class="para"&gt;
  We display only relevant results. In other words if there are no
  post/postun scriptlets there is no reason to include sanity output
  checking in the template. This will make more and more sense as we
  add more checks.
&lt;/div&gt;

&lt;h2&gt;JSON API&lt;/h2&gt;
&lt;div class="para"&gt;
  So how is it that different people will be able to write additional
  plugins for this review tool? We provide a relatively simple JSON
  api through stdin/stdout.
&lt;/div&gt;

&lt;div class="para"&gt;
  So to create a new check plugin you create a script or program in
  your language of choice. There is only one requirement:

  &lt;ul&gt;
  &lt;li&gt;Programming language has to have JSON format support
  &lt;/ul&gt;

  When the review tool runs your plugin it will send following message
  on its stdin:
  &lt;pre class="console"&gt;
{
    "supported_api": 1,
    "pkgname": "package name",
    "version": "package version",
    "release": "package release",
    "srpm":"path/to/srpm",
    "spec":{ path: "path/to/spec",
            "text": "spec text with expanded macros"},
    "rpms":[ "path/to/rpm", ...],
    "rpmlint": "rpmlint output",
    "build_dir": "/path/to/src/directory/after/build"
}
  &lt;/pre&gt;

  When your plugin is done with checks it returns following message by
  writing it to stdout:
  &lt;pre class="console"&gt;
{
    "command": "results",
    "supported_api": 1,
    "checks":
    [
        {
         "name": "CheckName",
         "url": "URL to guidelines usually",
         "group": "Group for this test.(Java, Perl, etc.)",
         "text": "Check description that shows on review template",
         "deprecates":["DeprecatedTest", ...]
         "type": "MUST"|"SHOULD",
         "result": "pass"|"fail"|"inconclusive",
         "extra_output": "text",
        },
        ...
    ]
}
  &lt;/pre&gt;

  If the plugin closes stdout without writing anything there, it means
  there were no relevant automated tests to run and no non-automated
  tests to include in template for manual evaluation. This is useful
  so we don't include for example Perl-related test output for Java
  packages and vice-versa.
&lt;/div&gt;

&lt;h2&gt;Roadmap&lt;/h2&gt;
While the tool is already usable and soon to be packaged in Fedora,
there are still quite a few things we want to improve:
 &lt;ul&gt;
   &lt;li&gt;Add more functions to API (currently there is just get_section)&lt;/li&gt;
   &lt;li&gt;Automate all automatable tests currently available&lt;/li&gt;
   &lt;li&gt;Get rid of redundant tests (don't duplicate rpmlint)&lt;/li&gt;
   &lt;li&gt;Add more tests of course!&lt;/li&gt;
   &lt;li&gt;Maybe add templating support?&lt;/li&gt;
 &lt;/ul&gt;

 We have currently 3-4 active committers, checks for C/C++, generic,
 Java, R packages. There is already and example external plugin written in Perl.
 If you have any improvement ideas, bugreports or
 just want to tell us we suck because we should have done X...get in
 touch!
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9113231689788545980-726788235311777675?l=inputvalidation.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=c3v8yLlv0Co:Ww6-JXKRdvA:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=c3v8yLlv0Co:Ww6-JXKRdvA:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=c3v8yLlv0Co:Ww6-JXKRdvA:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=c3v8yLlv0Co:Ww6-JXKRdvA:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=c3v8yLlv0Co:Ww6-JXKRdvA:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=c3v8yLlv0Co:Ww6-JXKRdvA:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=c3v8yLlv0Co:Ww6-JXKRdvA:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=c3v8yLlv0Co:Ww6-JXKRdvA:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/InsAndOutsOfInputs/~4/c3v8yLlv0Co" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/InsAndOutsOfInputs/~3/c3v8yLlv0Co/fedora-review-package-reviews-made.html</link><author>noreply@blogger.com (Stanislav Ochotnický)</author><thr:total>0</thr:total><feedburner:origLink>http://inputvalidation.blogspot.com/2011/11/fedora-review-package-reviews-made.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-9113231689788545980.post-3811592379717133997</guid><pubDate>Thu, 03 Nov 2011 18:14:00 +0000</pubDate><atom:updated>2011-11-03T19:14:51.225+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">rant</category><category domain="http://www.blogger.com/atom/ns#">personal</category><category domain="http://www.blogger.com/atom/ns#">packaging</category><category domain="http://www.blogger.com/atom/ns#">fedora</category><title>My job: I am a software chef</title><description>&lt;div align="justify"&gt;
  &lt;div class="para"&gt;
    How often are you asked what is your job? Most non-IT people will not
    be able to understand packaging, dependencies, rpms and whatnot. Hell,
    I even had trouble explaining what I do to my ex-schoolmates from
    university working in a traditional corporate environments. And they
    are software developers.
  &lt;/div&gt;

  &lt;div class="para"&gt;
    Was that just my problem? I don't think so. I had an epiphany while on
    a vacation few months back. I am almost sure the idea was not mine and
    it was just my subconsciousness that stole it from someone else. So
    what is my revelation? As you might have guessed from the title:
  &lt;/div&gt;

  &lt;center&gt;&lt;h1&gt;I am a software chef. I create recipes and prepare them.&lt;/h1&gt;&lt;/center&gt;

  &lt;div class="para"&gt;
    I work in a restaurant, that we call Linux distribution. There are
    many restaurants, each having their own recipes, rules and so
    on. Some restaurants form "chains" where they share most of their
    recipes. In these cases there is usually one restaurant that
    creates most recipes (Debian is such a restaurant in its Linux ecosystem).
  &lt;/div&gt;

  &lt;div class="para"&gt;
    Each restaurant usually has hundreds of chefs, some of them
    specialize in few recipes (build scripts), some are more
    flexible. In my case I specialize in a type of recipes dealing
    with coffee (i.e. Java).
  &lt;/div&gt;

  &lt;div class="para"&gt;
    Every recipe starts with customer (user) ordering some meal they have
    heard about. I look up ingredients (upstream projects) the food is made of and start
    recreating recipe for our restaurant. Quite often the food is made
    of more recipes (dependencies) and I have to create those
    first. Sometimes these recipes are already being prepared by other
    chefs, so I just use their work for my final meal. However our
    ingredients can be slightly bit different from the original. For
    example we have cow milk, but no goat milk that was in original
    recipe. So I have to find a way to fix the recipe using spices
    (patches).
  &lt;/div&gt;

  &lt;div class="para"&gt;
    Creating recipes is only part of my job though. I also work with
    our suppliers of ingredients (upstream developers). Sometimes the
    ingredients are bad, or I have found a way to improve the
    ingredient so I contact the suppliers and we work together.
  &lt;/div&gt;

  &lt;div class="para"&gt;
    Third part of my job is improving cooking process (simplifying
    packaging). So sometimes I move some furniture around so that
    other chefs don't have so much between the fridge and other places.
    Or I create a new mixer (tools) that speeds up mixing of ingredients.
  &lt;/div&gt;

  &lt;div class="para"&gt;
    Final part of my job is to work in a VIP part of the restaurant
    (RHEL). Only some customers can go there, most meals are usually
    very similar to normal restaurant, but each meal is tasted
    (tested) before we give it to customers and if they don't like it
    they can complain and we bring them improved recipe.
  &lt;/div&gt;

  &lt;div class="para"&gt;
    I find this metaphor kind of works for most things to a
    surprising degree. For the record:
    &lt;ul&gt;
    &lt;li&gt;Package maintainers - chefs&lt;/li&gt;
    &lt;li&gt;QE/QA - tasters&lt;/li&gt;
    &lt;li&gt;Security - bouncers&lt;/li&gt;
    &lt;li&gt;Release engineering - waiters (sorry guys)&lt;/li&gt;
    &lt;/ul&gt;

    Do you have an idea where this came from? Or can you think of a
    better metaphor for packaging? I'll probably keep updating and expanding this
    post as I go so I can point people to this when then want to know
    what I do..
  &lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9113231689788545980-3811592379717133997?l=inputvalidation.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=silN9k4iCDc:2cD6PvJgVXQ:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=silN9k4iCDc:2cD6PvJgVXQ:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=silN9k4iCDc:2cD6PvJgVXQ:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=silN9k4iCDc:2cD6PvJgVXQ:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=silN9k4iCDc:2cD6PvJgVXQ:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=silN9k4iCDc:2cD6PvJgVXQ:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=silN9k4iCDc:2cD6PvJgVXQ:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=silN9k4iCDc:2cD6PvJgVXQ:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/InsAndOutsOfInputs/~4/silN9k4iCDc" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/InsAndOutsOfInputs/~3/silN9k4iCDc/my-job-i-am-software-chef.html</link><author>noreply@blogger.com (Stanislav Ochotnický)</author><thr:total>4</thr:total><feedburner:origLink>http://inputvalidation.blogspot.com/2011/11/my-job-i-am-software-chef.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-9113231689788545980.post-6529998607457105433</guid><pubDate>Thu, 03 Nov 2011 15:53:00 +0000</pubDate><atom:updated>2011-11-03T16:56:35.609+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">rpm</category><category domain="http://www.blogger.com/atom/ns#">packaging</category><category domain="http://www.blogger.com/atom/ns#">fedora</category><category domain="http://www.blogger.com/atom/ns#">macro</category><title>Automatic javadoc subpackage generation</title><description>&lt;div align="justify"&gt;
  &lt;div&gt;
Do you hate repeating the same thing over and over again? I know I
do...&lt;/div&gt;

&lt;div&gt;
Java packaging guidelines state that we have to include javadocs with
all java packages. This means we have to repeat following code in
almost all packages (except pom and resource projects):
&lt;pre class="console"&gt;
...
%package        javadoc
Summary:        API documentation for %{name}
Group:          Documentation
Requires:       jpackage-utils

%description    javadoc
%{summary}.
...

%install
...
# javadoc
install -d -m 755 %{buildroot}%{_javadocdir}/%{name}
cp -pr target/site/apidocs/* %{buildroot}%{_javadocdir}/%{name}

...

%files javadoc
%doc LICENSE
%doc %{_javadocdir}/%{name}
...
&lt;/pre&gt;
&lt;/div&gt;

&lt;div class="para"&gt;
The code is practically the same in all packages so why not automate
this? Well there were two main reasons why this wasn't done before:
&lt;ul&gt;
  &lt;li&gt;Copying of files needs to be done during install phase&lt;/li&gt;
  &lt;li&gt;If package contains license, javadoc has to have it too&lt;/li&gt;
&lt;/ul&gt;

We solved both of these in a fairly reasonable way. Resulting macro
help looks like this:
&lt;pre class="console"&gt;
# %create_javadoc_subpackage can be used to completely create
# javadoc subpackage for java projects.
# !!! Needs to be used at the end of %install section
# There are these variables that change its behaviour:
#
# %__javadoc_license - set if the license is in non-standard place to
#                prevent Requires on main package
# %__apidocs_dir - set custom path to directory with javadocs
#                (defaults to target/site/apidocs)
# %__javadoc_skip_requires - if defined javadoc subpackage will not
#                require main package under any circumstances (useful
#                if upstream doesn't provide separate license file)
#
&lt;/pre&gt;

Is it understandable enough? If you need to generate javadocs, just
make them build and then add &lt;em&gt;%create_javadoc_subpackage&lt;/em&gt; macro
call at the end of %install section. Normally you shouldn't have to
change anything. We search in a few standard places for licenses. More
specifically we look for &lt;em&gt;LICENSE* COPYING* doc/LICENSE*
doc/COPYING* license*&lt;/em&gt;. Do you have more ideas where to look? It's
easy to add. If we don't find license we automatically add requires on
main package and assume you put license in there. If upstream doesn't
provide separate license file you can do &lt;em&gt;%global
__javadoc_skip_requires t&lt;/em&gt; and we will ignore licensing completely.
&lt;/div&gt;

&lt;div class="para"&gt;
I'd like this added to our packaging guidelines so we can start using
it. My testing shows it works fairly well. I'd love to improve it so
you could place it anywhere in the spec, not just %install section,
but rpm macros are...complicated.
&lt;/div&gt;

&lt;div class="para"&gt;
&lt;b&gt;*Note*&lt;/b&gt;: For gory details head over to our &lt;a href="http://git.fedorahosted.org/git/?p=javapackages.git;a=tree;h=6c9dba2d9f6397de2d88d8ebe9cf15d95f3d6c54;hb=6c9dba2d9f6397de2d88d8ebe9cf15d95f3d6c54"&gt;git repository&lt;/a&gt;. For now it's in separate feature branch.
&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9113231689788545980-6529998607457105433?l=inputvalidation.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=dKv4Z4S38s8:wfRF3zTPcqo:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=dKv4Z4S38s8:wfRF3zTPcqo:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=dKv4Z4S38s8:wfRF3zTPcqo:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=dKv4Z4S38s8:wfRF3zTPcqo:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=dKv4Z4S38s8:wfRF3zTPcqo:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=dKv4Z4S38s8:wfRF3zTPcqo:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=dKv4Z4S38s8:wfRF3zTPcqo:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=dKv4Z4S38s8:wfRF3zTPcqo:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/InsAndOutsOfInputs/~4/dKv4Z4S38s8" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/InsAndOutsOfInputs/~3/dKv4Z4S38s8/automatic-javadoc-subpackage-generation.html</link><author>noreply@blogger.com (Stanislav Ochotnický)</author><thr:total>0</thr:total><feedburner:origLink>http://inputvalidation.blogspot.com/2011/11/automatic-javadoc-subpackage-generation.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-9113231689788545980.post-768621274690125328</guid><pubDate>Sun, 16 Oct 2011 22:25:00 +0000</pubDate><atom:updated>2011-10-17T00:25:51.845+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">personal</category><category domain="http://www.blogger.com/atom/ns#">lyrics</category><category domain="http://www.blogger.com/atom/ns#">en</category><category domain="http://www.blogger.com/atom/ns#">song</category><category domain="http://www.blogger.com/atom/ns#">reply</category><title>Understood and agreed with</title><description>&lt;div&gt;
Dear OSS/Fedora/whatever reader. Stop right here.&lt;/div&gt;&lt;br/&gt;

&lt;div&gt;
&lt;span style="font-family: tahoma,helvetica,arial,sans-serif; line-height: 15px;"&gt;
&lt;span style="text-decoration: line-through;"&gt;Oh nothing's going to change my love for you&lt;/span&gt;&lt;br /&gt;
I wanna spend my life with you&lt;br /&gt;
So we make love on the grass under the moon&lt;br /&gt;
No one call tell, damned if I do&lt;br /&gt;
&lt;span style="text-decoration: line-through;"&gt;Forever journey on golden avenues&lt;/span&gt;&lt;br /&gt;
&lt;span style="text-decoration: line-through;"&gt;I drift in your eyes since I love you&lt;/span&gt;&lt;br /&gt;
I got that beat in my veins for only rule&lt;br /&gt;
Love is to share, mine is for you&lt;br /&gt;
&lt;/span&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9113231689788545980-768621274690125328?l=inputvalidation.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=4xHIDRJjTac:Apfhkx-Eusg:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=4xHIDRJjTac:Apfhkx-Eusg:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=4xHIDRJjTac:Apfhkx-Eusg:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=4xHIDRJjTac:Apfhkx-Eusg:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=4xHIDRJjTac:Apfhkx-Eusg:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=4xHIDRJjTac:Apfhkx-Eusg:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=4xHIDRJjTac:Apfhkx-Eusg:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=4xHIDRJjTac:Apfhkx-Eusg:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/InsAndOutsOfInputs/~4/4xHIDRJjTac" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/InsAndOutsOfInputs/~3/4xHIDRJjTac/understood-and-agreed-with.html</link><author>noreply@blogger.com (Stanislav Ochotnický)</author><thr:total>1</thr:total><feedburner:origLink>http://inputvalidation.blogspot.com/2011/10/understood-and-agreed-with.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-9113231689788545980.post-6243074480104609504</guid><pubDate>Mon, 12 Sep 2011 16:47:00 +0000</pubDate><atom:updated>2011-09-12T18:47:26.336+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">packaging</category><category domain="http://www.blogger.com/atom/ns#">en</category><category domain="http://www.blogger.com/atom/ns#">fedora</category><title>Making packaging Maven projects easier</title><description>&lt;div align="justify"&gt;
There are two recent changes to our Java guidelines in Fedora and use of Maven when packaging that I'd like to mention today

&lt;h1&gt;Maven dependency mapping macros&lt;/h1&gt;
Thing I haven't blogged about yet but it's pretty important: We
have new macros for maven depmaps in Fedora. In the past when you
wanted to map certain groupId:artifactId to a file in _javadir, you
had to include snippet like this in your spec:


&lt;pre class="console"&gt;
%add_to_maven_depmap com.google.guava guava 05 JPP guava
%add_to_maven_depmap com.google.collections google-collections 05 JPP guava
&lt;/pre&gt;

This tells our maven that &lt;em&gt;com:google:guava:guava&lt;/em&gt; and
&lt;em&gt;com.google.collections:google-collections&lt;/em&gt; can be found in one of the
repositories as JPP/guava.jar. It meant you had to know the
&lt;em&gt;groupId:artifactId&lt;/em&gt; and other information, plus it was extremely easy
to make a mistake here causing all sorts of trouble.


Current code doing the same thing:
&lt;pre class="console"&gt;
%add_maven_depmap JPP-guava.pom guava.jar -a "com.google.collections:google-collections"
&lt;/pre&gt;

We parse the pom file and get groupId:artifactId from it, plus we do additional sanity checks such as:
&lt;ul&gt;
&lt;li&gt; naming of pom and jar file have to be consistent
&lt;li&gt; jar file has to exist if packaging type is not pom
&lt;/ul&gt;

If you need
additional mappings you can easily add them. There are few &lt;a href="https://fedoraproject.org/wiki/Packaging:Java#add_maven_depmap_macro"&gt;other
options&lt;/a&gt; for this new macro useful in certain situations.

  &lt;h1&gt;Maven test deps skipping&lt;/h1&gt;
Long story short: When you use -Dmaven.test.skip=true in Fedora
packages you no longer need to patch those test dependencies out of
pom.xml.
&lt;br&gt;&lt;br&gt;
  
We've had &lt;a href="http://maven.apache.org/"&gt;Apache Maven&lt;/a&gt; in
Fedora for quite some time and packaging using Maven has been getting
easier over time due to small tweaks to our packaging macros and
guidelines changes. However there has been one problem that's been
bugging all Java packagers and was especially confusing for those
starting to package software built with Maven. The problem is that
Maven creates a tree of dependencies before it starts building the
project, but it includes test dependencies even when tests are being
skipped.
&lt;br&gt;&lt;br&gt;

Skipping tests is sometimes necessary due to problems with koji, or
dependencies and up until now we had to either patch those tests
dependencies from pom.xml or use custom dependency mappings (ugly
concept in itself).
&lt;br&gt;&lt;br&gt;

Last week I decided it's about time someone did something about this,
so I dug in the Maven code and created a solution (more of a hack
really) that is already included in Fedora. If you want the gory
details, you can read the &lt;a
href="http://pkgs.fedoraproject.org/gitweb/?p=maven.git;a=commitdiff;h=61f66c0070f0920a1dd964319ee3b6c6ad87045d"&gt;patch
itself&lt;/a&gt; (I advise against it). I'll try to make the patch work
properly so that it can be included in mainstream code.
&lt;br&gt;&lt;br&gt;


I can just hope that packagers will find these changes helpful, but
general feedback has been positive.
&lt;/div&gt;
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9113231689788545980-6243074480104609504?l=inputvalidation.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=KEba6P2HQbc:zSfrrk2eM_I:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=KEba6P2HQbc:zSfrrk2eM_I:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=KEba6P2HQbc:zSfrrk2eM_I:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=KEba6P2HQbc:zSfrrk2eM_I:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=KEba6P2HQbc:zSfrrk2eM_I:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=KEba6P2HQbc:zSfrrk2eM_I:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=KEba6P2HQbc:zSfrrk2eM_I:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=KEba6P2HQbc:zSfrrk2eM_I:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/InsAndOutsOfInputs/~4/KEba6P2HQbc" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/InsAndOutsOfInputs/~3/KEba6P2HQbc/making-packaging-maven-projects-easier.html</link><author>noreply@blogger.com (Stanislav Ochotnický)</author><thr:total>0</thr:total><feedburner:origLink>http://inputvalidation.blogspot.com/2011/09/making-packaging-maven-projects-easier.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-9113231689788545980.post-4164648581324370839</guid><pubDate>Fri, 26 Aug 2011 10:09:00 +0000</pubDate><atom:updated>2011-08-26T12:09:13.687+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">fedora git fedpkg patch bug</category><title>Fixing fedpkg clog output to be git-friendly</title><description>&lt;div align="justify"&gt;
I have been doing proxy-maintainer now for a few people and I found
strange problem with &lt;em&gt;fedpkg clog&lt;/em&gt; in relation to &lt;em&gt;git
format-patch&lt;/em&gt; and &lt;em&gt;git am&lt;/em&gt;.&lt;br&gt;&lt;br&gt;

If you have a changelog message like this:
&lt;pre class="console"&gt;
* Mon Feb 28 2011 Stanislav Ochotnicky &lt;sochotnicky@redhat.com&gt; - 2.1.1-1
- Update to 2.1.1
- Update patch
- Disable guice-eclipse for now
&lt;/pre&gt;

&lt;em&gt;fedpkg commit -c&lt;/em&gt; would create git commit message like this:
&lt;pre class="console"&gt;
commit 22b5306036b6ef1022498b63e40324370ff7159b (HEAD, f15)
Author:     Stanislav Ochotnicky &lt;sochotnicky@redhat.com&gt;
AuthorDate: Fri Aug 26 11:45:54 2011 +0200

    Update to 2.1.1
    Update patch
    Disable guice-eclipse for now
&lt;/pre&gt;

This works fine and mighty as long as you don't try to produce patch
from this commit. Let's see what happens with &lt;em&gt;git format-patch
HEAD~1&lt;/em&gt;.

&lt;pre class="console"&gt;
$ head 0001-Update-to-2.1.1.patch                                                                                           f15 [22b5306]
From 22b5306036b6ef1022498b63e40324370ff7159b Mon Sep 17 00:00:00 2001
From: Stanislav Ochotnicky &lt;sochotnicky@redhat.com&gt;
Date: Fri, 26 Aug 2011 11:45:54 +0200
Subject: [PATCH] Update to 2.1.1 Update patch Disable guice-eclipse for now
&lt;/pre&gt;

After adding this patch to repository using &lt;em&gt;git am&lt;/em&gt; the line
breaks would disappear. This is because git expects empty line after
subject and description of the commit afterwards.&lt;br&gt;&lt;br&gt;

I decided to try and fix fedpkg clog a bit. Given the previous
changelog, now it creates git message like this:

&lt;pre class="console"&gt;
commit 768964ce2145ef2b472fc5ef8781fb036d586b0e (HEAD, f15)
Author:     Stanislav Ochotnicky &lt;sochotnicky@redhat.com&gt;
AuthorDate: Fri Aug 26 11:57:20 2011 +0200

    Update to 2.1.1

    - Update patch
    - Disable guice-eclipse for now

&lt;/pre&gt;

This means that &lt;em&gt;git format-patch&lt;/em&gt; can do the right thing. I
filed &lt;a
href="https://fedorahosted.org/fedora-packager/ticket/116"&gt;bug
report&lt;/a&gt; for fedora-package so hopefully we can have this
fixed sometime.


&lt;/div&gt;
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9113231689788545980-4164648581324370839?l=inputvalidation.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=zjWP_h7B0I8:MwaK8QXWDLw:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=zjWP_h7B0I8:MwaK8QXWDLw:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=zjWP_h7B0I8:MwaK8QXWDLw:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=zjWP_h7B0I8:MwaK8QXWDLw:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=zjWP_h7B0I8:MwaK8QXWDLw:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=zjWP_h7B0I8:MwaK8QXWDLw:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=zjWP_h7B0I8:MwaK8QXWDLw:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=zjWP_h7B0I8:MwaK8QXWDLw:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/InsAndOutsOfInputs/~4/zjWP_h7B0I8" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/InsAndOutsOfInputs/~3/zjWP_h7B0I8/fixing-fedpkg-clog-output-to-be-git.html</link><author>noreply@blogger.com (Stanislav Ochotnický)</author><thr:total>0</thr:total><feedburner:origLink>http://inputvalidation.blogspot.com/2011/08/fixing-fedpkg-clog-output-to-be-git.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-9113231689788545980.post-7322777444640463412</guid><pubDate>Wed, 27 Jul 2011 17:05:00 +0000</pubDate><atom:updated>2011-07-27T19:36:39.563+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">rpmlint</category><category domain="http://www.blogger.com/atom/ns#">packaging</category><category domain="http://www.blogger.com/atom/ns#">fedora</category><title>Addition of fedpkg rpmlint</title><description>&lt;div align="justify"&gt;
&lt;b&gt;*Edit:*&lt;/b&gt; Yes, there is &lt;em&gt;fedpkg lint&lt;/em&gt; but it somewhat limited so read on. Instead of addition of "rpmlint" command Pingou will improve current lint&lt;br/&gt;&lt;br/&gt;

  Recently I was trying to help OpenSuSE guys with some updates to
  their Java stack and I was sent &lt;a
  href="https://build.opensuse.org/package/files?package=jpackage-utils&amp;project=openSUSE%3AFactory&amp;rev=6dbb068af84cc2d8600d348172959c53"&gt;link
  to their build system&lt;/a&gt;. I noticed a file called
  &lt;b&gt;jpackage-utils-rpmlintrc&lt;/b&gt; and this got me thinking...&lt;br/&gt;&lt;br/&gt;

  What if we added &lt;em&gt;rpmlint&lt;/em&gt; command to fedpkg with per-package
  rpmlint ignore settings? Turns out &lt;a
  href="https://fedoraproject.org/wiki/User:Pingou"&gt;Pingou&lt;/a&gt; took my
  idea and implemented it in under an hour :-)

  &lt;br /&gt;
  &lt;br /&gt;
  An example run:
&lt;pre class="console"&gt;
$ fedpkg rpmlint
plexus-interpolation.spec: W: invalid-url Source0: plexus-interpolation-1.14.tar.xz
0 packages and 1 specfiles checked; 0 errors, 1 warnings.

plexus-interpolation.spec: W: invalid-url Source0: plexus-interpolation-1.14.tar.xz
plexus-interpolation.src: W: spelling-error %description -l en_US interpolator -&gt; interpolate, interpolation, interrogator
plexus-interpolation.src: W: invalid-url Source0: plexus-interpolation-1.14.tar.xz
1 packages and 1 specfiles checked; 0 errors, 3 warnings.
2 packages run
rpmlint has not been run on rpm files but should
&lt;/pre&gt;


OK, so we can run rpmlint on spec, srpm and binary rpms with single command. But I don't like to see the same warnings all the time, because that means I will probably miss real problems when they appear. For this &lt;em&gt;fedpkg rpmlint&lt;/em&gt; uses .rpmlint file as additional rpmlint config. So after creating:

&lt;pre class="console"&gt;
$ cat &amp;gt; .rpmlint &amp;lt;&amp;lt; EOF
# we have scm checkout with comment in spec
addFilter('invalid-url')
# false positive
addFilter('spelling-error.*interpolator')
EOF
$ fedpkg rpmlint
0 packages and 1 specfiles checked; 0 errors, 0 warnings.

1 packages and 1 specfiles checked; 0 errors, 0 warnings.
2 packages run
rpmlint has not been run on rpm files but should
&lt;/pre&gt;

Cool right? Pierre sent patch with this feature to fedpkg developers, so hopefully we'll see this addition soon. I then plan to add custom .rpmlint configurations to all my packages so that they will be warning-free.
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9113231689788545980-7322777444640463412?l=inputvalidation.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=9d8f7Q9Cn50:BByY8BQBHcc:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=9d8f7Q9Cn50:BByY8BQBHcc:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=9d8f7Q9Cn50:BByY8BQBHcc:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=9d8f7Q9Cn50:BByY8BQBHcc:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=9d8f7Q9Cn50:BByY8BQBHcc:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=9d8f7Q9Cn50:BByY8BQBHcc:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=9d8f7Q9Cn50:BByY8BQBHcc:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=9d8f7Q9Cn50:BByY8BQBHcc:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/InsAndOutsOfInputs/~4/9d8f7Q9Cn50" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/InsAndOutsOfInputs/~3/9d8f7Q9Cn50/addition-of-fedpkg-rpmlint.html</link><author>noreply@blogger.com (Stanislav Ochotnický)</author><thr:total>3</thr:total><feedburner:origLink>http://inputvalidation.blogspot.com/2011/07/addition-of-fedpkg-rpmlint.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-9113231689788545980.post-7693022302669587554</guid><pubDate>Tue, 26 Jul 2011 11:41:00 +0000</pubDate><atom:updated>2011-07-26T14:13:03.343+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">rpm</category><category domain="http://www.blogger.com/atom/ns#">packaging</category><category domain="http://www.blogger.com/atom/ns#">fedora</category><category domain="http://www.blogger.com/atom/ns#">python</category><category domain="http://www.blogger.com/atom/ns#">script</category><title>Print expanded SourceX: urls from spec files</title><description>&lt;div align="justify"&gt;
I've noticed quite a few times that people add comments to their
Source0: urls without macros to seemingly simplify manual
downloading. It looks like this:
&lt;pre class="console"&gt;
Name:      jsoup
Version:   1.6.1
...
# http://jsoup.org/packages/jsoup-1.6.1-sources.jar
Source0:        http://%{name}.org/packages/%{name}-%{version}-sources.jar
&lt;/pre&gt;

This creates burden on maintainers to keep those urls
up-to-date as version changes, so I created simple python script for
printing out Source urls from spec files:

&lt;pre name="code" class="python"&gt;
#!/usr/bin/python

import rpm
import sys

ts=rpm.TransactionSet()
spec_obj = ts.parseSpec(sys.argv[1])

sources = spec_obj.sources

for url, num, flags in sources:
    print url
&lt;/pre&gt;


Chmod this +x, put into your PATH and enjoy by giving it path to spec file.&lt;br /&gt;

&lt;b&gt;*Edit*:&lt;/b&gt; Probably much nicer way to do the same thing already present on your system (courtesy of Alexander Kurtakov):
&lt;pre class="console"&gt;spectool X.spec&lt;/pre&gt;

I knew there was something like this, but forgot what it was. Oh well...2 minutes lost.
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9113231689788545980-7693022302669587554?l=inputvalidation.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=TgaPbqBsbG8:LfAdmapAFng:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=TgaPbqBsbG8:LfAdmapAFng:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=TgaPbqBsbG8:LfAdmapAFng:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=TgaPbqBsbG8:LfAdmapAFng:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=TgaPbqBsbG8:LfAdmapAFng:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=TgaPbqBsbG8:LfAdmapAFng:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=TgaPbqBsbG8:LfAdmapAFng:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=TgaPbqBsbG8:LfAdmapAFng:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/InsAndOutsOfInputs/~4/TgaPbqBsbG8" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/InsAndOutsOfInputs/~3/TgaPbqBsbG8/print-expanded-sourcex-urls-from-spec.html</link><author>noreply@blogger.com (Stanislav Ochotnický)</author><thr:total>2</thr:total><feedburner:origLink>http://inputvalidation.blogspot.com/2011/07/print-expanded-sourcex-urls-from-spec.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-9113231689788545980.post-6610619603315944411</guid><pubDate>Tue, 17 May 2011 13:15:00 +0000</pubDate><atom:updated>2011-05-17T15:15:48.643+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">video fosdem2011 java packaging guide</category><title>FOSDEM 2011: Java Packaging for Developers - Video</title><description>I've mentioned before that I attended FOSDEM this year. It was more than 3 months ago and I finally got my hands on video from my presentation. Courtesy of &lt;a href="http://fuseyism.com/"&gt;Andrew John Hughes&lt;/a&gt;, licensed under &lt;a href="http://creativecommons.org/licenses/by-nd/2.0"&gt;CC-BY-ND&lt;/a&gt;. As a refresher, slides are available &lt;a href="http://sochotni.fedorapeople.org/fosdem2011-sochotnicky.pdf"&gt;here&lt;/a&gt;.

&lt;video src="http://sochotni.fedorapeople.org/20110205-fosdem11-guide_to_packaging.ogg" controls="controls"&gt;
your browser does not support the video tag. You can still download video from &lt;a href="http://sochotni.fedorapeople.org/20110205-fosdem11-guide_to_packaging.ogg"&gt;my fedorapeople place&lt;/a&gt;.
&lt;/video&gt;

&lt;br/&gt;
You can play or download rest of the videos by going to &lt;a href="http://fuseyism.com/#movies"&gt;Andrew's page&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9113231689788545980-6610619603315944411?l=inputvalidation.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=YXhD3u-qgXg:WXl0Wk0yX-8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=YXhD3u-qgXg:WXl0Wk0yX-8:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=YXhD3u-qgXg:WXl0Wk0yX-8:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=YXhD3u-qgXg:WXl0Wk0yX-8:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=YXhD3u-qgXg:WXl0Wk0yX-8:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=YXhD3u-qgXg:WXl0Wk0yX-8:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=YXhD3u-qgXg:WXl0Wk0yX-8:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=YXhD3u-qgXg:WXl0Wk0yX-8:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/InsAndOutsOfInputs/~4/YXhD3u-qgXg" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/InsAndOutsOfInputs/~3/YXhD3u-qgXg/fosdem-2011-java-packaging-for.html</link><author>noreply@blogger.com (Stanislav Ochotnický)</author><thr:total>0</thr:total><feedburner:origLink>http://inputvalidation.blogspot.com/2011/05/fosdem-2011-java-packaging-for.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-9113231689788545980.post-8037919663078202100</guid><pubDate>Wed, 20 Apr 2011 13:02:00 +0000</pubDate><atom:updated>2011-04-20T15:05:36.303+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">packaging</category><category domain="http://www.blogger.com/atom/ns#">howto</category><category domain="http://www.blogger.com/atom/ns#">fedora</category><title>Getting your Java Application in Linux: Guide for Developers (Part 2)</title><description>&lt;div align="justify"&gt;
&lt;h1&gt;Ant and Maven&lt;/h1&gt;

&lt;a
href="http://inputvalidation.blogspot.com/2011/04/getting-your-java-application-in-linux.html"&gt;Last
time&lt;/a&gt; I have written about general rules of engagement for Java
developers if they want to make lives of packagers easier. Today I'll
focus on specifics of two main build systems in use today: Ant and
Maven, but more so on Maven for reasons I'll state in a while.

&lt;h2&gt;Ant&lt;/h2&gt;
Ant is (or at least used to be) most widely deployed build system in
Java ecosystem. There are probably multiple reasons for it, but
generally it's because Ant is relatively simple. In *NIX world Ant is
equivalent of pure make (and build.xml of Makefile). build.xml is just
that: an XML, and it has additional extensions to simplify common tasks
(calling javac, javadoc, etc.).

So the question is:
&lt;blockquote&gt;
  I am starting a new java project. How can I use Ant properly to make life easier for you?
&lt;/blockquote&gt;

The most simple answer? &lt;b&gt;DON'T!&lt;/b&gt; It might seem harsh and ignorant
of bigger picture and it probably is. But I believe it's also true
that Ant is generally harder to package than Maven. Ant build.xml
files are almost always unique pieces of art in themselves and as such
can be a pain to package. I am always reminded of following quote when
I have to dig through some smart build.xml system:
&lt;blockquote&gt;
Debugging is twice as hard as writing the code in the first
place. Therefore, if you write the code as cleverly as possible, you
are, by definition, not smart enough to debug it.
&lt;br/&gt; &lt;br/&gt;
&amp;nbsp;&amp;nbsp;--Brian Kernighan
&lt;/blockquote&gt;

And I have a feeling some people try to be really clever when writing
their build.xml files. That said, I understand there are times when
using Ant is just too tempting so I'll include a few tips for it
anyway.

&lt;h3&gt;Use apache-ivy extension for dependencies&lt;/h3&gt;
&lt;p&gt;
One of main problem with and is handling of various
dependencies. Usually, they are in some subdirectory of main tree,
some jars versioned, some not, some patched without any note about
it...in other words nightmare in itself. &lt;a
href="http://ant.apache.org/ivy/"&gt;Apache-ivy&lt;/a&gt; extension helps
here because it works with dependency metadata that packagers can use
to figure out real build dependencies including versions. We can also
be sure that no dependencies are patched in one way or the other.
&lt;/p&gt;

&lt;p&gt;
Ivy is nice for developers as well. It will make your source tarballs
much smaller (You do have source tarballs right?!) and your build.xml
nicer. I won't include any examples here because I believe that &lt;a
href="http://ant.apache.org/ivy/history/latest-milestone/tutorial/start.html"&gt;Ivy
documentation&lt;/a&gt; is indeed very good.&lt;/p&gt;

&lt;h3&gt;One lib/ to rule them all&lt;/h3&gt;
In case you really don't want to use Ivy, make sure you place all your
dependencies in one directory in top level of your project (don't
scatter your dependencies, even if you are using multiple
sub-projects). This directory should ideally be called
&lt;em&gt;lib/&lt;/em&gt;. It should contain your dependencies named
as &lt;em&gt;${name}-${version}.jar&lt;/em&gt;. Most of the time you should
include license files for every dependency you bundle, because you are
becoming distributors and for most licenses this means you have to
provide full text of the license. For licenses use identical name as
jar filenames, but use ".license" suffix. All in all, make it easy to
figure out your build dependencies and play with them.


&lt;h3&gt;Don't be too clever&lt;/h3&gt;
I can't stress this enough. Try to keep your build.xml files to the
bare minimum. Understanding ten 30 KiB big build.xml files with
multiple-phase build and tests spread through 10 directories is no
fun. Please think of poor packager when you write your build.xml
files. I don't mind having grey hair that much, but I'd rather if it
came later rather than sooner.

&lt;h1&gt;Maven&lt;/h1&gt;
And now we are coming to my favourite part. Maven is a build and
project management tool that has extensive plugin support able to do
almost anything developer might ask for. And all that while providing
formal project structure, so that once you learn how Maven works in
one project you can re-use your knowledge in other projects.

&lt;h2&gt;Maven goodies&lt;/h2&gt;
Maven provides several good things for packagers such as providing
clear dependencies and preventing simple patched dependencies from
sneaking in. Most important advantage for packagers coming with Maven
is the fact that &lt;em&gt;problems are the same in all projects&lt;/em&gt;. Once
you understand how certain Maven plugin works, you will know what to
expect and what to look for. But Maven is nice not just for packagers,
but also for developers.

&lt;h3&gt;Declarative instead of descriptive&lt;/h3&gt;
You don't tell Maven:
&lt;blockquote&gt;Add jar A, jar B to the classpath, then use this properies
file to set-up test resources. Then compile tests (Have you compiled
sources yet?) and then ... and run them with X&lt;/blockquote&gt;

Instead you place test files and resources into appropriate
directories and Maven will take care of everything. You just need to
specify your test dependencies in nice and tidy pom.xml.


&lt;h3&gt;Project metadata in one place&lt;/h3&gt;
With Maven you have all project information in one place:
&lt;ul&gt;
  &lt;li&gt;Developer contact information&lt;/li&gt;
&lt;li&gt;Homepage&lt;/li&gt;
&lt;li&gt;SCM URLs&lt;/li&gt;
&lt;li&gt;Mailinglists&lt;/li&gt;
&lt;li&gt;Issue tracker URL&lt;/li&gt;
&lt;li&gt;Project reports/site generation&lt;/li&gt;
&lt;li&gt;Dependencies&lt;/li&gt;
&lt;li&gt;Ability modify behaviour according to architecture, OS or other property&lt;/li&gt;
&lt;/ul&gt;
Need I say more? Fill it out, keep it up-to-date and we will all be happy.

&lt;h3&gt;Great integration with other tools&lt;/h3&gt;
Ecosystem around Maven has been growing in past years and now you will
find good support for handling your pom.xml files in any major java
IDE. But that is just the tip of the iceberg. There are Maven plugins
adding all kinds of additional tool support. Running checkstyle on
your code, helping with licensing, integration with gpg, ssh, jflex
and making releases. There are plugins for that and more.

&lt;h3&gt;Support for Ant&lt;/h3&gt;
If you are in process of migrating your build system from Ant to
Maven, you can do it in phases. For parts of your builds you can
easily run Ant with maven-ant-plugin. Good example of such migration
in progress is checkstyle. In version 5.2 they introduced Maven build
system while preserving their old layout and running Ant for tests.

&lt;h2&gt;Maven messier side&lt;/h2&gt;
A.K.A What you need to be aware of. It's generally quite hard to do
something bad in Maven, because it won't let you do that easily. That
said, there are plugins that can make it hard for us to package your
software.

&lt;h3&gt;maven-dependency-plugin:copy-dependencies&lt;/h3&gt;
This specific goal can potentially cause problems because it allows to
copy classes from dependencies into resulting jar files. As I wrote
last time, this is unacceptable because it creates possible licensing,
security and maintenance nightmares. If you need even just one class
from another project, rather than copying it, add it as a dependency
into pom.xml


&lt;h3&gt;maven-shade-plugin&lt;/h3&gt;
Shade plugin is a very shady plugin (pun intended). It can be used to
weave depdencies inside your jars while changing their package names
and doing all kinds of modifications in the process. I'll give you a small test now :-)
Let's say you have jar file with following contents:
&lt;pre class="console"&gt;
META-INF/
META-INF/MANIFEST.MF
META-INF/maven/
META-INF/maven/org.packager/
META-INF/maven/org.packager/Pack/
META-INF/maven/org.packager/Pack/pom.properties
META-INF/maven/org.packager/Pack/pom.xml
org/
org/packager/
org/packager/signature/
org/packager/signature/SignatureReader.class
org/packager/signature/SignatureVisitor.class
org/packager/signature/SignatureWriter.class
org/packager/Pack.class
&lt;/pre&gt;

Can you tell, from looking at jar contents where is
org.packager.signature subpackage coming from? Take your time, think
about it. Nothing? Well here's a hint:
&lt;pre name="code" class="xml"&gt;
&amp;lt;plugin&amp;gt;
  &amp;lt;groupId&amp;gt;org.apache.maven.plugins&amp;lt;/groupId&amp;gt;
  &amp;lt;artifactId&amp;gt;maven-shade-plugin&amp;lt;/artifactId&amp;gt;
  &amp;lt;configuration&amp;gt;
    &amp;lt;relocations&amp;gt;
      &amp;lt;relocation&amp;gt;
        &amp;lt;pattern&amp;gt;org.objectweb.asm&amp;lt;/pattern&amp;gt;
        &amp;lt;shadedPattern&amp;gt;org.packager&amp;lt;/shadedPattern&amp;gt;
      &amp;lt;/relocation&amp;gt;
    &amp;lt;/relocations&amp;gt;
  &amp;lt;/configuration&amp;gt;
&amp;lt;/plugin&amp;gt;
&lt;/pre&gt;

I believe this demonstrates why usage of shade plugin is evil (in 99%
of cases at least). This is especially problematic if the shaded
packages are part of public API of your project, because we won't be
able to simply fix this in one package, but it will cascade up the
dependency chain.

&lt;h3&gt;maven-bundle-plugin&lt;/h3&gt;
Bundle is one of the more controversial plugins, because it can be
used both for good and bad :-) One of the most important good use
cases for bundle plugin is generating OSGI bundles. Every project can
easily make their jar files OSGI compatible by doing something like
this:
&lt;pre name="code" class="xml"&gt;
  ...
  &amp;lt;packaging&amp;gt;bundle&amp;lt;/packaging&amp;gt;
  ...
  &amp;lt;build&amp;gt;
    &amp;lt;plugins&amp;gt;
      &amp;lt;plugin&amp;gt;
        &amp;lt;groupId&amp;gt;org.apache.felix&amp;lt;/groupId&amp;gt;
        &amp;lt;artifactId&amp;gt;maven-bundle-plugin&amp;lt;/artifactId&amp;gt;
        &amp;lt;extensions&amp;gt;true&amp;lt;/extensions&amp;gt;
      &amp;lt;/plugin&amp;gt;
    &amp;lt;/plugins&amp;gt;
  &amp;lt;/build&amp;gt;
  ...
&lt;/pre&gt;

Easy right? Now to the darker side of bundle plugin. I have another
example to test your skills. This one should be easier than shade
plugin:
&lt;pre class="console"&gt;
META-INF/MANIFEST.MF
META-INF/
META-INF/maven/
META-INF/maven/org.packager/
META-INF/maven/org.packager/Pack/
META-INF/maven/org.packager/Pack/pom.properties
META-INF/maven/org.packager/Pack/pom.xml
org/
org/objectweb/
org/objectweb/asm/
org/objectweb/asm/signature/
org/objectweb/asm/signature/SignatureReader.class
org/objectweb/asm/signature/SignatureVisitor.class
org/objectweb/asm/signature/SignatureWriter.class
org/packager/
org/packager/Pack.class
&lt;/pre&gt;

Problem is the same as with shade plugin (bundling of dependencies),
but at least here it's more visible in the contents of the jar and it
will not poison API of the jar. Just for the record, this is how it
was created:

&lt;pre name="code" class="xml"&gt;
&amp;lt;plugin&amp;gt;
  &amp;lt;groupId&amp;gt;org.apache.felix&amp;lt;/groupId&amp;gt;
  &amp;lt;artifactId&amp;gt;maven-bundle-plugin&amp;lt;/artifactId&amp;gt;
  &amp;lt;extensions&amp;gt;true&amp;lt;/extensions&amp;gt;
  &amp;lt;configuration&amp;gt;
    &amp;lt;instructions&amp;gt;
      &amp;lt;Export-Package&amp;gt;org.objectweb.asm.signature&amp;lt;/Export-Package&amp;gt;
    &amp;lt;/instructions&amp;gt;
  &amp;lt;/configuration&amp;gt;
&amp;lt;/plugin&amp;gt;
&lt;/pre&gt;

&lt;h1&gt;Summary&lt;/h1&gt;
Today I wrote about:
&lt;ul&gt;
  &lt;li&gt;Ant and why you shouldn't use it (that much)&lt;/li&gt;
  &lt;li&gt;Ant and how to use it if you have to&lt;/li&gt;
  &lt;li&gt;Maven and why it rocks for packagers and developers&lt;/li&gt;
  &lt;li&gt;Maven and its plugins and why they suck for packagers sometimes&lt;/li&gt;
&lt;/ul&gt;

There are a lot more things that can cause problems, but these are the
most obvious and easily fixed. I'll try to gather more information
about things we (packagers) can do to help you (developers) a bit
more and perhaps include one final part for this guide.


  &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9113231689788545980-8037919663078202100?l=inputvalidation.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=Ot5LMPKCBWA:Oke9aFBEag4:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=Ot5LMPKCBWA:Oke9aFBEag4:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=Ot5LMPKCBWA:Oke9aFBEag4:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=Ot5LMPKCBWA:Oke9aFBEag4:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=Ot5LMPKCBWA:Oke9aFBEag4:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=Ot5LMPKCBWA:Oke9aFBEag4:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=Ot5LMPKCBWA:Oke9aFBEag4:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=Ot5LMPKCBWA:Oke9aFBEag4:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/InsAndOutsOfInputs/~4/Ot5LMPKCBWA" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/InsAndOutsOfInputs/~3/Ot5LMPKCBWA/getting-your-java-application-in-linux_20.html</link><author>noreply@blogger.com (Stanislav Ochotnický)</author><thr:total>2</thr:total><feedburner:origLink>http://inputvalidation.blogspot.com/2011/04/getting-your-java-application-in-linux_20.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-9113231689788545980.post-4161211871205557040</guid><pubDate>Fri, 08 Apr 2011 15:26:00 +0000</pubDate><atom:updated>2011-04-08T17:26:12.684+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">packaging</category><category domain="http://www.blogger.com/atom/ns#">howto</category><category domain="http://www.blogger.com/atom/ns#">fedora</category><title>Getting your Java Application in Linux: Guide for Developers (Part 1)</title><description>&lt;div align="justify"&gt;
  &lt;h1&gt;Introduction to packaging Java&lt;/h1&gt;
  Packaging Java libraries and applications in Fedora has been my
  daily bread for almost a year now. I realized now is the time to
  share some of my thoughts on the matter and perhaps share a few
  ideas that upstream developers might find useful when dealing with
  Linux distributions.&lt;br /&gt;&lt;br /&gt;

  This endeavour is going to be split into several posts, because
  there are more sub-topics I want to write about. Most of this is
  going to be based on my talk I did @ FOSDEM 2011. Originally I was
  hoping to just post the video, but it seems to be taking more time
  than I expected :-)&lt;br/&gt;&lt;br/&gt;

  If you are not entirely familiar with status of Java on Linux
  systems it would be a good idea to first read a great article by Thierry
  Carrez called
  &lt;a href="http://fnords.wordpress.com/2010/09/24/the-real-problem-with-java-in-linux-distros/"&gt;
    The real problem with Java in Linux distros&lt;/a&gt;. A short quote from that blog:
  &lt;blockquote&gt;
    The problem is that Java open source upstream projects do not
    really release code. Their main artifact is a complete binary
    distribution, a bundle including their compiled code and a set of
    third-party libraries they rely on.
  &lt;/blockquote&gt;

  There is no simple solution and my suggestions are only mid-term
  workarounds and ways to make each other's (upstream &amp;harr; downstream)
  lives easier. Sometimes I am quite terse in suggestions, but if need
  be I'll expand them later on.&lt;br /&gt;

  &lt;br /&gt;
  &lt;br /&gt;
  &lt;h1&gt;Part 1: General rules of engagement&lt;/h1&gt;

  Today I am going to focus on general rules that apply to all Java
  projects wishing to be packaged in Linux distributions:
  &lt;ul&gt;
    &lt;li&gt; Making source releases&lt;/li&gt;
    &lt;li&gt; Handling Dependencies&lt;/li&gt;
    &lt;li&gt; Bugfix releases&lt;/li&gt;
  &lt;/ul&gt;

  For full understanding a short summary of general requirements for
  packages to be added to most Linux distributions:
  &lt;ul&gt;
    &lt;li&gt; All packages have to be built from source&lt;/li&gt;
    &lt;li&gt; No bundled dependencies used for building/running&lt;/li&gt;
    &lt;li&gt; Have single version of each library that all packages use&lt;/li&gt;
  &lt;/ul&gt;

  There are a lot of reasons for these rules and they have been
  flogged to death multiple times in various places. It mostly boils
  down to severe maintenance and security problems when these rules
  are not followed.

  &lt;br /&gt;
  &lt;br /&gt;
  &lt;h2&gt;Making source releases&lt;/h2&gt;
  As I mentioned previously most Linux distributions rebuild packages
  from source even when there is an upstream release that is binary
  compatible. To do this we need sources obviously :-) Unfortunately
  quite a few (mostly Maven) projects don't do source release
  tarballs. Some projects provide source releases without build scripts
  (build.xml or pom.xml files). Most notable examples are Apache Maven
  plugins. For each and every update of one of these plugins we have to
  checkout the source from upstream repository and generate the tarball
  ourselves.&lt;br /&gt;

  All projects using Maven build system can simply make packagers' lives
  easier by having following snippet in their pom.xml files:
  &lt;pre class="console"&gt;
    &amp;lt;build&amp;gt;
      &amp;lt;plugins&amp;gt;
 ...
 &amp;lt;plugin&amp;gt;
   &amp;lt;artifactId&amp;gt;maven-assembly-plugin&amp;lt;/artifactId&amp;gt;
   &amp;lt;configuration&amp;gt;
     &amp;lt;descriptorRefs&amp;gt;
       &amp;lt;descriptorRef&amp;gt;project&amp;lt;/descriptorRef&amp;gt;
     &amp;lt;/descriptorRefs&amp;gt;
   &amp;lt;/configuration&amp;gt;
   &amp;lt;executions&amp;gt;
     &amp;lt;execution&amp;gt;
       &amp;lt;id&amp;gt;make-assembly&amp;lt;/id&amp;gt;
       &amp;lt;phase&amp;gt;package&amp;lt;/phase&amp;gt;
       &amp;lt;goals&amp;gt;
         &amp;lt;goal&amp;gt;single&amp;lt;/goal&amp;gt;
       &amp;lt;/goals&amp;gt;
     &amp;lt;/execution&amp;gt;
   &amp;lt;/executions&amp;gt;
 &amp;lt;/plugin&amp;gt;
 ...
      &amp;lt;/plugins&amp;gt;
    &amp;lt;/build&amp;gt;
  &lt;/pre&gt;

  This will create -project.zip/tar.gz files containing all the files
  needed to rebuild  package from source. I have no real advice for
  projects using Ant for now, but I'll summarise them next time.

  &lt;br /&gt;
  &lt;br /&gt;
  &lt;h2&gt;Handling dependencies&lt;/h2&gt;
  I have a feeling that most Java projects don't spend too much time
  thinking about dependencies. This should change so here are
  a few things to think about when adding new dependencies to your project.

  &lt;br /&gt;
  &lt;br /&gt;
  &lt;h3&gt;Verify if the dependency isn't provided by JVM&lt;/h3&gt;
  Often packages contain unnecessary dependencies that are provided by
  all recent JVMs. Think twice if you really need another XML parser.

  &lt;br /&gt;
  &lt;br /&gt;
  &lt;h3&gt;Try to pick dependencies from major projects&lt;/h3&gt;
  Major projects (apache-commons libraries, eclipse, etc.) are much
  more likely to be packaged and supported properly in Linux
  distributions. If you use some unknown small library packagers will
  have to package that first and this can sometimes lead to such
  frustrating dependency chains they will give up before packaging
  your software.

  &lt;br /&gt;
  &lt;br /&gt;
  &lt;h3&gt;Do NOT patch your dependencies&lt;/h3&gt;
  Sometimes a project A does almost exactly what you want, but not
  quite...So you patch it and ship it with your project B as a
  dependency. This will cause problems for Linux distributions because
  you basically forked the original project A. What you should do
  instead is work with the developers of project A to add features you
  need or fix those pesky bugs.

  &lt;br /&gt;
  &lt;br /&gt;
  &lt;h2&gt;Bugfix releases&lt;/h2&gt;
  Every software project has bugs, so sooner or later you will have to
  do a bugfix release. As always there are certain rules you should
  try to uphold when doing bugfix releases.

  &lt;br /&gt;
  &lt;br /&gt;
  &lt;h3&gt;Use correct version numbers&lt;/h3&gt;
  This depends on your versioning scheme. I'll assume you are using
  standard X.Y.Z versions for your releases. Changes in Z are smallest
  released changes of your project. They should mostly contain only
  bugfixes and unobtrusive and simple feature additions if
  necessary. If you want to add bigger features you should change Y
  part of the version.

  &lt;br /&gt;
  &lt;br /&gt;
  &lt;h3&gt;Backward compatible&lt;/h3&gt;
  Bugfix releases have to be backwards compatible at all times. No API
  changes are allowed.

  &lt;br /&gt;
  &lt;br /&gt;
  &lt;h3&gt;No changes in dependencies&lt;/h3&gt;
  You should not change dependencies or add new ones in bugfix
  releases. Even updating dependency to a new version can cause
  massive recursive need for updates or new dependencies. The only
  time it's acceptable to change/add dependency version in bugfix
  release is when new dependency is required to fix the bug.

  &lt;br /&gt;
  &lt;br /&gt;
  An excellent example of how NOT to do things was Apache Maven update
  from 3.0 to 3.0.1. This update changed requirements from Aether 1.7
  to Aether 1.8. Aether 1.8 had new dependency on
  async-http-client. Async-http-client depends on netty, jetty 7.x and
  more libraries. So what should have been simple bugfix update turned
  into need for major update of 1 package and 2 new package
  additions. If this update contained security fixes it would cause
  serious problems to resolve in timely manner.


  &lt;br /&gt;
  &lt;br /&gt;
  &lt;h1&gt;Summary&lt;/h1&gt;
  &lt;ul&gt;
    &lt;li&gt;Create source releases containing build scripts&lt;/li&gt;
    &lt;li&gt;Think about your dependencies carefully&lt;/li&gt;
    &lt;li&gt;Handle micro releases gracefully&lt;/li&gt;
  &lt;/ul&gt;

  Next time I'll look into some Ant and Maven specifics that are
  causing problems for packagers and how to resolve them in your
  projects.

  &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9113231689788545980-4161211871205557040?l=inputvalidation.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=CVxFEsVzg_Y:eTV3bQmDUZQ:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=CVxFEsVzg_Y:eTV3bQmDUZQ:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=CVxFEsVzg_Y:eTV3bQmDUZQ:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=CVxFEsVzg_Y:eTV3bQmDUZQ:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=CVxFEsVzg_Y:eTV3bQmDUZQ:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=CVxFEsVzg_Y:eTV3bQmDUZQ:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=CVxFEsVzg_Y:eTV3bQmDUZQ:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=CVxFEsVzg_Y:eTV3bQmDUZQ:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/InsAndOutsOfInputs/~4/CVxFEsVzg_Y" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/InsAndOutsOfInputs/~3/CVxFEsVzg_Y/getting-your-java-application-in-linux.html</link><author>noreply@blogger.com (Stanislav Ochotnický)</author><thr:total>2</thr:total><feedburner:origLink>http://inputvalidation.blogspot.com/2011/04/getting-your-java-application-in-linux.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-9113231689788545980.post-7561770112498240979</guid><pubDate>Fri, 11 Mar 2011 11:00:00 +0000</pubDate><atom:updated>2011-03-11T13:14:52.644+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">open source</category><category domain="http://www.blogger.com/atom/ns#">projects</category><category domain="http://www.blogger.com/atom/ns#">software</category><category domain="http://www.blogger.com/atom/ns#">python</category><category domain="http://www.blogger.com/atom/ns#">programming</category><title>Accessing WebDAV calendar from commandline</title><description>&lt;div align="justify"&gt;
  &lt;p&gt;
Have you tried to access Zimbra or Google Calendar from command line?
I have. And I couldn't find  any normal command line client that would
be able to read and write these calendars, display alerts etc. Well
there is a &lt;a href="https://code.google.com/p/googlecl/"&gt;googlecl project&lt;/a&gt;
, but it's specific for Google Calendar and is not using standard
WebDav iCal access methods.
  &lt;/p&gt;

&lt;p&gt;
  Thus I set out to create console application that would fulfil my
  needs. What are my requirements?:
  &lt;ul&gt;
    &lt;li&gt; Read/write access to Google Calendar and Zimbra (at least)
    &lt;li&gt; Multiple remote calendars
    &lt;li&gt; Working alerts
    &lt;li&gt; Nice ncurses UI (but also ability to just display some info
    and quit)
    &lt;li&gt; Correct handling of timezones
    &lt;li&gt; Integration with mail client (open ics files received by email)
    &lt;li&gt; I guess a lot more :-)
  &lt;/ul&gt;
&lt;/p&gt;

&lt;p&gt;
  I had a look at existing python modules that work on iCalendar, WebDAV
  and combination of both. There are quite a few of them, but I just
  didn't like their APIs. They were usually complex and required
  knowledge of iCal specification. So I decided to create simplified
  module that would be easy to understand (even if not so powerful).
&lt;/p&gt;

&lt;p&gt;
  I named the project &lt;a href="https://github.com/sochotnicky/pywebcal"&gt;pywebcal&lt;/a&gt;
  (yes, unimaginative) and it's now on github. I would &lt;b&gt;LOVE&lt;/b&gt; some
  input. I know it's far from perfect (or complete), but let's
  see. For now it offers read-only support for Zimbra (Google should
  work too but I haven't tested in a while).
&lt;/p&gt;

&lt;p&gt;
  You can have a look at the example directory that contains one simple
  example you can run in-place and see if it works :-) I did my best to
  create proper test cases covering problems with timezones and whatnot,
  and this helped me quite a lot with recent refactoring. I am now
  using &lt;a href="http://vobject.skyhouseconsulting.com/"&gt;vobject&lt;/a&gt;
  library as my backend and it is rather nice to use. Plan is to allow
  access to vobject components so that my simplified API is not
  preventing some advanced modifications.
&lt;/p&gt;

&lt;p&gt;
  Next step is obviously to start working on ncurses application
  itself. Anyone wants to help?
&lt;/p&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9113231689788545980-7561770112498240979?l=inputvalidation.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=5a2NxEFf6Tk:zgEzDHVJfSw:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=5a2NxEFf6Tk:zgEzDHVJfSw:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=5a2NxEFf6Tk:zgEzDHVJfSw:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=5a2NxEFf6Tk:zgEzDHVJfSw:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=5a2NxEFf6Tk:zgEzDHVJfSw:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=5a2NxEFf6Tk:zgEzDHVJfSw:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=5a2NxEFf6Tk:zgEzDHVJfSw:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=5a2NxEFf6Tk:zgEzDHVJfSw:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/InsAndOutsOfInputs/~4/5a2NxEFf6Tk" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/InsAndOutsOfInputs/~3/5a2NxEFf6Tk/accessing-webdav-calendar-from.html</link><author>noreply@blogger.com (Stanislav Ochotnický)</author><thr:total>1</thr:total><feedburner:origLink>http://inputvalidation.blogspot.com/2011/03/accessing-webdav-calendar-from.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-9113231689788545980.post-9128516188026692716</guid><pubDate>Mon, 14 Feb 2011 17:21:00 +0000</pubDate><atom:updated>2011-02-14T18:22:17.820+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">problem</category><category domain="http://www.blogger.com/atom/ns#">howto</category><category domain="http://www.blogger.com/atom/ns#">fedora</category><category domain="http://www.blogger.com/atom/ns#">bug</category><category domain="http://www.blogger.com/atom/ns#">security</category><title>Problems with running gpg-agent as root</title><description>&lt;div align="justify"&gt;
  This is gonna be short post for people experiencing various issues
  with pinentry and gpg-agent. This is mostly happening on systems
  with only gpgv2.&lt;br/&gt;&lt;br/&gt;

  I have been asked to look at
  bug &lt;a href="https://bugzilla.redhat.com/show_bug.cgi?id=676034"&gt;676034&lt;/a&gt;
  in Red Hat Enterprise Linux. There we actually two issues there:
  &lt;ul&gt;
    &lt;li&gt; Running pinentry with DISPLAY variable set but no available
    GUI pinenty helpers
    &lt;li&gt; Using gpg on console after doing "su -"
  &lt;/ul&gt;

  First problem was relatively easy to figure out. Pinentry finds
  DISPLAY variable and looks for pinentry-gtk, pinentry-qt or
  pinentry-qt4 helpers to ask for passphrase. Unfortunately if none of
  these GUI helpers can be found, pinentry doesn't try their console
  counterpart. Workaround is simple: unset DISPLAY variable if you are
  working over ssh connection (or don't use X forwarding when you
  don't need it). More recent pinentry features proper failover to
  pinentry-curses&lt;br/&gt;&lt;br/&gt;

  Second problem was a bit more tricky to figure out, although in the
  end it was a facepalm situation. When trying to use GNUPG as root on
  console, hoping for pinentry-curses to ask for passphrase, users
  were instead introduced to this message: &lt;em&gt;ERR 83886179 Operation
  cancelled&lt;/em&gt;. To make things more confusing, everything seemed to
  work when logging in as root directly from ssh.&lt;br&gt;&lt;br&gt;

  At first I thought that this must be caused by environment
  variables, but this seemed to be incorrect assumption. Instead the
  reason was that current tty was owned by original owner and not
  root. This seemed to cause problem with gpg-agent and/or ncurses
  pinentry. I will investigate who was the real culprit here, but
  this bug seems to be fixed at least in recent Fedoras&lt;br&gt; &lt;br&gt;

  So what should you do if you have weird problems with gpg and
  pinentry as root? Here's what:
  &lt;pre class="console"&gt;
    $ su -
    [enter password]
    # chown root `tty`
    [use gpg, pinentry as you want]
  &lt;/pre&gt;

  Easy right?

  As a final note...I've been to FOSDEM and I plan to blog about it, but
  I guess I am waiting for the videos to show online. It's quite
  possible I'll blog about it before that however, since it's taking a while.
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9113231689788545980-9128516188026692716?l=inputvalidation.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=iumSP1ymErA:ihqvR_oDkhE:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/InsAndOutsOfInputs/~4/iumSP1ymErA" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/InsAndOutsOfInputs/~3/iumSP1ymErA/this-is-gonna-be-short-post-for-people.html</link><author>noreply@blogger.com (Stanislav Ochotnický)</author><thr:total>0</thr:total><feedburner:origLink>http://inputvalidation.blogspot.com/2011/02/this-is-gonna-be-short-post-for-people.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-9113231689788545980.post-1900399331955622633</guid><pubDate>Fri, 10 Dec 2010 13:16:00 +0000</pubDate><atom:updated>2010-12-11T12:01:20.980+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">open source</category><category domain="http://www.blogger.com/atom/ns#">howto</category><category domain="http://www.blogger.com/atom/ns#">git</category><category domain="http://www.blogger.com/atom/ns#">software</category><title>Automatic squashing of last git commits</title><description>&lt;div align="justify"&gt;
  I have written before about my &lt;a href="http://inputvalidation.blogspot.com/2010/10/packaging-workflow-patch-management-and_4170.html"&gt;workflow in Fedora&lt;/a&gt;. This workflow includes a relatively high number of rebasing where I squash last two commits into one. I use it to quickly refine and test patches. My history then usually looks something like this:
  &lt;pre class="console"&gt;
$ git log --format=oneline --decorate=no | head -3
2db8eacd7f7c20be88824caae5f5af16b9520d34 temp
443bb0f019c87f0090bb9da295a019c0eee23729 Add conditional BRs to enable ff merge between f14
b4c602f9f044598544cff3d68710f68b9447ea0f Fix installation of pom files for artifact jars
  &lt;/pre&gt;

  Where &lt;em&gt;443bb0f&lt;/em&gt; is my first attempt at the fix and &lt;em&gt;2db8eac&lt;/em&gt; is a fixed fix :-). Before pushing this into upstream repository I usually squash last two commits to look like this:
  &lt;pre class="console"&gt;
$ git log --format=oneline --decorate=no | head -2
f852c3e260d21bbc642f861e6fa6ea62caa7b69b Add conditional BRs to enable ff merge between f14
b4c602f9f044598544cff3d68710f68b9447ea0f Fix installation of pom files for artifact jars
  &lt;/pre&gt;
  I used to do it manually, but I do it often enough it made sense to automate this. So without further ado:
  &lt;pre class="console"&gt;
#!/bin/sh

export EDITOR="sed -i '2s/pick/squash/;/# This is the 2nd commit message:/,$ {d}'"

git rebase -i HEAD~2
&lt;/pre&gt;
  Save this somewhere inside your $PATH and chmod +x (or set up shell alias). Then just running this will automatically squash last two commits, using HEAD~1 commit message and discarding last commit message. No warranties though :-)
&lt;br/&gt;&lt;br/&gt;
&lt;b&gt;Edit:&lt;/b&gt; Benjamin suggested to use "fixup" instead of "squash". This is new thing in git 1.7+. For more information on this see &lt;a href="http://technosorcery.net/2010/02/07/fun_with_the_upcoming_1.7_release_of_git_rebase_--interactive_--autosquash.html"&gt;this blogpost&lt;/a&gt;.
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9113231689788545980-1900399331955622633?l=inputvalidation.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=-jDFBEjGgSE:a7UNqOXnask:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=-jDFBEjGgSE:a7UNqOXnask:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=-jDFBEjGgSE:a7UNqOXnask:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=-jDFBEjGgSE:a7UNqOXnask:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=-jDFBEjGgSE:a7UNqOXnask:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=-jDFBEjGgSE:a7UNqOXnask:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=-jDFBEjGgSE:a7UNqOXnask:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=-jDFBEjGgSE:a7UNqOXnask:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/InsAndOutsOfInputs/~4/-jDFBEjGgSE" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/InsAndOutsOfInputs/~3/-jDFBEjGgSE/automatic-squashing-of-last-git-commits.html</link><author>noreply@blogger.com (Stanislav Ochotnický)</author><thr:total>2</thr:total><feedburner:origLink>http://inputvalidation.blogspot.com/2010/12/automatic-squashing-of-last-git-commits.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-9113231689788545980.post-8107080591064576953</guid><pubDate>Tue, 30 Nov 2010 18:33:00 +0000</pubDate><atom:updated>2010-11-30T19:33:44.236+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">packaging</category><category domain="http://www.blogger.com/atom/ns#">fedora</category><category domain="http://www.blogger.com/atom/ns#">software</category><title>Fedora has Freemind</title><description>&lt;div align="justify"&gt;
During past few months I have been reviewing packages for Fedora with
approximate speed of 1.53 package per week :-) &lt;br/&gt;&lt;br /&gt;

Most of packages I reviewed were libraries and other things that are
not so interesting to users. But one of last packages I reviewed is
different. It is one of the
best &lt;a href="http://en.wikipedia.org/wiki/Mind_map"&gt;mind-mapping&lt;/a&gt;
software in existence :-) Yes,
it's &lt;a href="http://freemind.sourceforge.net/wiki/index.php/Main_Page"&gt;Freemind&lt;/a&gt;. If
you've never tried mind-mapping before, let me quote first paragraph
from wikipedia:
&lt;blockquote&gt;
A mind map is a diagram used to represent words, ideas, tasks, or other items linked to and arranged around a central key word or idea. Mind maps are used to generate, visualize, structure, and classify ideas, and as an aid to studying and organizing information, solving problems, making decisions, and writing.
&lt;/blockquote&gt;
So what are you waiting
for? &lt;a href="https://admin.fedoraproject.org/updates/freemind-0.9.0-0.7.rc11.fc14"&gt;Try
  it out!&lt;/a&gt;
&lt;/br /&gt;
&lt;/br /&gt;

There were attempts to package Freemind before, but all would-be
maintainers gave up when they noticed how many dependencies are needed
and how Java packaging actually works (I don't really blame
them). So everyone please.
Let's. Have. A. Staaaaanding. Ovaaation. Fooor. &lt;a href="http://fedoraproject.org/wiki/User:Hannes"&gt;Johannes
  Lips&lt;/a&gt;. He made it! If you live close by, buy him a beer will
you? :-)
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9113231689788545980-8107080591064576953?l=inputvalidation.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=PzMco_nceps:csIDxbX7Hdg:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=PzMco_nceps:csIDxbX7Hdg:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=PzMco_nceps:csIDxbX7Hdg:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=PzMco_nceps:csIDxbX7Hdg:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=PzMco_nceps:csIDxbX7Hdg:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=PzMco_nceps:csIDxbX7Hdg:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=PzMco_nceps:csIDxbX7Hdg:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=PzMco_nceps:csIDxbX7Hdg:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/InsAndOutsOfInputs/~4/PzMco_nceps" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/InsAndOutsOfInputs/~3/PzMco_nceps/fedora-has-freemind.html</link><author>noreply@blogger.com (Stanislav Ochotnický)</author><thr:total>0</thr:total><feedburner:origLink>http://inputvalidation.blogspot.com/2010/11/fedora-has-freemind.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-9113231689788545980.post-3094587455950676542</guid><pubDate>Thu, 11 Nov 2010 13:00:00 +0000</pubDate><atom:updated>2010-11-11T14:00:11.201+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">open source</category><category domain="http://www.blogger.com/atom/ns#">problem</category><category domain="http://www.blogger.com/atom/ns#">network</category><category domain="http://www.blogger.com/atom/ns#">en</category><category domain="http://www.blogger.com/atom/ns#">software</category><title>Local DNS caching - just do it already!</title><description>&lt;div align="justify"&gt;
  I recently encountered weird problems with my network connection at home. Everything
  worked, but was unbelievably slooooow. Ping showed times of ~30 ms,
  but I could easily see it took more time for those packets to go
  there and back.&lt;br&gt;&lt;br&gt;

  I took me some time to figure out what was happening. Looking back,
  checking DNS server should have been one of the first things to
  do. Seems like first DNS server provided by my provider has been
  down. That meant that every DNS query timed out and then went to the
  second DNS which got me my response. For some reason ping did DNS
  query before every new package being sent. That explains its weird
  behaviour.&lt;br&gt;&lt;br&gt;


  This problem got me to finally install local caching dns. I was
  thinking about doing it before, but I never got around to do it
  until now. I always thought it's gonna be a few-hour nightmare. Now
  I blame my previous experience with bind :-D For simple local
  caching bind would be overkill, so I chose dnsmasq. Using it was as
  simple as installing, running dnsmasq and executing
  &lt;pre class="console"&gt;$ echo 'nameserver 127.0.0.1' &gt; /etc/resolv.conf.head&lt;/pre&gt;
&lt;br&gt;

  From that point on every &lt;i&gt;resolv.conf&lt;/i&gt; file generated by &lt;i&gt;dhcpcd&lt;/i&gt;
  will have my local DNS as first DNS server to try. For this time you
  can add it there manually. Then you can verify
  your setup works by running following command twice in a row:
  &lt;pre class="console"&gt;$ dig randomserver.com&lt;/pre&gt; First execution
  should have &lt;i&gt;Query time: XX msec&lt;/i&gt; with XX being few tens of
  miliseconds. Query time for second run should be zero or very close
  to zero.&lt;br&gt;&lt;br&gt;

  Congratulations. You have your very own caching server. Who
  knows...maybe you'll even notice some improvements in your network
  connection :-)
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9113231689788545980-3094587455950676542?l=inputvalidation.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=fzUQdZnT9BY:p6XIR67H3R8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=fzUQdZnT9BY:p6XIR67H3R8:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=fzUQdZnT9BY:p6XIR67H3R8:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=fzUQdZnT9BY:p6XIR67H3R8:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=fzUQdZnT9BY:p6XIR67H3R8:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=fzUQdZnT9BY:p6XIR67H3R8:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=fzUQdZnT9BY:p6XIR67H3R8:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=fzUQdZnT9BY:p6XIR67H3R8:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/InsAndOutsOfInputs/~4/fzUQdZnT9BY" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/InsAndOutsOfInputs/~3/fzUQdZnT9BY/local-dns-caching-just-do-it-already.html</link><author>noreply@blogger.com (Stanislav Ochotnický)</author><thr:total>6</thr:total><feedburner:origLink>http://inputvalidation.blogspot.com/2010/11/local-dns-caching-just-do-it-already.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-9113231689788545980.post-1638311793323294190</guid><pubDate>Wed, 10 Nov 2010 20:22:00 +0000</pubDate><atom:updated>2010-11-10T21:22:43.667+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">open source</category><category domain="http://www.blogger.com/atom/ns#">projects</category><category domain="http://www.blogger.com/atom/ns#">en</category><category domain="http://www.blogger.com/atom/ns#">fedora</category><category domain="http://www.blogger.com/atom/ns#">software</category><category domain="http://www.blogger.com/atom/ns#">python</category><category domain="http://www.blogger.com/atom/ns#">pyqt</category><title>PyQTrailer revisited</title><description>&lt;div align="justify"&gt;
Some time ago, I wrote about my little project: apple.com &lt;a href="http://inputvalidation.blogspot.com/2010/05/downloading-trailers-on-linux-final.html"&gt;trailer
downloader&lt;/a&gt;. Apple is still not very open-source friendly as far as
its trailer website is concerned. So all points I made in my original
post still stand. To my surprise this little project is still alive and
kicking, with new ideas for improvements coming and coming
:-). What is even more important: it seems that so far no
breakage happened due to apple changing something on the
web.&lt;br /&gt;&lt;br /&gt;

Since the first version I released almost 6 months ago several new
features appeared. Some of them include:
&lt;ul&gt;
  &lt;li&gt;Parallel downloading of trailers&lt;/li&gt;
  &lt;li&gt;Ability to run movie player (mplayer, vlc, etc) without
  downloading file to HDD&lt;/li&gt;
  &lt;li&gt;Lot of customisation/performance options added&lt;/li&gt;
  &lt;li&gt;Working support for trailer search&lt;/li&gt;
  &lt;li&gt;Localisation support&lt;/li&gt;
  &lt;li&gt;Python 3 support&lt;/li&gt;
&lt;/ul&gt;

Latest version (0.5.2) is available in Gentoo repositories already, and should
hit Fedora updates in next day or so (this will be delayed due to new
package acceptance criteria though). Enjoy.
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9113231689788545980-1638311793323294190?l=inputvalidation.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=HfKVF1oBllA:A-x6btdbvAY:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=HfKVF1oBllA:A-x6btdbvAY:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=HfKVF1oBllA:A-x6btdbvAY:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=HfKVF1oBllA:A-x6btdbvAY:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=HfKVF1oBllA:A-x6btdbvAY:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=HfKVF1oBllA:A-x6btdbvAY:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=HfKVF1oBllA:A-x6btdbvAY:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=HfKVF1oBllA:A-x6btdbvAY:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/InsAndOutsOfInputs/~4/HfKVF1oBllA" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/InsAndOutsOfInputs/~3/HfKVF1oBllA/pyqtrailer-revisited.html</link><author>noreply@blogger.com (Stanislav Ochotnický)</author><thr:total>1</thr:total><feedburner:origLink>http://inputvalidation.blogspot.com/2010/11/pyqtrailer-revisited.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-9113231689788545980.post-2165065232858165140</guid><pubDate>Wed, 20 Oct 2010 21:55:00 +0000</pubDate><atom:updated>2010-10-23T19:45:11.038+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">open source</category><category domain="http://www.blogger.com/atom/ns#">howto</category><category domain="http://www.blogger.com/atom/ns#">qt</category><category domain="http://www.blogger.com/atom/ns#">python</category><category domain="http://www.blogger.com/atom/ns#">programming</category><category domain="http://www.blogger.com/atom/ns#">pyqt</category><title>Python3, PyQt4 and missing QString</title><description>&lt;div align="justify"&gt;
  As I was recently adding support for Python 3 to my little trailer
  downloader application that
  I &lt;a href="http://inputvalidation.blogspot.com/2010/05/downloading-trailers-on-linux-final.html"&gt;mentioned
  before&lt;/a&gt;
  (&lt;a href="http://github.com/sochotnicky/pyqtrailer"&gt;PyQTrailer&lt;/a&gt;)
  I encountered a strange problem with PyQt4 that only occurred in
  Python 3.&lt;br /&gt;&lt;br /&gt;


  Let's take this simple python example:

&lt;pre class="console"&gt;
$ python
&gt;&gt;&gt; from PyQt4.QtCore import QString
&gt;&gt;&gt;
&lt;/pre&gt;

  That same code snippet doesn't work in python3 interpreter though:

&lt;pre class="console"&gt;
$ python3
&gt;&gt;&gt; from PyQt4.QtCore import QString
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
ImportError: cannot import name QString
&gt;&gt;&gt;
&lt;/pre&gt;

My first instinct was: Bug! Gentoo PyQt4 ebuild was doing something
terrible and somehow made PyQt4 unusable in python3 interpreter. Turns
out my gut instinct was wrong (once again :-) ).&lt;br/&gt;&lt;br/&gt;

PyQt4 since version 4.6 changed API of QString and QVariant for python
3.x. For QString this is due to fact that from Python 3.0, string
literals are unicode objects (no need for u'unicode' magic
anymore). This means that you can use ordinary Python strings in place
for QString. But I wanted my QString for something like this:

&lt;pre name="code" class="python"&gt;
  ...
  downloadClicked = pyqtSignal((QString, ))
  ...
&lt;/pre&gt;

This snippet creates Qt signals that you can
then &lt;em&gt;emit&lt;/em&gt;. Question is... How can we update this for Python
3.x? We could probably just replace QString with &lt;em&gt;type("")&lt;/em&gt;,
but for a change that wouldn't work with Python 2.x. So? Python
dynamic nature to the rescue! &lt;br/&gt;&lt;b&gt;Edit: simplified QString definition (thanks Arfrever)&lt;/b&gt;

&lt;pre name="code" class="python"&gt;
try:
    from PyQt4.QtCore import QString
except ImportError:
    # we are using Python3 so QString is not defined
    QString = str
&lt;/pre&gt;

If we put previous code sample to the beginning of our Python file we
can use QString in our code and it will keep working both in Python
3.x and Python 2.x. Case closed dear Watson.
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9113231689788545980-2165065232858165140?l=inputvalidation.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=xJIj7kHjdsk:RRoNRdsHCH8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=xJIj7kHjdsk:RRoNRdsHCH8:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=xJIj7kHjdsk:RRoNRdsHCH8:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=xJIj7kHjdsk:RRoNRdsHCH8:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=xJIj7kHjdsk:RRoNRdsHCH8:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=xJIj7kHjdsk:RRoNRdsHCH8:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=xJIj7kHjdsk:RRoNRdsHCH8:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=xJIj7kHjdsk:RRoNRdsHCH8:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/InsAndOutsOfInputs/~4/xJIj7kHjdsk" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/InsAndOutsOfInputs/~3/xJIj7kHjdsk/python3-pyqt4-and-missing-qstring.html</link><author>noreply@blogger.com (Stanislav Ochotnický)</author><thr:total>2</thr:total><feedburner:origLink>http://inputvalidation.blogspot.com/2010/10/python3-pyqt4-and-missing-qstring.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-9113231689788545980.post-5916794364341474714</guid><pubDate>Wed, 20 Oct 2010 08:12:00 +0000</pubDate><atom:updated>2010-10-20T10:12:26.021+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">rant</category><category domain="http://www.blogger.com/atom/ns#">open source</category><category domain="http://www.blogger.com/atom/ns#">fedora</category><category domain="http://www.blogger.com/atom/ns#">game</category><title>Fedora RPG - Three level badge system?</title><description>&lt;div align="justify"&gt;
  I stumbled upon one great idea on Fedora Planet. It is nothing
  other
  than &lt;a href="http://nicubunu.blogspot.com/2010/10/fedora-rpg.html"&gt;Fedora
  RPG!&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;

  In short, it's a system to create characters similar as they are
  in Role-playing games (RPGs) with levels, skill points and more.&lt;br /&gt;&lt;br /&gt;

  You might think it doesn't make sense to give contributors "points" for
  non-gaming activities but you would be wrong. Most communities have
  created ways to reward their members this way. Look no further than my
  favourite &lt;a href="http://stackoverflow.com/"&gt;stackoverflow.com&lt;/a&gt;. It
  also uses badge and skill point system for various actions on the
  website. In &lt;a href="http://blog.stackoverflow.com/2008/07/stack-overflow-badge-feedbac/"&gt;one of earliest blog posts&lt;/a&gt; about how stackoverflow will
  work, Jeff Atwood shared his vision: three levels of badges (bronze, silver, gold).
  Each level with unique badges tailored to the purpose of
  stackoverflow.&lt;br /&gt;&lt;br /&gt;

  I guess Fedora RPG will go a bit further in this regard. I would
  love to know how it will all turn out and how the levels will
  work. Let the games begin!&lt;br /&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9113231689788545980-5916794364341474714?l=inputvalidation.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=Yt8VX4JmCd4:Odxt6N3YKwM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=Yt8VX4JmCd4:Odxt6N3YKwM:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=Yt8VX4JmCd4:Odxt6N3YKwM:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=Yt8VX4JmCd4:Odxt6N3YKwM:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=Yt8VX4JmCd4:Odxt6N3YKwM:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=Yt8VX4JmCd4:Odxt6N3YKwM:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=Yt8VX4JmCd4:Odxt6N3YKwM:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=Yt8VX4JmCd4:Odxt6N3YKwM:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/InsAndOutsOfInputs/~4/Yt8VX4JmCd4" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/InsAndOutsOfInputs/~3/Yt8VX4JmCd4/fedora-rpg-three-level-badge-system.html</link><author>noreply@blogger.com (Stanislav Ochotnický)</author><thr:total>4</thr:total><feedburner:origLink>http://inputvalidation.blogspot.com/2010/10/fedora-rpg-three-level-badge-system.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-9113231689788545980.post-1857320123969104281</guid><pubDate>Fri, 15 Oct 2010 10:51:00 +0000</pubDate><atom:updated>2010-10-15T13:08:20.194+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">packaging</category><category domain="http://www.blogger.com/atom/ns#">linux</category><category domain="http://www.blogger.com/atom/ns#">en</category><category domain="http://www.blogger.com/atom/ns#">howto</category><category domain="http://www.blogger.com/atom/ns#">git</category><category domain="http://www.blogger.com/atom/ns#">fedora</category><title>Packaging workflow, patch management and git magic in Fedoraland</title><description>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;&lt;div align="justify"&gt;Big part of my job is packaging for Fedora Linux (I am pretty sure I haven't mentioned this before :-) ). I have spent last 6 months working on various Java packages, adding new packages to Fedora, updating dependencies etc. I have developed certain workflow which I believe might be of interest to other packagers. So here goes. Most of these hints are about managing patches for your packages. I'll also try to work on concrete package so it won't be completely theoretical.&lt;br /&gt;
&lt;br /&gt;
Let's assume your project already has some history and patches. Let's fix velocity bug &lt;a href="https://bugzilla.redhat.com/show_bug.cgi?id=640660"&gt;640660&lt;/a&gt; for example. I'll start with steps I took and what they meant, and I'll summarize in the end with rationale what I have gained by using my workflow (and what could be improved).&lt;br /&gt;
&lt;br /&gt;
After modifying BuildRequires and Requires to tomcat6 servlet api I tried to build velocity:&lt;br /&gt;
&lt;pre class="console"&gt;$ fedpkg mock
&lt;/pre&gt;This is what I got:&lt;br /&gt;
&lt;pre name="code" class="xml"&gt;---snip----
compile-test:
    [javac] Compiling 125 source files to /builddir/build/BUILD/velocity-1.6.3/bin/test-classes
    [javac] /builddir/build/BUILD/velocity-1.6.3/bin/test-src/org/apache/velocity/test/VelocityServletTestCase.java:135: org.apache.velocity.test.VelocityServletTestCase.MockServletContext is not abstract and does not override abstract method getContextPath() in javax.servlet.ServletContext
    [javac]     static class MockServletContext implements ServletContext
    [javac]            ^
    [javac] Note: /builddir/build/BUILD/velocity-1.6.3/bin/test-src/org/apache/velocity/test/VelocityServletTestCase.java uses or overrides a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 1 error
BUILD FAILED
/builddir/build/BUILD/velocity-1.6.3/build/build.xml:251: Compile failed; see the compiler error output for details.
Total time: 47 seconds
---snip---
&lt;/pre&gt;The issue seems simple to fix, just missing stub function in a test case, right? So what now?&lt;br /&gt;
&lt;pre class="console"&gt;$ fedpkg prep
$ mv velocity-1.6.3 velocity-1.6.3.git
$ cd velocity-1.6.3.git
$ git init &amp;amp;&amp;amp; git add . &amp;amp;&amp;amp; git commit -m 'init'
&lt;/pre&gt;This effectively created my small git repository for sources and populated it with all files. Using fedpkg prep step we extracted the tarball and applied already existing patches to unpacked sources. I suggest you create shell alias for last three commands as you'll be using it a lot. We moved directory to velocity-1.6.3.git so that next (accidental?) fedpkg prep won't erase our complicated changes (yes it happened to me once. I've had better days). Note that velocity-1.6.3.git is not a temporary directory. I will keep it around after fixing this bug so that I can use git history, diffs and other features in the future. It is especially nice when you have packages with lot of patches on top. &lt;br /&gt;
&lt;br /&gt;
Now we can easily work in our new git repository, edit source file in question and do:&lt;br /&gt;
&lt;pre class="console"&gt;$ git add src/test/org/apache/velocity/test/VelocityServletTestCase.java
$ git commit -m 'Fix test for servlet api 2.5'
$ git format-patch HEAD~1
&lt;/pre&gt;This created commit with descriptive message and generated a patch file 0001-Fix-test-for-servlet-api-2.5.patch in our current directory. This is how the patch looks like:&lt;br /&gt;
&lt;pre name="code" class="xml"&gt;From 8758e3c83411ffadc084d241217fc25f1fd31f42 Mon Sep 17 00:00:00 2001
From: Stanislav Ochotnicky &amp;lt;sochotnicky@redhat.com&amp;gt;
Date: Thu, 14 Oct 2010 10:20:52 +0200
Subject: [PATCH] Fix test for servlet api 2.5

---
 .../velocity/test/VelocityServletTestCase.java     |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/src/test/org/apache/velocity/test/VelocityServletTestCase.java b/src/test/org/apache/velocity/test/VelocityServletTestCase.java
index 824583e..ac0ab5c 100644
--- a/src/test/org/apache/velocity/test/VelocityServletTestCase.java
+++ b/src/test/org/apache/velocity/test/VelocityServletTestCase.java
@@ -16,7 +16,7 @@ package org.apache.velocity.test;
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
- * under the License.    
+ * under the License.
  */
 
 import java.io.IOException;
@@ -149,6 +149,11 @@ public class VelocityServletTestCase extends TestCase
             return this;
         }
 
+        public String getContextPath()
+        {
+            return "";
+        }
+
         public String getServletContextName()
         {
             return "VelocityTestContext";
-- 
1.7.2.3
&lt;/pre&gt;&lt;br /&gt;
Now that we have patch prepared for velocity we need to use it in the spec file and we're done. &lt;br /&gt;
&lt;br /&gt;
Let's say our first attempted patch wouldn't work as expected and build (or test) still failed. We modify the sources again and do another commit. What we have now is:&lt;br /&gt;
&lt;pre class="console"&gt;$ git log --format=oneline
c15f7e02eaae93b755cc0bfde6def3d6e67d2b0f (HEAD, master) Fix previous commit
3e3d654c142c7028c9c7895579fba204c4c4bf08 Fix test for servlet api 2.5
2f32554ddf892f4cca3f78b1f82a7c3ab169c357 init
&lt;/pre&gt;&lt;br /&gt;
We don't want two patches in the spec file for one fix so: time for git magic. You've probably heard of git rebase if you've been using git for a while. What we want to do now is merge last two commits into one, or in git-speak "squash" them. To do this you have to do:&lt;br /&gt;
&lt;pre class="console"&gt;$ git rebase -i HEAD~2
&lt;/pre&gt;Now your editor should pop-up with this text:&lt;br /&gt;
&lt;pre class="editor"&gt;pick 3e3d654 Fix test for servlet api 2.5
pick c15f7e0 Fix previous commit

# Rebase 2f32554..c15f7e0 onto 2f32554
#
# Commands:
#  p, pick = use commit
#  r, reword = use commit, but edit the commit message
#  e, edit = use commit, but stop for amending
#  s, squash = use commit, but meld into previous commit
#  f, fixup = like "squash", but discard this commit's log message
#
# If you remove a line here THAT COMMIT WILL BE LOST.
# However, if you remove everything, the rebase will be aborted.
#
&lt;/pre&gt;&lt;br /&gt;
So we just need to change "pick c15f7e0 Fix previous commit" into "squash c15f7e0 Fix previous commit" (you can also use just 's' instead of 'squash'). Save. Close. Another editor window will open with something like this:&lt;br /&gt;
&lt;pre class="editor"&gt;# This is a combination of 2 commits.
# The first commit's message is:

Fix test for servlet api 2.5

# This is the 2nd commit message:

Fix previous commit

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
&lt;/pre&gt;&lt;br /&gt;
For this case we will delete second message because we just want to pretend our first attempt was perfect :-). Save. Close. Now we have:&lt;br /&gt;
&lt;pre class="console"&gt;$ git log --format=oneline
cbabb6ac43f7bdb8e52ccd09c25cfd0a032b553c (HEAD, master) Fix test for servlet api 2.5
2f32554ddf892f4cca3f78b1f82a7c3ab169c357 init
&lt;/pre&gt;&lt;br /&gt;
Repeat as many times as you want. You can also re-order commits and change commit messages with rebase (note that if you just want to change last commit message you can do "git commit --amend"). I generally don't create commits until I have working patch though.&lt;br /&gt;
&lt;br /&gt;
So why do I think all this mumbo-jumbo improves my workflow? Let's see:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt; I can have long comments for every patch I create (instead a line or two in spec file)&lt;br /&gt;
&lt;li&gt; I can use the same patches to send directly to upstream&lt;br /&gt;
&lt;li&gt; I don't have to juggle around with diff and remember what files I changed where&lt;br /&gt;
&lt;li&gt; Probably several other things I haven't even realized&lt;br /&gt;
&lt;/ul&gt;I have a few things that bother me of course. git format-patch generates filenames that are different from standard practice of %{name}-%{version}-message.patch. This is not a git problem. For packages where only my patches exist I stick with git naming, but when there are different patches I stick with naming they started. Another thing that is bothering me is that creating initial repository by using "fedpkg prep" hides patches that were applied to sources. That's why I am thinking about re-working my packages so that all patches will be in my git repositories as commits with descriptive messages. No need for comments in the spec file anymore.  Perhaps someone can suggest other improvements to my approach. &lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9113231689788545980-1857320123969104281?l=inputvalidation.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=a3qJh7EG-wk:9AhfotKQZ04:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=a3qJh7EG-wk:9AhfotKQZ04:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=a3qJh7EG-wk:9AhfotKQZ04:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=a3qJh7EG-wk:9AhfotKQZ04:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=a3qJh7EG-wk:9AhfotKQZ04:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=a3qJh7EG-wk:9AhfotKQZ04:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=a3qJh7EG-wk:9AhfotKQZ04:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=a3qJh7EG-wk:9AhfotKQZ04:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/InsAndOutsOfInputs/~4/a3qJh7EG-wk" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/InsAndOutsOfInputs/~3/a3qJh7EG-wk/packaging-workflow-patch-management-and_4170.html</link><author>noreply@blogger.com (Stanislav Ochotnický)</author><thr:total>1</thr:total><feedburner:origLink>http://inputvalidation.blogspot.com/2010/10/packaging-workflow-patch-management-and_4170.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-9113231689788545980.post-9101111899515242749</guid><pubDate>Sat, 28 Aug 2010 20:13:00 +0000</pubDate><atom:updated>2010-08-28T22:13:27.705+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">open source</category><category domain="http://www.blogger.com/atom/ns#">projects</category><category domain="http://www.blogger.com/atom/ns#">photography</category><category domain="http://www.blogger.com/atom/ns#">en</category><category domain="http://www.blogger.com/atom/ns#">software</category><category domain="http://www.blogger.com/atom/ns#">qt</category><category domain="http://www.blogger.com/atom/ns#">programming</category><category domain="http://www.blogger.com/atom/ns#">kde</category><title>Uploading original photos from Digikam to Flickr</title><description>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;&lt;div align='justify'&gt;I have been using &lt;a href='http://www.digikam.org/'&gt;Digikam&lt;/a&gt; for managing my photos for some time. It's pretty neat software and development is progressing quite fast. You can think of it as Lightroom, just without the neat non-destructive editing. But that is &lt;a href='http://www.digikam.org/drupal/node/534'&gt;coming&lt;/a&gt; too, thanks to Google and another round of &lt;a href='http://code.google.com/soc/'&gt;Summer of Code&lt;/a&gt; participants. But I wouldn't be writing this blog post if Digikam was flawless would I? :-) &lt;br/&gt;&lt;br/&gt;First I'll describe my work-flow in few short bullet-points :-)&lt;br/&gt;&lt;ul&gt;&lt;li&gt;Shoot a LOT of photos&lt;/li&gt;&lt;li&gt;Delete almost as many photos&lt;/li&gt;&lt;li&gt;Geotag, tag/keyword and rate remaining photos&lt;/li&gt;&lt;li&gt;If it was party or something similar upload to Facebook right away&lt;/li&gt;&lt;li&gt;Pick few photos and improve them a bit with Gimp (nothing fancy, just crop/levels)&lt;/li&gt;&lt;li&gt;Upload all photos to Flickr as a backup/sharing place&lt;br/&gt;&lt;/li&gt;&lt;/ul&gt;Digikam enables me to work like this, except the last point. Why? Because apparently Digikam developers don't think anyone would update their photos to Flickr without first resizing/recompressing them. This  how flickr export dialog looks like this:&lt;br/&gt;&lt;img src='http://lh5.ggpht.com/_okEyaW3QNa0/THlpPwrYnHI/AAAAAAAAIvk/j4YaXOL-yQw/%5BUNSET%5D.png?imgmax=800' style='max-width: 800px;'/&gt;&lt;br/&gt;&lt;br/&gt;See the problem? Even if I don't chose "Resize photos before uploading" Digikam will still re-compress them which is a Really-Bad-Thing(tm) to do with jpeg files. I had some previous experience with Qt3 and even Qt4. so I though it might be a good idea to look into fixing this small annoyance. I will not bore you with the details how I checked out svn repository with git and rest of the stuff. Here is the result:&lt;br/&gt;&lt;img src='http://lh3.ggpht.com/_okEyaW3QNa0/THlqXNT9NcI/AAAAAAAAIvo/FDncRzWxh3o/%5BUNSET%5D.png?imgmax=800' style='max-width: 800px;'/&gt;&lt;br/&gt;&lt;br/&gt;If you un-check "Send original file (no resizing)" original settings will appear and you can resize/recompress as much as you want (Blasphemy! Madness!). The patch is not flawless, because it won't prevent you from trying to upload RAW files to Flickr, but it's good enough for me :-) It's not even that big, stats are like this:&lt;br/&gt;&lt;font face='monospace'&gt;&lt;br/&gt; flickrexport/flickrtalker.cpp |   18 ++++++++++++------&lt;br/&gt; flickrexport/flickrtalker.h   |    2 +-&lt;br/&gt; flickrexport/flickrwidget.cpp |   34 ++++++++++++++++++++++++++--------&lt;br/&gt; flickrexport/flickrwidget.h   |    5 +++++&lt;br/&gt; flickrexport/flickrwindow.cpp |    4 ++++&lt;br/&gt; flickrexport/flickrwindow.h   |    1 +&lt;br/&gt; 6 files changed, 49 insertions(+), 15 deletions(-)&lt;br/&gt;&lt;/font&gt;&lt;br/&gt;You can download &lt;a href='https://dl.dropbox.com/u/165616/0001-Support-for-exporting-original-file-in-flickr.patch'&gt;the patch&lt;/a&gt; from my Dropbox for now until the &lt;a href='http://bugs.kde.org/show_bug.cgi?id=212106'&gt;bugreport&lt;/a&gt; I created some time ago will get sorted out (don't hold your breath too much though). The patch applies cleanly across all versions of kipi-plugins I tried (from 0.8.something to 1.4.0). Happy uploading.&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9113231689788545980-9101111899515242749?l=inputvalidation.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=QRnmhV4Oic0:MzQs3b4bHJU:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=QRnmhV4Oic0:MzQs3b4bHJU:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=QRnmhV4Oic0:MzQs3b4bHJU:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=QRnmhV4Oic0:MzQs3b4bHJU:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=QRnmhV4Oic0:MzQs3b4bHJU:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=QRnmhV4Oic0:MzQs3b4bHJU:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=QRnmhV4Oic0:MzQs3b4bHJU:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=QRnmhV4Oic0:MzQs3b4bHJU:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/InsAndOutsOfInputs/~4/QRnmhV4Oic0" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/InsAndOutsOfInputs/~3/QRnmhV4Oic0/uploading-original-photos-from-digikam.html</link><author>noreply@blogger.com (Stanislav Ochotnický)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/_okEyaW3QNa0/THlpPwrYnHI/AAAAAAAAIvk/j4YaXOL-yQw/s72-c/%5BUNSET%5D.png?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://inputvalidation.blogspot.com/2010/08/uploading-original-photos-from-digikam.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-9113231689788545980.post-7216033202139964919</guid><pubDate>Mon, 10 May 2010 21:19:00 +0000</pubDate><atom:updated>2010-11-10T21:40:30.342+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">open source</category><category domain="http://www.blogger.com/atom/ns#">projects</category><category domain="http://www.blogger.com/atom/ns#">linux</category><category domain="http://www.blogger.com/atom/ns#">en</category><category domain="http://www.blogger.com/atom/ns#">software</category><category domain="http://www.blogger.com/atom/ns#">python</category><title>Downloading trailers on Linux - final solution</title><description>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;I love films. All of them to be exact. I believe you just have to be in the right mood and you would enjoy even few of the &lt;a href='http://www.imdb.com/chart/bottom'&gt;worst movies ever made&lt;/a&gt;. Even though I am a proponent of open source philosophy, we as a society are obviously not ready to embrace it in entertainment industry just yet. &lt;br/&gt;&lt;br/&gt;This is where &lt;a href='http://www.apple.com/trailers'&gt;www.apple.com/trailers&lt;/a&gt; comes into play. Apple made great deals with movie studios and you can watch/download newest movie trailers. Well...sort of. Apple employs variety of restrictions which makes this site next to useless on a Linux desktop. It hides links to trailers themselves behind reference files so that when you download with your favorite browser, you will only get small reference file not the trailer itself. And that is after you circumvent user-agent protection. Because apple believes nothing but iTunes/iPad/iOtherAppleStuff should access these trailers. There are scripts around that can make downloading possible for Linux users. I have been using &lt;a href='http://userscripts.org/scripts/show/2484'&gt;Apple Trailer Download&lt;/a&gt; script for Greasemonkey for quite some time, but it always stopped working after some time.&lt;br/&gt;&lt;br/&gt;Another opportunity for me I guess. I have been trying to improve my Python-fu for some time so what better way then a small project like this? I started last weekend after I found out Apple actually publishes JSON data of trailers on its site. This made access quite easy from python and is quite error-prone to changes of website itself (as long as Apple doesn't pull whole JSON thingy...but they are actively using it too). Long story short...there are two outputs from this endeavor:&lt;br/&gt;&lt;ul&gt;&lt;li&gt;&lt;a href='http://github.com/sochotnicky/pytrailer'&gt;pytrailer&lt;/a&gt; - python module to simplify access to movies on apple.com/trailers&lt;/li&gt;&lt;li&gt;&lt;a href='http://github.com/sochotnicky/pyqtrailer'&gt;pyqtrailer&lt;/a&gt; - Qt4 interface that displays poster, movie information and enables downloading of trailers&lt;/li&gt;&lt;/ul&gt;You can report bugs on respective websites (there are quite a few now, but basic downloading for hd trailers works). If you want to try it out just running:&lt;br/&gt;&lt;div align='justify'&gt;# easy_install pyqtrailer&lt;br/&gt;should work as long as you have PyQt4 installed. You can just run &lt;font face='monospace'&gt;pyqtrailer&lt;/font&gt; now and you should see something like this:&lt;br/&gt;&lt;img src='http://lh3.ggpht.com/_okEyaW3QNa0/S-h4x5of7SI/AAAAAAAAIs8/Xv33cyhvXk8/%5BUNSET%5D.png?imgmax=800' style='max-width: 800px;'/&gt;&lt;br/&gt;&lt;br/&gt;That's it. I will improve/fix it a bit but don't expect too much :-)&lt;br/&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9113231689788545980-7216033202139964919?l=inputvalidation.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=JAopIo1F8B4:8o7V9ygtzXE:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=JAopIo1F8B4:8o7V9ygtzXE:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=JAopIo1F8B4:8o7V9ygtzXE:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=JAopIo1F8B4:8o7V9ygtzXE:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=JAopIo1F8B4:8o7V9ygtzXE:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=JAopIo1F8B4:8o7V9ygtzXE:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=JAopIo1F8B4:8o7V9ygtzXE:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=JAopIo1F8B4:8o7V9ygtzXE:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/InsAndOutsOfInputs/~4/JAopIo1F8B4" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/InsAndOutsOfInputs/~3/JAopIo1F8B4/downloading-trailers-on-linux-final.html</link><author>noreply@blogger.com (Stanislav Ochotnický)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/_okEyaW3QNa0/S-h4x5of7SI/AAAAAAAAIs8/Xv33cyhvXk8/s72-c/%5BUNSET%5D.png?imgmax=800" height="72" width="72" /><thr:total>2</thr:total><feedburner:origLink>http://inputvalidation.blogspot.com/2010/05/downloading-trailers-on-linux-final.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-9113231689788545980.post-2243530191916198231</guid><pubDate>Sat, 27 Mar 2010 22:41:00 +0000</pubDate><atom:updated>2010-03-28T00:53:39.520+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">open source</category><category domain="http://www.blogger.com/atom/ns#">problem</category><category domain="http://www.blogger.com/atom/ns#">linux</category><category domain="http://www.blogger.com/atom/ns#">en</category><category domain="http://www.blogger.com/atom/ns#">software</category><category domain="http://www.blogger.com/atom/ns#">bug</category><category domain="http://www.blogger.com/atom/ns#">kernel</category><title>And he's back! (from hibernating)</title><description>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;&lt;div align='justify'&gt;What better way to celebrate summer solstice, than by making my computer able to hibernate? Since my last post a lot has happened with me. I got a new phone (HTC Hero FTW!), I finished university, went traveling a bit and I also got a new notebook (because the old one died on me). R.I.P. Thinkpad R51, welcome Thinkpad T500. There are several things I could start writing about now. Starting with how great Hero and Android is to use all the way to today's blog post: How to make my computer hibernate?&lt;br /&gt;&lt;br /&gt;Linux has had support for hibernating for quite a few years now and although it's not perfect, it usually works out of the box. What it needs however is swap device big enough so that it can store image of memory for hibernating. Now I hit a problem. When I got my new Thinkpad I thought "Hey, I have 4GB of RAM...why would I need a swap?". And even if I REALLY needed more than 4GB RAM I can still create temporary swap by using &lt;a href='http://www.redhat.com/docs/manuals/linux/RHL-8.0-Manual/custom-guide/s1-swap-adding.html'&gt;swapfile&lt;/a&gt;. Unfortunately I couldn't make swapfile on &lt;a href='http://en.wikipedia.org/wiki/Logical_Volume_Manager_%28Linux%29'&gt;LVM&lt;/a&gt; work with &lt;a href='http://www.tuxonice.net/'&gt;TuxOnIce&lt;/a&gt;. TuxOnIce also has another alternative to swap or swapfile for hibernating: Using filewriter, which is quite similar to swapfile support, I managed to get it to work (after some work, kernel debugging and one small patch to TuxOnIce).&lt;br /&gt;&lt;br /&gt;I set &lt;em&gt;FilewriterLocation&lt;/em&gt; in hibernate.conf to point to a place where I wanted to store hibernation file and I set the size to 4GB. As instructed in TuxOnIce &lt;a href='http://www.tuxonice.net/HOWTO-2.html'&gt;HOWTO&lt;/a&gt;, I then ran &lt;pre class='console'&gt;hibernate --no-suspend&lt;/pre&gt; to create this image. It created the file as expected, but when it was supposed to tell me settings for bootloader (resume argument) it silently failed. When I tried again, whole computer froze. I was puzzled. How could this happen? I am using Linux so things like this don't happen! But hey, I should be able to figure out what's wrong with it right? I set up my kernel to include &lt;a href='http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.33.y.git;a=blob_plain;f=Documentation/networking/netconsole.txt;hb=HEAD'&gt;netconsole&lt;/a&gt;, and ran hibernate again. This time I caught where the bug happened. The output was something like this:&lt;br /&gt;&lt;br /&gt;&lt;pre style='font-size: 90%;' class='console'&gt;TuxOnIce: No image found.&lt;br /&gt;BUG: unable to handle kernel paging request at 6539207a&lt;br /&gt;IP: [&amp;lt;c10763a6&amp;gt;] toi_attr_store+0x186/0x2a0&lt;br /&gt;*pdpt = 0000000032732001 *pde = 0000000000000000&lt;br /&gt;Oops: 0000 [#1] PREEMPT SMP&lt;br /&gt;last sysfs file: /sys/power/tuxonice/file/target&lt;br /&gt;Modules linked in: netconsole aes_i586 aes_generic radeon ttm drm_kms_helper drm&lt;br /&gt; i2c_algo_bit sco bnep ipt_MASQUERADE iptable_nat nf_nat ipt_LOG nf_conntrack_ip&lt;br /&gt;v4 nf_defrag_ipv4 xt_state nf_conntrack ipt_REJECT xt_tcpudp iptable_filter ip_t&lt;br /&gt;ables x_tables rfcomm l2cap vboxnetadp vboxnetflt vboxdrv arc4 iwlagn iwlcore ma&lt;br /&gt;c80211 sdhci_pci snd_hda_codec_conexant sdhci pcmcia e1000e uvcvideo mmc_core cf&lt;br /&gt;g80211 snd_hda_intel yenta_socket btusb rsrc_nonstatic tpm_tis pcspkr pcmcia_cor&lt;br /&gt;e videodev v4l1_compat intel_agp wmi agpgart tpm snd_hda_codec tpm_bios video fu&lt;br /&gt;se xfs raid10 raid1 raid0 md_mod scsi_wait_scan sbp2 ohci1394 ieee1394 usbhid uh&lt;br /&gt;ci_hcd usb_storage ehci_hcd usbcore sr_mod sg uvesafb cfbfillrect cfbimgblt cn c&lt;br /&gt;fbcopyarea [last unloaded: microcode]&lt;br /&gt; &lt;br /&gt;Pid: 12870, comm: hibernate Not tainted 2.6.33.1-w0rm #16 2082BRG/2082BRG&lt;br /&gt;EIP: 0060:[&amp;lt;c10763a6&amp;gt;] EFLAGS: 00010202 CPU: 0&lt;br /&gt;EIP is at toi_attr_store+0x186/0x2a0&lt;br /&gt;EAX: 00000000 EBX: 36203430 ECX: 00000000 EDX: f231f200&lt;br /&gt;ESI: 65392066 EDI: 00f60062 EBP: f6006331 ESP: f62a7f14&lt;br /&gt; DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068&lt;br /&gt;Process hibernate (pid: 12870, ti=f62a6000 task=f20a0270 task.ti=f62a6000)&lt;br /&gt;Stack:&lt;br /&gt; 00000000 fffffff4 00000001 c1790ca0 00000000 f6e8ab64 c16c75a4 f6d1c380&lt;br /&gt;&amp;lt;0&amp;gt; f62a7f64 c114298d 00000015 00000015 b7709000 f21385c0 f6d1c394 c16c75a4&lt;br /&gt;&amp;lt;0&amp;gt; f6ec7ac0 f21385c0 b7709000 00000015 f62a7f8c c10f207c f62a7f98 00000000&lt;br /&gt;Call Trace:&lt;br /&gt; [&amp;lt;c114298d&amp;gt;] ? sysfs_write_file+0x9d/0x100&lt;br /&gt; [&amp;lt;c10f207c&amp;gt;] ? vfs_write+0x9c/0x180&lt;br /&gt; [&amp;lt;c11428f0&amp;gt;] ? sysfs_write_file+0x0/0x100&lt;br /&gt; [&amp;lt;c10f221d&amp;gt;] ? sys_write+0x3d/0x70&lt;br /&gt; [&amp;lt;c1002ccc&amp;gt;] ? sysenter_do_call+0x12/0x22&lt;br /&gt;Code: c7 45 e0 00 00 00 00 3b 5d 08 0f 85 e9 fe ff ff 8b 46 20 85 c0 0f 84 de fe&lt;br /&gt; ff ff ff d0 8b 7d e0 85 ff 8d 76 00 0f 84 d9 fe ff ff &amp;lt;8b&amp;gt; 46 14 31 d2 e8 60 03&lt;br /&gt; 05 00 8b 46 10 c7 46 14 00 00 00 00 a8&lt;br /&gt;EIP: [&amp;lt;c10763a6&amp;gt;] toi_attr_store+0x186/0x2a0 SS:ESP 0068:f62a7f14&lt;br /&gt;CR2: 000000006539207a&lt;br /&gt;---[ end trace 124a5ee29ef71277 ]---&lt;/pre&gt;&lt;br /&gt;So what can we deduce from this bug output? Let's go from the top. Bug name (unable to handle kernel paging request) means that it is likely a memory corruption issue. Someone accessed memory that he was not supposed to. &lt;b&gt;IP&lt;/b&gt; tells us that function where the error occurred was toi_attr_store in unknown file, unknown line (I don't have debug information included in kernel). There are other information we can get from that output, but I didn't really need them. Quick search through kernel sources told me that &lt;i&gt;toi_attr_store&lt;/i&gt; is a function inside &lt;i&gt;kernel/power/tuxonice_sysfs.c&lt;/i&gt;. I scanned the code, learning what approximately it did. Then I placed &lt;b&gt;printk&lt;/b&gt; statements thorough the function so that I could approximate where inside the function the code fails. After some time I narrowed it down to following snippet:&lt;br /&gt;&lt;pre class='c' name='code'&gt;&lt;br /&gt;	if (!result)&lt;br /&gt;    		result = count;&lt;br /&gt;&lt;br /&gt;        /* Side effect routine? */&lt;br /&gt;        if (result == count &amp;amp;&amp;amp; sysfs_data-&amp;gt;write_side_effect)&lt;br /&gt;                sysfs_data-&amp;gt;write_side_effect();&lt;br /&gt;&lt;br /&gt;        /* Free temporary buffers */&lt;br /&gt;        if (assigned_temp_buffer) {&lt;br /&gt;                toi_free_page(31,&lt;br /&gt;                        (unsigned long) sysfs_data-&amp;gt;data.string.variable);&lt;br /&gt;                sysfs_data-&amp;gt;data.string.variable = NULL;&lt;br /&gt;        }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Kernel crashed when it tried to call &lt;i&gt;toi_free_page&lt;/i&gt;. After a few reboots and printks later I found out that this was just a coincidence, and sysfs_data variable itself became corrupt even before the call to the &lt;i&gt;toi_free_page&lt;/i&gt;. Good candidate? Of course: &lt;i&gt;write_side_effect&lt;/i&gt;. But what exactly was &lt;i&gt;write_side_effect&lt;/i&gt;? This function was passed as an argument, and therefore I wasn't able to easily find out what was real code executed at this point. Time to find out! From my previous debugging attempts I knew code failed while it tried to write location of my resume file into /sys/power/tuxonince/file/target. TuxOnIce code defined handling for string sysfs arguments as such:&lt;br /&gt;&lt;pre class='c' name='code'&gt;&lt;br /&gt;#define SYSFS_STRING(_name, _mode, _string, _max_len, _flags, _wse) { \&lt;br /&gt;        .attr = {.name  = _name , .mode   = _mode }, \&lt;br /&gt;        .type = TOI_SYSFS_DATA_STRING, \&lt;br /&gt;        .flags = _flags, \&lt;br /&gt;        .data = { .string = { .variable = _string, .max_length = _max_len } }, \&lt;br /&gt;        .write_side_effect = _wse }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I found this macro used inside &lt;i&gt;tuxonice_file.c&lt;/i&gt; source code like this:&lt;br /&gt;&lt;pre class='c' name='code'&gt; &lt;br /&gt;SYSFS_STRING("target", SYSFS_RW, toi_file_target, 256,&lt;br /&gt;                SYSFS_NEEDS_SM_FOR_WRITE, test_toi_file_target)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;So we found our &lt;i&gt;write_side_effect&lt;/i&gt; code inside &lt;i&gt;test_toi_file_target&lt;/i&gt; function. In one part this function was calling &lt;i&gt;hex_dump_to_buffer&lt;/i&gt; to convert device UUID into hexadecimal string. The call looked like this:&lt;br /&gt;&lt;pre class='c' name='code'&gt; &lt;br /&gt;hex_dump_to_buffer(fs_info-&amp;gt;uuid, 16, 32, 1, buf, 50, 0);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This should convert input (fs_info-&amp;gt;uuid) into hexadecimal string and store it inside buf. Author of the original code correctly thought about function adding spaces between bytes and therefore need to have more space in the buffer (argument 50 is telling &lt;i&gt;hex_dump_to_buffer&lt;/i&gt; how big is output buffer). Unfortunately that same author declared buf as 33 char array. &lt;i&gt;hex_dump_to_buffer&lt;/i&gt; therefore stepped outside the buffer and corrupted memory, causing all the problems. I fixed this bug, and sent a patch to the &lt;a href='http://lists.tuxonice.net/pipermail/tuxonice-devel/2010-March/006016.html'&gt;tuxonice-devel&lt;/a&gt; mailing list. As of now, it is already in the git repository ready to be released with next bugfix release of TuxOnIce. &lt;br /&gt;&lt;br /&gt;That is everything for today, but as I already noted I am using LVM on my system (except root partition) and also use &lt;a href='http://dev.gentoo.org/%7Espock/projects/gensplash/'&gt;fbsplash&lt;/a&gt; for nice animations while rebooting. I am using initrd for this, and I will have another post on that topic.&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9113231689788545980-2243530191916198231?l=inputvalidation.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=iq73w8aMicU:BT28i-usw_I:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=iq73w8aMicU:BT28i-usw_I:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=iq73w8aMicU:BT28i-usw_I:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=iq73w8aMicU:BT28i-usw_I:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=iq73w8aMicU:BT28i-usw_I:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=iq73w8aMicU:BT28i-usw_I:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=iq73w8aMicU:BT28i-usw_I:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=iq73w8aMicU:BT28i-usw_I:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/InsAndOutsOfInputs/~4/iq73w8aMicU" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/InsAndOutsOfInputs/~3/iq73w8aMicU/and-he-back-from-hibernating.html</link><author>noreply@blogger.com (Stanislav Ochotnický)</author><thr:total>1</thr:total><feedburner:origLink>http://inputvalidation.blogspot.com/2010/03/and-he-back-from-hibernating.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-9113231689788545980.post-5557254995821173923</guid><pubDate>Tue, 25 Aug 2009 22:16:00 +0000</pubDate><atom:updated>2009-08-26T00:38:45.033+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">rant</category><category domain="http://www.blogger.com/atom/ns#">projects</category><category domain="http://www.blogger.com/atom/ns#">mobile</category><category domain="http://www.blogger.com/atom/ns#">problem</category><category domain="http://www.blogger.com/atom/ns#">linux</category><category domain="http://www.blogger.com/atom/ns#">en</category><category domain="http://www.blogger.com/atom/ns#">lock-in</category><title>Mobile (not so) open standards</title><description>&lt;div align="justify"&gt;Yesterday I promised I'll talk about why I hate mobile phones. Of course I didn't mean all of them. Just the ones I have to deal with. Why? Well my mobile phone kind of died few days ago. I have a Nokia N73 and it's really quite good phone even if it's a bit old by today's standards. You control the phone by using "joystick" kind of thing in the upper part of keyboard. I decided to include image so you don't have to look for it :-)&lt;br /&gt;&lt;img style="max-width: 800px;" src="http://lh4.ggpht.com/_okEyaW3QNa0/SpPCjWdHwAI/AAAAAAAAIoY/xrA89pX2tX8/%5BUNSET%5D.jpg?imgmax=800" height="266" width="151" /&gt;&lt;br /&gt;So this joystick stopped working (even slightest touch would be evaluated as pushing it, therefore it was unusable). I didn't have my backup phone with me, but one friend gave me her battered Siemens S55. So what was the problem? Well I have the same sim card for almost 10 years now. Back then only 100 contacts would fit on it. I have almost 300 contacts in my N73. So how do I get all contacts from one phone to the other? Normally I could just send them through bluetooth, but since I couldn't really control my N73 this was out of question. I was barely able to turn on the bluetooth. I thought that I'll use &lt;a href="http://en.wikipedia.org/wiki/SyncML"&gt;SyncML&lt;/a&gt; interface to get vCards from N73 to my computer and then sync them again to the S55. In the end I kind of did, but boy was that an unpleasant experience!&lt;br /&gt;&lt;br /&gt;So what exactly happened? I installed &lt;a href="http://www.opensync.org"&gt;OpenSync&lt;/a&gt; libraries and tools and using multisyncgui I created sync group with one side being file-sync plugin and other was syncml-obex-client plugin. Configuraion of file-sync plugin was mostly just changing path to directory where I wanted to sync. Final version looked like this:&lt;br /&gt;&lt;pre name="code" class="xml:nogutter"&gt;&lt;br /&gt;&amp;lt;?xml version=&amp;#34;1.0&amp;#34;?&amp;gt;&lt;br /&gt;&amp;lt;config&amp;gt;&lt;br /&gt;  &amp;lt;directory&amp;gt;&lt;br /&gt;    &amp;lt;path&amp;gt;/tmp/sync&amp;lt;/path&amp;gt;&lt;br /&gt;    &amp;lt;objtype&amp;gt;contact&amp;lt;/objtype&amp;gt;&lt;br /&gt;    &amp;lt;objformat&amp;gt;vcard30&amp;lt;/objformat&amp;gt;&lt;br /&gt;  &amp;lt;/directory&amp;gt;&lt;br /&gt;&amp;lt;/config&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Configuration for syncml-obex-client appeared to be much more challenging. It appears that Nokia N73 has two quirks:&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;It only talks to SyncML client if it says its name is "PC Suite" &lt;br /&gt;&lt;li&gt;It contains a bug that causes it to freeze after certain amount of data if configuration is not correct&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;First of these quirks is mentioned in almost every tutorial on data synchronization in Linux. However the second one caused me to lose quite some time. My Nokia N73 would freeze after synchronizing approximately 220-240 contacts. To continue working I had to restart the whole phone.In the end I found out that I need to set parameter recvLimit to 10000 in order to synchronize everything. Final setting for syncml-obex-client looks like this:&lt;br /&gt;&lt;pre name="code" class="xml:nogutter"&gt;&lt;br /&gt;&amp;lt;?xml version=&amp;#34;1.0&amp;#34;?&amp;gt;&lt;br /&gt;&amp;lt;config&amp;gt;&lt;br /&gt;  &amp;lt;type&amp;gt;2&amp;lt;/type&amp;gt;&lt;br /&gt;  &amp;lt;bluetooth_address&amp;gt;00:1B:33:3A:D1:37&amp;lt;/bluetooth_address&amp;gt;&lt;br /&gt;  &amp;lt;!-- Nokia Obex server channel --&amp;gt;&lt;br /&gt;  &amp;lt;bluetooth_channel&amp;gt;13&amp;lt;/bluetooth_channel&amp;gt;&lt;br /&gt;  &amp;lt;interface&amp;gt;0&amp;lt;/interface&amp;gt;&lt;br /&gt;  &amp;lt;identifier&amp;gt;PC Suite&amp;lt;/identifier&amp;gt;&lt;br /&gt;  &amp;lt;version&amp;gt;1&amp;lt;/version&amp;gt;&lt;br /&gt;  &amp;lt;wbxml&amp;gt;1&amp;lt;/wbxml&amp;gt;&lt;br /&gt;  &amp;lt;username&amp;gt;&amp;lt;/username&amp;gt;&lt;br /&gt;  &amp;lt;password&amp;gt;&amp;lt;/password&amp;gt;&lt;br /&gt;  &amp;lt;usestringtable&amp;gt;1&amp;lt;/usestringtable&amp;gt;&lt;br /&gt;  &amp;lt;onlyreplace&amp;gt;0&amp;lt;/onlyreplace&amp;gt;&lt;br /&gt;  &amp;lt;onlyLocaltime&amp;gt;0&amp;lt;/onlyLocaltime&amp;gt;&lt;br /&gt;  &amp;lt;recvLimit&amp;gt;10000&amp;lt;/recvLimit&amp;gt;&lt;br /&gt;  &amp;lt;maxObjSize&amp;gt;0&amp;lt;/maxObjSize&amp;gt;&lt;br /&gt;  &amp;lt;database&amp;gt;&lt;br /&gt;     &amp;lt;name&amp;gt;Contacts&amp;lt;/name&amp;gt;&lt;br /&gt;     &amp;lt;objtype&amp;gt;contact&amp;lt;/objtype&amp;gt;&lt;br /&gt;     &amp;lt;objformat&amp;gt;vcard21&amp;lt;/objformat&amp;gt;&lt;br /&gt;  &amp;lt;/database&amp;gt;  &lt;br /&gt;&amp;lt;/config&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;So after all that I was able to get vCards from my N73 to my notebook. For every vCard OpenSync created file in directory &lt;font face='Monospaced'&gt;/tmp/sync&lt;/font&gt;. Now came the interesting part. How to get these vCards to Siemens S55?&lt;br /&gt;&lt;br /&gt;Simple Google search on Siemens S55 and synchronization in Linux seemed to suggest that tool most suited to do the job was &lt;a href="http://www.hendrik-sattler.de/scmxx/" title='Scmxx'&gt;scmxx&lt;/a&gt;. This little app is specialized on certain Siemens phones. According to some manuals it was supposed to be able to upload vCards themselves, however I couldn't get it to work as scmxx was complaining about invalid command line arguments.After some testing I found out that it could access and change sim card phone numbers. &lt;br /&gt;&lt;br /&gt;Unfortunately for me, my sim card has limit of 100 phone numbers, each with 14 character identifier (name). This meant I needed to convert vCards from N73 to special format that scmxx used. Mentioned format looked something like this:&lt;br /&gt;&lt;pre name="code"&gt;&lt;br /&gt;1,"09116532168","Jones Rob"&lt;br /&gt;2,"09223344567","Moore John"&lt;br /&gt;...&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;First column being number of slot that will be overwritten by new information, second column is number and third one name of contact (less than 15 characters).&lt;br /&gt;&lt;br /&gt;So I fired up vim and started coding conversion script. It didn't take long and I had my contact in the old-new phone. There are a lot of hard-coded things in that script since I don't plan to ever use it again but you can &lt;a href="https://dl.getdropbox.com/u/165616/vcard2scmxx.py"&gt;download it&lt;/a&gt; from my dropbox. Consider it public domain, and if anyone asks I didn't have anything to do with it :-)&lt;br /&gt;&lt;pre name="code" class="python:collapse"&gt;&lt;br /&gt;import os&lt;br /&gt;import re&lt;br /&gt;&lt;br /&gt;MAX_CONTACTS=100&lt;br /&gt;&lt;br /&gt;class PbEntry(object):&lt;br /&gt;&lt;br /&gt;    def __init__(self, name, tel, year, month, day):&lt;br /&gt;        self.name = name&lt;br /&gt;        self.tel = tel&lt;br /&gt;        self.year = year&lt;br /&gt;        self.month = month&lt;br /&gt;        self.day = day&lt;br /&gt;&lt;br /&gt;def cmp_pb(e1, e2):&lt;br /&gt;    if e1.year &gt; e2.year:&lt;br /&gt;        return -1&lt;br /&gt;    elif e1.year &lt; e2.year:&lt;br /&gt;        return 1&lt;br /&gt;    else:&lt;br /&gt;        if e1.month &gt; e2.month:&lt;br /&gt;            return -1&lt;br /&gt;        elif e1.month &lt; e2.month:&lt;br /&gt;            return 1&lt;br /&gt;        return 0&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;telRe = re.compile('TEL(;TYPE=\w+)*:([*#+0-9]+)', re.M)&lt;br /&gt;revRe = re.compile('REV:(\d{4})(\d{2})(\d{2}).*', re.M)&lt;br /&gt;nameRe = re.compile('^N:(.*);(.*);;;', re.M)&lt;br /&gt;def get_entry_from_text(text):&lt;br /&gt;    ret = nameRe.search(text)&lt;br /&gt;    surname = None&lt;br /&gt;    name = None&lt;br /&gt;    tel = None&lt;br /&gt;    rev = None&lt;br /&gt;    if ret:&lt;br /&gt;        surname =  ret.group(1)&lt;br /&gt;        name = ret.group(2)&lt;br /&gt;&lt;br /&gt;    ret = telRe.search(text)&lt;br /&gt;    if ret:&lt;br /&gt;        tel =  ret.group(len(ret.groups()))&lt;br /&gt;    &lt;br /&gt;    if surname and name:&lt;br /&gt;        fn = "%s %s" % (surname,name)&lt;br /&gt;    elif surname:&lt;br /&gt;        fn = surname&lt;br /&gt;    else:&lt;br /&gt;       fn = name&lt;br /&gt;    &lt;br /&gt;    if fn:&lt;br /&gt;        ret = re.search('(.{0,14}).*', fn)&lt;br /&gt;        fn = ret.group(1)&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;    ret = revRe.search(text)&lt;br /&gt;    year = ret.group(1)&lt;br /&gt;    month = ret.group(2)&lt;br /&gt;    day = ret.group(3)&lt;br /&gt;&lt;br /&gt;    return PbEntry(fn, tel, year, month, day)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;entries = []&lt;br /&gt;&lt;br /&gt;files = os.listdir('/tmp/sync')&lt;br /&gt;for file in files:&lt;br /&gt;    fh = open('/tmp/sync/%s' % file, 'r')&lt;br /&gt;    content = fh.read()&lt;br /&gt;    entry = get_entry_from_text(content)&lt;br /&gt;    entries.append(entry)&lt;br /&gt;&lt;br /&gt;entries = sorted(entries, cmp=cmp_pb)&lt;br /&gt;&lt;br /&gt;i = 1&lt;br /&gt;for entry in entries:&lt;br /&gt;    print '%d,"%s","%s"' % (i, entry.tel, entry.name)&lt;br /&gt;    i = i + 1&lt;br /&gt;    if i &gt; MAX_CONTACTS:&lt;br /&gt;        break&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I had my share of incompatibilities between mobile phones, computers and other devices. Fortunately most of devices being sold today use open communication protocols for sharing of data (and other stuff). Too bad people had to put so much energy into reverse engineering proprietary solutions in the past. Just ranting about this vendor lock-in could be spread on quite a few pages. Imagine having 300+ contacts and calendar information in your phone of brand X. When you are buying your new phone, you would be able to synchronize your data only if you bought new phone also from brand X. Would that affect your decision? It sure would affect mine.&lt;br /&gt;&lt;br /&gt;Now I have a choice. After fixing my old N73 I will start looking into new phone. So far &lt;a href="http://www.htc.com/europe/product/hero/a-closer-look.html"&gt;HTC Hero&lt;/a&gt; looks pretty cool and &lt;a href="http://www.engadget.com/2009/07/23/htc-hero-review/"&gt;reviews&lt;/a&gt; are not half bad.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9113231689788545980-5557254995821173923?l=inputvalidation.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=MjETsHip4dc:tQCRJST3xJk:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=MjETsHip4dc:tQCRJST3xJk:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=MjETsHip4dc:tQCRJST3xJk:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=MjETsHip4dc:tQCRJST3xJk:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=MjETsHip4dc:tQCRJST3xJk:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=MjETsHip4dc:tQCRJST3xJk:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?a=MjETsHip4dc:tQCRJST3xJk:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/InsAndOutsOfInputs?i=MjETsHip4dc:tQCRJST3xJk:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/InsAndOutsOfInputs/~4/MjETsHip4dc" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/InsAndOutsOfInputs/~3/MjETsHip4dc/mobile-not-so-open-standards.html</link><author>noreply@blogger.com (Stanislav Ochotnický)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh4.ggpht.com/_okEyaW3QNa0/SpPCjWdHwAI/AAAAAAAAIoY/xrA89pX2tX8/s72-c/%5BUNSET%5D.jpg?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://inputvalidation.blogspot.com/2009/08/mobile-not-so-open-standards.html</feedburner:origLink></item></channel></rss>

