Skip to content

Support building from a local directory / non-Packagist source #79

Description

@TimWolla

This would be useful to test if what I've written into composer.json is correct and whether the build actually works, before committing to my changes by pushing them into a public repository and submitting them to Packagist.

This includes both the test after the initial pie-ification and before submission to Packagist and also tests after adding or removing configure flags.

see https://phpc.social/@timwolla/113367860412703002

Activity

  1. asgrim commented on Oct 28, 2024

    @asgrim
    Contributor

    Thanks - this should be possible once #48 is complete 👍

  2. self-assigned this
    on Nov 7, 2024
  3. asgrim commented on Nov 14, 2024

    @asgrim
    Contributor

    With the PR #83, this becomes possible, and the following steps will enable you to download/build/install source code for a PIE package that has not yet been published to Packagist:

    • Use PIE with work in progress branch asgrim:adapt-to-use-composer-installer (see PR Adapt to use composer installer #83)
    • If you have not run PIE for the target PHP before:
      • Run pie info -v foo/bar:dev-pie (doesn't actually matter what command really)
      • First run will not work, but will have created an empty pie.json
    • Locate pie.json for your target PHP, e.g. in ~/.config/pie/php8.3_<hash>/pie.json
    • Update pie.json manually to add the repository for what you're trying to do:

    Example for a GitHub repo:

    {
        "repositories": [
            {
                "type": "vcs",
                "url": "https://github.com/foo/bar"
            }
        ]
    }

    Example for a local repo:

    {
        "repositories": [
            {
                "type": "path",
                "url": "/path/to/foo/bar"
            }
        ]
    }
    • Then you can use the package as normal, (using whatever version constraint is appropriate, e.g. foo/bar:* for local repo, foo/bar:dev-branch-name for a GH repo, e.g.:
      • bin/pie info foo/bar:dev-pie (useful for checking the ./configure options available in PIE)
      • bin/pie download -v foo/bar:dev-pie
      • bin/pie build -v foo/bar:dev-pie --enable-some-option
      • bin/pie install -v foo/bar:dev-pie --enable-some-option

    Given the above possibility, maybe adding a new pie CLI option to combine (i.e. it would add the repository into pie.json for you), maybe something like:

    • --path-repository=/path/to/foo/bar
    • --vcs-repository=https://github.com/foo/bar

    Usage examples:

    • bin/pie install --path-repository=/path/to/foo/bar foo/bar:*
    • bin/pie install --vcs-repository=https://github.com/foo/bar foo/bar:*

    Since repository configuration can actually get quite advanced, I'm not sure we could get a fully comprehensive syntax in the CLI for defining all possible kinds of repositories, so maybe just providing the basics would suffice? I'm open to feedback on how we actually would do this though, perhaps there is a better way :D

  4. removed their assignment
    on Nov 15, 2024
  5. macintoshplus commented on Nov 19, 2024

    @macintoshplus
    Contributor

    Is it possible to add a custom repository like private composer into the pie.json file?

    It's to allow a repository to help distribute extension code sources or pre-built DLL. Especially the oldest extensions.

  6. asgrim commented on Nov 19, 2024

    @asgrim
    Contributor

    Is it possible to add a custom repository like private composer into the pie.json file?

    It's to allow a repository to help distribute extension code sources or pre-built DLL. Especially the oldest extensions.

    I have not tried a private repo, feel free to try it, the above guide may help :)

  7. macintoshplus commented on Nov 19, 2024

    @macintoshplus
  8. asgrim commented on Nov 19, 2024

    @asgrim
    Contributor

    @macintoshplus I am not sure what your latest comment means, or how it relates to building from different Composer repositories, which is what the OP is asking about. The sources and dist keys don't exist in composer.json. It sounds like you are trying to solve a separate problem, so please can you open a separate ticket :)

  9. macintoshplus commented on Nov 19, 2024

    @macintoshplus
    Contributor

    Right @asgrim, I have open #110.

  10. added
    maintainer investigatingThis ticket is being investigated by maintainers. Please check with us before contributing PRs etc!
    on Nov 21, 2024
  11. self-assigned this
    on Nov 21, 2024
  12. asgrim commented on Jan 20, 2025

    @asgrim
    Contributor

    As an update to this, I'm working on a separate command to list/add/remove repositories from a target PHP in PIE. It'll be something like:

    • list pie repository:list --with-php-config=/path/to/php-config
    • add pie repository:add vcs https://github.com/asgrim/example-pie-extension --with-php-config=/path/to/php-config
    • remove pie repository:remove https://github.com/asgrim/example-pie-extension --with-php-config=/path/to/php-config
    • add pie repository:add path /path/to/your/local/extension --with-php-config=/path/to/php-config
    • remove pie repository:remove /path/to/your/local/extension --with-php-config=/path/to/php-config

    Assuming there are no objections/issues/concerns/etc, this should make the next release :)

  13. added this to the 0.6.0 milestone on Jan 24, 2025
  14. macintoshplus commented on Jan 24, 2025

    @macintoshplus
    Contributor

    As an update to this, I'm working on a separate command to list/add/remove repositories from a target PHP in PIE. It'll be something like:

    • list pie repository:list --with-php-config=/path/to/php-config
    • add pie repository:add vcs https://github.com/asgrim/example-pie-extension --with-php-config=/path/to/php-config
    • remove pie repository:remove https://github.com/asgrim/example-pie-extension --with-php-config=/path/to/php-config
    • add pie repository:add path /path/to/your/local/extension --with-php-config=/path/to/php-config
    • remove pie repository:remove /path/to/your/local/extension --with-php-config=/path/to/php-config

    Assuming there are no objections/issues/concerns/etc, this should make the next release :)

    Why the with-php-config option? The repository is not added into the composer.json project file?

  15. asgrim commented on Jan 24, 2025

    @asgrim
    Contributor

    Why the with-php-config option? The repository is not added into the composer.json project file?

    No, PIE does not use your consuming project's composer.json to install extensions (yet - although it has been discussed). It uses a pie.json specific to each target PHP version. This is because Composer installs dependencies for your project (in vendor/) as you are probably aware, but PHP extensions are global per PHP install, so we have a pie.json per PHP install that you have. If you have one PHP install on your machine, and php-config is in your $PATH, then you do not need to specify --with-php-config (this is the most common scenario). So when you use these commands, PIE is modifying $PIE_WORKING_DIRECTORY/php8.3_<somehash>/pie.json repositories (which is what PIE uses to manage extension dependencies, per "Target PHP" installation).

  16. macintoshplus commented on Jan 24, 2025

    @macintoshplus
    Contributor

    Ok. I can't ask Pie to install all PHP Ext for my project based on composer configuration?

  17. asgrim commented on Jan 24, 2025

    @asgrim
    Contributor

    Ok. I can't ask Pie to install all PHP Ext for my project based on composer configuration?

    I did already directly answer that:

    No, PIE does not use your consuming project's composer.json to install extensions (yet - although it has been discussed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestmaintainer investigatingThis ticket is being investigated by maintainers. Please check with us before contributing PRs etc!

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions