Update of /cvsroot/fink/fink/perlmod/Fink
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7095

Modified Files:
        PkgVersion.pm ChangeLog 
Log Message:
Fix error message for missing Package: in SplitOffN:.

Fix get_source_count() to use instance variable instead of package
global for cache b/c object refs could change.


Index: PkgVersion.pm
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/PkgVersion.pm,v
retrieving revision 1.233
retrieving revision 1.234
diff -u -d -r1.233 -r1.234
--- PkgVersion.pm       2 Mar 2004 19:46:35 -0000       1.233
+++ PkgVersion.pm       2 Mar 2004 21:37:50 -0000       1.234
@@ -391,7 +391,7 @@
        $properties = &read_properties_var("splitoff$splitoff_num of \"$filename\"", 
$splitoff_data);
        $pkgname = $properties->{'package'};
        unless ($pkgname) {
-               print "No package name for SplitOff in $filename\n";
+               print "No package name for SplitOff$splitoff_num in $filename\n";
        }
        
        # copy version information
@@ -554,33 +554,28 @@
 
 # Returns the number of source tarballs for the package. Actually it
 # gives the highest *consecutive* N of SourceN, or 1 if no SourceN
-# (even if no Source either). FIXME: that's pretty weird.
-#
-# Results are cached in a package global (class variable) hash using
-# the object ref as the key. NB: perl hash keys get stringified so
-# cannot use the key as a ref.
+# (even if no Source b/c it's a nosource or bundle).
+# FIXME: that's pretty weird.
 
 sub get_source_count {
        my $self = shift;
 
-       our %source_count_cache;
-
        if (exists $self->{_parent}) {
                # SplitOff packages have no sources of their own
                return 0;
        }
 
-       if (!exists $source_count_cache{$self}) {
-               # not found is cache, so calculate it
+       if (!exists $self->{_sourcecount}) {
+               # have not calculated it before
                my $count = 1;
                while ($self->has_param('source'.($count+1))) {
                        $count++;
                }
-               # cache the result
-               $source_count_cache{$self} = $count;
+               # save the result for next time
+               $self->{_sourcecount} = $count;
        }
 
-       return $source_count_cache{$self};
+       return $self->{_sourcecount};
 }
 
 sub get_source {

Index: ChangeLog
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/ChangeLog,v
retrieving revision 1.561
retrieving revision 1.562
diff -u -d -r1.561 -r1.562
--- ChangeLog   2 Mar 2004 19:46:35 -0000       1.561
+++ ChangeLog   2 Mar 2004 21:37:50 -0000       1.562
@@ -1,5 +1,12 @@
 2004-03-02  Daniel Macks  <[EMAIL PROTECTED]>
 
+       * PkgVersion.pm: fix error message for missing Package: in
+       SplitOffN:. Caching by object ref is not safe so revert to
+       _sourcecount internally in get_source_count() (but must not be
+       used in other places b/c may not be saved to package db).
+       
+2004-03-02  Daniel Macks  <[EMAIL PROTECTED]>
+
        * PkgVersion.pm: Implement get_source_count() accessor. Remove
        is_multisource() accessor (leftover from long-gone SourceItems).
        * Engine.pm, PkgVersion.pm: abolish _sourcecount instance



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Fink-commits mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/fink-commits

Reply via email to