A command-line tool to copy open package pull requests from spack/spack to spack/spack-packages.
gitghCLI tool (authenticated with GitHub)jqfor 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
ghandjqutilities, 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-packagesdirectory:migrate-pkg-prs
-
If that looks good, run the tool with the
--migrateoption 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
--authorandPR_NUMBERSare mutually exclusive- If
PR_NUMBERSare specified: process only those PRs - If
--authoris specified: process all open PRs for that user - If neither: process all open PRs for the currently authenticated GitHub user (default behavior)
migrate-pkg-prsmigrate-pkg-prs --migratemigrate-pkg-prs --author johndoemigrate-pkg-prs --migrate 12345 67890migrate-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-packageswith the--migrateflag
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
developbranch 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