[PATCH 0/2]: gnu: Add aoflagger

DoneSubmitted by Sharlatan Hellseher.
Details
2 participants
  • Ludovic Courtès
  • Sharlatan Hellseher
Owner
unassigned
Severity
normal
S
S
Sharlatan Hellseher wrote on 26 Jun 19:43 +0200
(address . guix-patches@gnu.org)
CAO+9K5p-3mAFXtHwKqTidGB-KOfGmUcbX970NBZ5=Xs1ctijpQ@mail.gmail.com
Hi Guix team!
Here is a package depending on recently accepted Casacore - AOFlagger.
This series includes one source only package AOCommon, It's my first
time I packed such package type, I hope I made it correct.
Sharlatan Hellseher (2):
gnu: Add aocommon
gnu: Add aoflagger
gnu/packages/astronomy.scm | 90 +++++++++++++++++++
...flagger-use-system-provided-pybind11.patch | 38 ++++++++
2 files changed, 128 insertions(+)
create mode 100644
gnu/packages/patches/aoflagger-use-system-provided-pybind11.patch
base-commit: cbf02f10d7264d14accdc16b522077c8f857240f
--
… наш разум - превосходная объяснительная машина которая способна
найти смысл почти в чем угодно, истолковать любой феномен, но
совершенно не в состоянии принять мысль о непредсказуемости.
S
S
Sharlatan Hellseher wrote on 26 Jun 19:45 +0200
[PATCH 1/2]: gnu: Add aocommon
(address . 56238@debbugs.gnu.org)
CAO+9K5rd+SBEn4kkZ7qT5-AifO_GGG7_ePezu-twNhgfm2QGVQ@mail.gmail.com
--
… наш разум - превосходная объяснительная машина которая способна
найти смысл почти в чем угодно, истолковать любой феномен, но
совершенно не в состоянии принять мысль о непредсказуемости.
From 8f5a5dd88aa45b3048940c6d4a00d035007a8daa Mon Sep 17 00:00:00 2001
From: Sharlatan Hellseher <sharlatanus@gmail.com>
Date: Sun, 26 Jun 2022 18:25:12 +0100
Subject: [PATCH 1/2] gnu: Add aocommon

* gnu/packages/astronomy.scm (aocommon): New variable.
---
gnu/packages/astronomy.scm | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)

Toggle diff (40 lines)
diff --git a/gnu/packages/astronomy.scm b/gnu/packages/astronomy.scm
index 61c10c985f..27f7fa1c3b 100644
--- a/gnu/packages/astronomy.scm
+++ b/gnu/packages/astronomy.scm
@@ -78,6 +78,33 @@ (define-module (gnu packages astronomy)
   #:use-module (ice-9 match)
   #:use-module (srfi srfi-1))
 
+(define-public aocommon
+  (let ((commit "7329a075271edab8f6264db649e81e62b2b6ae5e")
+        (revision "1"))
+    (package
+      (name "aocommon")
+      (version (git-version "0.0.0" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://gitlab.com/aroffringa/aocommon")
+               (commit commit)))
+         (sha256
+          (base32 "0qcfax6pbzs0yigy0x8xibrkk539wm2pbvjsb4lh50fybir02nix"))
+         (file-name (git-file-name name version))))
+      (build-system copy-build-system)
+      (arguments
+       (list #:install-plan
+             #~'(("include/aocommon" "include/aocommon"))))
+      (home-page "https://gitlab.com/aroffringa/aocommon")
+      (synopsis "Collection of functionality that is reused in astronomical applications")
+      (description
+       "This package provides source-only AOCommon collection of functionality that is
+reused in several astronomical applications, such as @code{wsclean},
+@code{aoflagger}, @code{DP3} and @code{everybeam}.")
+      (license license:gpl3))))
+
 (define-public calceph
   (package
     (name "calceph")
-- 
2.36.0
S
S
Sharlatan Hellseher wrote on 26 Jun 19:46 +0200
[PATCH 2/2]: gnu: Add aoflagger
(address . 56238@debbugs.gnu.org)
CAO+9K5p2r_9OnfNxSxJ5CXOceLAFFYD8VCHU3m2Gp+=rPwWAsg@mail.gmail.com
--
… наш разум - превосходная объяснительная машина которая способна
найти смысл почти в чем угодно, истолковать любой феномен, но
совершенно не в состоянии принять мысль о непредсказуемости.
From bec695ac513c9f2e187484863f6c6e8e375ba2c4 Mon Sep 17 00:00:00 2001
From: Sharlatan Hellseher <sharlatanus@gmail.com>
Date: Sun, 26 Jun 2022 18:34:58 +0100
Subject: [PATCH 2/2] gnu: Add aoflagger

* gnu/packages/astronomy.scm (aoflagger): New vaiable
* gnu/packages/patches (aoflagger-use-system-provided-pybind11.patch):
Releated patch.
---
gnu/packages/astronomy.scm | 63 +++++++++++++++++++
...flagger-use-system-provided-pybind11.patch | 38 +++++++++++
2 files changed, 101 insertions(+)
create mode 100644 gnu/packages/patches/aoflagger-use-system-provided-pybind11.patch

Toggle diff (120 lines)
diff --git a/gnu/packages/astronomy.scm b/gnu/packages/astronomy.scm
index 27f7fa1c3b..afa2733c1a 100644
--- a/gnu/packages/astronomy.scm
+++ b/gnu/packages/astronomy.scm
@@ -140,6 +140,69 @@ (define-public calceph
 @end itemize\n")
     (license license:cecill)))
 
+(define-public aoflagger
+  (package
+    (name "aoflagger")
+    (version "3.2.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://gitlab.com/aroffringa/aoflagger")
+             (commit (string-append "v" version))))
+       (sha256
+        (base32 "1dcbfrbiybhpbypna2xhddx1wk7yifh38ha2r6p5rzsikzwlsin1"))
+       (patches
+        (search-patches "aoflagger-use-system-provided-pybind11.patch"))
+       (file-name (git-file-name name version))))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      ;; NOTE: (Sharlatan-20220626T175728+0100): Tests require external files
+      ;; download from https://www.astron.nl/citt/ci_data/aoflagger/
+      ;; FIXME: runtest is not found
+      #:tests? #f
+      #:configure-flags
+      #~(list (string-append "-DCASACORE_ROOT_DIR="
+                             #$(this-package-input "casacore")))
+      #:phases
+      #~(modify-phases %standard-phases
+          ;; NOTE: (Sharlatan-20220626T163240+0100): aocommon and pybind11 are
+          ;; expected to be found as git submodules, link them before build.
+          (add-after 'unpack 'link-submodule-package
+            (lambda _
+              (rmdir "external/aocommon")
+              (symlink #$(this-package-native-input "aocommon")
+                       (string-append (getcwd) "/external/aocommon")))))))
+    (native-inputs
+     (list aocommon
+           boost
+           pkg-config
+           python
+           pybind11))
+    (inputs
+     (list casacore
+           cfitsio
+           fftw
+           gsl
+           gtkmm-3
+           hdf5
+           lapack
+           libpng
+           libsigc++
+           libxml2
+           lua
+           openblas
+           zlib))
+    (home-page "https://gitlab.com/aroffringa/aoflagger")
+    (synopsis "Astronomical tool that can find and remove radio-frequency interference")
+    (description
+     "AOFlagger is a tool that can find and remove radio-frequency
+interference (RFI) in radio astronomical observations.  It can make use of Lua
+scripts to make flagging strategies flexible, and the tools are applicable to a
+wide set of telescopes.")
+    (license license:gpl3+)))
+
 (define-public casacore
   (package
     (name "casacore")
diff --git a/gnu/packages/patches/aoflagger-use-system-provided-pybind11.patch b/gnu/packages/patches/aoflagger-use-system-provided-pybind11.patch
new file mode 100644
index 0000000000..76bc52a4ba
--- /dev/null
+++ b/gnu/packages/patches/aoflagger-use-system-provided-pybind11.patch
@@ -0,0 +1,38 @@
+This patch was borrowed from Debian's package:
+https://salsa.debian.org/debian-astro-team/aoflagger/-/blob/0484ef75a663e3e07738550cdade46f433a53dac/debian/patches/Use-system-provided-pybind11.patch
+Description: Use system provided pybind11
+Author: Ole Streicher <olebole@debian.org>
+Origin: Debian
+Last-Update: Mon, 30 Aug 2021 11:05:37 +0200
+---
+ CMakeLists.txt | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 655ea5e..824ee2a 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -62,11 +62,6 @@ foreach(ExternalSubmodule IN LISTS ExternalSubmoduleDirectories)
+   endif()
+ endforeach()
+ 
+-# Include aocommon/pybind11 headers
+-include_directories("${CMAKE_SOURCE_DIR}/external/aocommon/include")
+-add_subdirectory("${CMAKE_SOURCE_DIR}/external/pybind11")
+-include_directories(SYSTEM ${pybind11_INCLUDE_DIR})
+-
+ find_package(
+   HDF5
+   COMPONENTS C CXX
+@@ -101,6 +96,11 @@ find_package(PythonInterp REQUIRED)
+ message(STATUS "Using python version ${PYTHON_VERSION_STRING}")
+ include_directories(SYSTEM ${PYTHON_INCLUDE_DIRS})
+ 
++# Include pybind11 headers
++find_package(pybind11 REQUIRED)
++include_directories("${CMAKE_SOURCE_DIR}/external/aocommon/include")
++include_directories(${pybind11_INCLUDE_DIR})
++
+ # boost::alignment requires Boost 1.56
+ find_package(Boost 1.56.0 REQUIRED COMPONENTS date_time filesystem system
+                                               unit_test_framework)
-- 
2.36.0
L
L
Ludovic Courtès wrote on 4 Aug 11:45 +0200
Re: bug#56238: [PATCH 0/2]: gnu: Add aoflagger
(name . Sharlatan Hellseher)(address . sharlatanus@gmail.com)(address . 56238-done@debbugs.gnu.org)
87h72sny01.fsf@gnu.org
Hi!

Sharlatan Hellseher <sharlatanus@gmail.com> skribis:

Toggle quote (3 lines)
> gnu: Add aocommon
> gnu: Add aoflagger

Finally applied, thanks!

I had to tweak a couple of things: change aocommon license to ‘gpl3+’
(since nothing says “version 3 only”), add missing #:use-module (guix
build-system copy), tweak description of aoflagger so it starts with an
actual sentence.

I took the liberty to remove timestamps like
“(Sharlatan-20220626T175728+0100)” from the comments: they’re
unnecessary (one can use ‘git annotate’), and given that repository
maintenance is a collective effort, having names associated with comment
doesn’t seem like a good idea.

Thanks,
Ludo’.
Closed
?