Sunday, February 24, 2013

Packaging protobuf-c for EL5

How boring a title that is!  Okay, we're RPMing up Protobuf-c - a c binding for the protobuf kit from Google - for EL5.  We need it to do something far more interesting later -- so these are the giants whose shoulders we stand upon.

I cheated;  let's be honest about that, and just how much I cheat to make my life easier.  It's a lot!  In this case, I stole the protobuf-c RPM as built in RHbz593559 for EL6, and which is supposed to be started for EL5 but hasn't dropped yet.  So we'll just finish that port.

  1. Go get it:
    wget http://download.fedoraproject.org/pub/epel/6/SRPMS/protobuf-c-0.15-2.el6.src.rpm
  2. Unpacking it is harder because of a strange change to the package format, where they seem to ignore compatibility.  So we need to do an rpm2cpio|cpio instead of a trivial rpm-i .  It's no big deal, but watch for it:
    rpm2cpio protobuf-c-0.15-2.el6.src.rpm | cpio -idumv
  3. Because the EL6 one has problems, we need to patch around those, but they're trivial;  it's surprising that we see this in what should be a quality product.  I worry about just how many people have this kind of blinders on.
    @@ -10,6 +10,7 @@
     Source1:        http://protobuf-c.googlecode.com/svn/tags/%{version}/LICENSE
    
     BuildRequires:  protobuf-devel
    +BuildRoot:     %{_tmppath}/%{name}-root
    
     %description
     Protocol Buffers are a way of encoding structured data in an efficient yet@@ -41,9 +41,13 @@
     make check
    
     %install
    +[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
     make install DESTDIR=$RPM_BUILD_ROOT
     rm -f $RPM_BUILD_ROOT/%{_libdir}/libprotobuf-c.la
    
    +%clean
    +[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
    +
     %post -p /sbin/ldconfig
     %postun -p /sbin/ldconfig
  4. now build:
    rpmbuild -ba protobuf-c.spec
And that's kinda it.  Can you see how simple a package-port this is?

Can you see how simple code-compatibility things we learned in first-year CompSci are being ignored here to our detriment?  This is so disappointing, and it wouldn't be a problem if I haven't had this very same conversation with someone in a position to fix it.

Labels: , , , , ,