The R Project SVN R

Rev

Rev 29528 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 29528 Rev 29564
Line 35... Line 35...
35
use Text::Wrap;
35
use Text::Wrap;
36
 
36
 
37
## Don't buffer output.
37
## Don't buffer output.
38
$| = 1;
38
$| = 1;
39
 
39
 
40
my $revision = ' $Revision: 1.184 $ ';
40
my $revision = ' $Revision: 1.185 $ ';
41
my $version;
41
my $version;
42
my $name;
42
my $name;
43
$revision =~ / ([\d\.]*) /;
43
$revision =~ / ([\d\.]*) /;
44
$version = $1;
44
$version = $1;
45
($name = $0) =~ s|.*/||;
45
($name = $0) =~ s|.*/||;
Line 647... Line 647...
647
		break;
647
		break;
648
	    }
648
	    }
649
	}
649
	}
650
	if($found != 0) {
650
	if($found != 0) {
651
	    $log->error();
651
	    $log->error();
-
 
652
	    $log->print("Invalid package name.\n");
652
	    $log->print("Invalid package name: this is the name of a base package.\n");
653
	    $log->print("This is the name of a base package.\n");
653
	    exit(1);
654
	    exit(1);
654
	}
655
	}
655
        $found = 0;
656
        $found = 0;
656
        foreach my $p (@R_pkgs_stubs) {
657
        foreach my $p (@R_pkgs_stubs) {
657
	    if($description->{"Package"} eq $p) {
658
	    if($description->{"Package"} eq $p) {
Line 661... Line 662...
661
	}
662
	}
662
	if($found != 0) {
663
	if($found != 0) {
663
	    $log->error();
664
	    $log->error();
664
	    $log->print("Invalid package name.\n");
665
	    $log->print("Invalid package name.\n");
665
	    $log->print(wrap("", "",
666
	    $log->print(wrap("", "",
666
			     ("This name was been used for a base package",
667
			     ("This name was used for a base package",
667
			      "and is remapped by library().\n")));
668
			      "and is remapped by library().\n")));
668
	    exit(1);
669
	    exit(1);
669
	}
670
	}
670
    }
671
    }
671
 
672
 
Line 686... Line 687...
686
	$log->print(wrap("", "", @msg_DESCRIPTION));
687
	$log->print(wrap("", "", @msg_DESCRIPTION));
687
	exit(1);
688
	exit(1);
688
    }
689
    }
689
 
690
 
690
    ## Optional entries in DESCRIPTION:
691
    ## Optional entries in DESCRIPTION:
691
    ##   Depends, Namespace, Priority.
692
    ##   Depends/Suggests, Namespace, Priority.
692
    ## These must be correct if present.
693
    ## These must be correct if present.
693
 
694
 
694
    ## <FIXME>
-
 
695
    ## We should also check Suggests here, but what precisely is allowed
-
 
696
    ## for this?
-
 
697
    ## </FIXME>
-
 
698
 
-
 
699
    if($description->{"Depends"}) {
695
    if($description->{"Depends"} || $description->{"Suggests"}) {
700
	my @dependencies = split(/\,\s*/, $description->{"Depends"});
696
	my @dependencies = split(/\,\s*/, ($description->{"Depends"},
-
 
697
					   $description->{"Suggests"}));
701
	my @matches;
698
	my @matches;
702
	my ($is_bad_dep_op, $is_bad_dep_version);
699
	my ($is_bad_dep_op, $is_bad_dep_version);
703
	my ($bad_dep_value, @bad_dep_error);
700
	my ($bad_dep_value, @bad_dep_error);
704
	foreach my $dep (@dependencies) {
701
	foreach my $dep (@dependencies) {
705
	    @matches =
702
	    @matches =
Line 735... Line 732...
735
		break;
732
		break;
736
	    }
733
	    }
737
	}
734
	}
738
	if($bad_dep_entry) {
735
	if($bad_dep_entry) {
739
	    $log->error();
736
	    $log->error();
740
	    $log->print("Malformed Depends field.\n");
737
	    $log->print("Malformed Depends or Suggests field.\n");
741
	    $log->print("Offending entry is: '$bad_dep_entry'.\n");
738
	    $log->print("Offending entry is: '$bad_dep_entry'.\n");
742
	    $log->print(wrap("", "", @bad_dep_error));
739
	    $log->print(wrap("", "", @bad_dep_error));
743
	    $log->print(wrap("", "", @msg_DESCRIPTION));
740
	    $log->print(wrap("", "", @msg_DESCRIPTION));
744
	    exit(1);
741
	    exit(1);
745
	}
742
	}
Line 1076... Line 1073...
1076
    ## named 'value'.
1073
    ## named 'value'.
1077
 
1074
 
1078
    if(-d "R") {
1075
    if(-d "R") {
1079
	$log->checking("for replacement functions with final arg not " .
1076
	$log->checking("for replacement functions with final arg not " .
1080
		       "named 'value'");
1077
		       "named 'value'");
-
 
1078
 
-
 
1079
	## <FIXME>
-
 
1080
	##   @msg_replace_funs
-
 
1081
	## </FIXME>
-
 
1082
 
1081
	my $Rcmd;
1083
	my $Rcmd;
1082
	if($opt_install) {
1084
	if($opt_install) {
1083
	    $Rcmd .= "checkReplaceFuns(package = \"${pkgname}\")\n";
1085
	    $Rcmd .= "checkReplaceFuns(package = \"${pkgname}\")\n";
1084
	}
1086
	}
1085
	else {
1087
	else {
Line 1372... Line 1374...
1372
 
1374
 
1373
    ## Check for code/documentation mismatches.
1375
    ## Check for code/documentation mismatches.
1374
 
1376
 
1375
    if($opt_codoc && (-d "man")) {
1377
    if($opt_codoc && (-d "man")) {
1376
	$log->checking("for code/documentation mismatches");
1378
	$log->checking("for code/documentation mismatches");
-
 
1379
 
-
 
1380
	## <FIXME>
-
 
1381
	##   @msg_codoc
-
 
1382
	## </FIXME>
-
 
1383
 
1377
	my $any = 0;
1384
	my $any = 0;
1378
 
1385
 
1379
	## Check for code/documentation mismatches in functions.
1386
	## Check for code/documentation mismatches in functions.
1380
	if(-d "R") {
1387
	if(-d "R") {
1381
	    my $Rcmd;
1388
	    my $Rcmd;
Line 1437... Line 1444...
1437
    ## aliases (do all functions shown in \usage have an alias?)
1444
    ## aliases (do all functions shown in \usage have an alias?)
1438
 
1445
 
1439
    if(-d "man") {
1446
    if(-d "man") {
1440
	$log->checking("Rd \\usage sections");
1447
	$log->checking("Rd \\usage sections");
1441
 
1448
 
-
 
1449
	## <FIXME>
-
 
1450
	##   @msg_doc_files
-
 
1451
	## </FIXME>
-
 
1452
 
1442
	my $Rcmd;
1453
	my $Rcmd;
1443
	if($opt_install) {
1454
	if($opt_install) {
1444
	    $Rcmd .= "checkDocFiles(package = \"${pkgname}\")\n";
1455
	    $Rcmd .= "checkDocFiles(package = \"${pkgname}\")\n";
1445
	}
1456
	}
1446
	else {
1457
	else {
Line 1503... Line 1514...
1503
 
1514
 
1504
    if($opt_examples && (-d &file_path($library, $pkgname, "R-ex"))) {
1515
    if($opt_examples && (-d &file_path($library, $pkgname, "R-ex"))) {
1505
	$log->creating("${pkgname}-Ex.R");
1516
	$log->creating("${pkgname}-Ex.R");
1506
	my $Rexdir = &file_path($library, $pkgname, "R-ex");
1517
	my $Rexdir = &file_path($library, $pkgname, "R-ex");
1507
        ## $Rexdir might contain spaces (not on Windows)
1518
        ## $Rexdir might contain spaces (not on Windows)
1508
        my $iszipped = 0;
1519
        my $is_zipped = 0;
1509
	my $cmd;
1520
	my $cmd;
1510
 
1521
 
1511
        if(-e &file_path($Rexdir, "Rex.zip")) {
1522
        if(-e &file_path($Rexdir, "Rex.zip")) {
1512
            $iszipped = 1;
1523
            $is_zipped = 1;
1513
	    my $UNZIP = &R_getenv("R_UNZIPCMD", "unzip -q");
1524
	    my $UNZIP = &R_getenv("R_UNZIPCMD", "unzip -q");
1514
            my $Rexfile = &file_path($Rexdir, "Rex.zip");
1525
            my $Rexfile = &file_path($Rexdir, "Rex.zip");
1515
	    $cmd = join(" ",
1526
	    $cmd = join(" ",
1516
			("$UNZIP",
1527
			("$UNZIP",
1517
			 &shell_quote_file_path($Rexfile),
1528
			 &shell_quote_file_path($Rexfile),
Line 1543... Line 1554...
1543
  	    $log->error();
1554
  	    $log->error();
1544
	    $log->print("Running massage-Examples to create " .
1555
	    $log->print("Running massage-Examples to create " .
1545
			"${pkgname}-Ex.R failed.\n");
1556
			"${pkgname}-Ex.R failed.\n");
1546
  	    exit(1);
1557
  	    exit(1);
1547
        }
1558
        }
1548
        if($iszipped) {
1559
        if($is_zipped) {
1549
            unlink(&list_files_with_exts($Rexdir, "R"));
1560
            unlink(&list_files_with_exts($Rexdir, "R"));
1550
        }
1561
        }
1551
 
1562
 
1552
	$log->result("OK");
1563
	$log->result("OK");
1553
	$log->checking("examples");
1564
	$log->checking("examples");
Line 1669... Line 1680...
1669
 
1680
 
1670
    ## Check package vignettes.
1681
    ## Check package vignettes.
1671
 
1682
 
1672
    chdir($pkgoutdir);
1683
    chdir($pkgoutdir);
1673
 
1684
 
1674
    if((-d &file_path($pkgdir, "inst", "doc"))
1685
    my $vignette_dir = &file_path($pkgdir, "inst", "doc");
-
 
1686
    if((-d $vignette_dir)
1675
       && &list_files_with_type(&file_path($pkgdir, "inst", "doc"),
1687
       && &list_files_with_type($vignette_dir, "vignette")) {
1676
				"vignette")) {
-
 
1677
	$log->checking(join("",
1688
	$log->checking(join(" ",
1678
			    ("package vignettes in '",
1689
			    ("package vignettes in",
1679
			     &file_path("inst", "doc"),
1690
			     &sQuote(&file_path("inst", "doc")))));
1680
			     "'")));
-
 
1681
	my $any = 0;
1691
	my $any = 0;
1682
 
1692
 
1683
	## Do PDFs exist for all package vignettes?
1693
	## Do PDFs exist for all package vignettes?
1684
	my @vignette_files =
1694
	my @vignette_files =
1685
	  &list_files_with_type(&file_path($pkgdir, "inst", "doc"),
1695
	  &list_files_with_type($vignette_dir, "vignette");
1686
				"vignette");
-
 
1687
	my @bad_vignettes = ();
1696
	my @bad_vignettes = ();
1688
	foreach my $file (@vignette_files) {
1697
	foreach my $file (@vignette_files) {
1689
	    my $pdf_file = $file;
1698
	    my $pdf_file = $file;
1690
	    $pdf_file =~ s/\.[[:alpha:]]+$/.pdf/;
1699
	    $pdf_file =~ s/\.[[:alpha:]]+$/.pdf/;
1691
	    push(@bad_vignettes, $file) unless(-f $pdf_file);
1700
	    push(@bad_vignettes, $file) unless(-f $pdf_file);
Line 1736... Line 1745...
1736
        my $latex_dir = &file_path($library, $pkgname, "latex");
1745
        my $latex_dir = &file_path($library, $pkgname, "latex");
1737
	if(-d $latex_dir) {
1746
	if(-d $latex_dir) {
1738
	    $ENV{'TEXINPUTS'} =
1747
	    $ENV{'TEXINPUTS'} =
1739
	      env_path(&file_path($R::Vars::R_HOME, "share", "texmf"),
1748
	      env_path(&file_path($R::Vars::R_HOME, "share", "texmf"),
1740
		       $ENV{'TEXINPUTS'});
1749
		       $ENV{'TEXINPUTS'});
1741
            my $was_zipped = 0;
1750
            my $is_zipped = 0;
1742
            # latex files might have been zipped
1751
            # latex files might have been zipped
1743
            if(-f &file_path($library, $pkgname, "latex", "Rhelp.zip")) {
1752
            if(-f &file_path($latex_dir, "Rhelp.zip")) {
1744
                $was_zipped = 1;
1753
                $is_zipped = 1;
-
 
1754
		my $UNZIP = &R_getenv("R_UNZIPCMD", "unzip -q");
1745
                my $cmd = "cd $latex_dir; unzip -qo Rhelp.zip";
1755
		my $latex_file = &file_path($latex_dir, "Rhelp.zip");
-
 
1756
		$cmd = join(" ",
-
 
1757
			    ("$UNZIP",
-
 
1758
			     &shell_quote_file_path($latex_file),
-
 
1759
			     "-d",
-
 
1760
			     &shell_quote_file_path($latex_dir)));
1746
                if(R_system($cmd)) {
1761
                if(R_system($cmd)) {
1747
		    $log->error();
1762
		    $log->error();
1748
		    $log->print("Unzipping latex files failed.\n");
1763
		    $log->print("Unzipping latex files failed.\n");
1749
		    exit(1);
1764
		    exit(1);
1750
                }
1765
                }
Line 1764... Line 1779...
1764
		}
1779
		}
1765
		close(FILE);
1780
		close(FILE);
1766
	    }
1781
	    }
1767
	    print MANUAL "\\end\{document\}\n";
1782
	    print MANUAL "\\end\{document\}\n";
1768
	    close(MANUAL);
1783
	    close(MANUAL);
1769
            if($was_zipped) {
1784
            if($is_zipped) {
1770
                if(R_system("rm -f $latex_dir/*.tex")) {
1785
		unlink(&list_files_with_exts($latex_dir, "tex"));
1771
		    $log->error();
-
 
1772
		    $log->print("Removing unzipped latex files failed.\n");
-
 
1773
		    exit(1);
-
 
1774
                }
-
 
1775
            }
1786
            }
1776
	    $log->result("OK");
1787
	    $log->result("OK");
1777
	    if($HAVE_LATEX) {
1788
	    if($HAVE_LATEX) {
1778
		$log->checking("${pkgname}-manual.tex");
1789
		$log->checking("${pkgname}-manual.tex");
1779
		## <NOTE>
1790
		## <NOTE>