Changeset 500 in ProjectBuilder for devel/pb/lib/ProjectBuilder/CMS.pm


Ignore:
Timestamp:
Aug 3, 2008, 1:20:30 PM (16 years ago)
Author:
Bruno Cornec
Message:
  • Working patch support added to pb (tested with buffer)
  • Filtering functions now handle also pointer on hashes (such as the new pb hash)
  • Filtering functions support new macro for patch support (PBPATCHSRC and PBPATCHCMD)
  • Env.pm now generates correct templates for patch support and uses the new pb hash
  • pb_cms_export extended to support file:// URI, and also supports an undef second param (no local export available)
  • In pb, hashes now include also the arch (for better patch support)
  • pb supports local CMS based patches, as well as external references (not tested yet)
  • New pb_get_arch function provided
  • New parameters for pb_system (mayfail and quiet)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/lib/ProjectBuilder/CMS.pm

    r452 r500  
    1616use English;
    1717use File::Basename;
     18use File::Copy;
    1819use POSIX qw(strftime);
    1920use lib qw (lib);
     
    109110This function exports a CMS content to a directory.
    110111The first parameter is the URL of the CMS content.
    111 The second parameter is the directory in which it is locally exposed (result of a checkout).
     112The second parameter is the directory in which it is locally exposed (result of a checkout). If undef, then use the original CMS content.
    112113The third parameter is the directory where we want to deliver it (result of export).
    113114
     
    127128
    128129if ($scheme =~ /^svn/) {
    129     if (-d $source) {
    130         $tmp = $destdir;
    131     } else {
    132         $tmp = "$destdir/".basename($source);
    133     }
    134     pb_system("svn export $source $tmp","Exporting $source from SVN to $tmp");
     130    if (defined $source) {
     131        if (-d $source) {
     132            $tmp = $destdir;
     133        } else {
     134            $tmp = "$destdir/".basename($source);
     135        }
     136        pb_system("svn export $source $tmp","Exporting $source from SVN to $tmp");
     137    } else {
     138        pb_system("svn export $uri $destdir","Exporting $uri from SVN to $destdir");
     139    }
    135140} elsif ($scheme eq "dir") {
    136141    pb_system("cp -a $path $destdir","Copying $uri from DIR to $destdir");
     
    152157    pb_mkdir_p($destdir);
    153158
    154     # Check whether the file is well formed
    155     # (containing already a directory with the project-version name)
    156     my ($pbwf) = pb_conf_get_if("pbwf");
    157     if ((defined $pbwf) && (defined $pbwf->{$ENV{'PBPROJ'}})) {
    158         $destdir = dirname($destdir);
     159    if (defined $source) {
     160        # Check whether the file is well formed
     161        # (containing already a directory with the project-version name)
     162        my ($pbwf) = pb_conf_get_if("pbwf");
     163        if ((defined $pbwf) && (defined $pbwf->{$ENV{'PBPROJ'}})) {
     164            $destdir = dirname($destdir);
     165        }
    159166    }
    160167
     
    174181        # zip
    175182        pb_system("cd $destdir ; unzip $path","Extracting $path in $destdir");
     183    } else {
     184        # simple file: copy it (patch e.g.)
     185        copy($path,$destdir);
    176186    }
    177187} elsif ($scheme =~ /^cvs/) {
     
    179189    my $dir=dirname($destdir);
    180190    my $base=basename($destdir);
    181     # CVS also needs a modules name not a dir
    182     #if (-d $source) {
     191    if (defined $source) {
     192        # CVS also needs a modules name not a dir
    183193        $tmp1 = basename($source);
    184         #} else {
    185         #$tmp1 = dirname($source);
    186         #$tmp1 = basename($tmp1);
    187         #}
     194    } else {
     195        # Probably not right, should be checked, but that way I'll notice it :-)
     196        $tmp1 = $uri;
     197    }
    188198    my $optcvs = "";
    189199
     
    304314} elsif ($scheme =~ /^cvs/) {
    305315    pb_system("cvs co $url $destination","Checking out $url to $destination ");
     316} elsif ($scheme =~ /^file/) {
     317    pb_cms_export($url,undef,$destination);
    306318} else {
    307319    die "cms $scheme unknown";
     
    417429}
    418430
    419 =item B<pb_cms_isdiff>
     431=item B<pb_cms_getpkg>
    420432
    421433This function returns the list of packages we are working on in a CMS action.
Note: See TracChangeset for help on using the changeset viewer.