Bug 20737 - RFE: install_info/uninstall_info macros
Summary: RFE: install_info/uninstall_info macros
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: rpm-build
Version: 7.0
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Jeff Johnson
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-11-13 00:53 UTC by Dmitry V. Levin
Modified: 2005-10-31 22:00 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-09-29 21:42:25 UTC
Embargoed:


Attachments (Terms of Use)

Description Dmitry V. Levin 2000-11-13 00:53:53 UTC
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_SUBST(__ID_U)
 
     AC_PATH_PROG(__INSTALL, install, /usr/bin/install, $MYPATH)
+    AC_PATH_PROG(__INSTALL_INFO, install-info, /sbin/install-info,
$MYPATH)
     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"	\
+done
+
+%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	\
+fi

Comment 1 Enrico Scholz 2000-11-14 14:43:36 UTC
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
   manually
- when using /usr/share in %netsharedpath install-info tries to modify the
dir-file


Comment 2 Dmitry V. Levin 2000-11-15 12:50:32 UTC
Well,
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
+@direntry
+* 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 18:19:10 UTC
Changing component.

Comment 4 Bill Nottingham 2005-09-29 21:42:25 UTC
Closing bugs on older, no longer supported, releases. Apologies for any lack of
response.

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.