[Pkg-tcltk-commits] r332 - tcltk-defaults/trunk/debian

sgolovan-guest at alioth.debian.org sgolovan-guest at alioth.debian.org
Sat Oct 20 08:58:02 UTC 2007


Author: sgolovan-guest
Date: 2007-10-20 08:58:02 +0000 (Sat, 20 Oct 2007)
New Revision: 332

Added:
   tcltk-defaults/trunk/debian/tcl-dev.install
   tcltk-defaults/trunk/debian/tcl-dev.manpages
   tcltk-defaults/trunk/debian/tcltk-depends.1
   tcltk-defaults/trunk/debian/tcltk-depends.in
Modified:
   tcltk-defaults/trunk/debian/rules
   tcltk-defaults/trunk/debian/tcl-dev.dirs
Log:
[tcltk-defaults]
Added tcltk-depends - a helper for generating tk and tcl depends substvars.


Modified: tcltk-defaults/trunk/debian/rules
===================================================================
--- tcltk-defaults/trunk/debian/rules	2007-10-20 02:42:20 UTC (rev 331)
+++ tcltk-defaults/trunk/debian/rules	2007-10-20 08:58:02 UTC (rev 332)
@@ -8,7 +8,7 @@
 VER    := 8.4
 TCLVER := 8.4.16-2
 TKVER  := 8.4.16-2
-PRIO   := 841
+COMPATVER := 8.4.16-1
 
 DOCS = tcltk-policy.html tcltk-policy.txt tcltk-policy.pdf
 
@@ -63,9 +63,9 @@
 	dh_clean -k
 	dh_installdirs
 
-	for f in debian/*.links.in debian/*.p*.in; do \
+	for f in debian/*.links.in debian/*.p*.in debian/tcltk-depends.in; do \
 	    sed -e "s/@VER@/$(VER)/g" \
-	    	-e "s/@PRIO@/$(PRIO)/g" \
+	    	-e "s/@COMPATVER@/$(COMPATVER)/g" \
 		<$$f >$${f%%.in} ; \
 	done
 
@@ -76,8 +76,9 @@
 	dh_testdir -i
 	dh_testroot -i
 	dh_install -i
-	dh_installdocs -i -A debian/README.Debian -N tk-doc
-	dh_installchangelogs -i -N tk-doc
+	dh_installdocs -i -A debian/README.Debian -Ntk-doc
+	dh_installchangelogs -i -Ntk-doc
+	dh_installman -i
 	dh_installmenu -i
 	dh_desktop -i
 	dh_link -i

Modified: tcltk-defaults/trunk/debian/tcl-dev.dirs
===================================================================
--- tcltk-defaults/trunk/debian/tcl-dev.dirs	2007-10-20 02:42:20 UTC (rev 331)
+++ tcltk-defaults/trunk/debian/tcl-dev.dirs	2007-10-20 08:58:02 UTC (rev 332)
@@ -1,3 +1,4 @@
+/usr/bin
 /usr/include
 /usr/lib
 /usr/share/aclocal

Added: tcltk-defaults/trunk/debian/tcl-dev.install
===================================================================
--- tcltk-defaults/trunk/debian/tcl-dev.install	                        (rev 0)
+++ tcltk-defaults/trunk/debian/tcl-dev.install	2007-10-20 08:58:02 UTC (rev 332)
@@ -0,0 +1 @@
+debian/tcltk-depends	/usr/bin

Added: tcltk-defaults/trunk/debian/tcl-dev.manpages
===================================================================
--- tcltk-defaults/trunk/debian/tcl-dev.manpages	                        (rev 0)
+++ tcltk-defaults/trunk/debian/tcl-dev.manpages	2007-10-20 08:58:02 UTC (rev 332)
@@ -0,0 +1 @@
+debian/tcltk-depends.1

Added: tcltk-defaults/trunk/debian/tcltk-depends.1
===================================================================
--- tcltk-defaults/trunk/debian/tcltk-depends.1	                        (rev 0)
+++ tcltk-defaults/trunk/debian/tcltk-depends.1	2007-10-20 08:58:02 UTC (rev 332)
@@ -0,0 +1,22 @@
+.TH tcltk-depends 1 "2007-09-26" "0.1" "Tcl/Tk packages for Debian GNU/Linux"
+.SH "NAME"
+tcltk\-depends \- calculates Tcl/Tk dependencies
+
+.SH "SYNOPSIS"
+\&\fBtcltk-depends\fR [\fIdebhelper\ options\fR]
+
+.SH "DESCRIPTION"
+tcltk-depends is a debhelper-like program which is responsible for generating
+the ${tcl:Depends} and ${tk:Depends} substitutions and adding them to substvars
+files.
+.PP
+If you use this program, your package must build-depend on tcl-dev
+or tk-dev.
+
+.SH "SEE ALSO"
+\&\fIdebhelper\fR\|(7)
+.PP
+This program is not a part of debhelper.
+
+.SH "AUTHOR"
+Sergei Golovan <sgolovan at debian.org>

Added: tcltk-defaults/trunk/debian/tcltk-depends.in
===================================================================
--- tcltk-defaults/trunk/debian/tcltk-depends.in	                        (rev 0)
+++ tcltk-defaults/trunk/debian/tcltk-depends.in	2007-10-20 08:58:02 UTC (rev 332)
@@ -0,0 +1,140 @@
+#!/usr/bin/tclsh
+
+if {[info commands lassign] == ""} {
+    proc lassign {list args} {
+	foreach name $args {
+	    upvar $name var
+
+	    set var [lindex $list 0]
+	    set list [lrange $list 1 end]
+	}
+	return $list
+    }
+}
+
+proc delsubstvar {package substvar} {
+    set substvarfile [file join debian $package.substvars]
+    if {[file exists $substvarfile]} {
+	set fd [open $substvarfile]
+	set lines [split [string trim [read $fd]] "\n"]
+	close $fd
+
+	set fd [open $substvarfile w]
+	foreach line $lines {
+	    if {[string first $substvar= $line] != 0} {
+		puts $fd $line
+	    }
+	}
+	close $fd
+    }
+}
+
+proc addsubstvar {package substvar deppackage} {
+    set substvarfile [file join debian $package.substvars]
+    if {[file exists $substvarfile]} {
+	set fd [open $substvarfile]
+	set lines [split [string trim [read $fd]] "\n"]
+	close $fd
+
+	set fd [open $substvarfile w]
+	set found 0
+	foreach line $lines {
+	    if {[string first $substvar= $line] != 0} {
+		puts $fd $line
+	    } else {
+		set items [split [string range $line [string length $substvar=] end] ","]
+		set items1 {}
+		foreach i $items {
+		    lappend items1 [string trim $i]
+		}
+		lappend items1 $deppackage
+		puts $fd $substvar=[join $items1 ", "]
+		set found 1
+	    }
+	}
+	if {!$found} {
+	    puts $fd $substvar=$deppackage
+	}
+	close $fd
+    } else {
+	set fd [open $substvarfile w]
+	puts $fd $substvar=$deppackage
+	close $fd
+    }
+}
+
+proc getpackages {arglist} {
+    if {[catch {open [file join debian control]} fd]} {
+	puts "cannot read debian/control: $fd"
+	exit 1
+    } else {
+	set arches all
+	set excluded {}
+	set explicit {}
+	while {[llength $arglist] > 0} {
+	    set arglist [lassign $arglist opt]
+	    switch -glob -- $opt {
+		-a -
+		--arch { set arches arch }
+		-i -
+		--indep { set arches indep }
+		-s -
+		--same-arch {
+		    puts "options -s and --same-arch aren't supported yet"
+		    exit 1
+		}
+		-p* { lappend explicit [string range $opt 2 end] }
+		--package=* { lappend explicit [string range $opt 10 end] }
+		-N* { lappend excluded [string range $opt 2 end] }
+		--no-package=* { lappend excluded [string range $opt 13 end] }
+	    }
+	}
+
+	set lines [split [read $fd] "\n"]
+	close $fd
+	set packages {}
+	set allpackages {}
+
+	set package ""
+	set arch ""
+	foreach line $lines {
+	    switch -glob -- $line {
+		"Package: *" {
+		    set package [string trim [string range $line 9 end]]
+		}
+		"Architecture: *" {
+		    set arch [string trim [string range $line 14 end]]
+		}
+		"" {
+		    if {$package == ""} {
+			# Do nothing
+		    } elseif {[lsearch -exact $excluded $package] >= 0} {
+			# Do nothing
+		    } elseif {[lsearch -exact $explicit $package] >= 0} {
+			lappend packages $package
+		    } elseif {($arches == "arch" && $arch != "all") || \
+			      ($arches == "indep" && $arch == "all")} {
+			lappend packages $package
+		    } elseif {$arches == "all"} {
+			lappend allpackages $package
+		    }
+		    set package ""
+		    set arch ""
+		}
+	    }
+	}
+	if {$arches == "all" && [llength $packages] == 0} {
+	    set packages $allpackages
+	}
+	return $packages
+    }
+}
+
+
+foreach package [getpackages $argv] {
+    delsubstvar $package "tcl:Depends"
+    addsubstvar $package "tcl:Depends" "tcl (>= @COMPATVER@)"
+    delsubstvar $package "tk:Depends"
+    addsubstvar $package "tk:Depends" "tk (>= @COMPATVER@)"
+}
+




More information about the Pkg-tcltk-commits mailing list