Bug 20737 - RFE: install_info/uninstall_info macros
RFE: install_info/uninstall_info macros
Product: Red Hat Linux
Classification: Retired
Component: rpm-build (Show other bugs)
All Linux
low Severity low
: ---
: ---
Assigned To: Jeff Johnson
David Lawrence
Depends On:
  Show dependency treegraph
Reported: 2000-11-12 19:53 EST by Dmitry V. Levin
Modified: 2005-10-31 17:00 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-09-29 17:42:25 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Dmitry V. Levin 2000-11-12 19:53:53 EST
Packages containing .info-files usually have to perform installation in
%post section and uninstallation in %preun section. Using macros can
significantly simplify this procedure, reducing it to smth like that:

%post devel
%install_info %name.info

%preun devel
%uninstall_info %name.info

Yes I've seen mandrake's macros doing this job, but I'd suggest more
universal and more easy to use ones.

Here is a patch to rpm-current (two lines have been broken into 2 pieces
each by the browser, but all the rest is right):

Index: configure.in
RCS file: /cvs/devel/rpm/configure.in,v
retrieving revision 1.227
diff -u -r1.227 configure.in
--- configure.in	2000/11/02 17:57:26	1.227
+++ configure.in	2000/11/13 00:31:49
@@ -181,6 +181,7 @@
     AC_PATH_PROG(__INSTALL, install, /usr/bin/install, $MYPATH)
+    AC_PATH_PROG(__INSTALL_INFO, install-info, /sbin/install-info,
     AC_PATH_PROG(__MAKE, make, /usr/bin/make, $MYPATH)
     AC_PATH_PROG(__MKDIR, mkdir, /bin/mkdir, $MYPATH)
     AC_PATH_PROG(__MV, mv, /bin/mv, $MYPATH)
Index: macros.in
RCS file: /cvs/devel/rpm/macros.in,v
retrieving revision 1.69
diff -u -r1.69 macros.in
--- macros.in	2000/11/02 17:57:26	1.69
+++ macros.in	2000/11/13 00:31:51
@@ -42,6 +42,7 @@
 %__gzip			%{_gzipbin}
 %__id			@__ID@
 %__install		@__INSTALL@
+%__install_info		@__INSTALL_INFO@
 %__ln_s			@LN_S@
 %__make			@__MAKE@
 %__mkdir		@__MKDIR@
@@ -650,3 +651,32 @@
 # %files -f %{name}.lang
 %find_lang	@RPMCONFIGDIR@/find-lang.sh %{buildroot}
+# Use these macros to install and uninstall info files.
+# For example:
+# %post devel
+# %install_info %name.info
+# %preun devel
+# %uninstall_info %name.info
+%install_info()	\
+for f in %*; do	\
+	if [ "$f" = "${f%/*}" ]; then	\
+		f="%{_infodir}/$f"	\
+	fi	\
+	%{__install_info} --dir-file="${f%/*}/dir" --info-file="$f"	\
+%uninstall_info()	\
+if [ $1 = 0 ]; then	\
+	for f in %*; do	\
+		if [ "$f" = "${f%/*}" ]; then	\
+			f="%{_infodir}/$f"	\
+		fi	\
+		%{__install_info} --delete --dir-file="${f%/*}/dir" --info-file="$f"	\
+	done	\
Comment 1 Enrico Scholz 2000-11-14 09:43:36 EST
The problem is not all info-files have DIR-ENTRY/DIR-SECTION tags so you must
enter them manually at the /sbin/install-info call.

I prefer a macro definition like
%__install_info	/sbin/install-info --info-dir=%{_infodir}

So you can use
%{__install_info} %{_infodir}/my_info.info --entry=foo --section=bar

But there are existing other problems related with install-info still:
- `PreReq: /sbin/install-info' and the `if [ "$0" = 0 ] ... fi' clause in the
%preun stage must be entered
- when using /usr/share in %netsharedpath install-info tries to modify the
Comment 2 Dmitry V. Levin 2000-11-15 07:50:32 EST
it is Right Thing (tm), or, better say, subject for Build Policy,
to build packages with all-sufficient texinfo documentation,
with necessary dircategory and direntry records fixed/added in .texi-files

Example from real life:
--- util-linux-2.10q-orig/sys-utils/ipc.texi	Fri Jul  9 06:56:41 1999
+++ util-linux-2.10q/sys-utils/ipc.texi	Tue Nov 14 22:32:48 2000
@@ -2,6 +2,10 @@
 @comment %**start of header (This is for running Texinfo on a region.)
 @setfilename ipc.info
 @settitle Inter Process Communication.
+@dircategory Development/C
+* IPC: (ipc).				System V style Inter Process Communication primitives.
+@end direntry
 @setchapternewpage odd
 @comment %**end of header (This is for running Texinfo on a region.)
About 'if..fi' clause in %preun:
It's already added in %uninstall_info.

About netshared /usr/share:
Whether rpm should care about it, or maybe /sbin/install-info, or even both?

If netshared path stored in standart variable, simple check could be added to
%(un)install_info macros to skip netshared files and/or skip index rebuilding
(if /sbin/install-info will support that).
Comment 3 Jeff Johnson 2001-02-21 13:19:10 EST
Changing component.
Comment 4 Bill Nottingham 2005-09-29 17:42:25 EDT
Closing bugs on older, no longer supported, releases. Apologies for any lack of

For RPM issues, please try a current release such as Fedora Core 4; if bugs
persist, please open a new issue.

Note You need to log in before you can comment on or make changes to this bug.