ports/89917: sysutils/portupgrade: fix the problem that portupgrade sometimes runs slow, and bump PORTVERSION to 20051204.

KOMATSU Shinichiro koma2 at lovepeers.org
Sun Dec 4 03:20:03 UTC 2005


>Number:         89917
>Category:       ports
>Synopsis:       sysutils/portupgrade: fix the problem that portupgrade sometimes runs slow, and bump PORTVERSION to 20051204.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Sun Dec 04 03:20:02 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     KOMATSU Shinichiro
>Release:        FreeBSD 5.4-RELEASE i386
>Organization:
>Environment:
FreeBSD 5.4-RELEASE i386

>Description:

(1) For years, I have experienced that portupgrade sometimes runs very slow.
After some investigation, I found that "pkgdb -aF" is invoked from portupgrade
or other programs (such as portversion) without having sufficient privilege
to modify /var/db/pkg/, and that error is not caught by the caller program,
and "pkgdb -aF" is invoked repeatedlly.

So, I fixed the following things:

- When pkgdb internally invoked from other program exits with error,
  make the caller program also exit with error.
- Display the error messages of pkgdb that run internally from other program.


When portupgrade or other programs die with the following error,

    ** You do not own /var/db/pkg. (use -f to force or run as root)
    Command failed [exit code 1]: /usr/local/sbin/pkgdb -aFQ

please run "pkgdb -aF" as the user that owns /var/db/pkg (usually root).


(2) Make new tarball that contains the above fix and all patches in files/.
Bump PORTVERSION to 20051204 and change MASTER_SITES.

>How-To-Repeat:

>Fix:

diff -urN --exclude=CVS --exclude=*.log* portupgrade.old/Makefile portupgrade/Makefile
--- portupgrade.old/Makefile	Sun Dec  4 11:32:55 2005
+++ portupgrade/Makefile	Sun Dec  4 10:57:11 2005
@@ -6,18 +6,16 @@
 #
 
 PORTNAME=	portupgrade
-PORTVERSION=	20041226
-PORTREVISION=	9
+PORTVERSION=	20051204
+PORTREVISION=	0
 CATEGORIES=	sysutils
-MASTER_SITES=	ftp://ftp.iDaemons.org/pub/distfiles/ \
-		${MASTER_SITE_LOCAL}
-MASTER_SITE_SUBDIR=	knu
+MASTER_SITES=	http://dists.lovepeers.org/distfiles/portupgrade/
 DISTNAME=	pkgtools-${DISTVERSION}
 
 MAINTAINER=	koma2 at lovepeers.org
 COMMENT=	FreeBSD ports/packages administration and management tool suite
 
-DISTVERSION=	20041224
+DISTVERSION=	${PORTVERSION}
 
 .if ${DISTVERSION} != ${PORTVERSION}
 PATCH_SITES=	${MASTER_SITES}
