ports/144605: [PATCH] Get ports-mgmt/portupgrade to build under Ruby 1.9.1

Aaron D. Gifford astounding at gmail.com
Wed Mar 10 01:40:01 UTC 2010


>Number:         144605
>Category:       ports
>Synopsis:       [PATCH] Get ports-mgmt/portupgrade to build under Ruby 1.9.1
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 10 01:40:01 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Aaron D. Gifford
>Release:        FreeBSD 8
>Organization:
>Environment:
FreeBSD example.org 8.0-STABLE FreeBSD 8.0-STABLE #0: Wed Jan 27 19:46:39 MST 2010     root at example.org:/usr/obj/usr/src/sys/VIN.TAMBLER.COM  amd64

>Description:
portupgrade won't build under Ruby 1.9.1 due to including Ruby globals in the parameters section of option blocks.  The fix is very simple.

Simple fix:
===========
..option code... {
  |$globalvar|

Becomes:
========
..option code... {
  |opt|
  $globalvar = opt


>How-To-Repeat:
see above
>Fix:
PATCH FOLLOWS:

--- bin/pkg_fetch.orig	2010-03-09 18:15:39.698076796 -0700
+++ bin/pkg_fetch	2010-03-09 18:16:30.392107623 -0700
@@ -74,7 +74,8 @@
     }
 
     opts.def_option("-f", "--force", "Download a package even if recorded as installed;#{NEXTLINE}Remove existing packages if they are corrupt") {
-      |$force|
+      |opt|
+      $force = opt
     }
 
 #    opts.def_option("-O", "--omit-check", "Omit sanity checks for dependencies.") {
@@ -82,15 +83,18 @@
 #    }
 
     opts.def_option("-q", "--noconfig", "Do not read pkgtools.conf") {
-      |$noconfig|
+      |opt|
+      $noconfig = opt
     }
 
     opts.def_option("-R", "--upward-recursive", "Download the packages required by the given#{NEXTLINE}packages as well") {
-      |$upward_recursive|
+      |opt|
+      $upward_recursive = opt
     }
 
     opts.def_option("-v", "--verbose", "Be verbose") {
-      |$verbose|
+      |opt|
+      $verbose = opt
     }
 
     opts.def_tail_option '
--- bin/pkg_glob.orig	2010-03-09 18:16:57.823583503 -0700
+++ bin/pkg_glob	2010-03-09 18:18:08.531231601 -0700
@@ -91,7 +91,8 @@
     }
 
     opts.def_option("-a", "--all", "#{$service_verb.capitalize} all the installed packages") {
-      |$all|
+      |opt|
+      $all = opt
       $recursive = false
       $upward_recursive = false
     }
@@ -109,13 +110,15 @@
     } if $service == :deinstall
 
     opts.def_option("-f", "--force", "Force removal of the packages [*]") {
-      |$force|
+      |opt|
+      $force = opt
       $pkg_delete_args.push '-f'
       $collate = false
     } if $service == :deinstall
 
     opts.def_option("-i", "--interactive", "Request confirmation for each package removal [*]") {
-      |$interactive|
+      |opt|
+      $interactive = opt
       if $interactive
 	$verbose = true
       end
@@ -124,7 +127,8 @@
     } if $service == :deinstall
 
     opts.def_option("-n", "--noexecute", "Do not actually deinstall a package, just report the#{NEXTLINE}steps that would be taken if it were [*]") {
-      |$noexecute|
+      |opt|
+      $noexecute = opt
       if $noexecute
 	$verbose = true
 	$interactive = false
@@ -143,11 +147,13 @@
     } if $service == :deinstall
 
     opts.def_option("-P", "--preserve", "Preserve shared libraries (Save *.so.n)") {
-      |$preserve_shlib|
+      |opt|
+      $preserve_shlib = opt
     } if $service == :deinstall
 
     opts.def_option("-q", "--noconfig", "Do not read pkgtools.conf") {
-      |$noconfig|
+      |opt|
+      $noconfig = opt
     }
 
     opts.def_option("-r", "--recursive", "#{$service_verb.capitalize} all those depending on the given#{NEXTLINE}packages as well") {
@@ -159,7 +165,8 @@
     }
 
     opts.def_option("-v", "--verbose", "Turn on verbose output [*]") {
-      |$verbose|
+      |opt|
+      $verbose = opt
       $pkg_delete_args.push '-v'
     } if $service == :deinstall
 
--- bin/pkg_sort.orig	2010-03-09 18:18:23.036954660 -0700
+++ bin/pkg_sort	2010-03-09 18:18:38.531657918 -0700
@@ -63,7 +63,8 @@
     }
 
     opts.def_option("-q", "--noconfig", "Do not read pkgtools.conf") {
-      |$noconfig|
+      |opt|
+      $noconfig = opt
     }
 
     opts.def_tail_option '
--- bin/pkgdb.orig	2010-03-09 18:19:04.731157147 -0700
+++ bin/pkgdb	2010-03-09 18:20:52.793090663 -0700
@@ -100,16 +100,19 @@
     }
 
     opts.def_option("-f", "--force", "Force;#{NEXTLINE}Specified with -u, update database#{NEXTLINE}regardless of timestamps#{NEXTLINE}Specified with -F, fix held packages too") {
-      |$force|
+      |opt|
+      $force = opt
     }
 
     opts.def_option("-F", "--fix", "Fix the package database interactively") {
-      |$fix_db|
+      |opt|
+      $fix_db = opt
       $interactive = true if ! $automatic
     }
 
     opts.def_option("-a", "--auto", "Turn on automatic mode when -F is also specified") {
-      |$automatic|
+      |opt|
+      $automatic = opt
       $interactive = false if $fix_db
     }
 
@@ -119,11 +122,13 @@
 
     opts.def_option("-i", "--interactive",
 		    "Turn on interactive mode") {
-      |$interactive|
+      |opt|
+      $interactive = opt
     }
 
     opts.def_option("-L", "--fix-lost", "Check and restore lost dependencies#{NEXTLINE}against the ports tree") {
-      |$check_lost|
+      |opt|
+      $check_lost = opt
     }
 
     opts.def_option("-o", "--origin=PKGNAME[=ORIGIN]", "Look up or change the origin of the given#{NEXTLINE}package") {
@@ -150,7 +155,8 @@
     }
 
     opts.def_option("-O", "--omit-check", "Specified with -F, turn off checks#{NEXTLINE}dependencies against the ports tree. Useful#{NEXTLINE}if you need a speed-up") {
-      |$omit_check|
+      |opt|
+      $omit_check = opt
     }
 
     opts.def_option("-Q", "--quiet", "Do not write anything to stdout;#{NEXTLINE}Specified twice, stderr neither") {
@@ -164,7 +170,8 @@
     }
 
     opts.def_option("-q", "--noconfig", "Do not read pkgtools.conf") {
-      |$noconfig|
+      |opt|
+      $noconfig = opt
     }
 
     opts.def_option("-s", "--substitute=/OLD/NEW/", "Substitute all the dependencies recorded#{NEXTLINE}as OLD with NEW") {
@@ -202,11 +209,13 @@
     }
 
     opts.def_option("-u", "--update", "Update the package database") {
-      |$update_db|
+      |opt|
+      $update_db = opt
     }
 
     opts.def_option("-v", "--verbose", "Be verbose") {
-      |$verbose|
+      |opt|
+      $verbose = opt
     }
 
     opts.def_tail_option '
