Koozali.org: home of the SME Server

Would like help with building rpm's

Offline Tib

  • *
  • 571
  • +0/-0
    • http://www.tibors.net
Would like help with building rpm's
« on: September 08, 2006, 06:21:38 AM »
Hello,

Just wondering if someone could give me some help with building a simple rpm.

I have read the Development guide but am stuck on the create links bit in the spec file.

I would really like to learn this

If you could help with this offline that would be great.

Regards,

Tib

fern

Re: Would like help with building rpm's
« Reply #1 on: September 08, 2006, 06:59:08 AM »
Tib

The devinfo list is the place where you could put specific detailed questions and hopefully (more than likely) get a good answer.

Offline SARK devs

  • ****
  • 2,806
  • +1/-0
    • http://sarkpbx.com
Would like help with building rpm's
« Reply #2 on: September 09, 2006, 05:13:45 PM »
Hello Tib

Quote
I have read the Development guide but am stuck on the create links bit in the spec file.


Createlinks is a Perl program that you include in your rpm tarball and it provides a simple way to build the links that SME Server needs, primarily, to associate events with actions and server-manager panels with the server-manager cgi-bin directory.  It gets installed "alongside" your rpm. Your rpm scriptlets then call it at install time to create the necessary links for your code.  As a general rule-of-thumb, if your rpm doesn't require any events or server-manager panels then you probably don't need the createlinks routine.  

The best way to see how "real" rpms work is to grab an smeserver system SRPM (any of 'em will do) and break into it. The smeserver rpms are very well written, by people who clearly knew/know what they're doing (mostly Gordon and Charlie), and you can learn a lot by browsing the specs files. Download the srpm into /usr/src/redhat/SRPMS.  Install it with..

rpm -Uvh smeserver-some-rpm.src.rpm

This will open the rpm and install its constituents into the rpm build libraries so that they are in exactly the same state as they were when the rpm was built.

Now, you will find the source tarball in /usr/src/redhat/SOURCES and the specs file in /usr/src/redhat/SPECS.  You can just open the specs file in your favourite editor but you'll have to untar the source...

tar xzvf smeserver-some-rpm.tar.gz

This will give you the untarred source tree.  Createlinks is at the top of the tree alongside root.

If you wish - you can grab the sail srpm - Sail contains both events and panels, you will see both kinds of link being built in its createlinks, but it's nowhere near as well written as the smeserver stuff.  Looking at Gordon's guidelines, I'm pretty sure that we use a fairly "old-fashioned" way of creating the links in our system (sail has been around for a year or two now and it started life under SME 6.0).

Kind Regards

Selintra

Offline Tib

  • *
  • 571
  • +0/-0
    • http://www.tibors.net
Would like help with building rpm's
« Reply #3 on: September 11, 2006, 02:35:51 AM »
selintra

I'll check your suggestion out through the week.

fern

I'll also check out the dev info area.

I'll get this sooner or later :hammer:

Thanks guys

Tib

Offline Tib

  • *
  • 571
  • +0/-0
    • http://www.tibors.net
Would like help with building rpm's
« Reply #4 on: September 14, 2006, 07:07:04 AM »
Ok ... I think I have worked most of it out ... but how and where would I put the equivalent to this
Code: [Select]
ln -s /etc/e-smith/web/functions/squidproperties /etc/e-smith/web/panels/manager/cgi-bin/squidproperties

I'm guessing it would somehow go in the createlinks file?

So I'm also guessing that the spec file as well as the createlinks file do what a .sh file would normally do.

Thanks in advance,

Tib

Offline SARK devs

  • ****
  • 2,806
  • +1/-0
    • http://sarkpbx.com
Would like help with building rpm's
« Reply #5 on: September 14, 2006, 09:02:46 AM »
Hi Tib

Oh Cool! - You're building a server-manager panel.  Nice one.

Here's a fragment from the SAIL createlinks - maybe not the best way but it works for us...
First the panel_link subroutine...
Code: [Select]
sub panel_link
{
    my ($function, $panel) = @_;

    unlink "root/etc/e-smith/web/panels/$panel/cgi-bin/$function";
    symlink("../../../functions/$function",
   "root/etc/e-smith/web/panels/$panel/cgi-bin/$function")
or die "Can't symlink to root/etc/e-smith/web/panels/$panel".
   "/cgi-bin/$function: $!";
}

Then the actual links...
Code: [Select]
my $panel = "manager";

panel_link("sarkagent", $panel);
panel_link("sarkauto", $panel);
panel_link("sarkcarrier", $panel);
panel_link("sarkcustom", $panel);
panel_link... etc. etc.


So... using the same layout, yours would be

Code: [Select]
panel_link("squidproperties", $panel);

Kind Regards

Selintra

Offline Tib

  • *
  • 571
  • +0/-0
    • http://www.tibors.net
Would like help with building rpm's
« Reply #6 on: September 17, 2006, 02:05:04 AM »
selintra

Thankyou for your help ... I have now created my first rpm  :D

And it even works  :o

Regards,

Tib

Offline byte

  • *
  • 2,183
  • +2/-0
Would like help with building rpm's
« Reply #7 on: September 20, 2006, 02:16:47 PM »
Tib,

Do you have any starting how to's that you could share, as building rpm's is something I've always wanted to do but never really had the time to  :roll:
--[byte]--

Have you filled in a Bug Report over @ http://bugs.contribs.org ? Please don't wait to be told this way you help us to help you/others - Thanks!

Offline Tib

  • *
  • 571
  • +0/-0
    • http://www.tibors.net
Would like help with building rpm's
« Reply #8 on: September 21, 2006, 04:32:17 AM »
byte

All I did is follow the develpoment guide ...

http://mirror.contribs.org/smeserver/contribs//gordonr/devguide/devguide.pdf

And then did what selintra suggested.

Just did a lot of reading and testing till it all came good  :D

need any help just let me know ... while it's fresh in my head  :lol:

Regards,

Tib