A command-line tool to copy open package pull requests from spack/spack
to spack/spack-packages
.
git
gh
CLI tool (authenticated with GitHub)jq
for JSON processing- Current directory should be a clone of
spack/spack-packages
- Either use Spack to install the tool:
spack install migrate-package-prs spack load migrate-package-prs
- Or, if you already have the
gh
andjq
utilities, you can simply clone the repository and add it to your PATH.git clone https://github.com/spack/migrate-package-prs.git export PATH="$PWD/migrate-package-prs/bin:$PATH"
-
Clone the new package repository and navigate to it:
git clone https://github.com/spack/spack-packages.git cd spack-packages
-
Do a dry-run of the migration tool from within the
spack-packages
directory:migrate-pkg-prs
-
If that looks good, run the tool with the
--migrate
option to create actual PRs:migrate-pkg-prs --migrate
For advanced usage, you can specify options and PR numbers:
migrate-pkg-prs [OPTIONS] [PR_NUMBERS...]
PR_NUMBERS
- (Optional) Specific PR numbers to process
--author USER
- Process all open PRs for the specified GitHub user--migrate
- Create PRs inspack/spack-packages
(default: local branches only)-h, --help
- Show help message
--author
andPR_NUMBERS
are mutually exclusive- If
PR_NUMBERS
are specified: process only those PRs - If
--author
is specified: process all open PRs for that user - If neither: process all open PRs for the currently authenticated GitHub user (default behavior)
migrate-pkg-prs
migrate-pkg-prs --migrate
migrate-pkg-prs --author johndoe
migrate-pkg-prs --migrate 12345 67890
migrate-pkg-prs 12345
- Fetches the specified PR from
spack/spack
- Cherry-picks commits (excluding merges) from the PR
- Creates a local branch named
spack-pr-{PR_NUMBER}
- Optionally creates a new PR in
spack/spack-packages
with the--migrate
flag
Local branches are created with the format: spack-pr-{PR_NUMBER}
When using --migrate
, the tool:
- Preserves the original PR title
- Adds a note to the PR body linking to the original PR
- Creates the PR against the
develop
branch inspack/spack-packages
The tool handles various failure scenarios:
- Failed fetches
- Cherry-pick conflicts
- Non-package PRs
- Branch creation issues
- Authentication problems
Failed PRs are skipped and reported in the summary.
Ensure you're authenticated with GitHub CLI:
gh auth login