From a596efcbf5b796f2467be42d20d880b31a65af70 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Sun, 23 Mar 2025 10:45:01 -0700 Subject: [PATCH] Migrate fortls and fpm to Homebrew Core --- .github/workflows/fpm-version-update.yml | 95 ------------------------ Formula/fortls.rb | 41 ---------- Formula/fpm.rb | 37 --------- README.md | 8 +- tap_migrations.json | 4 + 5 files changed, 7 insertions(+), 178 deletions(-) delete mode 100644 .github/workflows/fpm-version-update.yml delete mode 100644 Formula/fortls.rb delete mode 100644 Formula/fpm.rb create mode 100644 tap_migrations.json diff --git a/.github/workflows/fpm-version-update.yml b/.github/workflows/fpm-version-update.yml deleted file mode 100644 index 87c44cc..0000000 --- a/.github/workflows/fpm-version-update.yml +++ /dev/null @@ -1,95 +0,0 @@ -name: Auto-update fpm Formula - -on: - workflow_dispatch: # Allows manual trigger - -jobs: - update-fpm: - runs-on: ubuntu-latest - permissions: - actions: write - contents: write - pull-requests: write - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Fetch latest fpm release - id: get-latest-release - run: | - VERSION_WITH_V="$(curl -s https://api.github.com/repos/fortran-lang/fpm/releases/latest | jq -r '.tag_name')" - VERSION_WITHOUT_V="${VERSION_WITH_V#v}" # Remove leading 'v' - echo "LATEST_VERSION=${VERSION_WITHOUT_V}" >> "$GITHUB_ENV" - echo "LATEST_VERSION_V=${VERSION_WITH_V}" >> "$GITHUB_ENV" - echo "Latest version: ${VERSION_WITH_V} (stripped: ${VERSION_WITHOUT_V})" - - - name: Extract current formula version - id: get-current-version - run: | - CURRENT_VERSION="$(grep -oP 'url "https://github.com/fortran-lang/fpm/releases/download/v\K[0-9.]+' Formula/fpm.rb | head -n 1)" - echo "CURRENT_VERSION=${CURRENT_VERSION}" >> "$GITHUB_ENV" - echo "Current version: ${CURRENT_VERSION}" - - - name: Compare versions - id: check-update - run: | - if [ "${{ env.LATEST_VERSION }}" != "${{ env.CURRENT_VERSION }}" ] || [ "${{ github.event_name }}" == "workflow_dispatch" ]; then - echo "New version available or manually triggered!" - echo "UPDATE_NEEDED=true" >> "$GITHUB_ENV" - else - echo "UPDATE_NEEDED=false" >> "$GITHUB_ENV" - echo "No update needed." - fi - - - name: Get new SHA256 hash - if: env.UPDATE_NEEDED == 'true' - id: get-sha256 - run: | - SHA_URL="https://github.com/fortran-lang/fpm/releases/download/${{ env.LATEST_VERSION_V }}/fpm-${{ env.LATEST_VERSION }}.zip.sha256" - SHA256="$(curl -sL "${SHA_URL}" | awk '{print $1}')" - echo "SHA256=${SHA256}" >> "$GITHUB_ENV" - echo "New SHA256: ${SHA256}" - - - name: Create branch for update - if: env.UPDATE_NEEDED == 'true' - run: | - BRANCH_NAME="auto-update-fpm-${{ env.LATEST_VERSION }}-$(date +%s)" # Add timestamp to branch name for uniqueness - echo "BRANCH_NAME=${BRANCH_NAME}" >> "$GITHUB_ENV" - - - name: Update formula - if: env.UPDATE_NEEDED == 'true' - run: | - RUN_ID="${{ github.run_id }}-${{ github.run_number }}" - sed -i "1s/^/# Formula last updated on $(date -u +"%Y-%m-%dT%H:%M:%SZ") (Run: ${RUN_ID})\n/" Formula/fpm.rb - sed -i "s|url \".*\"|url \"https://github.com/fortran-lang/fpm/releases/download/${{ env.LATEST_VERSION_V }}/fpm-${{ env.LATEST_VERSION }}.zip\"|" Formula/fpm.rb - sed -i "s|sha256 \".*\"|sha256 \"${{ env.SHA256 }}\"|" Formula/fpm.rb - - - name: Debug - Show changes - if: env.UPDATE_NEEDED == 'true' - run: | - git diff Formula/fpm.rb || echo "No changes detected in Formula/fpm.rb" - - - name: Create Pull Request - if: env.UPDATE_NEEDED == 'true' - id: create-pr - uses: peter-evans/create-pull-request@v7 - with: - token: ${{ secrets.GITHUB_TOKEN }} - commit-message: "Update fpm to ${{ env.LATEST_VERSION }} with timestamp" - title: "Update fpm to ${{ env.LATEST_VERSION }}" - body: | - This PR automatically updates the fpm formula to version ${{ env.LATEST_VERSION }}. - - **Changes:** - - Updated URL to ${{ env.LATEST_VERSION_V }} release - - Updated SHA256 to match the new release - - Added timestamp to force PR: $(date -u +"%Y-%m-%dT%H:%M:%SZ") - - This PR was created automatically by GitHub Actions. - branch: ${{ env.BRANCH_NAME }} - base: main - labels: | - automated-pr - version-bump - diff --git a/Formula/fortls.rb b/Formula/fortls.rb deleted file mode 100644 index ab68281..0000000 --- a/Formula/fortls.rb +++ /dev/null @@ -1,41 +0,0 @@ -class Fortls < Formula - include Language::Python::Virtualenv - - desc "Fortran language server" - homepage "https://github.com/gnikit/fortls" - url "https://pypi.io/packages/source/f/fortls/fortls-2.13.0.tar.gz" - sha256 "23c5013e8dd8e1d65bf07be610d0827bc48aa7331a7a7ce13612d4c646d0db31" - license "MIT" - head "https://github.com/gnikit/fortls.git", branch: "master" - - bottle do - root_url "https://github.com/fortran-lang/homebrew-fortran/releases/download/fortls-2.13.0" - sha256 cellar: :any_skip_relocation, monterey: "83cef5b4236725d129e4f183b806d50a09cc538b7fb9e2e351656974931b19a1" - sha256 cellar: :any_skip_relocation, big_sur: "5d4ac95cff2a8ff73371148f1499c681fdf1f8c594ec2c7aea13cff2da46097a" - end - - depends_on "python@3.10" - - resource "json5" do - url "https://pypi.io/packages/source/j/json5/json5-0.9.5.tar.gz" - sha256 "703cfee540790576b56a92e1c6aaa6c4b0d98971dc358ead83812aa4d06bdb96" - end - - resource "packaging" do - url "https://pypi.io/packages/source/p/packaging/packaging-21.3.tar.gz" - sha256 "dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb" - end - - resource "pyparsing" do - url "https://pypi.io/packages/source/p/pyparsing/pyparsing-3.0.9.tar.gz" - sha256 "2b020ecf7d21b687f219b71ecad3631f644a47f01403fa1d1036b0c6416d70fb" - end - - def install - virtualenv_install_with_resources - end - - test do - system "#{bin}/fortls", "--help" - end -end diff --git a/Formula/fpm.rb b/Formula/fpm.rb deleted file mode 100644 index bbb125a..0000000 --- a/Formula/fpm.rb +++ /dev/null @@ -1,37 +0,0 @@ -# Formula last updated on 2025-03-10 for version 0.11.0 - -class Fpm < Formula - desc "Fortran Package Manager (fpm)" - homepage "https://fpm.fortran-lang.org" - url "https://github.com/fortran-lang/fpm/releases/download/v0.11.0/fpm-0.11.0.zip" - sha256 "f6c998c9afd39eb42c7e80a306cfbed5faa77eaa42eb4f75b93864c338db1795" - license "MIT" - - bottle do - root_url "https://github.com/fortran-lang/homebrew-fortran/releases/download/fpm-0.11.0" - rebuild 1 - sha256 cellar: :any, arm64_sonoma: "d5795b3b84fc2cb7eff32f48a64af03f439cd4bc562727ae2cfdde161b819f5e" - sha256 cellar: :any, ventura: "6046a6004ff42f03f67dff1af39f80be7e0deb679f797c787a1883e28ac10778" - end - - depends_on "curl" => :build - depends_on "gcc" # for gfortran - fails_with gcc: "4" - fails_with gcc: "5" - fails_with gcc: "6" - fails_with gcc: "7" - fails_with gcc: "8" - fails_with gcc: "9" - fails_with :clang - - def install - ENV.fortran - `export HOMEBREW_NO_INSTALL_FROM_API=1` - `chmod a+x ./install.sh` - system "./install.sh", "--prefix=#{prefix}" - end - - test do - system "#{bin}/fpm", "--version" - end -end diff --git a/README.md b/README.md index 1ecc6ba..010a4d6 100644 --- a/README.md +++ b/README.md @@ -2,17 +2,15 @@ This repository provides package build instructions for tools and libraries around Fortran compatible with the [Homebrew toolchain](https://brew.sh). -For example you can install *fpm* by tapping this repository +For example you can install *lfortran* by tapping this repository -``` -`brew tap fortran-lang/homebrew-fortran` -brew install fpm +```sh +brew tap fortran-lang/homebrew-fortran brew install lfortran ``` Available packages from this tap are -- [`fpm`](https://fpm.fortran-lang.org): Fortran package manager - [`lfortran`](https://lfortran.org): Modern interactive LLVM-based Fortran compiler diff --git a/tap_migrations.json b/tap_migrations.json new file mode 100644 index 0000000..666d506 --- /dev/null +++ b/tap_migrations.json @@ -0,0 +1,4 @@ +{ + "fortls": "homebrew/core", + "fpm": "homebrew/core" +}