[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Specifying %{variable} in control file for use in post inst?



Ignacio Valdes wrote:
On Thu, Apr 29, 2010 at 9:03 PM, Thomas Goirand <thomas@goirand.fr> wrote:
  
Ignacio Valdes wrote:
    
It is a very complex, large package.
Does anyone know the mechanics of doing introspection in postinst for
the control file defined variables?

      
Exactly why the postinst generation method that has been given as a
(pretty good) solution would not work?
    
Required to produce versions for both rpm and deb.  No introspection
means not easy to convert this from rpm to deb which is where this
started.  This would make it much easier to produce both deb and rpm
versions if it has the ability to introspect those variables.

-- IV
  
Here's what you could do:

DEBVERS=head -n 1 debian/changelog | cut -d'(' -f2 | cut -d')' -f1 | cut -d'-' -f1
sed -i "s/__VERSION__/${DEBVERS}/" mypackage.spec
sed "s/__VERSION__/${DEBVERS}/" debian/master.postinst >debian/postinst

This way, you are controlling the version variables of both your RPM and your
Debian package using what's in the debian/changelog.

Then, if you have some of your postinst script that is the same in both OS,
then you might want to have an OS independent script in a place like
/usr/share/PKGNAME/myscript, then just source it from spec file / postinst.

I don't see this as being so hard...

To my experience, it's a lot more easy to be able to maintain BOTH the rpm
and the Debian package rather than just porting from one to another. If you
want to avoid redundancy and want to factor things a bit. Maybe you could
suggest some modifications to the maintainer of the RPM package so you
can share changes with him later on.

Just my 2 cents, hoping it helped.

Thomas


Reply to: