ease update to a new release by git fetch-ing automatic first (to not run into situation branch/tag not known locally)

also fixed some spelling
This commit is contained in:
ralf 2023-04-09 09:28:12 +02:00
parent 24ca92e425
commit 3f04be2d03

View File

@ -162,7 +162,7 @@ foreach($bins as $name => $binaries)
if ($verbose) echo "Using following binaries: ".json_encode ($bins, JSON_UNESCAPED_SLASHES)."\n"; if ($verbose) echo "Using following binaries: ".json_encode ($bins, JSON_UNESCAPED_SLASHES)."\n";
if (!extension_loaded('curl')) die("Required PHP extesion 'curl' missing! You need to install php-curl package.\n\n"); if (!extension_loaded('curl')) die("Required PHP extension 'curl' missing! You need to install php-curl package.\n\n");
// check if we are on a git clone // check if we are on a git clone
$output = array(); $output = array();
@ -223,7 +223,7 @@ else
{ {
$target = $branch; $target = $branch;
// find latest release // find the latest release
if ($channel == 'release') if ($channel == 'release')
{ {
$target = get_latest_release($use_prerelease); $target = get_latest_release($use_prerelease);
@ -255,7 +255,7 @@ foreach(scandir(__DIR__) as $dir)
} }
if ($branch != $target) if ($branch != $target)
{ {
$cmd .= "$git checkout $target && "; $cmd .= "$git fetch && $git checkout $target && ";
} }
// no need to pull for release-channel/tags // no need to pull for release-channel/tags
if (!preg_match('/^\d+\.\d+\.\d{8}/', $target)) if (!preg_match('/^\d+\.\d+\.\d{8}/', $target))
@ -284,13 +284,13 @@ if ($npm)
if (!file_exists($chunks=__DIR__.'/chunks') || !is_dir($chunks)) if (!file_exists($chunks=__DIR__.'/chunks') || !is_dir($chunks))
{ {
if (!is_dir($chunks)) if (file_exists($chunks) && !is_dir($chunks))
{ {
unlink($chunks); unlink($chunks);
} }
if (!mkdir($chunks, 0755) && !is_dir($chunks)) if (!mkdir($chunks, 0755) && !is_dir($chunks))
{ {
throw new \RuntimeException(sprintf('Clound NOT create directory "%s"!', $chunks)); throw new \RuntimeException(sprintf('Cloud NOT create directory "%s"!', $chunks));
} }
} }
@ -359,7 +359,7 @@ function run_git(array $argv, $main_too=true)
} }
/** /**
* Get latest release * Get the latest release
* *
* @param boolean $prerelease =false include releases taged as prerelease * @param boolean $prerelease =false include releases taged as prerelease
* @param boolean $return_name =true true: just return name, false: full release object * @param boolean $return_name =true true: just return name, false: full release object