[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-womb] gnumaint maintfileupgrade mfupgrade
From: |
Karl Berry |
Subject: |
[Commit-womb] gnumaint maintfileupgrade mfupgrade |
Date: |
Thu, 28 Dec 2006 19:27:59 +0000 |
CVSROOT: /sources/womb
Module name: gnumaint
Changes by: Karl Berry <karl> 06/12/28 19:27:59
Added files:
. : maintfileupgrade
Removed files:
. : mfupgrade
Log message:
rename one-time utility
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnumaint/maintfileupgrade?cvsroot=womb&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnumaint/mfupgrade?cvsroot=womb&r1=1.2&r2=0
Patches:
Index: maintfileupgrade
===================================================================
RCS file: maintfileupgrade
diff -N maintfileupgrade
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ maintfileupgrade 28 Dec 2006 19:27:58 -0000 1.1
@@ -0,0 +1,223 @@
+#!/usr/bin/tclsh
+#
+# maintfileupgrade - GNU maintainers file upgrade to new format
+#
+# Copyright (C) 2006 Free Software Foundation Inc.
+#
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved.
+
+
+###
+### Global variables
+###
+
+set first_page_contents {}
+
+set contact_regexp {(?x)
+ # A regexp to match contact information
+ ^([^<(]*) # The name of the contact (optional)
+ (<address@hidden@[^>]+?>)? # The email of the contact (optional)
+ ((?:.+))?$ # Notes about the contact (optional)
+ }
+
+set package_line_regexp {(?x)
+ # A regexp to match a package description line
+ ^
+ ([^(]+) # The name of the package
+ ((?:.+))? # Package comments (optional)
+ \ - # Separator: " -"
+ (.*) # Contacts information (see above)
+ $
+ }
+
+set maintainers_file {}
+set maintainersdb {}
+
+
+###
+### Code
+###
+
+proc do_help_usage {} {
+
+ puts {Usage: mfupgrade FILE}
+ puts "Read FILE and convert its contents to the new maintainers format"
+ puts "Dump the new contents on the standard output"
+}
+
+proc parse_contacts {text} {
+
+ global contact_regexp
+
+ set contact_list {}
+
+ foreach scontact [split $text ,] {
+
+ if {![regexp -- $contact_regexp $scontact fullmatch contact_name
contact_email contact_comments]} {
+
+ puts "ERROR: not matching text $scontact"
+ exit 1
+ }
+
+ lappend contact_list [list [string trim $contact_name] \
+ [string trim [string trim [string trim
$contact_email "<"] ">"]] \
+ [string trim [string trim $contact_comments]
{( )}]]
+
+ }
+
+ return $contact_list
+
+}
+
+proc parse_package_line {line} {
+
+ global package_line_regexp
+
+ if {![regexp -- $package_line_regexp $line]} then {
+ # Invalid package line
+ return {}
+ }
+
+ regexp -- $package_line_regexp $line entire_match pkg_name pkg_comments
pkg_contacts
+
+ return [list [string trim $pkg_name] \
+ [string trim $pkg_comments] \
+ [parse_contacts [string trim $pkg_contacts]]]
+}
+
+
+proc build_maintainers_db {} {
+
+ global first_page_contents
+ global maintainers_file
+ global maintainersdb
+
+ # Open the maintainers file
+ if {[catch {set finput [open $maintainers_file r]}]} {
+
+ puts "Cannot open the maintainers file $maintainers_file"
+ puts "Aborting"
+ exit 1
+ }
+
+ # Get the first line and collect the info
+ gets $finput line
+ append first_page_contents $line
+ append first_page_contents "\n"
+
+ # Skip until second page
+ while {(![eof $finput]) && ([string index $line 0] != "\f")} {
+ gets $finput line
+ append first_page_contents $line
+ append first_page_contents "\n"
+ }
+ # Consume the ^L
+ if {![eof $finput]} then {
+ gets $finput line
+ }
+
+ # Parse package lines
+ while {(![eof $finput]) && ([string index $line 0] != "\f")} {
+
+ set pkginfo [parse_package_line $line]
+ lappend maintainersdb $pkginfo
+ gets $finput line
+ }
+
+ # Close the maintainers file
+ close $finput
+}
+
+proc do_convert {} {
+
+ global first_page_contents
+ global maintainersdb
+
+ puts $first_page_contents
+ puts {}
+
+ foreach pkg $maintainersdb {
+
+ if {[lindex $pkg 2] == ""} then {
+
+ set maintainer_name "Unmaintained"
+ set maintainer_email($maintainer_name) {}
+ set maintainer_notes($maintainer_name) {}
+ lappend maintainer_packages($maintainer_name) [list [lindex $pkg 0]
[lindex $pkg 1]]
+ }
+
+ foreach maintainer [lindex $pkg 2] {
+
+
+
+ set maintainer_name [lindex $maintainer 0]
+ set m_email [lindex $maintainer 1]
+ set m_notes [lindex $maintainer 2]
+
+ set maintainer_email($maintainer_name) $m_email
+ set maintainer_notes($maintainer_name) $m_notes
+ lappend maintainer_packages($maintainer_name) [list [lindex $pkg
0] [lindex $pkg 1]]
+ }
+
+
+ }
+
+ set maintainers_name_list [lsort [array names maintainer_email]]
+ foreach maintainer $maintainers_name_list {
+
+ puts "name: $maintainer"
+ puts "email: $maintainer_email($maintainer)"
+ if {$maintainer_notes($maintainer) != {}} then {
+ puts "note: $maintainer_notes($maintainer)"
+ }
+
+ foreach pkg $maintainer_packages($maintainer) {
+
+ puts "package: [lindex $pkg 0]"
+ ;#if {[lindex $pkg 1] != {}} then {
+ ;#puts "note: [lindex $pkg 1]"
+ ;#}
+ }
+
+ puts {}
+ }
+}
+
+proc main {} {
+
+ global argc
+ global argv
+ global maintainers_file
+
+ # Get the maintainers file from arguments
+ if {$argc != 1} then {
+
+ do_help_usage
+ exit 1
+ }
+
+ set maintainers_file [lindex $argv 0]
+ if {![file readable $maintainers_file]} then {
+
+ puts stderr "error: could not open file $maintainers_file"
+ exit 1
+ }
+
+ # Build the maintainers database
+ build_maintainers_db
+
+ # Convert the file
+ do_convert
+}
+
+
+# Call the main routine
+main
+
+# Local Variables:
+# mode: tcl
+# End:
+
+### End of file
Index: mfupgrade
===================================================================
RCS file: mfupgrade
diff -N mfupgrade
--- mfupgrade 31 Aug 2006 21:58:01 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,219 +0,0 @@
-#!/usr/bin/tclsh
-#
-# mfupgrade - GNU maintainers file upgrade to new format
-#
-# Copyright (C) 2006 Free Software Foundation Inc.
-
-
-###
-### Global variables
-###
-
-set first_page_contents {}
-
-set contact_regexp {(?x)
- # A regexp to match contact information
- ^([^<(]*) # The name of the contact (optional)
- (<address@hidden@[^>]+?>)? # The email of the contact (optional)
- ((?:.+))?$ # Notes about the contact (optional)
- }
-
-set package_line_regexp {(?x)
- # A regexp to match a package description line
- ^
- ([^(]+) # The name of the package
- ((?:.+))? # Package comments (optional)
- \ - # Separator: " -"
- (.*) # Contacts information (see above)
- $
- }
-
-set maintainers_file {}
-set maintainersdb {}
-
-
-###
-### Code
-###
-
-proc do_help_usage {} {
-
- puts {Usage: mfupgrade FILE}
- puts "Read FILE and convert its contents to the new maintainers format"
- puts "Dump the new contents on the standard output"
-}
-
-proc parse_contacts {text} {
-
- global contact_regexp
-
- set contact_list {}
-
- foreach scontact [split $text ,] {
-
- if {![regexp -- $contact_regexp $scontact fullmatch contact_name
contact_email contact_comments]} {
-
- puts "ERROR: not matching text $scontact"
- exit 1
- }
-
- lappend contact_list [list [string trim $contact_name] \
- [string trim [string trim [string trim
$contact_email "<"] ">"]] \
- [string trim [string trim $contact_comments]
{( )}]]
-
- }
-
- return $contact_list
-
-}
-
-proc parse_package_line {line} {
-
- global package_line_regexp
-
- if {![regexp -- $package_line_regexp $line]} then {
- # Invalid package line
- return {}
- }
-
- regexp -- $package_line_regexp $line entire_match pkg_name pkg_comments
pkg_contacts
-
- return [list [string trim $pkg_name] \
- [string trim $pkg_comments] \
- [parse_contacts [string trim $pkg_contacts]]]
-}
-
-
-proc build_maintainers_db {} {
-
- global first_page_contents
- global maintainers_file
- global maintainersdb
-
- # Open the maintainers file
- if {[catch {set finput [open $maintainers_file r]}]} {
-
- puts "Cannot open the maintainers file $maintainers_file"
- puts "Aborting"
- exit 1
- }
-
- # Get the first line and collect the info
- gets $finput line
- append first_page_contents $line
- append first_page_contents "\n"
-
- # Skip until second page
- while {(![eof $finput]) && ([string index $line 0] != "\f")} {
- gets $finput line
- append first_page_contents $line
- append first_page_contents "\n"
- }
- # Consume the ^L
- if {![eof $finput]} then {
- gets $finput line
- }
-
- # Parse package lines
- while {(![eof $finput]) && ([string index $line 0] != "\f")} {
-
- set pkginfo [parse_package_line $line]
- lappend maintainersdb $pkginfo
- gets $finput line
- }
-
- # Close the maintainers file
- close $finput
-}
-
-proc do_convert {} {
-
- global first_page_contents
- global maintainersdb
-
- puts $first_page_contents
- puts {}
-
- foreach pkg $maintainersdb {
-
- if {[lindex $pkg 2] == ""} then {
-
- set maintainer_name "Unmaintained"
- set maintainer_email($maintainer_name) {}
- set maintainer_notes($maintainer_name) {}
- lappend maintainer_packages($maintainer_name) [list [lindex $pkg 0]
[lindex $pkg 1]]
- }
-
- foreach maintainer [lindex $pkg 2] {
-
-
-
- set maintainer_name [lindex $maintainer 0]
- set m_email [lindex $maintainer 1]
- set m_notes [lindex $maintainer 2]
-
- set maintainer_email($maintainer_name) $m_email
- set maintainer_notes($maintainer_name) $m_notes
- lappend maintainer_packages($maintainer_name) [list [lindex $pkg
0] [lindex $pkg 1]]
- }
-
-
- }
-
- set maintainers_name_list [lsort [array names maintainer_email]]
- foreach maintainer $maintainers_name_list {
-
- puts "name: $maintainer"
- puts "email: $maintainer_email($maintainer)"
- if {$maintainer_notes($maintainer) != {}} then {
- puts "note: $maintainer_notes($maintainer)"
- }
-
- foreach pkg $maintainer_packages($maintainer) {
-
- puts "package: [lindex $pkg 0]"
- ;#if {[lindex $pkg 1] != {}} then {
- ;#puts "note: [lindex $pkg 1]"
- ;#}
- }
-
- puts {}
- }
-}
-
-proc main {} {
-
- global argc
- global argv
- global maintainers_file
-
- # Get the maintainers file from arguments
- if {$argc != 1} then {
-
- do_help_usage
- exit 1
- }
-
- set maintainers_file [lindex $argv 0]
- if {![file readable $maintainers_file]} then {
-
- puts stderr "error: could not open file $maintainers_file"
- exit 1
- }
-
- # Build the maintainers database
- build_maintainers_db
-
- # Convert the file
- do_convert
-}
-
-
-# Call the main routine
-main
-
-# Local Variables:
-# mode: tcl
-# End:
-
-### End of file
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-womb] gnumaint maintfileupgrade mfupgrade,
Karl Berry <=