diff -urN --exclude=CVS --exclude=*.log* portupgrade.old/distinfo portupgrade/distinfo
--- portupgrade.old/distinfo	Sun Dec  4 11:32:55 2005
+++ portupgrade/distinfo	Sun Dec  4 11:23:09 2005
@@ -1,6 +1,3 @@
-MD5 (pkgtools-20041224.tar.bz2) = 1c69732e569fa423152cc792d2c40113
-SHA256 (pkgtools-20041224.tar.bz2) = bf637cdcadc1bc843f300bf3d2628cf576c5d2252932f0f09188e8dd9d4803b7
-SIZE (pkgtools-20041224.tar.bz2) = 104308
-MD5 (pkgtools-20041224-20041226.diff.bz2) = aab3f2885424d5f25c8ab08d48da5f34
-SHA256 (pkgtools-20041224-20041226.diff.bz2) = 1900a764a50396d8f45b25576005533878bebcc37f5187099632ee591989ea63
-SIZE (pkgtools-20041224-20041226.diff.bz2) = 1086
+MD5 (pkgtools-20051204.tar.bz2) = 9c90481860f80d80f856ec72907ea730
+SHA256 (pkgtools-20051204.tar.bz2) = d118d5fb63a06217b61b06b1d0349413a131044d96cfe187da7da7a7bfd83867
+SIZE (pkgtools-20051204.tar.bz2) = 105771
diff -urN --exclude=CVS --exclude=*.log* portupgrade.old/files/patch-CAN-2005-0610 portupgrade/files/patch-CAN-2005-0610
--- portupgrade.old/files/patch-CAN-2005-0610	Mon May 23 20:30:17 2005
+++ portupgrade/files/patch-CAN-2005-0610	Thu Jan  1 09:00:00 1970
@@ -1,75 +0,0 @@
-diff -ur ../orig.pkgtools-20041224/lib/pkgdb.rb ./lib/pkgdb.rb
---- ../orig.pkgtools-20041224/lib/pkgdb.rb	Wed Mar 23 21:37:47 2005
-+++ ./lib/pkgdb.rb	Sun May 22 00:39:38 2005
-@@ -96,8 +96,7 @@
-     @db_dir = File.expand_path(new_db_dir || ENV['PKG_DBDIR'] || '/var/db/pkg')
- 
-     @db_file = File.join(@db_dir, 'pkgdb.db')
--    @tmp_dir = ENV['PKG_TMPDIR'] || ENV['TMPDIR'] || '/var/tmp'
--    @fixme_file = File.join(@tmp_dir, 'pkgdb.fixme')
-+    @fixme_file = ENV['PKG_FIXME_FILE'] || "/var/db/pkgdb.fixme"
-     @db_filebase = @db_file.sub(/\.db$/, '')
-     close_db
- 
-Only in ./lib: pkgdb.rb~
-diff -ur ../orig.pkgtools-20041224/lib/pkgmisc.rb ./lib/pkgmisc.rb
---- ../orig.pkgtools-20041224/lib/pkgmisc.rb	Wed Mar 23 21:37:47 2005
-+++ ./lib/pkgmisc.rb	Thu May  5 14:09:37 2005
-@@ -95,3 +95,31 @@
-     end
-   end
- end
-+
-+def init_tmpdir
-+  if ! $tmpdir.nil? && $tmpdir != "" then
-+    return
-+  end
-+  maintmpdir = ENV['PKG_TMPDIR'] || ENV['TMPDIR'] || '/var/tmp'
-+  if !FileTest.directory?(maintmpdir)
-+    raise "Temporary directory #{maintmpdir} does not exist"
-+  end
-+
-+  cmdline = shelljoin("/usr/bin/mktemp", "-d", maintmpdir + "/portupgradeXXXXXXXX")
-+  pipe = IO.popen(cmdline)
-+  tmpdir = pipe.gets
-+  pipe.close
-+  if $? != 0 || tmpdir.nil? || tmpdir.length == 0
-+    raise "Could not create temporary directory in #{maintmpdir}"
-+  end
-+  tmpdir.chomp!
-+
-+  at_exit {
-+    begin
-+      Dir.delete(tmpdir)
-+    rescue
-+      warning_message "Could not clean up temporary directory: " + $!
-+    end
-+    }
-+  $tmpdir=tmpdir
-+end
-diff -ur ../orig.pkgtools-20041224/lib/pkgsqldb.rb ./lib/pkgsqldb.rb
---- ../orig.pkgtools-20041224/lib/pkgsqldb.rb	Wed Mar 23 21:37:47 2005
-+++ ./lib/pkgsqldb.rb	Sun May 22 00:42:04 2005
-@@ -73,8 +73,7 @@
-     @db_dir = File.expand_path(new_db_dir || ENV['PKG_DBDIR'] || '/var/db/pkg')
- 
-     @db_file = File.join(@db_dir, 'pkgdb.sqldb')
--    @tmp_dir = ENV['PKG_TMPDIR'] || ENV['TMPDIR'] || '/var/tmp'
--    @fixme_file = File.join(@tmp_dir, 'pkgdb.fixme')
-+    @fixme_file = ENV['PKG_FIXME_FILE'] || "/var/db/pkgdb.fixme"
-     close_db
- 
-     @db_dir
-Only in ./lib: pkgsqldb.rb~
-diff -ur ../orig.pkgtools-20041224/lib/pkgtools.rb ./lib/pkgtools.rb
---- ../orig.pkgtools-20041224/lib/pkgtools.rb	Wed Mar 23 21:37:47 2005
-+++ ./lib/pkgtools.rb	Tue May  3 19:29:59 2005
-@@ -204,7 +204,7 @@
-   $ports_dir = $portsdb.ports_dir
-   $packages_base = ENV['PACKAGES'] || File.join($ports_dir, 'packages')
-   $packages_dir = File.join($packages_base, 'All')
--  $tmpdir = ENV['PKG_TMPDIR'] || ENV['TMPDIR'] || '/var/tmp'
-+  init_tmpdir
-   $pkg_path = ENV['PKG_PATH'] || $packages_dir
- 
-   $pkg_sites = (ENV['PKG_SITES'] || '').split
diff -urN --exclude=CVS --exclude=*.log* portupgrade.old/files/patch-Makefile.compat portupgrade/files/patch-Makefile.compat
--- portupgrade.old/files/patch-Makefile.compat	Mon May 23 20:30:17 2005
+++ portupgrade/files/patch-Makefile.compat	Thu Jan  1 09:00:00 1970
@@ -1,11 +0,0 @@
---- ../orig.pkgtools-20041224/Makefile.compat	Wed Mar 23 21:37:47 2005
-+++ Makefile.compat	Sun May 22 00:46:39 2005
-@@ -89,7 +89,7 @@
- .endif
- .endif
- 
--.endif defined(${group}) && !empty(${group})
-+.endif # defined(${group}) && !empty(${group})
- .endfor
- 
- .endif
diff -urN --exclude=CVS --exclude=*.log* portupgrade.old/files/patch-bin-pkgdb portupgrade/files/patch-bin-pkgdb
--- portupgrade.old/files/patch-bin-pkgdb	Wed Oct 19 16:47:48 2005
+++ portupgrade/files/patch-bin-pkgdb	Thu Jan  1 09:00:00 1970
@@ -1,13 +0,0 @@
-Index: bin/pkgdb
-===================================================================
---- bin/pkgdb	(revision 38)
-+++ bin/pkgdb	(working copy)
-@@ -615,7 +615,7 @@
-       next
-     end
- 
--    if $pkgdb.match?(pat, dep)
-+    if File.fnmatch?(pat, dep)
-       case alt
-       when :delete, :skip
- 	return [alt]
diff -urN --exclude=CVS --exclude=*.log* portupgrade.old/files/patch-bin-portsclean.1 portupgrade/files/patch-bin-portsclean.1
--- portupgrade.old/files/patch-bin-portsclean.1	Mon Jun 27 02:22:58 2005
+++ portupgrade/files/patch-bin-portsclean.1	Thu Jan  1 09:00:00 1970
@@ -1,24 +0,0 @@
-Index: bin/portsclean.1
-===================================================================
---- bin/portsclean.1	(revision 32)
-+++ bin/portsclean.1	(revision 34)
-@@ -8,7 +8,7 @@
- .Nd a tool to clean ports/packages garbage
- .Sh SYNOPSIS
- .Nm
--.Op Fl hCDDinPPQQq
-+.Op Fl hCDDiLnPPQQq
- .Sh DESCRIPTION
- .Nm
- is a tool to help users clean out the working directories of their ports
-@@ -81,7 +81,9 @@
- .Pp
- .It Fl Q
- .It Fl -quiet
--Do not write anything to stdout.  Specified twice, do not write
-+Do not write anything to stdout.  Specified twice (i.e.
-+.Fl QQ ) ,
-+do not write
- anything to stderr either.  This is for internal use.
- .Pp
- .It Fl q
diff -urN --exclude=CVS --exclude=*.log* portupgrade.old/files/patch-bin-portupgrade portupgrade/files/patch-bin-portupgrade
--- portupgrade.old/files/patch-bin-portupgrade	Sat Jul 30 01:34:48 2005
+++ portupgrade/files/patch-bin-portupgrade	Thu Jan  1 09:00:00 1970
@@ -1,22 +0,0 @@
-Index: bin/portupgrade
-===================================================================
---- bin/portupgrade	(revision 34)
-+++ bin/portupgrade	(revision 36)
-@@ -1560,7 +1560,7 @@
- 
-   timer_start(time_key = "Installation of #{pkgname}")
- 
--  cmdargs = [PkgDB::command(:pkg_add), '-f', pkgname]
-+  cmdargs = [PkgDB::command(:pkg_add), '-f', pkgfile]
- 
-   progress_message "Installing the new version via the package"
- 
-@@ -1705,7 +1705,7 @@
-           id_pkgname, id_origin, pkgdep = identify_pkg(file)
- 
-           if id_origin == origin
--            pkglist << [PkgInfo.new(id_pkgname), file]
-+            pkglist << [PkgInfo.new(id_pkgname), File.join(dir, file)]
-           end
-         }
-       }
diff -urN --exclude=CVS --exclude=*.log* portupgrade.old/files/patch-etc-Makefile portupgrade/files/patch-etc-Makefile
--- portupgrade.old/files/patch-etc-Makefile	Wed Dec 29 00:18:02 2004
+++ portupgrade/files/patch-etc-Makefile	Thu Jan  1 09:00:00 1970
@@ -1,14 +0,0 @@
-Index: etc/Makefile
-===================================================================
---- etc/Makefile	(リビジョン 1049)
-+++ etc/Makefile	(作業コピー)
-@@ -32,7 +32,8 @@
- ${script}: ${script:T}
- 	@mkdir -p ${BUILDDIR}
- 	${RUBY} -p \
--		-e 'sub %r:/usr/local:, "${PREFIX}"' \
-+		-e 'sub(%r:/usr/local:, "${PREFIX}")' \
-+		-e 'sub(%r:(/etc/rc\.subr):, "${PREFIX}\\1") if !File.exist?("/etc/rc.subr")' \
- 		${.ALLSRC} > ${.TARGET}
- .endfor
- 
diff -urN --exclude=CVS --exclude=*.log* portupgrade.old/files/patch-etc-pkgtools.conf portupgrade/files/patch-etc-pkgtools.conf
--- portupgrade.old/files/patch-etc-pkgtools.conf	Wed Oct 19 16:47:48 2005
+++ portupgrade/files/patch-etc-pkgtools.conf	Thu Jan  1 09:00:00 1970
@@ -1,16 +0,0 @@
-Index: etc/pkgtools.conf
-===================================================================
---- etc/pkgtools.conf	(revision 39)
-+++ etc/pkgtools.conf	(revision 40)
-@@ -252,8 +252,10 @@
-   # be used as B values, instead of pkgname glob patterns.  <:delete>
-   # means to delete the dependency and <:skip> to skip it.
-   #
--  # cf. pkg_glob(1)
-+  # This replacement is done when "pkgdb -F" is executed.
-   #
-+  # cf. pkg_glob(1), pkgdb(1)
-+  #
-   # e.g.:
-   #   ALT_PKGDEP = {
-   #     # If you use apache13-modssl instead of apache13
diff -urN --exclude=CVS --exclude=*.log* portupgrade.old/files/patch-lib_portsdb.rb portupgrade/files/patch-lib_portsdb.rb
--- portupgrade.old/files/patch-lib_portsdb.rb	Sun Dec  4 11:32:55 2005
+++ portupgrade/files/patch-lib_portsdb.rb	Thu Jan  1 09:00:00 1970
@@ -1,24 +0,0 @@
-Index: lib/portsdb.rb
-===================================================================
---- lib/portsdb.rb	(.../vendor/portupgrade/trunk/lib/portsdb.rb)	(revision 2)
-+++ lib/portsdb.rb	(.../branches/ports/lib/portsdb.rb)	(revision 41)
-@@ -194,8 +194,8 @@
-   def db_dir=(new_db_dir)
-     @db_dir = new_db_dir || ENV['PORTS_DBDIR'] || ports_dir
- 
--    @db_file = File.join(@db_dir, 'INDEX.db')
--    @db_filebase = @db_file.sub(/\.db$/, '')
-+    @db_filebase = File.join(@db_dir, File.basename(index_file()))
-+    @db_file = @db_filebase + '.db'
- 
-     close_db
- 
-@@ -846,7 +846,7 @@
- 
-   def all_depends_list(origin, before_args = nil, after_args = nil)
-     if !before_args && !after_args && i = port(origin)
--      i.all_depends.map { |n| origin(n) }
-+      i.all_depends.map { |n| origin(n) }.compact
-     else
-       all_depends_list!(origin, before_args, after_args)
-     end
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list