- Timestamp:
- Sep 6, 2017, 9:08:46 PM (7 years ago)
- Location:
- devel/pb
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb/bin/pb
r2303 r2312 1181 1181 } 1182 1182 1183 my ($scheme, $uri) = pb_ cms_init($pbinit,$param);1183 my ($scheme, $uri) = pb_vcs_init($pbinit,$param); 1184 1184 1185 1185 # We need 2 lines here … … 3538 3538 3539 3539 # Need this call for PBDIR 3540 my ($scheme2,$uri) = pb_ cms_init($pbinit);3540 my ($scheme2,$uri) = pb_vcs_init($pbinit); 3541 3541 3542 3542 my ($pbconf,$pbprojurl) = pb_conf_get("pbconfurl","pbprojurl"); … … 4300 4300 my $chglog; 4301 4301 4302 pb_ cms_init($pbinit);4302 pb_vcs_init($pbinit); 4303 4303 # Get project info on log file and generate tmp files used later on 4304 4304 $chglog = "$ENV{'PBROOTDIR'}/$pbpkg/pbcl"; -
devel/pb/lib/ProjectBuilder/CMS.pm
r2300 r2312 35 35 36 36 our @ISA = qw(Exporter); 37 our @EXPORT = qw(pb_cms_ init pb_cms_get_pkg pb_cms_get_real_pkg pb_cms_log);37 our @EXPORT = qw(pb_cms_get_pkg pb_cms_get_real_pkg pb_cms_log); 38 38 ($VERSION,$REVISION) = pb_version_init(); 39 39 … … 51 51 52 52 =over 4 53 54 =item B<pb_cms_init>55 56 This function setup the environment for the CMS system related to the URL given by the pbprojurl configuration parameter.57 The potential parameter indicates whether we should inititate the context or not.58 It sets up environement variables (PBPROJDIR, PBDIR, PBREVISION, PBCMSLOGFILE)59 60 =cut61 62 sub pb_cms_init {63 64 my $pbinit = shift;65 my $param = shift;66 67 my ($pbprojurl) = pb_conf_get("pbprojurl");68 confess "Undefined pbprojurl for $ENV{'PBPROJ'}\n" if ((not defined $pbprojurl) or (not defined $pbprojurl->{$ENV{'PBPROJ'}}));69 pb_log(2,"DEBUG: Project URL of $ENV{'PBPROJ'}: $pbprojurl->{$ENV{'PBPROJ'}}\n");70 my ($scheme, $account, $host, $port, $path) = pb_get_uri($pbprojurl->{$ENV{'PBPROJ'}});71 my $vcscmd = pb_vcs_cmd($scheme);72 73 my ($pbprojdir) = pb_conf_get_if("pbprojdir");74 75 if ((defined $pbprojdir) && (defined $pbprojdir->{$ENV{'PBPROJ'}})) {76 $ENV{'PBPROJDIR'} = $pbprojdir->{$ENV{'PBPROJ'}};77 } else {78 $ENV{'PBPROJDIR'} = "$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}";79 }80 # Expand potential env variable in it to allow string replacement81 eval { $ENV{'PBPROJDIR'} =~ s/(\$ENV.+\})/$1/eeg };82 83 84 # Computing the default dir for PBDIR.85 # what we have is PBPROJDIR so work from that.86 # Tree identical between PBCONFDIR and PBROOTDIR on one side and87 # PBPROJDIR and PBDIR on the other side.88 89 my $tmp = $ENV{'PBROOTDIR'};90 $tmp =~ s|^$ENV{'PBCONFDIR'}/||;91 # If no subdir, then replace again92 $tmp =~ s|^$ENV{'PBCONFDIR'}||;93 94 #95 # Check project cms compliance96 #97 my $turl = "$pbprojurl->{$ENV{'PBPROJ'}}/$tmp";98 $turl = $pbprojurl->{$ENV{'PBPROJ'}} if ($scheme =~ /^(flat)|(ftp)|(http)|(https)|(file)|(git)\b/o);99 # git svn is like svn100 $turl = "$pbprojurl->{$ENV{'PBPROJ'}}/$tmp" if ($scheme =~ /^git\+svn/o);101 pb_vcs_compliant(undef,'PBDIR',"$ENV{'PBPROJDIR'}/$tmp",$turl,$pbinit);102 103 104 if ($scheme =~ /^hg/) {105 $tmp = `(cd "$ENV{'PBDIR'}" ; $vcscmd identify )`;106 chomp($tmp);107 $tmp =~ s/^.* //;108 $ENV{'PBREVISION'}=$tmp;109 $ENV{'PBCMSLOGFILE'}="hg.log";110 } elsif ($scheme =~ /^git/) {111 if ($scheme =~ /svn/) {112 $tmp = `(cd "$ENV{'PBDIR'}" ; LANGUAGE=C $vcscmd info | grep -E '^Revision:' | cut -d: -f2)`;113 $tmp =~ s/\s+//;114 } else {115 $tmp = `(cd "$ENV{'PBDIR'}" ; $vcscmd log | head -1 | cut -f2)`;116 $tmp =~ s/^.* //;117 # Reduce length of commit id to 8 digit118 $tmp = substr($tmp,1,8);119 }120 chomp($tmp);121 $ENV{'PBREVISION'}=$tmp;122 $ENV{'PBCMSLOGFILE'}="git.log";123 } elsif ($scheme =~ /^(flat)|(ftp)|(http)|(https)|(file)\b/o) {124 $ENV{'PBREVISION'}="flat";125 $ENV{'PBCMSLOGFILE'}="flat.log";126 } elsif ($scheme =~ /^svn/) {127 # svnversion more precise than svn info if sbx128 if ((defined $param) && ($param eq "CMS")) {129 $tmp = `(LANGUAGE=C $vcscmd info $pbprojurl->{$ENV{'PBPROJ'}} | grep -E '^Revision:' | cut -d: -f2)`;130 $tmp =~ s/\s+//;131 } else {132 $tmp = `(cd "$ENV{'PBDIR'}" ; $vcscmd"version" .)`;133 }134 chomp($tmp);135 $ENV{'PBREVISION'}=$tmp;136 $ENV{'PBCMSLOGFILE'}="svn.log";137 } elsif ($scheme =~ /^svk/) {138 $tmp = `(cd "$ENV{'PBDIR'}" ; LANGUAGE=C $vcscmd info . | grep -E '^Revision:' | cut -d: -f2)`;139 $tmp =~ s/\s+//;140 chomp($tmp);141 $ENV{'PBREVISION'}=$tmp;142 $ENV{'PBCMSLOGFILE'}="svk.log";143 } elsif ($scheme =~ /^cvs/) {144 # Way too slow145 #$ENV{'PBREVISION'}=`(cd "$ENV{'PBROOTDIR'}" ; cvs rannotate -f . 2>&1 | awk '{print \$1}' | grep -E '^[0-9]' | cut -d. -f2 |sort -nu | tail -1)`;146 #chomp($ENV{'PBREVISION'});147 $ENV{'PBREVISION'}="cvs";148 $ENV{'PBCMSLOGFILE'}="cvs.log";149 $ENV{'CVS_RSH'} = "ssh" if ($scheme =~ /ssh/);150 } else {151 die "cms $scheme unknown";152 }153 154 pb_log(1,"pb_cms_init returns $scheme,$pbprojurl->{$ENV{'PBPROJ'}}\n");155 return($scheme,$pbprojurl->{$ENV{'PBPROJ'}});156 }157 53 158 54 =item B<pb_cms_get_pkg>
Note:
See TracChangeset
for help on using the changeset viewer.