Directories for packages

News and discussion about development of the Debian OS itself

Directories for packages

Postby markseger » 2009-10-13 17:09

I'm trying to build a package for collectl and do it in a way that parallels the installations on other systems. Specifically I install everything under the /opt/collectl directory and then create appropriate softlinks pointing back to the appropriate directories.

when I try to create my build directories under debian/ in my rules file with a command like:

mkdir -p $(CURDIR)/debian/collectl/opt/collectl/sbin

and then later copy my files to that directory, I get the errors like the following:

E: collectl dir-or-file-in-opt opt/collectl/sbin
E: collectl dir-or-file-in-opt opt/collectl/sbin/collectl

however the package builds AND the directory /opt/collectl/sbin is created and correctly populated. The command I'm using to build the package is:

debuild -sa -us -uc

-mark
markseger
 
Posts: 11
Joined: 2009-10-13 16:37

Re: Directories for packages

Postby smallchange » 2009-10-13 17:18

I think that what you are seeing is a debian packaging error because debian rules do not allow packages to use /opt. Debian packages become part of the system and /opt is for optional user added packages.
smallchange
 
Posts: 1740
Joined: 2009-05-04 15:56

Re: Directories for packages

Postby markseger » 2009-10-13 17:20

but isn't what I'm trying to build considered an optional package?
-mark
markseger
 
Posts: 11
Joined: 2009-10-13 16:37

Re: Directories for packages

Postby smallchange » 2009-10-13 17:40

It is a point of view type thing. It is an optional package in the debian system, but the /opt directory is for software installed by the admin that is not part of the system. I am not real clear on the linux FHS http://www.pathname.com/fhs/ and POSIX may play a role as well. It probably also includes a Debian decision as to how to interpret Linux FHS.

This is one interesting difference between RPM and dpkg that also involves the intent of the different packaging systems. I like the Debian way and think it is one of the real strengths of Debian. Others disagree. :)
smallchange
 
Posts: 1740
Joined: 2009-05-04 15:56

Re: Directories for packages

Postby markseger » 2009-10-13 17:56

ok, I think I get your point. In fact if I change my build target to /optt, things seem to work ok. Are there any other conventions for where to install a set of related files if not in /opt? Could I say use /usr/collectl and install everything under that? I'm open to any and all suggestions that would help avoid having to make actual code changes specific to debian because that would require a fork of the code and I certainly don't want to do that.

-mark
markseger
 
Posts: 11
Joined: 2009-10-13 16:37

Re: Directories for packages

Postby smallchange » 2009-10-13 19:15

I am not expert on this, and there may well be people reading this who can give you better information. I think it probably should use /usr as a top directory, with executables going in /usr/bin, docs in /usr/share/doc/collectl, man pages in /usr/share/man, and maybe some things in /usr/lib/collectl. Any configuration files go in /etc. I think that debhelper and some other tools will help with this. You may find some help in this post also. http://forums.debian.net/viewtopic.php?f=16&t=38976
smallchange
 
Posts: 1740
Joined: 2009-05-04 15:56

Re: Directories for packages

Postby markseger » 2009-10-13 20:11

so now I changed things so I can install my whole application under /usr/collectl and that piece works great (though I get some warning about putting ph files and other things under it) but then when I try to build a link from /usr/bin to point to /usr/collectl/sbin/collectl I get a protection error. Does this mean you can't put links into /usr/bin? Is that another debianism?
-mark
markseger
 
Posts: 11
Joined: 2009-10-13 16:37

Re: Directories for packages

Postby smallchange » 2009-10-13 21:37

Making links in /usr/bin is allowed, but there are certainly good practices for doing so and I do not know how enforced they are. Debian would really like to install the executable in /usr/bin. I am not sure what a .ph file is, but /usr/collectl is not in agreement with any standards and I expect Debians packaging tools will not like it.

I went to your sourceforge page and tried to download collectl but I could not. I am using iceweasel (firefox) 3.5.3 but when I select the download the auto download does not start and the manual link does nothing either.
smallchange
 
Posts: 1740
Joined: 2009-05-04 15:56

Re: Directories for packages

Postby markseger » 2009-10-14 12:24

re links: that's for telling me it's possible. made me examine my rules more closely and I found a typo. works fine now.
re collectl download: no idea what's wrong here as it's been working fine for over 2 years. All I can think of there must be something funky about your configuation?

As a comment about collectl on debian in general, I have an INSTALL script in the source tarball which if you run it creates /opt/hp/collectl and puts everything under that, creating links to the executable script, man pages, initd script and even the conf file. What I did in my rules files it manually place all but the collectl main script.

To answer your question about 'ph' files, and I may not have been correct in using that extension, I'm using them simply as perl include files. When first reading about perl, somewhere I read that 'ph' stood for 'perl header' and since C header files are included, I figured I could do the same with these. So perhaps a different way to phrase this whole conversation is if you have a script that wants to 'include' other scripts or whatever, where would you place them?

I also just had a flash, and I'm not saying I would do this, but what if I stripped the PH off my include files, put them into /usr/bin to make the cp work and then renamed them back in my last rule? Is the packager smart enough to deal with that chunk of hackery? Or just install into /optopt/collectl and rename it back to /opt/collect ;-)

-mark
markseger
 
Posts: 11
Joined: 2009-10-13 16:37

Re: Directories for packages

Postby markseger » 2009-10-14 12:51

Another thing I just thought of is I have a bunch of documentation in the form of html files. Where would those go? Currently I put them in /opt/hp/collectl/docs.
-mark
markseger
 
Posts: 11
Joined: 2009-10-13 16:37

Re: Directories for packages

Postby aakefbs » 2009-10-14 13:37

Hello Mark,

documentation has to go to /usr/share/doc/package-name/. If these are only a few files, dh_installdocs would do the job, e.g. as in my unionfs-fuse package:

# Build architecture-dependent files here.
binary-arch: build install
dh_testdir
dh_testroot
dh_installchangelogs
dh_installdocs CREDITS NEWS examples/
dh_installexamples

If these are lots of files a separate -doc package might be better.
aakefbs
 
Posts: 3
Joined: 2009-10-14 13:31

Re: Directories for packages

Postby smallchange » 2009-10-14 13:50

The download problem was on my side. My browser had been updated to 3.5 and was not working correctly. I did get a copy now and actually figured out what a .ph is. :) I think the usual way of doing this would be to have .pm perl modules and put them somewhere that perl can find them. I think the debian tools will do this very well and put it somewhere like /usr/share/perl/. The other thing would be to use /usr/lib/collectl to store the .ph files and make collectl check for that directory. The debian packaging tools will probably want you to create a lib package as well as the base package to deal with this.

I also just had a flash, and I'm not saying I would do this, but what if I stripped the PH off my include files, put them into /usr/bin to make the cp work and then renamed them back in my last rule? Is the packager smart enough to deal with that chunk of hackery? Or just install into /optopt/collectl and rename it back to /opt/collect


I would suggest that the tools might be smart enough to stop you from doing that. :) The packaging tools are designed to locate files where they belong, according to the Debian definition of that, so that Debian users know where to look for things. This consistency is a huge benefit. Being a nonconformist I realize how tempting it is to do things your own way, but there is a price for that. :)

I see that you have rpm's. Debian has a tool called alien that will create a .deb from an rpm. It may create more than one .deb. This may be enough to allow you to offer a .deb for the moment and give you some insight into how Debian would like to place things. Then again it may choke on a .ph file.

The documentation should go in /usr/share/doc/collectl, probably in a html subdirectory.
smallchange
 
Posts: 1740
Joined: 2009-05-04 15:56

Re: Directories for packages

Postby smallchange » 2009-10-14 14:02

I just downloaded your rpm and ran
Code: Select all
alien --scripts collectl-3.3.6-2.noarch.rpm
which generated collectl_3.3.6-3_all.deb. I then ran
Code: Select all
dpkg -x collectl_3.3.6-3_all.deb look
which extracted that .deb into a directory so I could look at it. It looks like it did what you initially set out to do, putting things in /opt, but also creating some links in /etc.
smallchange
 
Posts: 1740
Joined: 2009-05-04 15:56

Re: Directories for packages

Postby markseger » 2009-10-14 14:20

All good feedback. Thanks. It also occurred to me that a number of applications install ancillary stuff under /etc such as apache, openoffice and sample just to name a few. Could I just install under /etc/collectl? As for my main perl script finding the include files it wants I really don't want to put them under the perl directory because that would make it impossible to run multiple copies on the same machine using different include files, a feature that greatly simplifies development/testing. Consider the ability of running 2 different instances at the same time making sure both generate the same output.

However that would still require a link from /usr/bin to /etc/collectl/collectl. I suppose I could always put a line into collectl telling it when running on a debian distro and the include file doesn't exist in the execution directory to look in /etc/collectl before giving up. Would that be acceptable?

-mark
markseger
 
Posts: 11
Joined: 2009-10-13 16:37

Re: Directories for packages

Postby aakefbs » 2009-10-14 14:22

Here is a natively packaged version I am using:

http://www.pci.uni-heidelberg.de/tc/usr ... /collectl/


Need to update it to the most recent collectl version.
aakefbs
 
Posts: 3
Joined: 2009-10-14 13:31

Next

Return to Debian Development

Who is online

Users browsing this forum: No registered users and 4 guests

fashionable