Ignore:
Timestamp:
Feb 10, 2008, 7:31:25 PM (12 years ago)
Author:
bruno
Message:

pb_cms_export ready to host the real stuff for file.

File:
1 edited

Legend:

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

    r318 r319  
    6767        pb_log(0,"WARNING: using $proj as default project as none has been specified\n");
    6868        pb_log(0,"         Please either create a pbconf reference for project $proj in $ENV{'PBETC'}\n");
    69         pb_log(0,"         or call pb with the -p project option if you want to use another project\n");
     69        pb_log(0,"         or call pb with the -p project option or use the env var PBPROJ\n");
     70        pb_log(0,"         if you want to use another project\n");
    7071    }
    7172}
     
    9394#  ---------------------------------------------                ----------
    9495#  *      *        |       |        |          |                *        *
    95 # 1.0    dev    pbconf    ...     build     delivery PBCONF    1.0      dev                   PBDEVROOT
    96 #                  |                           |     PBDESTDIR
    97 #               ------                        pbrc   PBBUILDDIR
    98 #               |    |       
    99 #              1.0  dev                              PBROOT
     96# 1.0    dev    pbconf    ...     build     delivery PBCONF    dev      tag                   PBDEVROOT
     97#                  |                           |     PBDESTDIR           |
     98#               ------                        pbrc   PBBUILDDIR       -------
     99#               |    |                                                |     |
     100#              dev  tag                              PBROOT          1.0   1.1
    100101#                    |
     102#                 -------
     103#                 |     |
     104#                1.0   1.1
     105#                       |
    101106#               ----------------------------------
    102107#               |          |           |         |
     
    307312#pbproj $ENV{'PBPROJ'} = ftp://ftp.$ENV{'PBPROJ'}.org/src/$ENV{'PBPROJ'}-devel.tar.gz
    308313#pbproj $ENV{'PBPROJ'} = file:///src/$ENV{'PBPROJ'}-devel.tar.gz
     314#pbproj $ENV{'PBPROJ'} = dir:///src/$ENV{'PBPROJ'}-devel
    309315
    310316#
     
    375381            print CONF << "EOF";
    376382# Hash of default package/package directory
    377 #defpkgdir pkg1 = pkg1dir
     383#defpkgdir $pp = dir-$pp
    378384EOF
    379385        }
     
    381387        print CONF << "EOF";
    382388# Hash of additional package/package directory
    383 #extpkgdir minor-pkg = minor-pkg-dir
     389#extpkgdir minor-pkg = dir-minor-pkg
    384390
    385391# List of files per pkg on which to apply filters
     
    818824my $cmt=shift || $cmd;
    819825
    820 pb_log(2,"$cmt... ");
     826pb_log(0,"$cmt... ");
    821827#system("$cmd 2>&1 > $ENV{'PBTMP'}/system.log");
    822828system($cmd);
    823829if ($? == -1) {
    824     pb_log(2,"failed to execute ($cmd) : $!\n");
     830    pb_log(0,"failed to execute ($cmd) : $!\n");
    825831    pb_display_file("$ENV{'PBTMP'}/system.log");
    826832} elsif ($? & 127) {
    827     pb_log(2, "child ($cmd) died with signal ".($? & 127).", ".($? & 128) ? 'with' : 'without'." coredump\n");
     833    pb_log(0, "child ($cmd) died with signal ".($? & 127).", ".($? & 128) ? 'with' : 'without'." coredump\n");
    828834    pb_display_file("$ENV{'PBTMP'}/system.log");
    829835} elsif ($? == 0) {
    830     pb_log(2,"OK\n");
     836    pb_log(0,"OK\n");
    831837} else {
    832     pb_log(2, "child ($cmd) exited with value ".($? >> 8)."\n");
     838    pb_log(0, "child ($cmd) exited with value ".($? >> 8)."\n");
    833839    pb_display_file("$ENV{'PBTMP'}/system.log");
    834840}
     
    10341040sub pb_cms_export {
    10351041
    1036 my $scheme = shift;
     1042my $uri = shift;
    10371043my $source = shift;
    10381044my $destdir = shift;
     
    10411047
    10421048my @date = pb_get_date();
     1049# If it's not flat, then we have a real uri as source
     1050my ($scheme, $account, $host, $port, $path) = pb_get_uri($uri);
    10431051
    10441052if ($scheme eq "svn") {
     
    10491057    }
    10501058    pb_system("svn export $source $tmp","Exporting $source from SVN to $tmp");
    1051 } elsif ($scheme eq "flat") {
     1059} elsif ($scheme eq "dir") {
    10521060    if (-d $source) {
    10531061        $tmp = $destdir;
     
    10561064    }
    10571065    pb_system("cp -a $source $tmp","Exporting $source from DIR to $tmp");
     1066} elsif (($scheme eq "http") || ($scheme eq "ftp")) {
     1067    my $f = basename($path);
     1068    unlink "$ENV{'PBTMP'}/$f";
     1069    if (-x "/usr/bin/wget") {
     1070        pb_system("/usr/bin/wget -nv -O $ENV{'PBTMP'}/$f $uri","Downloading $uri with wget to $ENV{'PBTMP'}/$f\n");
     1071    } elsif (-x "/usr/bin/curl") {
     1072        pb_system("/usr/bin/curl $uri -o $ENV{'PBTMP'}/$f","Downloading $uri with curl to $ENV{'PBTMP'}/$f\n");
     1073    } else {
     1074        die "Unable to download $uri.\nNo wget/curl available, please install one of those";
     1075    }
     1076    pb_cms_export("file://$ENV{'PBTMP'}/$f",$source,$destdir);
     1077} elsif ($scheme eq "file") {
     1078    use File::MimeInfo;
     1079    my $mm = mimetype($path);
     1080    pb_log(2,"mimetype: $mm\n");
     1081
     1082    if ($mm =~ /\/x-bzip-compressed-tar$/) {
     1083        # tar+bzip2
     1084    } elsif ($mm =~ /\/x-lzma-compressed-tar$/) {
     1085        # tar+lzma
     1086    } elsif ($mm =~ /\/x-compressed-tar$/) {
     1087        # tar+gzip
     1088    } elsif ($mm =~ /\/x-tar$/) {
     1089        # tar
     1090    } elsif ($mm =~ /\/zip$/) {
     1091        # zip
     1092    }
     1093    pb_log(0,"scheme file not implemented yet\n");
    10581094} elsif ($scheme eq "cvs") {
    10591095    my $dir=dirname($destdir);
Note: See TracChangeset for help on using the changeset viewer.