Bug 33520

Summary: "bsdpan" files confuse portversion utility
Product: Ports & Packages Reporter: Vivek Khera <khera>
Component: Individual Port(s)Assignee: Akinori MUSHA <knu>
Status: Closed FIXED    
Severity: Affects Only Me CC: knu
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description Vivek Khera 2002-01-03 22:10:00 UTC
	

the ports' perl 5.6.1 installs with BSDPAN as default.  whenever
modules are installed via the "CPAN" utility, they create bsdpan-XXX
"ports" on the fly.  The pkgdb -F and portversion utilities complain
about missin origin of these files.  However, there is no origin since
they are not really ports in the traditional sense.  portversion
outputs something like this:

bsdpan-Digest-MD5-2.16      #  error - origin not recorded; run pkgdb -F

and running pkgdb -F does no good since there is no origin ;-(

Fix: 

I think it may be worth some special-case handling of ports that have
no origin like this, but I'm not sure the mechanics of doing it.

Right now, just ignore those warnings...

It is not urgent, but something to keep in mind as we progress towards
FreeBSD 5.x where perl5.6+BSDPAN might be standard.

Thanks.
How-To-Repeat: 	

install perl 5.6.1 with BSDPAN and install some modules via CPAN.
run "portversion -v -L=".
Comment 1 Akinori MUSHA 2002-01-04 19:20:05 UTC
At Thu, 3 Jan 2002 17:04:30 -0500 (EST),
Vivek Khera wrote:
> the ports' perl 5.6.1 installs with BSDPAN as default.  whenever
> modules are installed via the "CPAN" utility, they create bsdpan-XXX
> "ports" on the fly.  The pkgdb -F and portversion utilities complain
> about missin origin of these files.  However, there is no origin since
> they are not really ports in the traditional sense.  portversion
> outputs something like this:
> 
> bsdpan-Digest-MD5-2.16      #  error - origin not recorded; run pkgdb -F
> 
> and running pkgdb -F does no good since there is no origin ;-(

Both portversion(1) and pkgdb(1) should properly treat bsdpan-*
packages if you have 'bsdpan-*' in your HOLD_PKGS variable as listed
by default:

  knu@archon[2]% grep -C2 bsdpan /usr/local/etc/pkgtools.conf.sample
    # e.g.:
    #   HOLD_PKGS = [
    #     'bsdpan-*',
    #     'x11/XFree86*',
    #   ]
  
    HOLD_PKGS = [
      'bsdpan-*',
    ]
  knu@archon[2]% portversion -v bsdpan-Net-IRC-0.72
  bsdpan-Net-IRC-0.72         #  [held] error - origin not recorded; run pkgdb -F
  knu@archon[2]% sudo pkgdb -F
  Password:
(..snip..)
  Checking the origin of bsdpan-Net-IRC-0.72
  Missing origin.
  -> Ignored. (the package is held; specify -f to force)
(..snip..)

(Note the occurrences of the word "held")


But yes, portupgrade(1) may not handle packages without origins quite
correctly; it complains about a package's missing its origin before
checking if the package is "held". (It doesn't really matter since the
upgrade stops in any case)

The following patch makes portupgrade(1) properly look up HOLD_PKGS
before checking the origin for each package.  Apply it now if you
can't wait until the next release comes up.

Index: portupgrade
===================================================================
RCS file: /home/cvs/pkgtools/bin/portupgrade,v
retrieving revision 1.162
retrieving revision 1.163
diff -u -r1.162 -r1.163
--- portupgrade	2 Jan 2002 23:39:40 -0000	1.162
+++ portupgrade	3 Jan 2002 23:01:58 -0000	1.163
@@ -27,7 +27,7 @@
 # SUCH DAMAGE.
 #
 
-RCS_ID = %q$Idaemons: /home/cvs/pkgtools/bin/portupgrade,v 1.162 2002/01/02 23:39:40 knu Exp $
+RCS_ID = %q$Idaemons: /home/cvs/pkgtools/bin/portupgrade,v 1.163 2002/01/03 23:01:58 knu Exp $
 RCS_REVISION = RCS_ID.split[2]
 MYNAME = File.basename($0)
 
@@ -805,13 +805,7 @@
   oldpkgname = oldpkg.fullname
   origin ||= oldpkg.origin
 
-  if origin.nil?
-    warning_message "The origin of '#{oldpkgname}' is unknown."
-    warning_message "Specify one with -o option, or run 'pkgdb -F' to fix it."
-    raise OriginMissingError
-  end
-
-  if config_held?(origin)
+  if origin && config_held?(origin)
     warning_message "The port '#{origin}' is held by user."
 
     if $force
@@ -820,6 +814,21 @@
       progress_message "Skipping '#{origin}' (specify -f to force)"
       return false
     end
+  elsif config_held?(oldpkgname)
+    warning_message "The package '#{oldpkgname}' is held by user."
+
+    if $force
+      progress_message "Forced by user"
+    else
+      progress_message "Skipping '#{oldpkgname}' (specify -f to force)"
+      return false
+    end
+  end
+
+  if origin.nil?
+    warning_message "The origin of '#{oldpkgname}' is unknown."
+    warning_message "Specify one with -o option, or run 'pkgdb -F' to fix it."
+    raise OriginMissingError
   end
 
   logfile = f.path


-- 
                     /
                    /__  __            Akinori.org / MUSHA.org
                   / )  )  ) )  /     FreeBSD.org / Ruby-lang.org
Akinori MUSHA aka / (_ /  ( (__(  @ iDaemons.org / and.or.jp

"Somewhere out of a memory.. of lighted streets on quiet nights.."
Comment 2 Akinori MUSHA freebsd_committer freebsd_triage 2002-01-12 18:50:51 UTC
State Changed
From-To: open->closed

There's a configuration variable to avoid the "problem". 


Comment 3 Akinori MUSHA freebsd_committer freebsd_triage 2002-01-12 18:50:51 UTC
Responsible Changed
From-To: freebsd-ports->knu

I'm the maintainer.