LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 01-04-2006, 10:08 AM   #1
rpg
Member
 
Registered: Dec 2002
Distribution: OpenSUSE
Posts: 58

Rep: Reputation: 15
Question about rpm spec files and %post scripts


I have been trying to fix up a spec file for some xemacs packages so that it properly installs all of its info files.

The problem is that there is a set of info files that are installed, but that never get install-info invoked on them.

What I would like to do is to say (in the %post script)

Code:
for all info files being installed to %{_infodir}
    /sbin/install-info $f %{_infodir}/dir --section="Xemacs"
and then the inverse for the %postun script.

Unfortunately, I'm not sure how to translate "info files being installed to %{_infodir}" into bash code. Can anyone advise me?

Similarly, I need to translate "info files being removed from %{_infodir}" into bash code, and I have, if possible, even less notion of how to do that task.

I have had a look at the Maximum RPM book, but its examples of scripting are pretty limited, and don't seem to describe any environment variables, bound in the scripts, that would help with this. I would have thought that there would some way be access to the file list in the scripts, but I have not been able to determine what this is, if it exists.

Thanks!
 
Old 01-04-2006, 11:46 AM   #2
GrueMaster
Member
 
Registered: Aug 2005
Location: Oregon
Distribution: Kubuntu.
Posts: 848

Rep: Reputation: 30
Unfortunately, Maximum RPM is severly out of date, but updated documentation is available online here. The script you want to run is almost complete as is. Here is what the xemacs script for Mandriva does with the info files:

for f in /usr/share/info/xemacs/*.info.bz2; do
/sbin/install-info $f /usr/share/info/dir --section="XEmacs"
done

Hope this is helpful
 
Old 01-04-2006, 11:59 AM   #3
rpg
Member
 
Registered: Dec 2002
Distribution: OpenSUSE
Posts: 58

Original Poster
Rep: Reputation: 15
Clarifying the question....

Quote:
Originally Posted by GrueMaster
Unfortunately, Maximum RPM is severly out of date, but updated documentation is available online here. The script you want to run is almost complete as is. Here is what the xemacs script for Mandriva does with the info files:

Code:
for f in /usr/share/info/xemacs/*.info.bz2; do
  /sbin/install-info $f /usr/share/info/dir --section="XEmacs"
done
Hope this is helpful
I have looked at the Red Hat documentation as well. All the documentation on RPM that I can find is distressingly vague about what is the precise environment in which post install scripts will be evaluated. For example: What environment variables are available? What macros (%files?) may be employed? What directory will you be in?

The problem with the above script snippet is that xemacs also installs some files in /usr/share/info (as well as /usr/share/info/xemacs). The info files in /usr/share/info are not correctly indexed.

AFAICT, I cannot simply do:
Code:
for f in /usr/share/info/*.info.bz2; do
  /sbin/install-info $f /usr/share/info/dir --section="XEmacs"
done
...because if I do I will pick up not only the info files installed by xemacs, but also all the info files that are already there, turning the info directory into a mess. So the open question is "how do I find a list of the newly-added info files?" I don't see anything in the RPM docs that tells me how to do this...

Note that this problem does not arise in the code snippet you offered, because the packagers have carefully put those info files into a pristine new directory (/usr/share/info/xemacs).

Best,
R
 
Old 01-04-2006, 09:32 PM   #4
GrueMaster
Member
 
Registered: Aug 2005
Location: Oregon
Distribution: Kubuntu.
Posts: 848

Rep: Reputation: 30
I guess I'd have to see your spec file. The snippit I got was from the rpm's post script, not the actual spec file. I assumed from other spec files I do have that this should work if you manually install the info files during the install process of building the rpms. I'll check it more thoroughly when I get home from class.
 
Old 01-06-2006, 01:56 AM   #5
GrueMaster
Member
 
Registered: Aug 2005
Location: Oregon
Distribution: Kubuntu.
Posts: 848

Rep: Reputation: 30
Sorry for getting back so late on this.

The emacs package manually defines an rpm macro containing all the info file names, then uses the macro name in the post section to install them:

Quote:
%define info_files ada-mode autotype ccmode cl dired-x ebrowse ediff efaq emacs emacs-mime eshell eudc forms gnus idlwave info message mh-e pcl-cvs reftex sc speedbar vip viper widget woman

%post
# --section="GNU Emacs"
for f in %info_files; do %_install_info $f
done
:
Bad for dynamically added files, which is what I'd assume you are trying to acomplish. I'll continue to experiment and see what I can come up with.
 
Old 01-06-2006, 07:20 AM   #6
rpg
Member
 
Registered: Dec 2002
Distribution: OpenSUSE
Posts: 58

Original Poster
Rep: Reputation: 15
emacs versus xemacs

Yes, I believe that would work for FSF emacs, which is distributed rather differently. Unlike FSF emacs (AFAIK), Xemacs provides packaging of a large set of emacs-lisp packages. This is a modified Mandriva RPM, and rather than trying to keep on top of the set of emacs lisp packages, Mandriva simply repackages the "sumo tarball," of xemacs lisp packages. This leads to the approach you see here, where an attempt is made to automatically find the info files and package them up into one big xemacs-packages rpm.

FWIW, if it's inelegant to package this way, trying to use FSF emacs on Mandriva has shown me the value of it. Instead of the sumo tarball, FSF emacs is packages with a flood of individual emacs-lisp packages, which are nightmarish to track and get installed. It's much nicer to just get one big rpm and install that.

A second problem, which I have just found, is that there can be a fair amount of collision between xemacs and FSF emacs info files, so it's all the more important to find all the info files and operate on them.

One possibility, it seems to me, would be to find all the info files during the build process, when they're easy to get your hands on (I know how to do this). The problem with doing that is that I don't know how to pass information from the build process into the install process. It seems possible to push information from the build process in the special case of writing a file and then reading it into the %files (the %files -f filename trick). I don't know if there's any similar trick to more generally record information during a build cycle and then use it later in the install process.

Thanks for your help.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RPM Spec file creation, %files section question davidas Linux - Software 1 09-13-2007 02:26 AM
%file attribute for RPM SPEC files Brian of Gep Linux - Software 3 06-18-2004 04:51 AM
%file attribute for RPM SPEC files Brian of Gep Fedora 0 06-15-2004 07:12 PM
RPM Spec file creation: %file section question davidas Linux - Newbie 0 03-16-2004 10:36 PM
rpm spec files pk21 Programming 3 06-11-2003 04:53 AM


All times are GMT -5. The time now is 02:16 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration