Subversion Repositories DevTools

Rev

Rev 2450 | Rev 2764 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2450 Rev 2478
Line 68... Line 68...
68
my $opt_workDir = '/work';
68
my $opt_workDir = '/work';
69
my $opt_vobMap;
69
my $opt_vobMap;
70
my $opt_preserveProjectBase;
70
my $opt_preserveProjectBase;
71
my $opt_ignoreProjectBaseErrors;
71
my $opt_ignoreProjectBaseErrors;
72
my $opt_ignoreMakeProjectErrors;
72
my $opt_ignoreMakeProjectErrors;
-
 
73
my $opt_ignoreBadPaths;
73
my $opt_delete;
74
my $opt_delete;
74
my $opt_recentAge = 14;             # Days
75
my $opt_recentAge = 14;             # Days
75
my $opt_relabel = 0;
76
my $opt_relabel = 0;
76
my $opt_protected;
77
my $opt_protected;
77
my $opt_useSvn = 1;
78
my $opt_useSvn = 1;
78
my $opt_testRmDatabase;
79
my $opt_testRmDatabase;
-
 
80
my $opt_extractFromSvn;
79
 
81
 
80
################################################################################
82
################################################################################
81
#   List of Projects Suffixes and Branch Names to be used within SVN
83
#   List of Projects Suffixes and Branch Names to be used within SVN
82
#
84
#
83
#       Name        - Name of branch for the project
85
#       Name        - Name of branch for the project
Line 158... Line 160...
158
    'WinCEDeviceAutoInject'   => ',IgnoreMakeProject,',  # Looks OK
160
    'WinCEDeviceAutoInject'   => ',IgnoreMakeProject,',  # Looks OK
159
    'WinCEReboot'             => ',IgnoreMakeProject,',  # Looks OK
161
    'WinCEReboot'             => ',IgnoreMakeProject,',  # Looks OK
160
 
162
 
161
 
163
 
162
    'ftp'                   => 'SetProjectBase,',
164
    'ftp'                   => 'SetProjectBase,',
163
    'ddu_app_manager'       => 'SetProjectBase,',
165
    'ddu_app_manager'       => 'SetProjectBase,IgnoreMakeProject,',
-
 
166
    'ddu_afc'               => 'SetProjectBase,IgnoreMakeProject,',
-
 
167
    'ddu_dog'               => 'IgnoreMakeProject,',
164
    'ddu_afc'               => 'SetProjectBase,IgnoreMakeProject,',
168
    'ddu_afc'               => 'SetProjectBase,IgnoreMakeProject,',
165
 
169
 
166
    'icl'                   => 'IgnoreProjectBase,',
170
    'icl'                   => 'IgnoreProjectBase,',
167
    'itso'                  => 'IgnoreProjectBase,',
171
    'itso'                  => 'IgnoreProjectBase,',
168
#    'daf_osa_mos'           => 'IgnoreProjectBase,',
172
#    'daf_osa_mos'           => 'IgnoreProjectBase,',
Line 252... Line 256...
252
my $processCount = 0;
256
my $processCount = 0;
253
my $processTotal = 0;
257
my $processTotal = 0;
254
my $recentCount = 0;
258
my $recentCount = 0;
255
my $packageReLabelCount = 0;
259
my $packageReLabelCount = 0;
256
my %saneLabels;
260
my %saneLabels;
-
 
261
my $adjustedPath = 0;
257
 
262
 
258
our $GBE_RM_URL;
263
our $GBE_RM_URL;
259
my $UNIX = $ENV{'GBE_UNIX'};
264
my $UNIX = $ENV{'GBE_UNIX'};
260
 
265
 
261
my $result = GetOptions (
266
my $result = GetOptions (
Line 280... Line 285...
280
                "postimage!"    => \$opt_postimage,
285
                "postimage!"    => \$opt_postimage,
281
                'workdir:s'     => \$opt_workDir,
286
                'workdir:s'     => \$opt_workDir,
282
                'relabel!'      => \$opt_relabel,
287
                'relabel!'      => \$opt_relabel,
283
                'svn!'          => \$opt_useSvn,
288
                'svn!'          => \$opt_useSvn,
284
                'testRmDatabase'    => \$opt_testRmDatabase,
289
                'testRmDatabase'    => \$opt_testRmDatabase,
-
 
290
                'fromSvn!'          => \$opt_extractFromSvn,
285
                );
291
                );
286
 
292
 
287
#
293
#
288
#   Process help and manual options
294
#   Process help and manual options
289
#
295
#
Line 654... Line 660...
654
 
660
 
655
        if ( index( $data, 'IgnoreMakeProject,' ) >= 0) {
661
        if ( index( $data, 'IgnoreMakeProject,' ) >= 0) {
656
            $opt_ignoreMakeProjectErrors = 1;
662
            $opt_ignoreMakeProjectErrors = 1;
657
            Message ("Ignore MakeProject Usage");
663
            Message ("Ignore MakeProject Usage");
658
        }
664
        }
659
        
-
 
660
 
665
 
-
 
666
        if ( index( $data, 'IgnoreBadPath,' ) >= 0) {
-
 
667
            $opt_ignoreBadPaths = 1;
-
 
668
            Message ("Ignore Bad Paths in makefilest Usage");
-
 
669
        }
-
 
670
        
661
        if ( index( $data, 'utf8,' ) >= 0) {
671
        if ( index( $data, 'utf8,' ) >= 0) {
662
            $mustConvertFileNames = 1;
672
            $mustConvertFileNames = 1;
663
            Message ("Convert filenames to UTF8");
673
            Message ("Convert filenames to UTF8");
664
        }
674
        }
665
    }
675
    }
Line 1678... Line 1688...
1678
#
1688
#
1679
sub newPackageVersionBody
1689
sub newPackageVersionBody
1680
{
1690
{
1681
    my ($data, $entry) = @_;
1691
    my ($data, $entry) = @_;
1682
    my $rv;
1692
    my $rv;
-
 
1693
    my $vcs_type;
1683
    my $cc_label;
1694
    my $cc_label;
1684
    my $cc_path;
1695
    my $cc_path;
1685
    my $cc_path_original;
1696
    my $cc_path_original;
1686
 
1697
 
1687
    #
1698
    #
Line 1719... Line 1730...
1719
        return 1;
1730
        return 1;
1720
    }
1731
    }
1721
 
1732
 
1722
 
1733
 
1723
    $data->{tag} =~ m~^(.+?)::(.*?)(::(.+))?$~;
1734
    $data->{tag} =~ m~^(.+?)::(.*?)(::(.+))?$~;
-
 
1735
    $vcs_type = $1;
1724
    $cc_label = $4;
1736
    $cc_label = $4;
1725
    $cc_path = $2;
1737
    $cc_path = $2;
1726
    $cc_path = '/' . $cc_path;
1738
    $cc_path = '/' . $cc_path;
1727
    $cc_path =~ tr~\\/~/~s;
1739
    $cc_path =~ tr~\\/~/~s;
1728
    $cc_path_original = $cc_path;
1740
    $cc_path_original = $cc_path;
1729
 
1741
 
1730
    #
1742
    #
1731
    #   Correct well known path mistakes
1743
    #   Correct well known path mistakes in CC paths
1732
    #
1744
    #
1733
    $cc_path =~ s~/build.pl$~~i;
-
 
1734
    $cc_path =~ s~/src$~~i;
-
 
1735
    $cc_path =~ s~/cpp$~~i;
-
 
1736
    $cc_path =~ s~/MASS_Dev/Infra/~/MASS_Dev_Infra/~i;
-
 
1737
    $cc_path =~ s~/MASS_Dev/Tools/~/MASS_Dev_Tools/~i;
-
 
1738
    $cc_path =~ s~/MASS_Dev/Bus/~/MASS_Dev_Bus/~i;
-
 
1739
    $cc_path =~ s~/MASS_Dev_Bus/Cbp/~/MASS_Dev_Bus/CBP/~i;
-
 
1740
    $cc_path =~ s~/MREF_Package/ergpostmongui$~/MREF_Package/ergpostmongui~i;
-
 
1741
    $cc_path =~ s~/MREF_../MREF_Package/~/MREF_Package/~i;
-
 
1742
    $cc_path =~ s~/MREF_Package/mass_ergocdp/~/MREF_Package/ergocdp/~i;
-
 
1743
    $cc_path =~ s~/MASS_Dev_Bus/CBP/systemCD.ejb~/MASS_Dev_Bus/CBP/systemCD/ejb~i;
-
 
1744
    $cc_path =~ s~/MASS_Dev_Bus/Financial/cpp/paymentmanager~/MASS_Dev_Bus/Financial/cpp/paymentmanager~i;
-
 
1745
    $cc_path =~ s~/MASS_Dev_Bus/WebServices~/MASS_Dev_Bus/WebServices~i;
-
 
1746
    $cc_path =~ s~/MASS_Dev_Bus/CBP/nullAdapter~//MASS_Dev_Bus/CBP/nullAdaptor~i;
-
 
1747
 
-
 
1748
    $cc_path = '/MASS_Dev_Bus' if ( $cc_path =~ m~/MASS_Dev_Bus/ImageCapture(/|$)~i );
-
 
1749
    $cc_path = '/MASS_Dev_Bus/CBP/enquiry' if ( $versions{$entry}{name} eq 'EJBEnqPxyConnector');
-
 
1750
    $cc_path = '/MASS_Dev_Bus/CBP/enquiry' if ( $versions{$entry}{name} eq 'proxyif4j');
-
 
1751
    $cc_path = '/MASS_Dev_Bus' if ( $versions{$entry}{name} eq 'ImageCaptureTomcatDeployment');
-
 
1752
    $cc_path = '/MASS_Dev_Bus/WebServices/MassWS' if ( $versions{$entry}{name} eq 'MassWebServicesImpl');
-
 
1753
 
-
 
1754
    if (   $versions{$entry}{name} =~ m/^ERGagency$/i
-
 
1755
        || $versions{$entry}{name} =~ m/^ERGavm$/i
-
 
1756
        || $versions{$entry}{name} =~ m/^ERGboi$/i
-
 
1757
        || $versions{$entry}{name} =~ m/^ERGcallcenter$/i
-
 
1758
        || $versions{$entry}{name} =~ m/^ERGcardholder$/i
-
 
1759
        || $versions{$entry}{name} =~ m/^ERGcdaimports$/i
-
 
1760
        || $versions{$entry}{name} =~ m/^ERGcda$/i
-
 
1761
        || $versions{$entry}{name} =~ m/^ERGcscedit$/i
-
 
1762
        || $versions{$entry}{name} =~ m/^ERGcs$/i
-
 
1763
        || $versions{$entry}{name} =~ m/^ERGofs$/i
-
 
1764
        || $versions{$entry}{name} =~ m/^ERGols$/i
-
 
1765
        || $versions{$entry}{name} =~ m/^ERGtpf$/i
-
 
1766
        || $versions{$entry}{name} =~ m/^ERGorasys$/i
-
 
1767
        || $versions{$entry}{name} =~ m/^ERGoracs$/i
-
 
1768
        || $versions{$entry}{name} =~ m/^ERGpxyif$/i
-
 
1769
        || $versions{$entry}{name} =~ m/^ERGtp5upg$/i
-
 
1770
        || $versions{$entry}{name} =~ m/^ERGinstitutional$/i
-
 
1771
        || $versions{$entry}{name} =~ m/^ERGinfra$/i
-
 
1772
        || $versions{$entry}{name} =~ m/^ERGcrrpts$/i
-
 
1773
        || $versions{$entry}{name} =~ m/^ERGmiddle$/i
-
 
1774
        || $versions{$entry}{name} =~ m/^ERGmiddleapi$/i
-
 
1775
        || $versions{$entry}{name} =~ m/^ERGwebapi$/i
-
 
1776
        || $versions{$entry}{name} =~ m/^ERGwebtestui$/i
-
 
1777
        || $versions{$entry}{name} =~ m/^ERGwebesbui$/i
-
 
1778
        || $versions{$entry}{name} =~ m/^ERGwspiv$/i
-
 
1779
        || $versions{$entry}{name} =~ m/^ERGwscst$/i
-
 
1780
        || $versions{$entry}{name} =~ m/^sposMUG$/i
-
 
1781
        || $versions{$entry}{name} =~ m/^ERGfinman$/i
-
 
1782
        || $versions{$entry}{name} =~ m/^ERGkm$/i
-
 
1783
        || $versions{$entry}{name} =~ m/^ERGxml$/i
-
 
1784
        || $versions{$entry}{name} =~ m/^ERGoradacw$/i
-
 
1785
        || $versions{$entry}{name} =~ m/^ERGtru$/i
-
 
1786
        )
-
 
1787
    {
-
 
1788
        $cc_path = '/MREF_Package';
1745
    if ( $vcs_type eq 'CC' )
1789
    }
-
 
1790
 
-
 
1791
    if (   $versions{$entry}{name} =~ m/^tp5000_MUG$/i )
-
 
1792
    {
1746
    {
-
 
1747
        $cc_path =~ s~/build.pl$~~i;
-
 
1748
        $cc_path =~ s~/src$~~i;
-
 
1749
        $cc_path =~ s~/cpp$~~i;
-
 
1750
        $cc_path =~ s~/MASS_Dev/Infra/~/MASS_Dev_Infra/~i;
-
 
1751
        $cc_path =~ s~/MASS_Dev/Tools/~/MASS_Dev_Tools/~i;
-
 
1752
        $cc_path =~ s~/MASS_Dev/Bus/~/MASS_Dev_Bus/~i;
-
 
1753
        $cc_path =~ s~/MASS_Dev_Bus/Cbp/~/MASS_Dev_Bus/CBP/~i;
-
 
1754
        $cc_path =~ s~/MREF_Package/ergpostmongui$~/MREF_Package/ergpostmongui~i;
-
 
1755
        $cc_path =~ s~/MREF_../MREF_Package/~/MREF_Package/~i;
-
 
1756
        $cc_path =~ s~/MREF_Package/mass_ergocdp/~/MREF_Package/ergocdp/~i;
-
 
1757
        $cc_path =~ s~/MASS_Dev_Bus/CBP/systemCD.ejb~/MASS_Dev_Bus/CBP/systemCD/ejb~i;
-
 
1758
        $cc_path =~ s~/MASS_Dev_Bus/Financial/cpp/paymentmanager~/MASS_Dev_Bus/Financial/cpp/paymentmanager~i;
-
 
1759
        $cc_path =~ s~/MASS_Dev_Bus/WebServices~/MASS_Dev_Bus/WebServices~i;
-
 
1760
        $cc_path =~ s~/MASS_Dev_Bus/CBP/nullAdapter~//MASS_Dev_Bus/CBP/nullAdaptor~i;
-
 
1761
 
-
 
1762
        $cc_path = '/MASS_Dev_Bus' if ( $cc_path =~ m~/MASS_Dev_Bus/ImageCapture(/|$)~i );
-
 
1763
        $cc_path = '/MASS_Dev_Bus/CBP/enquiry' if ( $versions{$entry}{name} eq 'EJBEnqPxyConnector');
-
 
1764
        $cc_path = '/MASS_Dev_Bus/CBP/enquiry' if ( $versions{$entry}{name} eq 'proxyif4j');
-
 
1765
        $cc_path = '/MASS_Dev_Bus' if ( $versions{$entry}{name} eq 'ImageCaptureTomcatDeployment');
-
 
1766
        $cc_path = '/MASS_Dev_Bus/WebServices/MassWS' if ( $versions{$entry}{name} eq 'MassWebServicesImpl');
-
 
1767
 
-
 
1768
        if (   $versions{$entry}{name} =~ m/^ERGagency$/i
-
 
1769
            || $versions{$entry}{name} =~ m/^ERGavm$/i
-
 
1770
            || $versions{$entry}{name} =~ m/^ERGboi$/i
-
 
1771
            || $versions{$entry}{name} =~ m/^ERGcallcenter$/i
-
 
1772
            || $versions{$entry}{name} =~ m/^ERGcardholder$/i
-
 
1773
            || $versions{$entry}{name} =~ m/^ERGcdaimports$/i
-
 
1774
            || $versions{$entry}{name} =~ m/^ERGcda$/i
-
 
1775
            || $versions{$entry}{name} =~ m/^ERGcscedit$/i
-
 
1776
            || $versions{$entry}{name} =~ m/^ERGcs$/i
-
 
1777
            || $versions{$entry}{name} =~ m/^ERGofs$/i
-
 
1778
            || $versions{$entry}{name} =~ m/^ERGols$/i
-
 
1779
            || $versions{$entry}{name} =~ m/^ERGtpf$/i
-
 
1780
            || $versions{$entry}{name} =~ m/^ERGorasys$/i
-
 
1781
            || $versions{$entry}{name} =~ m/^ERGoracs$/i
-
 
1782
            || $versions{$entry}{name} =~ m/^ERGpxyif$/i
-
 
1783
            || $versions{$entry}{name} =~ m/^ERGtp5upg$/i
-
 
1784
            || $versions{$entry}{name} =~ m/^ERGinstitutional$/i
-
 
1785
            || $versions{$entry}{name} =~ m/^ERGinfra$/i
-
 
1786
            || $versions{$entry}{name} =~ m/^ERGcrrpts$/i
-
 
1787
            || $versions{$entry}{name} =~ m/^ERGmiddle$/i
-
 
1788
            || $versions{$entry}{name} =~ m/^ERGmiddleapi$/i
-
 
1789
            || $versions{$entry}{name} =~ m/^ERGwebapi$/i
-
 
1790
            || $versions{$entry}{name} =~ m/^ERGwebtestui$/i
-
 
1791
            || $versions{$entry}{name} =~ m/^ERGwebesbui$/i
-
 
1792
            || $versions{$entry}{name} =~ m/^ERGwspiv$/i
-
 
1793
            || $versions{$entry}{name} =~ m/^ERGwscst$/i
-
 
1794
            || $versions{$entry}{name} =~ m/^sposMUG$/i
-
 
1795
            || $versions{$entry}{name} =~ m/^ERGfinman$/i
1793
        if ( $versions{$entry}{version} =~ m~vtk$~ )
1796
            || $versions{$entry}{name} =~ m/^ERGkm$/i
-
 
1797
            || $versions{$entry}{name} =~ m/^ERGxml$/i
-
 
1798
            || $versions{$entry}{name} =~ m/^ERGoradacw$/i
-
 
1799
            || $versions{$entry}{name} =~ m/^ERGtru$/i
-
 
1800
            )
1794
        {
1801
        {
1795
            $cc_path = '/MREF_Package';
1802
            $cc_path = '/MREF_Package';
1796
        }
1803
        }
1797
    }
-
 
1798
 
1804
 
-
 
1805
        if (   $versions{$entry}{name} =~ m/^tp5000_MUG$/i )
-
 
1806
        {
-
 
1807
            if ( $versions{$entry}{version} =~ m~vtk$~ )
-
 
1808
            {
-
 
1809
                $cc_path = '/MREF_Package';
-
 
1810
            }
-
 
1811
        }
-
 
1812
 
1799
    if ( $cc_path_original ne $cc_path )
1813
        if ( $cc_path_original ne $cc_path )
1800
    {
1814
        {
1801
            Message ("Package: $versions{$entry}{name}. Forcing CC path to: $cc_path" );
1815
                Message ("Package: $versions{$entry}{name}. Forcing CC path to: $cc_path" );
-
 
1816
        }
1802
    }
1817
    }
1803
    
1818
    
1804
#print "--- Path: $cc_path, Label: $cc_label\n";
1819
#print "--- Path: $cc_path, Label: $cc_label\n";
1805
 
1820
 
-
 
1821
    if ( $vcs_type eq 'SVN' )
1806
    #
1822
    {
-
 
1823
        $rv = extractFilesFromSubversion( $data, $entry );
-
 
1824
        return $rv if ( $rv );
-
 
1825
    }
-
 
1826
    else
-
 
1827
    {
-
 
1828
        #
1807
    #   Create CC view
1829
        #   Create CC view
1808
    #   Import into Subversion View
1830
        #   Import into Subversion View
1809
    #
1831
        #
1810
    $rv = extractFilesFromClearCase( $data, $cc_path, $cc_label );
1832
        $rv = extractFilesFromClearCase( $data, $cc_path, $cc_label );
1811
    return $rv if ( $rv );
1833
        return $rv if ( $rv );
-
 
1834
    }
1812
 
1835
 
1813
    #
1836
    #
1814
    #   Developers have been slack
1837
    #   Developers have been slack
1815
    #       Sometime the mark the source path as 'GMTPE2005'
1838
    #       Sometime the mark the source path as 'GMTPE2005'
1816
    #       Sometimes as 'GMTPE2005/Package/Fred/Jill/Harry'
1839
    #       Sometimes as 'GMTPE2005/Package/Fred/Jill/Harry'
Line 1829... Line 1852...
1829
        unless ( $data->{ViewPath} eq $testDir  )
1852
        unless ( $data->{ViewPath} eq $testDir  )
1830
        {
1853
        {
1831
            Message ("Adjust Base Dir: $testDir");
1854
            Message ("Adjust Base Dir: $testDir");
1832
            $data->{adjustedPath} = $data->{ViewPath};
1855
            $data->{adjustedPath} = $data->{ViewPath};
1833
            $data->{ViewPath} = $testDir;
1856
            $data->{ViewPath} = $testDir;
-
 
1857
            $adjustedPath++;
1834
        }
1858
        }
1835
    }
1859
    }
1836
    Message ("BaseDir: $data->{ViewPath}");
1860
    Message ("BaseDir: $data->{ViewPath}");
-
 
1861
 
1837
    
1862
    #
-
 
1863
    #   Check for bad source paths
-
 
1864
    #
-
 
1865
    if (detectBadMakePaths($data) )
-
 
1866
    {
-
 
1867
        unless ( $opt_ignoreBadPaths )
-
 
1868
        {
-
 
1869
            $data->{BadPath}++;
-
 
1870
            $data->{errStr} = 'Bad Paths in Makefile';
-
 
1871
            return 4;           # Lets see what the others look like too
-
 
1872
#            return 14;
-
 
1873
        }
-
 
1874
    }
-
 
1875
 
1838
    #
1876
    #
1839
    #   Some really ugly packages make use of a Jats feature called 'SetProjectBase'
1877
    #   Some really ugly packages make use of a Jats feature called 'SetProjectBase'
1840
    #   Detect such packages as we will need to handle them differently
1878
    #   Detect such packages as we will need to handle them differently
1841
    #   Can't really handle it on the fly
1879
    #   Can't really handle it on the fly
1842
    #   All we can do is detect it and report it - at the moment
1880
    #   All we can do is detect it and report it - at the moment
Line 1861... Line 1899...
1861
    #       Vob Name is not a part of the migration
1899
    #       Vob Name is not a part of the migration
1862
    #       If we 'SuckUp' empty directories then this may break
1900
    #       If we 'SuckUp' empty directories then this may break
1863
    #       the pathing.
1901
    #       the pathing.
1864
    #   All we can do is detect it and report it - at the moment
1902
    #   All we can do is detect it and report it - at the moment
1865
    #
1903
    #
1866
    if (detectMakeProjectUsage($data, $cc_path) )
1904
    if (detectMakeProjectUsage($data) )
1867
    {
1905
    {
1868
        unless ( $opt_ignoreMakeProjectErrors )
1906
        unless ( $opt_ignoreMakeProjectErrors )
1869
        {
1907
        {
1870
            $data->{BadMakeProject}++;
1908
            $data->{BadMakeProject}++;
1871
            $data->{errStr} = 'Use of MakeProject detected';
1909
            $data->{errStr} = 'Use of MakeProject detected';
Line 1909... Line 1947...
1909
    #   Now we can create the SVN package and branching point before we
1947
    #   Now we can create the SVN package and branching point before we
1910
    #   import the CC data into SVN
1948
    #   import the CC data into SVN
1911
    #
1949
    #
1912
    if ( !$opt_useSvn )
1950
    if ( !$opt_useSvn )
1913
    {
1951
    {
1914
            $data->{errStr} = 'Subversion Import disabled';
1952
            $data->{errStr} = 'Subversion Import disabled' unless $data->{errStr};
1915
            return 5;
1953
            return 5;
1916
    }
1954
    }
1917
 
1955
 
1918
    my @args;
1956
    my @args;
1919
 
1957
 
Line 2337... Line 2375...
2337
#
2375
#
2338
sub endPackage
2376
sub endPackage
2339
{
2377
{
2340
    Message ("-- Import Summary ------------------------------------------------" );
2378
    Message ("-- Import Summary ------------------------------------------------" );
2341
    RmDirTree ('SvnImportDir');
2379
    RmDirTree ('SvnImportDir');
-
 
2380
    my $processedCount = 0;
-
 
2381
    my $inernalErrorCount = 0;
-
 
2382
    my $notProcessedCount = 0;
-
 
2383
    my $badPathCount = 0;
-
 
2384
    my $badProjectBaseCount = 0;
-
 
2385
    my $badMakeProjectCount = 0;
2342
 
2386
 
2343
    #
2387
    #
2344
    #   Display versions that did get captured
2388
    #   Display versions that did get captured
2345
    #
2389
    #
2346
    foreach my $entry ( @processOrder )
2390
    foreach my $entry ( @processOrder )
Line 2354... Line 2398...
2354
    #   Display versions that did not get created
2398
    #   Display versions that did not get created
2355
    #
2399
    #
2356
    foreach my $entry ( @processOrder )
2400
    foreach my $entry ( @processOrder )
2357
    {
2401
    {
2358
        $versions{$entry}{Scanned} = 1;
2402
        $versions{$entry}{Scanned} = 1;
2359
        next if ( $versions{$entry}{TagCreated} );
2403
        if ( $versions{$entry}{TagCreated} )
-
 
2404
        {
-
 
2405
            $processedCount++;
-
 
2406
            $badPathCount++ if ($versions{$entry}{data}{BadPath} );
-
 
2407
            $badProjectBaseCount++ if ($versions{$entry}{data}{BadProjectBase} );
-
 
2408
            $badMakeProjectCount++ if ($versions{$entry}{data}{BadMakeProject} );
-
 
2409
            next;
-
 
2410
        }
-
 
2411
 
2360
        my $reason = $versions{$entry}{data}{errStr} || '';
2412
        my $reason = $versions{$entry}{data}{errStr} || '';
2361
        my $tag = $versions{$entry}{vcsTag}|| 'No Tag';
2413
        my $tag = $versions{$entry}{vcsTag}|| 'No Tag';
2362
        Warning ("Not Processed: " . GetVname($entry) . ':' . $tag . ' : ' . $reason );
2414
        Warning ("Not Processed: " . GetVname($entry) . ':' . $tag . ' : ' . $reason );
-
 
2415
        $notProcessedCount++;
2363
    }
2416
    }
2364
 
2417
 
2365
    foreach my $entry ( keys(%versions) )
2418
    foreach my $entry ( keys(%versions) )
2366
    {
2419
    {
2367
        next if ( $versions{$entry}{Scanned} );
2420
        next if ( $versions{$entry}{Scanned} );
2368
        Warning ("(E) INTERNAL ERROR. Package Not Processed: " . GetVname($entry) );
2421
        Warning ("(E) INTERNAL ERROR. Package Not Processed: " . GetVname($entry) );
-
 
2422
        $inernalErrorCount++;
2369
    }
2423
    }
2370
 
2424
 
-
 
2425
    if ( $adjustedPath || 1 )
-
 
2426
    {
-
 
2427
        Information ("Package Paths");
-
 
2428
        foreach my $entry ( @processOrder )
-
 
2429
        {
-
 
2430
            my $viewPath = $versions{$entry}{data}{ViewPath} || '';
-
 
2431
            Information (sprintf "ViewPath: %20s : %s", GetVname($entry), $viewPath);
-
 
2432
        }
-
 
2433
    }
-
 
2434
 
-
 
2435
    Message ("Packages processed: $processedCount");
-
 
2436
    Warning ("Packages not processed: $notProcessedCount") if ( $notProcessedCount );
-
 
2437
    Warning ("Internal Errors: $inernalErrorCount") if ( $inernalErrorCount );
2371
    Message ("Packages Relabled: $packageReLabelCount") if ( $packageReLabelCount );
2438
    Message ("Packages Relabled: $packageReLabelCount") if ( $packageReLabelCount );
-
 
2439
    Warning ("Packages with Bad Paths: $badPathCount") if ( $badPathCount );
-
 
2440
    Warning ("Packages with Bad ProjectBase: $badProjectBaseCount") if ( $badProjectBaseCount );
-
 
2441
    Warning ("Packages with MakeProjects: $badMakeProjectCount") if ( $badMakeProjectCount );
-
 
2442
    Warning ("Global Error Detected") if ( $globalError );
2372
    Message ("All Done");
2443
    Message ("All Done");
2373
}
2444
}
2374
 
2445
 
2375
#-------------------------------------------------------------------------------
2446
#-------------------------------------------------------------------------------
2376
# Function        : extractFilesFromClearCase
2447
# Function        : extractFilesFromClearCase
Line 2482... Line 2553...
2482
    return 2;
2553
    return 2;
2483
 
2554
 
2484
}
2555
}
2485
 
2556
 
2486
#-------------------------------------------------------------------------------
2557
#-------------------------------------------------------------------------------
-
 
2558
# Function        : extractFilesFromSubversion
-
 
2559
#
-
 
2560
# Description     : Extract files from Subversion
-
 
2561
#                   May take a while as we handle nasty errors
-
 
2562
#
-
 
2563
# Inputs          : $data           - Hash of good stuff from newPackageVersionBody
-
 
2564
#                   $entry          - All the PV information
-
 
2565
#
-
 
2566
# Returns         : exit code
-
 
2567
#                   Sets up
-
 
2568
#                       $data->{errStr}
-
 
2569
#                       $data->{errCode}
-
 
2570
#                   As per newPackageVersionBody
-
 
2571
#
-
 
2572
sub extractFilesFromSubversion
-
 
2573
{
-
 
2574
    my ($data, $entry ) = @_;
-
 
2575
    my $tryCount = 0;
-
 
2576
    my $rv = 99;
-
 
2577
 
-
 
2578
    #
-
 
2579
    #   Create a nice name for the import
-
 
2580
    #
-
 
2581
    my $import_label = saneLabel($entry);
-
 
2582
    
-
 
2583
 
-
 
2584
    $data->{ViewRoot} = $opt_name ? $opt_name : $import_label;
-
 
2585
    $data->{ViewPath} =  $data->{ViewRoot};
-
 
2586
    $data->{ViewPath} =~  tr~/~/~s;
-
 
2587
 
-
 
2588
    if ( $opt_reuse && -d $data->{ViewPath}  )
-
 
2589
    {
-
 
2590
        Message ("Reusing view: $import_label");
-
 
2591
        return 0;
-
 
2592
    }
-
 
2593
 
-
 
2594
    #
-
 
2595
    #   Only allow import from SVN if asked nicely
-
 
2596
    #   May be used if we are correcting a package - and some have been
-
 
2597
    #   placed in SVN
-
 
2598
    #
-
 
2599
    unless ( $opt_extractFromSvn )
-
 
2600
    {
-
 
2601
        $data->{errStr} = 'Some Packages are in SVN';
-
 
2602
        return 15;
-
 
2603
    }
-
 
2604
    
-
 
2605
 
-
 
2606
#print "--- ViewRoot: $data->{ViewPath}\n";
-
 
2607
    $rv = JatsToolPrint ( 'jats_svnrelease',
-
 
2608
                          '-extractfiles',
-
 
2609
                          '-root=.' ,
-
 
2610
                          '-noprefix',
-
 
2611
                          '-DevMode=escrow',
-
 
2612
                          '-label', $data->{tag},
-
 
2613
                          '-view', $data->{ViewPath},
-
 
2614
                );
-
 
2615
 
-
 
2616
    if ( $rv == 10 ) {
-
 
2617
        $data->{errStr}  = 'No Files in the extracted view';
-
 
2618
        $data->{errCode} = '0';
-
 
2619
        return 2;
-
 
2620
 
-
 
2621
    } elsif ( $rv == 11 ) {
-
 
2622
        $data->{errStr} = 'Label not found';
-
 
2623
        $data->{errCode} = 'L';
-
 
2624
        return 2;
-
 
2625
    } elsif ( $rv ) {
-
 
2626
        $data->{errStr} = 'Subversion reported error';
-
 
2627
        return 2;
-
 
2628
    }
-
 
2629
 
-
 
2630
    unless ( -d $data->{ViewPath}  )
-
 
2631
    {
-
 
2632
        $data->{errStr} = 'Failed to extract files from Subversion';
-
 
2633
        return 2;
-
 
2634
    }
-
 
2635
 
-
 
2636
    #
-
 
2637
    #   Looks good
-
 
2638
    #
-
 
2639
    return 0;
-
 
2640
}
-
 
2641
 
-
 
2642
#-------------------------------------------------------------------------------
2487
# Function        : detectMakeProjectUsage
2643
# Function        : detectMakeProjectUsage
2488
#
2644
#
2489
# Description     : etect and report usage of the MakeProject directive
2645
# Description     : etect and report usage of the MakeProject directive
2490
#
2646
#
2491
# Inputs          : $data               - Ref to a hash of bits
2647
# Inputs          : $data               - Ref to a hash of bits
2492
#                   $cc_path            - Packages cc_path
-
 
2493
#
2648
#
2494
# Returns         : true    - Bad usage (Really good usage not detected)
2649
# Returns         : true    - Bad usage (Really good usage not detected)
2495
#                   false   - Good usage detected
2650
#                   false   - Good usage detected
2496
#
2651
#
2497
sub detectMakeProjectUsage
2652
sub detectMakeProjectUsage
2498
{
2653
{
2499
    my ($data, $cc_path) = @_;
2654
    my ($data) = @_;
2500
    my $retval = 0;
2655
    my $retval = 0;
2501
    my $eSuf = $opt_ignoreMakeProjectErrors ? '' : 'Error';
2656
    my $eSuf = $opt_ignoreMakeProjectErrors ? '' : 'Error';
2502
 
2657
 
2503
    #
2658
    #
2504
    #   Find makefile.pl
2659
    #   Find makefile.pl
2505
    #
2660
    #
2506
    Message ("Locate JATS makefiles");
2661
    Message ("Detect MakeProject Usage");
2507
    my $usesMakeProject = 0;
2662
    my $usesMakeProject = 0;
2508
    my $badIncludeFile = 0;
2663
    my $badIncludeFile = 0;
2509
 
2664
 
2510
    my $search = JatsLocateFiles->new("--Recurse=1",
2665
    my $search = JatsLocateFiles->new("--Recurse=1",
2511
                                       "--FilterIn=makefile.pl",
2666
                                       "--FilterIn=makefile.pl",
Line 2566... Line 2721...
2566
                        $myProjectDir = $myProject;
2721
                        $myProjectDir = $myProject;
2567
                        $myProjectDir =~ s~/[^/]+$~~;
2722
                        $myProjectDir =~ s~/[^/]+$~~;
2568
                        last;
2723
                        last;
2569
                    }
2724
                    }
2570
                    Error ("No project Found") unless ( defined $myProjectDir);
2725
                    Error ("No project Found") unless ( defined $myProjectDir);
-
 
2726
 
-
 
2727
                    #
-
 
2728
                    #   Look for 'include.txt' that may be bwteen the makefile and the project
-
 
2729
                    #
-
 
2730
 
-
 
2731
 
2571
                    if ( -f "$myProjectDir/include.txt" )
2732
                    if ( -f "$myProjectDir/include.txt" )
2572
                    {
2733
                    {
2573
                        Warning ("Co-located 'include.txt' file also found");
2734
                        Warning ("Co-located 'include.txt' file also found");
2574
                    }
2735
                    }
2575
 
2736
 
Line 2673... Line 2834...
2673
    
2834
    
2674
    return $retval;
2835
    return $retval;
2675
}
2836
}
2676
 
2837
 
2677
#-------------------------------------------------------------------------------
2838
#-------------------------------------------------------------------------------
-
 
2839
# Function        : detectBadMakePaths
-
 
2840
#
-
 
2841
# Description     : Detect and report bad usage of some directives
-
 
2842
#
-
 
2843
# Inputs          : $data               - Ref to a hash of bits
-
 
2844
#
-
 
2845
# Returns         : true    - Bad usage (Really good usage not detected)
-
 
2846
#                   false   - Good usage detected
-
 
2847
#
-
 
2848
sub detectBadMakePaths
-
 
2849
{
-
 
2850
    my ($data) = @_;
-
 
2851
    my $retval = 0;
-
 
2852
    my $eSuf = $opt_ignoreBadPaths ? '' : 'Error';
-
 
2853
 
-
 
2854
    #
-
 
2855
    #   Find makefile.pl
-
 
2856
    #
-
 
2857
    Message ("Detect Bad Source Paths");
-
 
2858
    my $badPath = 0;
-
 
2859
 
-
 
2860
    my $search = JatsLocateFiles->new("--Recurse=1",
-
 
2861
                                       "--FilterIn=makefile.pl",
-
 
2862
                                       );
-
 
2863
    my @makefiles = $search->search($data->{ViewPath});
-
 
2864
    foreach my $file ( @makefiles )
-
 
2865
    {
-
 
2866
        $file =~ tr~/~/~s;
-
 
2867
        my $max_up = ($file =~ tr~/~/~);
-
 
2868
        my $shownPath;
-
 
2869
#print "---Reading: $workDir/$data->{ViewPath}/$file\n";
-
 
2870
        if ( open( my $fh, '<', "$data->{ViewPath}/$file" ) )
-
 
2871
        {
-
 
2872
            my $eof = 0;
-
 
2873
            my $line = '';
-
 
2874
 
-
 
2875
            until ( $eof )
-
 
2876
            {
-
 
2877
                my $in = <$fh>;
-
 
2878
                unless ( defined $in )
-
 
2879
                {
-
 
2880
                    $eof = 1;
-
 
2881
                }
-
 
2882
                else
-
 
2883
                {
-
 
2884
                $in =~ s~\s+$~~;
-
 
2885
                $in =~ s~^\s+~~;
-
 
2886
                $in =~ s~^#.*$~~;
-
 
2887
                $in =~ s~\s*[^\$]#.*$~~;
-
 
2888
                $line .= ' ' if ( $line );
-
 
2889
                $line .= $in;
-
 
2890
                $line =~ s~\s+~ ~g;
-
 
2891
#print "====== '$line'\n";
-
 
2892
                redo unless ( $line =~ m~;$~  );
-
 
2893
                }
-
 
2894
                if ( $line =~ m~^AddDir~ || $line =~ m~^AddSrcDir~ || $line =~ m~^AddIncDir~ || $line =~ m~^Src~ )
-
 
2895
                {
-
 
2896
                    #
-
 
2897
                    #   Extract out the arguments
-
 
2898
                    #
-
 
2899
                    my @myArgs;
-
 
2900
                    my $myProjectDir;
-
 
2901
                    my $myProject = "$data->{ViewRoot}/$file";
-
 
2902
                    $myProject =~ s~/[^/]+$~~;
-
 
2903
                    $line =~ s~.*\(~push \@myArgs, (~;
-
 
2904
                    eval $line;
-
 
2905
                    Error("Line did not compiler: $line", "Err: $@" ) if ($@);
-
 
2906
                    shift @myArgs;
-
 
2907
                    foreach ( @myArgs )
-
 
2908
                    {
-
 
2909
                        next if ( m~^--~ );
-
 
2910
                        next unless ( m~^\.\./~ );
-
 
2911
                        my $tmp = $_;
-
 
2912
                        $tmp =~ s~Z~z~g;
-
 
2913
                        $tmp =~ s~\.\./~Z~g;
-
 
2914
                        my $upCount = ( $tmp =~ tr~Z~Z~ );
-
 
2915
                        if ( $upCount > $max_up )
-
 
2916
                        {
-
 
2917
                            Warning ("Makefile Path: $file ") unless $shownPath;
-
 
2918
                            Warning ("Path escapes view: $max_up, $upCount, $_");
-
 
2919
                            $badPath++;
-
 
2920
                            $shownPath = 1;
-
 
2921
                        }
-
 
2922
#print "---x Path : $max_up, $upCount, $_\n";
-
 
2923
                    }
-
 
2924
                }
-
 
2925
                $line = '';
-
 
2926
            }
-
 
2927
            close $fh;
-
 
2928
        }
-
 
2929
        else
-
 
2930
        {
-
 
2931
            Warning ("detectBadMakePaths$eSuf - Cannot open makefile: $file");
-
 
2932
            $retval = 1;
-
 
2933
        }
-
 
2934
    }
-
 
2935
 
-
 
2936
    #
-
 
2937
    #   Used
-
 
2938
    #   May be improved latter
-
 
2939
    #
-
 
2940
    if ( $badPath )
-
 
2941
    {
-
 
2942
        Warning ("detectBadMakePaths$eSuf - Bad Path seen. Must check manually");
-
 
2943
        $retval = 1;
-
 
2944
    }
-
 
2945
    
-
 
2946
    return $retval;
-
 
2947
}
-
 
2948
 
-
 
2949
 
-
 
2950
#-------------------------------------------------------------------------------
2678
# Function        : detectProjectBaseUsage
2951
# Function        : detectProjectBaseUsage
2679
#
2952
#
2680
# Description     : Detect and report usage of the SetProjectBase directive
2953
# Description     : Detect and report usage of the SetProjectBase directive
2681
#
2954
#
2682
# Inputs          : $data               - Ref to a hash of bits
2955
# Inputs          : $data               - Ref to a hash of bits
Line 2691... Line 2964...
2691
    my $eSuf = $opt_ignoreProjectBaseErrors ? '' : 'Error';
2964
    my $eSuf = $opt_ignoreProjectBaseErrors ? '' : 'Error';
2692
 
2965
 
2693
    #
2966
    #
2694
    #   Find makefile.pl
2967
    #   Find makefile.pl
2695
    #
2968
    #
2696
    Message ("Locate JATS makefiles");
2969
    Message ("Detect ProjectBase Usage");
2697
    my $usesProjectBase = 0;
2970
    my $usesProjectBase = 0;
2698
    my $definesProjectBase = 0;
2971
    my $definesProjectBase = 0;
2699
    my $definitionError = 0;
2972
    my $definitionError = 0;
2700
 
2973
 
2701
    my $search = JatsLocateFiles->new("--Recurse=1",
2974
    my $search = JatsLocateFiles->new("--Recurse=1",
Line 4334... Line 4607...
4334
    -[no]postimage     - Create image after transger: Def: -post
4607
    -[no]postimage     - Create image after transger: Def: -post
4335
    -workdir=path      - Use for temp storage (def:/work)
4608
    -workdir=path      - Use for temp storage (def:/work)
4336
    -delete            - Delete SVN package before test
4609
    -delete            - Delete SVN package before test
4337
    -[no]relabel       - Attempt to relabel dirs in packages that don't extract
4610
    -[no]relabel       - Attempt to relabel dirs in packages that don't extract
4338
    -testRmDatabase    - Use test database
4611
    -testRmDatabase    - Use test database
-
 
4612
    -[no]fromSvn       - Also extract packages from SVN
4339
 
4613
 
4340
=head1 OPTIONS
4614
=head1 OPTIONS
4341
 
4615
 
4342
=over 8
4616
=over 8
4343
 
4617