Skip to content

Commit 56ee154

Browse files
Vitexusclaude
andcommitted
fix: read package name from composer.json for InstalledVersions identity
Use jq to extract the composer.json name field at build time (PKG_SOURCE), and fall back to __DIR__/composer.json at runtime when APP_NAME is unset. Add jq to Build-Depends where missing. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 7a1e6cb commit 56ee154

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

debian/autoload.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
foreach (\Composer\InstalledVersions::getAllRawData() as $d) {
2626
$versions = array_merge($versions, $d['versions'] ?? []);
2727
}
28-
$name = defined('APP_NAME') ? APP_NAME : 'unknown';
28+
$_cj = @json_decode(@file_get_contents(__DIR__ . '/composer.json'), true);
29+
$name = defined('APP_NAME') ? APP_NAME : ($_cj['name'] ?? basename(__DIR__));
2930
$version = defined('APP_VERSION') ? APP_VERSION : '0.0.0';
3031
$versions[$name] = ['pretty_version' => $version, 'version' => $version,
3132
'reference' => null, 'type' => 'library', 'install_path' => __DIR__,

debian/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Source: php-vitexsoftware-ease-html-widgets
2-
Build-Depends: debhelper (>= 7.0.50~), phpdocumentor, debhelper-compat (= 12)
2+
Build-Depends: debhelper (>= 7.0.50~), phpdocumentor, debhelper-compat (= 12), jq
33
Standards-Version: 4.3.0
44
Maintainer: Vítězslav Dvořák <info@vitexsoftware.cz>
55
Uploaders: Vitex <vitex@hippy.cz>

debian/rules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
77

88
PKG_VERSION := $(shell dpkg-parsechangelog -S Version | sed 's/~.*//')
9-
PKG_SOURCE := $(shell dpkg-parsechangelog -S Source)
9+
PKG_SOURCE := $(shell jq -r '.name' composer.json)
1010

1111
%:
1212
dh $@

0 commit comments

Comments
 (0)