--- bin/pkgdu.orig	2010-03-09 18:21:43.188127157 -0700
+++ bin/pkgdu	2010-03-09 18:22:14.117536092 -0700
@@ -78,20 +78,24 @@
     }
 
     opts.def_option("-t", "--total", "Display a grand total") {
-      |$total|
+      |opt|
+      $total = opt
     }
 
     opts.def_option("-q", "--quiet", "Display only grand total") {
-      |$quiet|
+      |opt|
+      $quiet = opt
       $total = true
     }
 
     opts.def_option("-r", "--recursive", "Check for all those depending on the given#{NEXTLINE}packages as well") {
-      |$recursive|
+      |opt|
+      $recursive = opt
     }
 
     opts.def_option("-R", "--upward-recursive", "Check for all those required by the given#{NEXTLINE}packages as well") {
-      |$upward_recursive|
+      |opt|
+      $upward_recursive = opt
     }
 
     opts.def_option("-x", "--exclude=GLOB", "Exclude packages matching the specified glob#{NEXTLINE}pattern") {
--- bin/portcvsweb.orig	2010-03-09 18:22:26.311302750 -0700
+++ bin/portcvsweb	2010-03-09 18:22:56.838718892 -0700
@@ -419,11 +419,13 @@
     }
 
     opts.def_option("-q", "--noconfig", "Do not read pkgtools.conf") {
-      |$noconfig|
+      |opt|
+      $noconfig = opt
     }
 
     opts.def_option("-v", "--verbose", "Be verbose") {
-      |$verbose|
+      |opt|
+      $verbose = opt
     }
 
     opts.def_option("-F", "--freshports", 
--- bin/portsclean.orig	2010-03-09 18:23:04.202577707 -0700
+++ bin/portsclean	2010-03-09 18:23:58.639536906 -0700
@@ -73,7 +73,8 @@
     }
 
     opts.def_option("-C", "--workclean", "Clean up working directories") {
-      |$workclean|
+      |opt|
+      $workclean = opt
     }
 
     opts.def_option("-D", "--distclean", "Clean up distfiles which are not referenced from any#{NEXTLINE}port in the ports tree;#{NEXTLINE}Specified twice, clean up distfiles which are not#{NEXTLINE}referenced from any port that is currently installed") {
@@ -87,11 +88,13 @@
     }
 
     opts.def_option("-L", "--libclean", "Clean up old shared libraries") {
-      |$libclean|
+      |opt|
+      $libclean = opt
     }
 
     opts.def_option("-n", "--noexecute", "Do not actually delete files") {
-      |$noexecute|
+      |opt|
+      $noexecute = opt
       if $noexecute
 	$interactive = false
       end
@@ -116,7 +119,8 @@
     }
 
     opts.def_option("-q", "--noconfig", "Do not read pkgtools.conf") {
-      |$noconfig|
+      |opt|
+      $noconfig = opt
     }
 
     opts.def_tail_option '
--- bin/portsdb.orig	2010-03-09 18:24:08.193353919 -0700
+++ bin/portsdb	2010-03-09 18:25:40.088596540 -0700
@@ -73,7 +73,8 @@
     }
 
     opts.def_option("-f", "--force", "Force to update database regardless of timestamps") {
-      |$force|
+      |opt|
+      $force = opt
     }
 
     opts.def_option("-F", "--fetchindex", "Fetch INDEX") {
@@ -82,7 +83,8 @@
     }
 
     opts.def_option("-M", "--master-recursive", "List all the master ports of the given packages#{NEXTLINE}as well") {
-      |$master_recursive|
+      |opt|
+      $master_recursive = opt
     }
 
 #    opts.def_option("-O", "--omit-check", "Omit sanity checks for dependencies.") {
@@ -90,15 +92,18 @@
 #    }
 
     opts.def_option("-q", "--noconfig", "Do not read pkgtools.conf") {
-      |$noconfig|
+      |opt|
+      $noconfig = opt
     }
 
     opts.def_option("-r", "--recursive", "List all those depending on the given packages#{NEXTLINE}as well") {
-      |$recursive|
+      |opt|
+      $recursive = opt
     }
 
     opts.def_option("-R", "--upward-recursive", "List all those required by the given packages#{NEXTLINE}as well") {
-      |$upward_recursive|
+      |opt|
+      $upward_recursive = opt
     }
 
 #    opts.def_option("-S", "--slave-recursive", "List all the slave ports of the given packages#{NEXTLINE}as well") {
