Skip to content

Commit

Permalink
add casacore data again
Browse files Browse the repository at this point in the history
  • Loading branch information
d3v-null committed Jan 29, 2025
1 parent 4c0dd20 commit edeba36
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 16 deletions.
62 changes: 53 additions & 9 deletions .github/workflows/bottle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,28 @@ jobs:

- run: brew test-bot --only-setup Formula/*

- run: brew test-bot --only-tap-syntax

- run: brew test-bot --only-formulae Formula/aoflagger.rb Formula/birli.rb
- name: test-bot
run: |
brew tap mwatelescope/tap
# TODO: casacore aoflagger birli
for package in cfitsio_reentrant casacore-data; do
brew test-bot mwatelescope/tap/$package
done
- name: audit
run: |
for package in cfitsio_reentrant casacore-data casacore aoflagger birli; do
brew audit mwatelescope/tap/$package
done
- name: Get version number from current date
run: echo "DATE=$(date +'v%Y.%m.%d.%H.%M')" | tee -a "$GITHUB_ENV"

- name: get archive names
id: archive_names
run: |
# build casacore source first
brew install --build-from-source Formula/casacore.rb
brew install --build-from-source Formula/cfitsio_reentrant.rb
for package in aoflagger birli; do
brew install --build-bottle Formula/$package.rb
brew bottle --json Formula/$package.rb
for package in cfitsio_reentrant casacore-data casacore aoflagger birli; do
brew install --formula --build-bottle mwatelescope/tap/$package
brew bottle --json mwatelescope/tap/$.rb
echo "${package}_path=$(ls ${package}--*.bottle*.tar.gz)" | tee -a "$GITHUB_ENV"
done
Expand Down Expand Up @@ -85,3 +91,41 @@ jobs:
asset_path: ${{ env.birli_path }}
asset_name: ${{ env.birli_path }}
asset_content_type: application/gzip

# todo:
# - run: brew test-bot --only-formulae Formula/cfitsio_reentrant.rb Formula/casacore-data.rb
# Error: Unexpected bottle tarball: /Users/runner/work/homebrew-tap/homebrew-tap/cfitsio_reentrant--4.5.0_1.arm64_sonoma.bottle.1.tar.gz
# Error: Unexpected bottle JSON: /Users/runner/work/homebrew-tap/homebrew-tap/cfitsio_reentrant--4.5.0_1.arm64_sonoma.bottle.json
#
# - run: brew test-bot --only-formulae Formula/casacore.rb
# Error: Failed to load cask: Formula/casacore-data.rb
# Cask 'casacore-data' is unreadable: wrong constant name #<Class:0x00000001399f8c08>
# Error: Failed to load cask: Formula/casacore.rb
# Cask 'casacore' is unreadable: wrong constant name #<Class:0x0000000139ab83f0>
# Warning: Treating Formula/casacore.rb as a formula.
# Error: The `brew link` step did not complete successfully
# The formula built, but is not symlinked into /opt/homebrew
# Could not symlink include/fitsio.h
# Target /opt/homebrew/include/fitsio.h
# is a symlink belonging to cfitsio_reentrant. You can unlink it:
# brew unlink cfitsio_reentrant
# To force the link and overwrite all conflicting files:
# brew link --overwrite cfitsio
# To list all files that would be deleted:
# brew link --overwrite cfitsio --dry-run
# Possible conflicting files are:
# /opt/homebrew/include/fitsio.h -> /opt/homebrew/Cellar/cfitsio_reentrant/4.5.0_1/include/fitsio.h
# /opt/homebrew/include/fitsio2.h -> /opt/homebrew/Cellar/cfitsio_reentrant/4.5.0_1/include/fitsio2.h
# /opt/homebrew/include/longnam.h -> /opt/homebrew/Cellar/cfitsio_reentrant/4.5.0_1/include/longnam.h



# TODO:
# - run: brew test-bot --only-tap-syntax
# Error: 1 failed step!
# brew style mwatelescope/tap
# /opt/homebrew/Cellar/actionlint/1.7.7: 8 files, 5.0MB
# ../../../../../opt/homebrew/Library/Taps/mwatelescope/homebrew-tap/.github/workflows/bottle.yml:39:9: shellcheck reported issue in this script: SC1089:error:1:100: Parsing stopped here. Is this keyword correctly matched up? [shellcheck]
# |
# 39 | - run:
# | ^~~~
2 changes: 1 addition & 1 deletion Formula/aoflagger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ class Aoflagger < Formula
depends_on "pybind11" => :build if build.with?("python")

depends_on "boost"
depends_on "cfitsio_reentrant"
depends_on "fftw"
depends_on "lapack"
depends_on "libpng"
depends_on "[email protected]"
depends_on "mwatelescope/tap/casacore"
depends_on "mwatelescope/tap/cfitsio_reentrant"
depends_on "hdf5" => :optional

def install
Expand Down
9 changes: 7 additions & 2 deletions Formula/birli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ class Birli < Formula
sha256 "4b0a14f6bbd12e292d04eaa9791597a6d08f9fa044c9ba6dba8e06f796544bb9"
license "MPL-2.0"

head "https://github.com/MWATelescope/Birli.git"
head "https://github.com/MWATelescope/Birli.git", branch: "main"

depends_on "automake" => :build
depends_on "rust" => :build
depends_on "gcc" => :test
depends_on "aoflagger"
depends_on "cfitsio_reentrant"
depends_on "mwatelescope/tap/cfitsio_reentrant"

def install
with_env(
Expand All @@ -23,4 +23,9 @@ def install
end
bin.install "target/release/birli"
end

test do
system "cargo", "test", "--locked", "--release"
system "target/release/birli", "--help"
end
end
53 changes: 53 additions & 0 deletions Formula/casacore-data.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# source: https://github.com/casacore/homebrew-tap/blob/e104598bbfe44e17a07d59c8bdb6a3559b527c67/Formula/casacore-data.rb
class ZtarDownloadStrategy < CurlDownloadStrategy
def stage(&block)
UnpackStrategy::Tar.new(cached_location).extract(basename:, verbose: verbose?)
chdir(&block)
end
end

class CasacoreData < Formula
desc "Ephemerides and geodetic data for casacore measures (via Astron)"
homepage "https://github.com/casacore/casacore"
# curl ftp://[email protected]/outgoing/Measures/
url "ftp://[email protected]/outgoing/Measures/WSRT_Measures_20250128-160001.ztar", using: ZtarDownloadStrategy
# curl -s 'ftp://[email protected]/outgoing/Measures/WSRT_Measures_20250128-160001.ztar' | sha256 -
sha256 "5835e3f5458d8f88fd057044a891d26a5cbfdec9a865967b1189d4fd52140c80"
head "ftp://ftp.astron.nl/outgoing/Measures/WSRT_Measures.ztar", using: ZtarDownloadStrategy

option "with-casapy", "Use Mac CASA.App (aka casapy) data directory if found"

deprecated_option "use-casapy" => "with-casapy"

APP_DIR = (Pathname.new "/Applications").freeze
CASAPY_APP_NAME = "CASA.app".freeze
CASAPY_APP_DIR = (APP_DIR / CASAPY_APP_NAME).freeze
CASAPY_DATA = (CASAPY_APP_DIR / "Contents/data").freeze

def install
if build.with? "casapy"
if !Dir.exist? CASAPY_APP_DIR
odie "--with-casapy was specified, but #{CASAPY_APP_NAME} was not found in #{APP_DIR}"
elsif !Dir.exist? CASAPY_DATA
odie "--with-casapy was specified, but data directory not found at #{CASAPY_DATA}"
end
prefix.install_symlink CASAPY_DATA
else
(prefix / CASAPY_DATA.basename).install Dir["*"]
end
end

def caveats
data_dir = prefix / CASAPY_DATA.basename
if File.symlink? data_dir
"Linked to CASA data directory (#{CASAPY_DATA}) from #{data_dir}"
else
"Installed latest Astron WSRT_Measures tarball to #{data_dir}"
end
end

test do
Dir.exist? (prefix / CASAPY_DATA.basename / "ephemerides")
Dir.exist? (prefix / CASAPY_DATA.basename / "geodetic")
end
end
7 changes: 4 additions & 3 deletions Formula/casacore.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
# source: https://github.com/casacore/homebrew-tap/blob/e104598bbfe44e17a07d59c8bdb6a3559b527c67/Formula/casacore.rb
class Casacore < Formula
desc "Suite of C++ libraries for radio astronomy data processing"
homepage "https://github.com/casacore/casacore"
url "https://github.com/casacore/casacore/archive/refs/tags/v3.6.1.tar.gz"
sha256 "480d3340fa17e9ba67f18efbaff4bbb272a01d1f400d2295c0b6c86eb7abcf82"
head "https://github.com/casacore/casacore.git"
head "https://github.com/casacore/casacore.git", branch: "master"

option "without-python", "Build without Python bindings"

depends_on "cmake" => :build
depends_on "casacore/tap/casacore-data"
depends_on "cfitsio_reentrant"
depends_on "fftw"
depends_on "gcc" # for gfortran
depends_on "gsl"
depends_on "hdf5"
depends_on "mwatelescope/tap/casacore-data"
depends_on "mwatelescope/tap/cfitsio_reentrant"
depends_on "ncurses"
depends_on "openblas"
depends_on "readline"
Expand Down
1 change: 0 additions & 1 deletion Formula/cfitsio_reentrant.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
class CfitsioReentrant < Formula
desc "C access to FITS data files with optional Fortran wrappers with reentrant"
# https://heasarc.gsfc.nasa.gov/fitsio/c/c_user/node15.html
homepage "https://heasarc.gsfc.nasa.gov/docs/software/fitsio/fitsio.html"
url "https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio-4.5.0.tar.gz"
sha256 "e4854fc3365c1462e493aa586bfaa2f3d0bb8c20b75a524955db64c27427ce09"
Expand Down

0 comments on commit edeba36

Please sign in to comment.