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

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

Open
TimWolla opened this issue Oct 28, 2024 · 7 comments
Open

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

TimWolla opened this issue Oct 28, 2024 · 7 comments
Assignees
Labels
enhancement New feature or request maintainer feedback needed Needs details or feedback to be added by maintainers

Comments

@TimWolla
Copy link
Member

TimWolla commented Oct 28, 2024

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

@asgrim asgrim added the enhancement New feature or request label Oct 28, 2024
@asgrim
Copy link
Collaborator

asgrim commented Oct 28, 2024

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

@asgrim asgrim self-assigned this Nov 7, 2024
@asgrim
Copy link
Collaborator

asgrim commented Nov 14, 2024

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

@asgrim asgrim removed their assignment Nov 15, 2024
@macintoshplus
Copy link

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.

@asgrim
Copy link
Collaborator

asgrim commented Nov 19, 2024

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 :)

@macintoshplus
Copy link

The minimal structure for the package is:

{
    "name": "smarty/smarty",
    "version": "3.1.7",
    "dist": {
        "url": "https://www.smarty.net/files/Smarty-3.1.7.zip",
        "type": "zip"
    }
}

For an extension, the dist key is the list of URLs of the prebuild DLL archive? or source code? or whatever?

I have this idea of JSON structure. Right?

{
    "name": "smarty/smarty",
    "version": "3.1.7",
    "sources": {
        "url": "https://www.smarty.net/files/Smarty-3.1.7.zip",
        "type": "zip"
        "reference": "tags/3.1.7"
    }
    "dist": {
        "url": "https://www.smarty.net/files/Smarty-3.1.7-8.4-ts-vs17-x86_64.zip",
        "type": "zip"
    },{
        "url": "https://www.smarty.net/files/Smarty-3.1.7-8.4-ts-vs17-x86.zip",
        "type": "zip"
    },{
        "url": "https://www.smarty.net/files/Smarty-3.1.7-8.4-nts-vs17-x86_64.zip",
        "type": "zip"
    },{
        "url": "https://www.smarty.net/files/Smarty-3.1.7-8.4-nts-vs17-x86.zip",
        "type": "zip"
    }
}

@asgrim
Copy link
Collaborator

asgrim commented Nov 19, 2024

@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 :)

@macintoshplus
Copy link

Right @asgrim, I have open #110.

@asgrim asgrim added the maintainer feedback needed Needs details or feedback to be added by maintainers label Nov 21, 2024
@asgrim asgrim self-assigned this Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request maintainer feedback needed Needs details or feedback to be added by maintainers
Projects
None yet
Development

No branches or pull requests

3 participants