Skip to content

Commit

Permalink
Merge pull request #22 from iamsergio/work/sergio
Browse files Browse the repository at this point in the history
brew improvements
  • Loading branch information
iamsergio authored Nov 18, 2024
2 parents 98d013e + 9d27314 commit fd356af
Show file tree
Hide file tree
Showing 22 changed files with 422 additions and 84 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# SPDX-FileCopyrightText: 2023 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]>
#
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only

name: CI

on:
push:
pull_request:

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os:
- macos-14
- macos-15

steps:
- name: Checkout sources
uses: actions/checkout@v4

# Cache brew packages
- uses: tecolicom/actions-use-homebrew-tools@v1
with:
tools: "graphviz qt@5 qt@6"

- name: Brew install
run: |
brew install --build-from-source --formula ./kdstatemachineeditor-qt5.rb
brew install --build-from-source --formula ./kdstatemachineeditor-qt6.rb
brew install --build-from-source --formula ./kdsoap-qt5.rb
brew install --build-from-source --formula ./kdsoap-qt6.rb
brew install --build-from-source --formula ./kdreports-qt5.rb
brew install --build-from-source --formula ./kdreports-qt6.rb
brew install --build-from-source --formula ./kdsingleapplication-qt5.rb
brew install --build-from-source --formula ./kdsingleapplication-qt6.rb
brew install --build-from-source --formula ./kddockwidgets-qt5.rb
brew install --build-from-source --formula ./kddockwidgets-qt6.rb
brew install --build-from-source --formula ./gammaray-qt5.rb
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__pycache__
10 changes: 6 additions & 4 deletions charm-qt4.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ class CharmQt4 < Formula

depends_on "qt" => "with-d-bus"
depends_on "cmake" => :build
depends_on "ninja" => :build


def install
system "cmake", ".", "-DCharm_VERSION=1.10.0", *std_cmake_args
system "make"
system "make", "install"
system "cmake", ".", "-G", "Ninja", "-DCharm_VERSION=1.10.0", *std_cmake_args
system "ninja"
system "ninja", "install"
end

test do
system "make", "test"
system "ctest"
end
end
12 changes: 7 additions & 5 deletions charm-qt5.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@ class CharmQt5 < Formula
sha256 "82e1b2356bd5a29f4b6b19b6c7dc7a8b0ce32574a5999b617647743e012f52b6"
head "https://github.com/KDAB/Charm.git"

depends_on "qt5" => "with-d-bus"
depends_on "qt@5" => "with-d-bus"
depends_on "qtkeychain"
depends_on "cmake" => :build
depends_on "ninja" => :build


def install
system "cmake", ".", "-DCharm_VERSION=1.12.0rc2", *std_cmake_args
system "make"
system "make", "install"
system "cmake", ".", "-G", "Ninja", "-DCharm_VERSION=1.12.0rc2", *std_cmake_args
system "ninja"
system "ninja", "install"
end

test do
system "make", "test"
system "ctest"
end
end
12 changes: 7 additions & 5 deletions gammaray-qt5.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@ class GammarayQt5 < Formula
sha256 "03d7ca7bd5eb600c9c389d0cf071960330592f1f392a783b7fec5f9eaa5df586"
head "https://github.com/KDAB/GammaRay.git"

depends_on "qt5" => "with-d-bus"
depends_on "qt@5" => "with-d-bus"
depends_on "kdstatemachineeditor-qt5"
depends_on "cmake" => :build
depends_on "ninja" => :build


def install
system "cmake", ".", *std_cmake_args
system "make"
system "make", "install"
system "cmake", ".", "-G", "Ninja", *std_cmake_args
system "ninja"
system "ninja", "install"
end

test do
system "make", "test"
system "ctest"
end
end
96 changes: 96 additions & 0 deletions info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: MIT

# prints packages that have an outdated version in brew than in github
# they are candidates for update.py
#

from utils import *

formulas = {
'kddockwidgets-qt5.rb': {"repo": "KDAB/KDDockWidgets"},
'kddockwidgets-qt6.rb': {"repo": "KDAB/KDDockWidgets"},
'kdsingleapplication-qt5.rb': {"repo": "KDAB/KDSingleApplication"},
'kdsingleapplication-qt6.rb': {"repo": "KDAB/KDSingleApplication"},
'kdsoap-qt5.rb': {"repo": "KDAB/KDSoap"},
'kdsoap-qt6.rb': {"repo": "KDAB/KDSoap"},
'kdchart-qt5.rb': {"repo": "KDAB/KDChart"},
'kdchart-qt6.rb': {"repo": "KDAB/KDChart"},
'kdreports-qt5.rb': {"repo": "KDAB/KDReports"},
'kdreports-qt6.rb': {"repo": "KDAB/KDReports"},
'gammaray-qt5.rb': {"repo": "KDAB/Gammaray"},
'kdmactouchbar-qt5.rb': {"repo": "KDAB/KDMacTouchBar"},
# 'kdstatemachineeditor-qt5.rb': {"repo": "KDAB/KDStateMachineEditor"},
# 'kdstatemachineeditor-qt6.rb': {"repo": "KDAB/KDStateMachineEditor"},
}

def unique_repos():
seen_repos = set()
unique_repo_list = []

for filename in formulas:
repo = formulas[filename]["repo"]
if repo not in seen_repos:
unique_repo_list.append(repo)
seen_repos.add(repo)

return unique_repo_list

def run_command_with_output(command):
output = os.popen(command).read()
return output

# Gets the package version from an .rb file
def get_version_in_brew(filename):
lines = run_command_with_output(f"brew info --formula {filename}").split('\n')

# example: ==> kdstatemachineeditor-qt6: stable 2.0.0-beta2, HEAD
first_line = lines[0]
return first_line.split(' ')[3].rstrip(',')

def get_latest_version_in_github(repo, strip_tag = True):
lines = run_command_with_output(f"gh release list --repo {repo} --limit 1").split('\n')
# example:
# TITLE TYPE TAG NAME PUBLISHED
# KDReports 2.3.0 Latest kdreports-2.3.0 about 2 months ago
version = lines[0].split('\t')[2]

if strip_tag:
version = version.replace('v', '')
version = version.split('-')[-1]

return version

def print_current_brew_versions():
print("\nCurrent Homebrew versions:")
for filename in formulas:
version = get_version_in_brew(filename)
filename = filename.ljust(30)
print(f"{filename}: {version}")

def print_latest_github_versions():
print("\nLatest Github versions:")
for repo in unique_repos():
version = get_latest_version_in_github(repo)
repo = repo.ljust(30)
print(f"{repo}: {version}")

def print_outdated_packages():
print("\nOutdated packages:")
has_outdated = False

for filename in formulas:
current_version = get_version_in_brew(filename)
github_version = get_latest_version_in_github(formulas[filename]["repo"])

if current_version != github_version:
has_outdated = True
filename = filename.ljust(30)
print(f"{filename}: {current_version} => {github_version}")

if not has_outdated:
print("No outdated packages found")

# print_latest_github_versions()
# print_current_brew_versions()
print_outdated_packages()
12 changes: 7 additions & 5 deletions kdchart-qt5.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@ class KdchartQt5 < Formula
sha256 "57359cb9593b5a7866b4b41d9397ca4386316559d449a57b4fe2ab491bb304e9"
head "https://github.com/KDAB/KDChart.git"

depends_on "qt5" => "with-d-bus"
depends_on "qt@5" => "with-d-bus"
depends_on "cmake" => :build
depends_on "ninja" => :build


def install
system "cmake", ".", *std_cmake_args
system "make"
system "make", "install"
system "cmake", ".", "-G", "Ninja", *std_cmake_args
system "ninja"
system "ninja", "install"
end

test do
system "make", "test"
system "ctest"
end
end
12 changes: 7 additions & 5 deletions kdchart-qt6.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@ class KdchartQt6 < Formula
sha256 "57359cb9593b5a7866b4b41d9397ca4386316559d449a57b4fe2ab491bb304e9"
head "https://github.com/KDAB/KDChart.git"

depends_on "qt6" => "with-d-bus"
depends_on "qt@6" => "with-d-bus"
depends_on "cmake" => :build
depends_on "ninja" => :build


def install
system "cmake", ".", "-DKDChart_QT6=True", *std_cmake_args
system "make"
system "make", "install"
system "cmake", ".", "-G", "Ninja", "-DKDChart_QT6=True", *std_cmake_args
system "ninja"
system "ninja", "install"
end

test do
system "make", "test"
system "ctest"
end
end
16 changes: 9 additions & 7 deletions kddockwidgets-qt5.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
class KddockwidgetsQt5 < Formula
desc "Advanced Dock Widget Framework for Qt5"
homepage "https://github.com/KDAB/KDDockWidgets"
url "https://github.com/KDAB/KDDockWidgets/releases/download/v2.0.0/kddockwidgets-2.0.0.tar.gz"
sha256 "10514846c8111812d575eaec701c7fef2d3a169d4ef2256fa50f52f70f508598"
url "https://github.com/KDAB/KDDockWidgets/releases/download/v2.1.0/kddockwidgets-2.1.0.tar.gz"
sha256 "cf3242b8fde8988b2661366b6a9597bcb67164074c4f31d03ec2999b475a25d7"
head "https://github.com/KDAB/KDDockWidgets.git"

depends_on "qt5" => "with-d-bus"
depends_on "qt@5" => "with-d-bus"
depends_on "cmake" => :build
depends_on "ninja" => :build


def install
system "cmake", ".", *std_cmake_args
system "make"
system "make", "install"
system "cmake", ".", "-G", "Ninja", "-DKDDockWidgets_NO_SPDLOG=ON", *std_cmake_args
system "ninja"
system "ninja", "install"
end

test do
system "make", "test"
system "ctest"
end
end
15 changes: 8 additions & 7 deletions kddockwidgets-qt6.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
class KddockwidgetsQt6 < Formula
desc "Advanced Dock Widget Framework for Qt6"
homepage "https://github.com/KDAB/KDDockWidgets"
url "https://github.com/KDAB/KDDockWidgets/releases/download/v2.0.0/kddockwidgets-2.0.0.tar.gz"
sha256 "10514846c8111812d575eaec701c7fef2d3a169d4ef2256fa50f52f70f508598"
url "https://github.com/KDAB/KDDockWidgets/releases/download/v2.1.0/kddockwidgets-2.1.0.tar.gz"
sha256 "cf3242b8fde8988b2661366b6a9597bcb67164074c4f31d03ec2999b475a25d7"
head "https://github.com/KDAB/KDDockWidgets.git"

depends_on "qt6" => "with-d-bus"
depends_on "qt@6" => "with-d-bus"
depends_on "cmake" => :build
depends_on "ninja" => :build

def install
system "cmake", ".", "-DKDDockWidgets_QT6=True", *std_cmake_args
system "make"
system "make", "install"
system "cmake", ".", "-G", "Ninja", "-DKDDockWidgets_NO_SPDLOG=ON", "-DKDDockWidgets_QT6=True", *std_cmake_args
system "ninja"
system "ninja", "install"
end

test do
system "make", "test"
system "ctest"
end
end
10 changes: 6 additions & 4 deletions kdmactouchbar-qt5.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ class KdmactouchbarQt5 < Formula
sha256 "d6ca70ab9ffbe12d247e19357c833561bb8cfe7ba1909c06962f009ee65e7a47"
head "https://github.com/KDAB/KDMacTouchBar.git"

depends_on "qt5" => "with-d-bus"
depends_on "qt@5" => "with-d-bus"
depends_on "cmake" => :build
depends_on "ninja" => :build


def install
system "cmake", ".", *std_cmake_args
system "make"
system "make", "install"
system "cmake", ".", "-G", "Ninja", *std_cmake_args
system "ninja"
system "ninja", "install"
end

end
10 changes: 6 additions & 4 deletions kdreports-qt4.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ class KdreportsQt4 < Formula

depends_on "qt" => "with-d-bus"
depends_on "cmake" => :build
depends_on "ninja" => :build


def install
system "cmake", ".", *std_cmake_args
system "make"
system "make", "install"
system "cmake", ".", "-G", "Ninja", *std_cmake_args
system "ninja"
system "ninja", "install"
end

test do
system "make", "test"
system "ctest"
end
end
12 changes: 7 additions & 5 deletions kdreports-qt5.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@ class KdreportsQt5 < Formula
sha256 "1e4c96564e016198fcd9d25b0047abe0a988be263239bb8d027f26b21f6f406c"
head "https://github.com/KDAB/KDReports.git"

depends_on "qt5" => "with-d-bus"
depends_on "qt@5" => "with-d-bus"
depends_on "cmake" => :build
depends_on "ninja" => :build


def install
system "cmake", ".", *std_cmake_args
system "make"
system "make", "install"
system "cmake", ".", "-G", "Ninja", *std_cmake_args
system "ninja"
system "ninja", "install"
end

test do
system "make", "test"
system "ctest"
end
end
Loading

0 comments on commit fd356af

Please sign in to comment.