Skip to content
This repository has been archived by the owner on Dec 23, 2020. It is now read-only.

Commit

Permalink
Make update_ci_repo task more resilient to tabs/spaces from git
Browse files Browse the repository at this point in the history
Warn user if generating an empty changelog because of any error in git pull
  • Loading branch information
Gaetano Giunta committed Jul 13, 2012
1 parent 07db6ce commit 5827981
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions pakefile.php
Expand Up @@ -68,7 +68,7 @@ function run_show_properties( $task=null, $args=array(), $cliopts=array() )
}

/**
* Downloads eZP from its source repository
* Downloads eZP from its source repository (needs to be run only once)
* @todo add a dependency on a check-updates task that updates script itself?
*/
function run_init( $task=null, $args=array(), $cliopts=array() )
Expand Down Expand Up @@ -282,6 +282,11 @@ function run_generate_changelog( $task=null, $args=array(), $cliopts=array() )
$changelogArray = array_map( 'trim', $changelogArray );
$changelogText = implode( "\n", $changelogArray );

if ( $changelogText == '' )
{
pake_echo( "Git log returns an empty string - generating an empty changelog file. Please check if there is any problem with $rootpath" );
}

// extract known wit issues
preg_match_all( "/^[- ]?Fix(?:ed|ing)?(?: bug|for ticket)? #0?([0-9]+):? (.*)$/mi", $changelogText, $bugfixesMatches, PREG_PATTERN_ORDER );
preg_match_all( "/^[- ]?Implement(?:ed)?(?: enhancement)? #0?([0-9]+):? (.*)$/mi", $changelogText, $enhancementsMatches, PREG_PATTERN_ORDER );
Expand Down Expand Up @@ -400,20 +405,19 @@ function run_update_ci_repo( $task=null, $args=array(), $cliopts=array() )
{
if ( strpos( $remote, $opts['ci-repo']['git-url'] . ' (push)' ) !== false )
{
$originp = explode( ' ', $remote );
$originp = preg_split( '/[ \t]/', $remote );
$originp = $originp[0];
}
if ( strpos( $remote, $opts['ci-repo']['git-url'] . ' (fetch)' ) !== false )
{
$originf = explode( ' ', $remote );
$originf = preg_split( '/[ \t]/', $remote );
$originf = $originf[0];
}
}
if ( !$originp || !$originf )
{
throw new pakeException( "CI repo dir $cipath does not seem to be linked to git repo {$opts['ci-repo']['git-url']}" );
}

$repo = new pakeGit( $cipath );

if ( $opts['ci-repo']['git-branch'] != '' )
Expand Down Expand Up @@ -660,7 +664,8 @@ function run_run_jenkins_build( $task=null, $args=array(), $cliopts=array() )
}

/**
* Creates different versions of the build tarballs.
* Creates different versions of the build tarballs (the main tarballs are created
* on Jenkins).
*
* We rely on the pake dependency system to do the real stuff
* (run pake -P to see tasks included in this one)
Expand Down

0 comments on commit 5827981

Please sign in to comment.