@@ -106,11 +111,13 @@
 #    }
 
     opts.def_option("-u", "--update", "Update INDEX.db") {
-      |$update_db|
+      |opt|
+      $update_db = opt
     }
 
     opts.def_option("-U", "--updateindex", "Update INDEX") {
-      |$update_index|
+      |opt|
+      $update_index = opt
     }
 
     opts.def_option("-x", "--exclude=GLOB", "Exclude ports matching the specified glob#{NEXTLINE}pattern") {
--- bin/portupgrade.orig	2010-03-09 18:26:16.505899641 -0700
+++ bin/portupgrade	2010-03-09 18:26:23.561765031 -0700
@@ -235,43 +235,50 @@
 
     opts.def_option("-a", "--all",
 		    "Do with all the installed packages") {
-      |$all|
+      |opt|
+      $all = opt
       $recursive = false
       $upward_recursive = false
     }
 
     opts.def_option("-A", "--afterinstall=CMD",
 		    "Run the command after each installation") {
-      |$afterinstall|
+      |opt|
+      $afterinstall = opt
       $afterinstall.strip!
     }
 
     opts.def_option("-b", "--backup-packages",
 		    "Keep backup packages of the old versions") {
-      |$backup_packages|
+      |opt|
+      $backup_packages = opt
     }
 
     opts.def_option("--batch",
 		    "Run an upgrading process in a batch mode" << NEXTLINE <<
     		    "(with BATCH=yes)") {
-      |$batch_mode|
+      |opt|
+      $batch_mode = opt
     }
 
     opts.def_option("-B", "--beforebuild=CMD",
 		    "Run the command before each build; If the command" << NEXTLINE <<
 		    "exits in failure, then the port will be skipped") {
-      |$beforebuild|
+      |opt|
+      $beforebuild = opt
       $beforebuild.strip!
     }
 
     opts.def_option("-c", "--config",
 		    "Run \"make config-conditional\" before everything for all tasks") {
-      |$config|
+      |opt|
+      $config = opt
     }
 
     opts.def_option("-C", "--force-config",
 		    "Run \"make config\" before everything for all tasks") {
-      |$force_config|
+      |opt|
+      $force_config = opt
       $config = true
     }
 
@@ -284,36 +291,42 @@
 
     opts.def_option("-e", "--emit-summaries",
 		    "Emit summary info after each port processing" << NEXTLINE ) {
-      |$emit_summaries|
+      |opt|
+      $emit_summaries = opt
     }
 
     opts.def_option("-f", "--force",
 		    "Force the upgrade of a port even if it is to be a" << NEXTLINE <<
 		    "downgrade or just a reinstall, or the port is held") {
-      |$force|
+      |opt|
+      $force = opt
     }
 
     opts.def_option("-F", "--fetch-only",
 		    "Only fetch distfiles or packages (if -P is given);" << NEXTLINE <<
 		    "Do not build or install anything") {
-      |$fetch_only|
+      |opt|
+      $fetch_only = opt
     }
 
     opts.def_option("--ignore-moved",
 		    "Ignore MOVED file") {
-      |$ignore_moved|
+      |opt|
+      $ignore_moved = opt
     }
 
     opts.def_option("-i", "--interactive",
 		    "Turn on interactive mode") {
-      |$interactive|
+      |opt|
+      $interactive = opt
       $verbose = true
     }
 
     opts.def_option("-k", "--keep-going",
 		    "Force the upgrade of a port even if some of the" << NEXTLINE <<
 		    "requisite ports have failed to upgrade") {
-      |$keep_going|
+      |opt|
+      $keep_going = opt
     }
 
     opts.def_option("-l", "--results-file=FILE",
@@ -337,7 +350,8 @@
     opts.def_option("-m", "--make-args=ARGS",
 		    "Specify arguments to append to each make(1)" << NEXTLINE <<
 		    "command line") {
-      |$make_args|
+      |opt|
+      $make_args = opt
     }
 
     opts.def_option("-M", "--make-env=ARGS",
@@ -354,7 +368,8 @@
     opts.def_option("-n", "--noexecute",
 		    "Do not upgrade any ports, but just show what would" << NEXTLINE <<
 		    "be done") {
-      |$noexecute|
+      |opt|
+      $noexecute = opt
       $verbose = true
       $interactive = true
       $yestoall = false
@@ -364,7 +379,8 @@
 		    "Install a new one when a specified package is" << NEXTLINE <<
 		    "not installed, after upgrading all the dependent" << NEXTLINE <<
 		    "packages (default: #{MYNAME == 'portinstall' ? 'on' : 'off'})") {
-      |$new|
+      |opt|
+      $new = opt
     }
 
     opts.def_option("-o", "--origin=ORIGIN",
@@ -381,7 +397,8 @@
 
     opts.def_option("-p", "--package",
 		    "Build package when each port is installed") {
-      |$package|
+      |opt|
+      $package = opt
     }
 
     opts.def_option("-P", "--use-packages",
@@ -396,18 +413,21 @@
 
     opts.def_option("--use-packages-only",
 		    "Or -PP; Use no ports but packages only") {
-      |$use_packages_only|
+      |opt|
+      $use_packages_only = opt
       $use_packages = true
     }
 
     opts.def_option("-q", "--quiet",
 		    "Be quiet when -N option specified and the package already installed") {
-      |$quiet|
+      |opt|
+      $quiet = opt
     }
 
     opts.def_option("--noconfig",
 		    "Do not read pkgtools.conf") {
-      |$noconfig|
+      |opt|
+      $noconfig = opt
     }
 
     opts.def_option("-r", "--recursive",
@@ -425,7 +445,8 @@
 
     opts.def_option("-s", "--sudo",
 		    "Run commands under sudo(8) where needed") {
-      |$sudo|
+      |opt|
+      $sudo = opt
     }
 
     opts.def_option("-S", "--sudo-command=CMD",
@@ -442,7 +463,8 @@
 
     opts.def_option("-v", "--verbose",
 		    "Be verbose") {
-      |$verbose|
+      |opt|
+      $verbose = opt
     }
 
     opts.def_option("-w", "--noclean",
@@ -459,7 +481,8 @@
 
     opts.def_option("--without-env-upgrade",
       		    "Do not set UPGRADE_* environment variables") {
-      |$without_env_upgrade|
+      |opt|
+      $without_env_upgrade = opt
     }
 
     opts.def_option("-x", "--exclude=GLOB",
@@ -478,7 +501,8 @@
 
     opts.def_option("-y", "--yes",
 		    "Answer yes to all the questions") {
-      |$yestoall|
+      |opt|
+      $yestoall = opt
       $verbose = true
       $noexecute = false
     }
--- bin/portversion.orig	2010-03-09 18:27:16.377764751 -0700
+++ bin/portversion	2010-03-09 18:27:20.723681087 -0700
@@ -86,7 +86,8 @@
     }
 
     opts.def_option("-c", "--command-output", "Enable command output") {
-      |$command_output|
+      |opt|
+      $command_output = opt
     }
 
     opts.def_option("-C", "--command-args=ARGS", "Specify the arguments for portupgrade in command#{NEXTLINE}output (default: none)") {
@@ -100,11 +101,13 @@
 
     opts.def_option("--ignore-moved",
 		    "Ignore MOVED file") {
-      |$ignore_moved|
+      |opt|
+      $ignore_moved = opt
     }
 
     opts.def_option("-l", "--limit=CHARS", "Only include the packages with the specified#{NEXTLINE}status flags") {
-      |$limit_chars|
+      |opt|
+      $limit_chars = opt
       # XXX: workaround: optparse treats `-l=' as '-l ""'
       if $limit_chars.empty?
 	$limit_chars = '='
@@ -112,7 +115,8 @@
     }
 
     opts.def_option("-L", "--inv-limit=CHARS", "Exclude the packages with the specified#{NEXTLINE}status flags") {
-      |$inv_limit_chars|
+      |opt|
+      $inv_limit_chars = opt
       # XXX: workaround: optparse treats `-L=' as '-L ""'
       if $inv_limit_chars.empty?
 	$inv_limit_chars = '='
@@ -128,7 +132,8 @@
     }
 
     opts.def_option("-q", "--noconfig", "Do not read pkgtools.conf") {
-      |$noconfig|
+      |opt|
+      $noconfig = opt
     }
 
     opts.def_option("-Q", "--quiet", "Do not display status chars") {
@@ -136,20 +141,24 @@
     }
 
     opts.def_option("-r", "--recursive", "Check for all those depending on the given#{NEXTLINE}packages as well") {
-      |$recursive|
+      |opt|
+      $recursive = opt
     }
 
     opts.def_option("-R", "--upward-recursive", "Check for all those required by the given#{NEXTLINE}packages as well") {
-      |$upward_recursive|
+      |opt|
+      $upward_recursive = opt
     }
 
     opts.def_option("-t", "--test=VERSION", "Compare the version with the following one(s),#{NEXTLINE}and print the result(s)") {
-      |$test_version|
+      |opt|
+      $test_version = opt
       $test_version = PkgVersion.new($test_version)
     }
 
     opts.def_option("-v", "--verbose", "Be verbose") {
-      |$verbose|
+      |opt|
+      $verbose = opt
       $verbose_output = :verbose
       $display = :fullname
     }


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list