Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v224 #588

Merged
merged 12 commits into from Sep 5, 2022
Merged

v224 #588

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Expand Up @@ -35,7 +35,7 @@ jobs:
command: |
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === file_get_contents('https://composer.github.io/installer.sig')) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer --version=2.3.8
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer --version=2.4.1
rm composer-setup.php
- checkout
- run:
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,20 @@
# heroku-buildpack-php CHANGELOG

## v224 (2022-09-05)

### ADD

- ext-blackfire/1.81.0 [David Zuelke]
- ext-phalcon/5.0.0RC4 [David Zuelke]
- PHP/8.0.23 [David Zuelke]
- PHP/8.1.10 [David Zuelke]

### CHG

- Composer/2.4.1 [David Zuelke]
- Composer/2.2.18 [David Zuelke]
- blackfire/2.10.1 [David Zuelke]

## v223 (2022-08-04)

### ADD
Expand Down
4 changes: 2 additions & 2 deletions bin/compile
Expand Up @@ -219,7 +219,7 @@ fi
mkdir -p $build_dir/.heroku/php-min
ln -s $build_dir/.heroku/php-min /app/.heroku/php-min

curl_retry_on_18 --retry-connrefused --retry 3 --connect-timeout 5 --fail --silent --location -o $build_dir/.heroku/php-min.tar.gz "${s3_url}php-min-8.1.9.tar.gz" || {
curl_retry_on_18 --retry-connrefused --retry 3 --connect-timeout 5 --fail --silent --location -o $build_dir/.heroku/php-min.tar.gz "${s3_url}php-min-8.1.10.tar.gz" || {
mcount "failures.bootstrap.download.php-min"
error <<-EOF
Failed to download minimal PHP for bootstrapping!
Expand All @@ -232,7 +232,7 @@ curl_retry_on_18 --retry-connrefused --retry 3 --connect-timeout 5 --fail --sile
tar xzf $build_dir/.heroku/php-min.tar.gz -C $build_dir/.heroku/php-min
rm $build_dir/.heroku/php-min.tar.gz

curl_retry_on_18 --retry-connrefused --retry 3 --connect-timeout 5 --fail --silent --location -o $build_dir/.heroku/composer.tar.gz "${s3_url}composer-2.3.10.tar.gz" || {
curl_retry_on_18 --retry-connrefused --retry 3 --connect-timeout 5 --fail --silent --location -o $build_dir/.heroku/composer.tar.gz "${s3_url}composer-2.4.1.tar.gz" || {
mcount "failures.bootstrap.download.composer"
error <<-EOF
Failed to download Composer for bootstrapping!
Expand Down
2 changes: 1 addition & 1 deletion support/build/_util/mkrepo.sh
Expand Up @@ -15,7 +15,7 @@ function s3cmd_get_progress() {
fi
echo -n "$line"
len=${#line}
done < <(grep --line-buffered -o -E '\[[0-9]+ of [0-9]+\]') # filter only the "[1 of 99]" bits from 's3cmd get' output
done < <(grep --line-buffered -o -P '(?<=\[)[0-9]+ of [0-9]+(?=\])' | awk -W interactive '{print int($1/$3*100)"% ("$1"/"$3")"}') # filter only the "[1 of 99]" bits from 's3cmd get' output and divide using awk
}

upload=false
Expand Down
8 changes: 5 additions & 3 deletions support/build/_util/sync.sh
Expand Up @@ -13,7 +13,7 @@ function s3cmd_get_progress() {
fi
echo -n "$line"
len=${#line}
done < <(grep --line-buffered -o -E '\[[0-9]+ of [0-9]+\]') # filter only the "[1 of 99]" bits from 's3cmd get' output
done < <(grep --line-buffered -o -P '(?<=\[)[0-9]+ of [0-9]+(?=\])' | awk -W interactive '{print int($1/$3*100)"% ("$1"/"$3")"}') # filter only the "[1 of 99]" bits from 's3cmd get' output and divide using awk
}

remove=true
Expand Down Expand Up @@ -87,7 +87,8 @@ here=$(cd $(dirname $0); pwd)
# clean up at the end
trap 'rm -rf $src_tmp $dst_tmp;' EXIT

echo -n "Fetching source's manifests from s3://${src_bucket}/${src_prefix}... " >&2
echo -n "Fetching source's manifests
from s3://${src_bucket}/${src_prefix}... " >&2
(
cd $src_tmp
out=$(s3cmd ${s3cmd_src_host_options} --ssl get s3://${src_bucket}/${src_prefix}packages.json 2>&1) || { echo -e "No packages.json in source repo:\n$out" >&2; exit 1; }
Expand All @@ -108,7 +109,8 @@ S3_REGION=$src_region $here/mkrepo.sh $src_bucket $src_prefix ${src_tmp}/*.compo
[[ ! $proceed =~ [nN]o* ]] && exit 1 # yes is the default so doing yes | sync.sh won't do something stupid
}

echo -n "Fetching destination's manifests from s3://${dst_bucket}/${dst_prefix}... " >&2
echo -n "Fetching destination's manifests
from s3://${dst_bucket}/${dst_prefix}... " >&2
(
cd $dst_tmp
s3cmd ${s3cmd_dst_host_options} --ssl --progress get s3://${dst_bucket}/${dst_prefix}*.composer.json 2>&1 | tee download.log | s3cmd_get_progress >&2 || { echo -e "failed! Error:\n$(cat download.log)" >&2; exit 1; }
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions support/build/composer
Expand Up @@ -30,6 +30,9 @@ fi

php composer-setup.php --version=${dep_version}

# work around https://github.com/composer/composer/issues/11046
echo '{}' > composer.json

plugin_api_version=$(php composer.phar show --platform | grep 'composer-plugin-api' | awk '{print $2}')

# php is in there, so clear it first
Expand Down
File renamed without changes.
5 changes: 5 additions & 0 deletions support/build/composer-2.4.1
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
# Build Path: /app/.heroku/php
# Build Deps: php-min-*

source $(dirname $0)/composer
4 changes: 3 additions & 1 deletion support/build/php
Expand Up @@ -228,7 +228,9 @@ fi
EOF

# we need composer to extract all extensions with versions
curl -sS https://getcomposer.org/installer | php
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php --2.2 # https://github.com/composer/composer/issues/11046

# first, read all platform packages (just "ext-" and "php-") that are already there; could be statically built, or enabled through one of the INIs loaded
platform_default=$(php composer.phar show --platform | grep -E '^(ext-\S+|php-\S+)' | sed s@^@heroku-sys/@ | tr -s " " | cut -d " " -f1,2 | sort)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 8 additions & 8 deletions support/devcenter/generate.php
Expand Up @@ -125,8 +125,8 @@

$db = new SQLite3(':memory:');
$db->createCollation('VERSION_CMP', 'version_compare'); // for sorting/MAXing versions; we have to use it explicitly inside MAX(CASE…) statements in addition to setting it on the version column
$db->exec("CREATE TABLE packages (name TEXT COLLATE NOCASE, version TEXT COLLATE VERSION_CMP, type TEXT, series TEXT, stack TEXT)");
$db->exec("CREATE TABLE extensions (name TEXT COLLATE NOCASE, url TEXT, version TEXT COLLATE VERSION_CMP, runtime TEXT, series TEXT, stack TEXT, bundled INTEGER DEFAULT 0, enabled INTEGER DEFAULT 1)");
$db->exec("CREATE TABLE packages (name TEXT COLLATE NOCASE, version TEXT COLLATE VERSION_CMP, type TEXT, series TEXT COLLATE VERSION_CMP, stack TEXT)");
$db->exec("CREATE TABLE extensions (name TEXT COLLATE NOCASE, url TEXT, version TEXT COLLATE VERSION_CMP, runtime TEXT, series TEXT COLLATE VERSION_CMP, stack TEXT, bundled INTEGER DEFAULT 0, enabled INTEGER DEFAULT 1)");
$insertPackage = $db->prepare("INSERT INTO packages (name, version, type, series, stack) VALUES(:name, :version, :type, :series, :stack)");
$insertExtension = $db->prepare("INSERT INTO extensions (name, url, version, runtime, series, stack, bundled, enabled) VALUES(:name, :url, :version, :runtime, :series, :stack, :bundled, :enabled)");

Expand Down Expand Up @@ -173,7 +173,7 @@
} elseif($package['type'] == 'heroku-sys-program' && $package['name'] == 'heroku-sys/composer') {
$serie = explode('.', $package['version']);
if($serie[0] == '2' && $serie[1] == '2') {
$serie = 'LTS 2.2'; // Composer 2.2 is LTS
$serie = '2 LTS'; // Composer 2.2 is LTS
} else {
$serie = $serie[0]; // 3, 4, 5 etc - semver major version
}
Expand All @@ -191,7 +191,7 @@
foreach($stacks as $key => $stack) {
$runtimesQuery[] = ", MAX(CASE WHEN stack = '${stack}' THEN version END COLLATE VERSION_CMP) AS '${stack}'";
}
$runtimesQuery[] = "FROM packages WHERE name = 'php' GROUP BY name, series ORDER BY series ASC";
$runtimesQuery[] = "FROM packages WHERE name = 'php' GROUP BY name, series ORDER BY series COLLATE VERSION_CMP ASC";
$results = $db->query(implode(" ", $runtimesQuery));
$runtimes = [];
while($row = $results->fetchArray(SQLITE3_ASSOC)) {
Expand Down Expand Up @@ -243,7 +243,7 @@
$extensionsQuery[] = ", MAX(CASE WHEN extensions.series = '${serie}' AND extensions.stack = '${stack}' THEN extensions.version END COLLATE VERSION_CMP) AS 'version_${serie}_${stack}'";
}
}
$extensionsQuery[] = "FROM extensions WHERE extensions.bundled = 0 GROUP BY extensions.name, major_version ORDER BY extensions.name ASC, major_version ASC";
$extensionsQuery[] = "FROM extensions WHERE extensions.bundled = 0 GROUP BY extensions.name, major_version ORDER BY extensions.name ASC, major_version COLLATE VERSION_CMP ASC";
$result = $db->query(implode(" ", $extensionsQuery));
$eExtensions = [];
while($row = $result->fetchArray(SQLITE3_ASSOC)) {
Expand Down Expand Up @@ -301,20 +301,20 @@
foreach($stacks as $key => $stack) {
$composersQuery[] = ", MAX(CASE WHEN stack = '${stack}' THEN version END COLLATE VERSION_CMP) AS '${stack}'";
}
$composersQuery[] = "FROM packages WHERE name = 'composer' GROUP BY name, series ORDER BY series ASC";
$composersQuery[] = "FROM packages WHERE name = 'composer' GROUP BY name, series ORDER BY series COLLATE VERSION_CMP ASC";
$results = $db->query(implode(" ", $composersQuery));
$composers = [];
while($row = $results->fetchArray(SQLITE3_ASSOC)) {
$row["name"] = ucfirst($row["name"]); // "Composer"
$row["series"] = $row["series"].".x"; // "2.x"
$row["series"] = $row["series"].(strpos($row["series"], "LTS")?"":".x"); // "2.x"
$composers[] = $row;
}

$webserversQuery = ["SELECT name, series"];
foreach($stacks as $key => $stack) {
$webserversQuery[] = ", MAX(CASE WHEN stack = '${stack}' THEN version END COLLATE VERSION_CMP) AS '${stack}'";
}
$webserversQuery[] = "FROM packages WHERE type = 'heroku-sys-webserver' GROUP BY name, series ORDER BY name ASC, series ASC";
$webserversQuery[] = "FROM packages WHERE type = 'heroku-sys-webserver' GROUP BY name, series ORDER BY name ASC, series COLLATE VERSION_CMP ASC";
$results = $db->query(implode(" ", $webserversQuery));
$webservers = [];
while($row = $results->fetchArray(SQLITE3_ASSOC)) {
Expand Down