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

Feature: Records of extensions installed with PIE #26

Open
asgrim opened this issue Sep 24, 2024 · 4 comments
Open

Feature: Records of extensions installed with PIE #26

asgrim opened this issue Sep 24, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@asgrim
Copy link
Collaborator

asgrim commented Sep 24, 2024

An idea I've been toying with, and wanted to start getting something more concrete designed, is to have PIE keep a record of which extensions it has installed. Maybe something like a $HOME/.config/pie/extensions.json or similar, with contents:

{
  "installs": [
    {
      "package": "xdebug/xdebug",
      "version": "3.4.0",
      "date": "2024-09-24T16:45:45Z",
      "configure-options": "--enable-xdebug --something-else",
      "download-url": "https://api.github.com/whatever/the/path/was.zip",
      "installed-extension-path": "/path/to/php/extensions/xdebug.so",
      "checksum": "9cc2ae8a1ba7a93da39b46fc1019c481",
      "ini-file-used": null,
      "extra-files-installed": [],
      "extension-type": "php-ext",
      "extension-name": "xdebug",
      "target-platform": {
        "php-binary-path": "/path/to/php",
        "php-version": "8.3.1",
        "architecture": "x86_64",
        "thread-safety-mode": "ts",
        "windows-compiler": null
      }
    },
    {
      "package": "xdebug/xdebug",
      "version": "3.4.0",
      "date": "2024-09-24T16:56:45Z",
      "configure-options": "--enable-xdebug",
      "download-url": "https://api.github.com/whatever/the/path/was.zip",
      "extension-type": "php-ext",
      "installed-extension-path": "/path/to/a/different/php/extensions/xdebug.so",
      "checksum": "2b422f21c93009b4d7474f014703d191",
      "ini-file-used": null,
      "extra-files-installed": [],
      "extension-name": "xdebug",
      "target-platform": {
        "php-binary-path": "/path/to/a/different/php",
        "php-version": "8.3.3",
        "architecture": "x86_64",
        "thread-safety-mode": "nts",
        "windows-compiler": null
      }
    },
    {
      "package": "xdebug/xdebug",
      "version": "3.4.1",
      "date": "2024-09-24T17:30:45Z",
      "configure-options": "--enable-xdebug --something-else",
      "download-url": "https://api.github.com/whatever/the/path/was.zip",
      "installed-extension-path": "/path/to/php/extensions/xdebug.so",
      "checksum": "8b573595c92a1216ddbc7fe839a276c4",
      "ini-file-used": null,
      "extra-files-installed": [],
      "extension-type": "php-ext",
      "extension-name": "xdebug",
      "target-platform": {
        "php-binary-path": "/path/to/php",
        "php-version": "8.3.1",
        "architecture": "x86_64",
        "thread-safety-mode": "ts",
        "windows-compiler": null
      }
    }
  ]
}

overview

Essentially, each time PIE is used to install an extension, we record all the metadata/information about the installation.

What can this benefit?

See #24 - if an extension was installed with PIE, we know how it was built, so we can fairly simply rebuild it with the same configure options etc.

It may help with #13 too ?

Could also help with a generic pie update command, which tries to update all PIE-enabled extensions (with the help of the install log)

When we do pie show, we can check the checksum against the real ext, to ensure it has changed (i.e. "it got out of sync with PIE").

Note ini-file-used is all null at the moment, it is for future use when php/pie#20 is done.

@asgrim asgrim added the enhancement New feature or request label Sep 24, 2024
@asgrim
Copy link
Collaborator Author

asgrim commented Sep 25, 2024

Discussed with Composer folks, it may be possible to use InstalledFilesystemRepository from Composer to track this. Should be possible to add the extra metadata that PIE needs (such as .so/.dll hash, configure options, target platform, etc.) in setExtra or setTransportOptions ("I'd recommend the latter as it's less likely to interfere but if you namespace it properly extra will be fine too I guess"). Something worth looking into to avoid re-inventing the wheel 💯

@asgrim
Copy link
Collaborator Author

asgrim commented Oct 10, 2024

see also php/pie#48

@stof
Copy link
Contributor

stof commented Dec 3, 2024

One thing to be careful with the proposed file location: it does not seem to play well with systems that have multiple versions of PHP installed.

@asgrim
Copy link
Collaborator Author

asgrim commented Dec 3, 2024

One thing to be careful with the proposed file location: it does not seem to play well with systems that have multiple versions of PHP installed.

This was sort of already done in php/pie#83 - the composer home in PIE is scoped to the target PHP version (so there is multiple Composer homes)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants