? info.diff
? old-info.diff
Index: portdestroot.tcl
===================================================================
RCS file: /Volumes/src/cvs/od/proj/darwinports/base/src/port1.0/portdestroot.tcl,v
retrieving revision 1.7
diff -u -r1.7 portdestroot.tcl
--- portdestroot.tcl	6 Aug 2003 01:28:22 -0000	1.7
+++ portdestroot.tcl	13 Aug 2003 22:51:36 -0000
@@ -76,9 +76,15 @@
 }
 
 proc destroot_finish {args} {
-    global destroot
+    global destroot prefix
 
     # Prune empty directories in ${destroot}
     catch {system "find \"${destroot}\" -depth -type d -print | xargs rmdir 2>/dev/null"}
+    # Delete any info/dir file since we're going to run install-info
+    set dirfile "${destroot}/${prefix}/info/dir"
+    if {[file exists $dirfile]} {
+	ui_debug "removing $dirfile"
+	file delete -force $dirfile
+    }
     return 0
 }
Index: portinstall.tcl
===================================================================
RCS file: /Volumes/src/cvs/od/proj/darwinports/base/src/port1.0/portinstall.tcl,v
retrieving revision 1.64
diff -u -r1.64 portinstall.tcl
--- portinstall.tcl	5 Aug 2003 09:28:56 -0000	1.64
+++ portinstall.tcl	13 Aug 2003 22:51:36 -0000
@@ -68,6 +68,11 @@
 	    exec touch -r $src_element $dst_element
 	}
     }
+
+    # if it's an info file in an info directory, run install-info
+    if [regexp {(.*/info)/([^/]*\.info)$} $dst_element match path filename] {
+	system "install-info ${path}/${filename} ${path}/dir"
+    }
 }
 
 proc directory_dig {rootdir workdir {cwd ""}} {
Index: portpackage.tcl
===================================================================
RCS file: /Volumes/src/cvs/od/proj/darwinports/base/src/port1.0/portpackage.tcl,v
retrieving revision 1.43
diff -u -r1.43 portpackage.tcl
--- portpackage.tcl	6 Aug 2003 04:55:34 -0000	1.43
+++ portpackage.tcl	13 Aug 2003 22:51:36 -0000
@@ -75,6 +75,7 @@
     file copy -force -- ${portresourcepath}/package/background.tiff ${pkgpath}/Contents/Resources/background.tiff
     system "mkbom ${destpath} ${pkgpath}/Contents/Archive.bom"
     system "cd ${destpath} && pax -x cpio -w -z . > ${pkgpath}/Contents/Archive.pax.gz"
+    write_postinstall_script ${pkgpath}/Contents/Resources/postinstall ${destpath}
 
     write_sizes_file ${pkgpath}/Contents/Resources/Archive.sizes ${portname} ${portversion} ${pkgpath} ${destpath}
 
@@ -243,4 +244,23 @@
 InstalledSize $installedSize
 CompressedSize $compressedSize"
     close $fd
+}
+
+proc write_postinstall_script {script destpath} {
+    set find [open "|find ${destpath} -name *.info" r]
+    # this never returns anything.
+    # why?  I dunno.  tcl is not my friend.
+    while {[gets $find fname] >= 0} {
+	if {![info exists scriptfile]} {
+	    set scriptfile [open $script w]
+	    puts $scriptfile "#!/bin/sh"
+	}
+	regexp "^${destpath}(/.*/info)/(\[^/]*\.info)$" $fname match path filename
+	puts $scriptfile "install-info ${path}/${filename} ${path}/dir"
+    }
+    if [info exists scriptfile] {
+	close $scriptfile
+	file attributes $script -permission +x
+    }
+    close $find
 }
Index: portrpmpackage.tcl
===================================================================
RCS file: /Volumes/src/cvs/od/proj/darwinports/base/src/port1.0/portrpmpackage.tcl,v
retrieving revision 1.3
diff -u -r1.3 portrpmpackage.tcl
--- portrpmpackage.tcl	6 Aug 2003 04:55:34 -0000	1.3
+++ portrpmpackage.tcl	13 Aug 2003 22:51:36 -0000
@@ -159,8 +159,26 @@
 %build
 echo \"Go DarwinPorts\"
 %install
-%clean
-%files -f ${destroot}/../${portname}.filelist
-"
+%clean"
+    set filelist [open "${destroot}/../${portname}.filelist" r]
+    set post {}
+    set preun {}
+    while {[gets $filelist fname] >= 0} {
+	# if it's an info file in an info directory, run install-info
+	if [regexp {"(.*/info)/(.*\.info)"$} $fname match path filename] {
+	    append post "install-info ${path}/${filename} ${path}/dir\n"
+	    append preun "install-info --delete ${path}/${filename} ${path}/dir\n"
+	}
+    }
+    close $filelist
+    if {$post != {}} {
+	puts $specfd "%post
+${post}"
+    }
+    if {$preun != {}} {
+	puts $specfd "%preun
+${preun}"
+    }
+    puts $specfd "%files -f ${destroot}/../${portname}.filelist"
     close $specfd
 }
Index: portuninstall.tcl
===================================================================
RCS file: /Volumes/src/cvs/od/proj/darwinports/base/src/port1.0/portuninstall.tcl,v
retrieving revision 1.28
diff -u -r1.28 portuninstall.tcl
--- portuninstall.tcl	7 May 2003 06:42:44 -0000	1.28
+++ portuninstall.tcl	13 Aug 2003 22:51:36 -0000
@@ -119,6 +119,10 @@
 			}
 		    }
 		} else {
+		    # if it's an info file in an info directory, run install-info
+		    if [regexp {(.*/info)/([^/]*\.info)$} $fname match path filename] {
+			system "install-info --delete ${path}/${filename} ${path}/dir"
+		    }
 		    if [catch {file delete -- $fname}] {
 			ui_info "$UI_PREFIX  [format [msgcat::mc "Uninstall unable to remove file %s"] $fname]"
 			set uninst_err 1
