Updated stubs, improved PHP7 compatibility

This commit is contained in:
Christopher Vagnetoft
2016-07-21 03:08:06 +02:00
parent 10f4f09a34
commit 9f8cf0bf38
10 changed files with 35 additions and 15 deletions

View File

@ -57,6 +57,7 @@ class Hotfix
break;
case 'php':
$exec = "/usr/bin/env php";
$head = "<?php require_once \"".__DIR__."/../../vendor/autoload.php\"; ".file_get_contents(__DIR__."/../stubs/php.stub");
break;
default:
fprintf(STDERR, "Error: Unsupported language %s\n", $lang);

View File

@ -44,7 +44,11 @@ class Loader
} else {
list ($body, $signature) = explode($sigHeader, $hotfix);
$signature = $sigHeader.$signature;
$signer = $this->verifySignature($body, $signature);
if (!$insecure) {
$signer = $this->verifySignature($body, $signature);
} else {
$signer = null;
}
}
return new Hotfix($body, $signer);
}
@ -64,6 +68,10 @@ class Loader
$fingerprint = $sigInfo[0]['fingerprint'];
$keyInfo = gnupg_keyinfo($gpg, $fingerprint);
if (empty($keyInfo)) {
throw new \Exception("Unknown signer (key id {$sigInfo[0]['fingerprint']})");
}
$subKeys = $keyInfo[0]['subkeys'];
$keyId = null;
foreach ($subKeys as $subKey) {
@ -73,10 +81,6 @@ class Loader
}
}
if (empty($keyInfo)) {
throw new \Exception("Unknown signer (key id {$sigInfo[0]['fingerprint']})");
}
return [ $keyInfo[0], $keyId ];
}
}

View File

@ -8,7 +8,7 @@ class HotfixApplication extends Application
{
public function __construct()
{
parent::__construct("Hotfixer", "0.1");
parent::__construct("Hotfix", APP_VERSION." (".PHAR_BUILD_DATE.")");
$this->add(new Command\ApplyCommand());
$this->add(new Command\SignCommand());
}

View File

@ -2,14 +2,15 @@ test -e /etc/lsb-release && source /etc/lsb-release
function exec() {
echo -e "\e[36;1m[exec]\e[36;21m $*\e[0m"
LOG=$(tempfile -p exec)
$@ &>$LOG
# LOG=$(tempfile -p exec)
$@
# &>$LOG
EC=$?
if [ $EC -gt 0 ]; then
echo -e "\e[31;1m[warn]\e[31;21m Command completed with exitcode $EC\e[0m"
tail -n5 $LOG | awk '{ print " " $0 }'
# tail -n5 $LOG | awk '{ print " " $0 }'
fi
rm $LOG
# rm $LOG
}
function info() {
echo -e "\e[32;1m[info]\e[32;21m $*\e[0m"