Good afternoon,

in my recent quest for a proper way of packaging libraries (libsigc++
for that matter) for maemo, I ran into a number of issues.

The symptoms:

I hunted down libsigc++-2.0_2.0.16-2.tar.gz source and applicable debian
diff file, unpacked, applied the diff file and built arm.deb package.

Installing it in scratchbox would give me 'Operation not permitted'
error:

[sbox-SDK_ARM:] app-installer-tool install libsigc++-2.0_arm.deb
...
dpkg (subprocess): failed to chroot to `/var/lib/install': Operation not
permitted
dpkg: error processing libsigc++-2.0 (--purge):
subprocess post-removal script returned error exit status 2
...

Installing the same package on 770 would fail somewhat differently:

dpkg(subprocess): unable to execute old post-removal script: No such
file or directory
--------------------------

However, I remembered that GPE libraries would install flawlessly both
on SDK_ARM and 770. Following recent announcement about new version of
GPE by Florian Boor (thanks for the package!), I downloaded one of the
libraries, libgpewidget, built and installed it just fine - no errors
given. Both installation and removal was flawless.

I unpacked libsigc++-2.0_arm.deb and libgpewidget_arm.deb archives
side-by-side and began comparing the differences. What I found out after
tiresome trial and error was that libgpewidget doesn't have either
'postinst' or 'postrm' shell scripts included in .deb package! So, by
removing these two files from the archive and repackaging it again I was
able to install libsigc++-2.0_arm.deb (if you burn with desire to learn
the *art* of debian packaging by hand, check out this link
http://db.glug-bom.org/wiki/index.php/Build_a_Debian_Package )

Another wrinkle - it is very easy to corrupt debian packaging archive -
once you've attempted to install bad package with app-installer-tool,
there is no way to get rid of it cleanly - you have to do it by hand:

1. Go to /var/lib/install/var/lib/dpkg
2. Open 'status' file and change the 'Status' line of your ill-fated
   package from 'purge reinstreq half-installed' to 
   'purge ok not-installed'
3. examine ./info directory. If there are any of 
   package.postinst/.postrm files in there for you package, get rid 
   of them.

Now, being totally ignorant of debian packaging system, here are my
questions:

1. What do I need to put in my package/debian/rules file to prohibit
   dpkg-deb from installing or adding any postinst/postrm file to 
   the archive on its own. Even if I don't have any post-* scripts,
   dh_installdeb tends to stick a pair in with 'ldconfig' clause for
   'remove' command (quite undestandable - it is a library after all).

2. Does 770 require to have ldconfig executed after library
   installation?

3. My guess the installation fails in the first place due to the 
   permissions issue of some sort: I am logged in as a root, but 
   install to /var/lib/install as 'installer' user. Could this be
   the root of all problems?

4. Is there  a cleaner way of restoring the sanity of 'status' file
   except for editing it by hand?


Here is the 'libsigc++-2.0/debian/rules' file in question
----------------------------------------------------------
#!/usr/bin/make -f
# -*- makefile -*-

# Use debhelper V. 3
export DH_COMPAT=4

# The current SONAME (FIXME: can we autodetect this?)
SONAME=0c2a

# Files whose name varies with the soname.  For each entry x of this
# variable, the file debian/libsigc++-2.0-$(SONAME).$(x) will be
# created from debian/libsigc++-2.0.soname.$(x) file.
SONAME_SPECIFIC_EXTS=install

b := $(shell pwd)/debian/tmp

binary: binary-arch binary-indep

binary-arch: binary-arch-stamp
binary-arch-stamp: install
        dh_testdir -a
        dh_testroot -a
        dh_compress -a
        dh_fixperms -a
        dh_makeshlibs -a -V'libsigc++-2.0-$(SONAME) (>= 2.0.2)'
        dh_installdeb -a
        dh_shlibdeps -a
        dh_strip -a
        dh_gencontrol -a -- -VSoname=$(SONAME)
        dh_md5sums -a
        dh_builddeb -a

        touch binary-arch-stamp

binary-indep: binary-indep-stamp
binary-indep-stamp: install
        dh_compress -i -Xdoxygen_tags
        dh_fixperms -i
        dh_installdeb -i
        dh_strip -i
        dh_gencontrol -i -- -VSoname=$(SONAME)
        dh_md5sums -i
        dh_builddeb -i

        touch binary-indep-stamp

build: build-stamp
build-stamp: config
        dh_testdir -a
        #cd builddir && perl -i -pe 's/^(hardcode_libdir_flag_spec\s*=
\s*).+$$/$$1" -D__LIBTOOL_IS_A_FOOL__ "/' libtool
        cd builddir && $(MAKE)
        touch build-stamp

clean: clean-arrange
        dh_testdir
        dh_testroot
        if [ -d builddir ]; then rm -rf builddir; fi
        #-for x in debian/*.patch; do patch --dry-run -fRp1 < $$x
> /dev/null&&\
          patch -fRp1 < $$x ; done
        dh_clean build-stamp config-stamp install-stamp
debian/shlibs.local

config: config-stamp
config-stamp:
        dh_testdir
        #for x in debian/*.patch; do patch --dry-run -fp1 < $$x
> /dev/null && \
          patch -fp1 < $$x; done
        test -d builddir || mkdir builddir
        cd builddir && ../configure --prefix=/usr
        touch config-stamp

install: install-stamp
install-stamp: build arrange
        dh_testdir
        dh_installdirs

        # Include and .pc files are in install-data, not install-exec,
so we
        # need to do a full install.
        cd builddir && $(MAKE) prefix=$(b)/usr install
        # Rename the documentation...
        mv $(b)/usr/share/doc/libsigc-2.0 $(b)/usr/share/doc/libsigc
++-2.0-doc
        dh_install --sourcedir=debian/tmp

        dh_installdocs
        dh_installexamples -plibsigc++-2.0-doc examples/*.cc
        dh_installchangelogs ChangeLog

        touch install-stamp

clean-arrange:
        dh_testdir
        dh_testroot
        if [ -f debian/soname-specific-files ]; then rm -f `cat
debian/soname-specific-files`; rm debian/soname-specific-files; fi

# This rule adjusts the soname-specific files.
arrange: arrange-stamp
arrange-stamp: install clean-arrange
        for x in $(SONAME_SPECIFIC_EXTS); do echo "debian/libsigc
++-2.0-$(SONAME).$$x" > debian/soname-specific-files; done
        #echo "debian/libsigc++-2.0-$(SONAME).postinst" >
debian/soname-specific-files
        for x in $(SONAME_SPECIFIC_EXTS); do cp -v debian/libsigc
++-2.0.soname.$$x debian/libsigc++-2.0-$(SONAME).$$x; done
        touch arrange-stamp

.PHONY: arrange build clean-arrange binary-indep binary-arch binary
install force-clean

----------------------------------------------------------

any hints, tips, suggestions are welcome.
-Vlad



_______________________________________________
maemo-developers mailing list
maemo-developers@maemo.org
https://maemo.org/mailman/listinfo/maemo-developers

Reply via email to