Commits

shl...@52c325ad-5fd0-0310-8a0f-c43feede02cc  committed c2d4106

- Changed the Readonly variables that contained command-line
invocations of "rpm" (that got invoked when loading the module) to a
memoized method that gets called at run time.
- Fixes the build errors reported in:
- http://nntp.x.perl.org/group/perl.cpan.testers/2202219

  • Participants
  • Parent commits 1335d84

Comments (0)

Files changed (2)

File CPANPLUS-Dist-Fedora/Changes

 
 ( CPANPLUS-Dist-Mdv changes below. )
 
+ - Changed the Readonly variables that contained command-line 
+ invocations of "rpm" (that got invoked when loading the module) to a
+ memoized method that gets called at run time.
+    - Fixes the build errors reported in:
+        - http://nntp.x.perl.org/group/perl.cpan.testers/2202219
+ 
 0.0.2 TODO: FILL IN.
  - Applied a modified version of Chris Weyl's patch to 
  lib/CPANPLUS/Dist/Fedora.pm :

File CPANPLUS-Dist-Fedora/lib/CPANPLUS/Dist/Fedora.pm

 
 our $VERSION = '0.0.2';
 
-Readonly my $RPMDIR => do { chomp(my $d=qx[ rpm --eval %_topdir ]); $d; };
-Readonly my $PACKAGER => 
-    do { my $d = `rpm --eval '%{packager}'`; chomp $d; $d };
 Readonly my $DEFAULT_LICENSE => 'CHECK(GPL+ or Artistic)';
 Readonly my $DIR => cwd;
 
             module    => $module,
             buildreqs => $buildreqs,
             date      => strftime("%a %b %d %Y", localtime),
-            packager  => $PACKAGER,
+            packager  => $self->_get_packager(),
             docfiles  => join(' ', @docfiles),
 
             packagervers => $VERSION,
 # 
 sub _has_been_built {
     my ($self, $name, $vers) = @_;
+    my $RPMDIR = $self->_get_RPMDIR();
     my $pkg = ( sort glob "$RPMDIR/RPMS/*/$name-$vers-*.rpm" )[-1];
     return $pkg;
     # FIXME: should we check cooker?
     return 'no summary found';
 }
 
+sub _get_RPMDIR
+{
+    my $self = shift;
+
+    # Memoize it.
+    if (!defined($self->{_RPMDIR}))
+    {
+        chomp(my $d=qx[ rpm --eval %_topdir ]);
+        $self->{_RPMDIR} = $d;
+    }
+
+    return $self->{_RPMDIR};
+}
+
+sub _get_packager
+{
+    my $self = shift;
+
+    # Memoize it.
+    if (!defined($self->{_packager}))
+    {
+        my $d = `rpm --eval '%{packager}'`; 
+        chomp $d;
+        $self->{_packager} = $d;
+    }
+
+    return $self->{_packager};
+}
 1;
 
 __END__