diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 83bd0ad..d90e972 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -13,13 +13,16 @@ jobs: fail-fast: false matrix: package: - - skyfield-data - - kosmorrolib - - kosmorro + - pypi: skyfield-data + recipe: python3-skyfield-data + - pypi: kosmorrolib + recipe: python3-kosmorrolib + - pypi: kosmorro + recipe: kosmorro type: - deb - - name: "${{ matrix.package }} (${{ matrix.type }})" + + name: "${{ matrix.package.pypi }} (${{ matrix.type }})" steps: - uses: actions/checkout@v5 @@ -28,12 +31,12 @@ jobs: python-version: "3.x" - run: | - pip install ${{ matrix.package }} + pip install ${{ matrix.package.pypi }} - run: | sudo apt update - sudo apt install dpkg fakeroot lintian - - - run: make ${{ matrix.package }}.deb + sudo apt install ronn dpkg fakeroot lintian + + - run: make ${{ matrix.package.recipe }}.deb - - run: lintian -i ${{ matrix.package }}_*.deb \ No newline at end of file + - run: lintian -i ${{ matrix.package.recipe }}_*.deb diff --git a/Makefile b/Makefile index 275aafd..5e0c704 100644 --- a/Makefile +++ b/Makefile @@ -12,19 +12,24 @@ clean: ####################### .PHONY: deb -deb: skyfield-data.deb kosmorrolib.deb kosmorro.deb +deb: python3-skyfield-data.deb python3-kosmorrolib.deb kosmorro.deb -skyfield-data.deb: +python3-skyfield-data.deb: mkdir -p skyfield-data-deb/DEBIAN mkdir -p skyfield-data-deb/usr/bin + mkdir -p skyfield-data-deb/usr/share/doc/python3-skyfield-data mkdir -p skyfield-data-deb/usr/lib/python3/dist-packages pip install --target=tmp skyfield-data + rm -rf tmp/skyfield_data/__pycache__ cp -r tmp/skyfield_data skyfield-data-deb/usr/lib/python3/dist-packages cp -r tmp/skyfield_data-$(SKYFIELD_DATA_VERSION).dist-info skyfield-data-deb/usr/lib/python3/dist-packages cp deb/skyfield-data/control skyfield-data-deb/DEBIAN/control + curl https://raw.githubusercontent.com/brunobord/skyfield-data/refs/tags/$(SKYFIELD_DATA_VERSION)/CHANGELOG.md | python deb/mkchangelogs.py python3-skyfield-data Deuchnord "jerome@deuchnord.fr" | gzip -9 > skyfield-data-deb/usr/share/doc/python3-skyfield-data/changelog.gz + curl https://raw.githubusercontent.com/brunobord/skyfield-data/refs/tags/$(SKYFIELD_DATA_VERSION)/COPYING > skyfield-data-deb/usr/share/doc/python3-skyfield-data/copyright + sed -i "s/Version: __VERSION__/Version: $(SKYFIELD_DATA_VERSION)/" skyfield-data-deb/DEBIAN/control fakeroot dpkg-deb --build skyfield-data-deb @@ -32,17 +37,23 @@ skyfield-data.deb: rm -rf skyfield-data-deb tmp -kosmorrolib.deb: +python3-kosmorrolib.deb: mkdir -p kosmorrolib-deb/DEBIAN mkdir -p kosmorrolib-deb/usr/bin + mkdir -p kosmorrolib-deb/usr/share/doc/python3-kosmorrolib mkdir -p kosmorrolib-deb/usr/lib/python3/dist-packages pip install --target=tmp kosmorrolib + rm -rf tmp/kosmorrolib/__pycache__ cp -r tmp/kosmorrolib kosmorrolib-deb/usr/lib/python3/dist-packages cp -r tmp/kosmorrolib-$(KOSMORROLIB_VERSION).dist-info kosmorrolib-deb/usr/lib/python3/dist-packages cp deb/kosmorrolib/control kosmorrolib-deb/DEBIAN/control + curl https://raw.githubusercontent.com/Kosmorro/lib/refs/tags/v$(KOSMORROLIB_VERSION)/CHANGELOG.md | python deb/mkchangelogs.py python3-kosmorrolib Deuchnord "jerome@deuchnord.fr" | gzip -9 > kosmorrolib-deb/usr/share/doc/python3-kosmorrolib/changelog.gz + curl https://raw.githubusercontent.com/Kosmorro/lib/refs/tags/v$(KOSMORROLIB_VERSION)/LICENSE.md > kosmorrolib-deb/usr/share/doc/python3-kosmorrolib/copyright + + sed -i "s/Version: __VERSION__/Version: $(KOSMORROLIB_VERSION)/" kosmorrolib-deb/DEBIAN/control fakeroot dpkg-deb --build kosmorrolib-deb @@ -54,13 +65,21 @@ kosmorrolib.deb: kosmorro.deb: mkdir -p kosmorro-deb/DEBIAN mkdir -p kosmorro-deb/usr/bin + mkdir -p kosmorro-deb/usr/share/doc/kosmorro + mkdir -p kosmorro-deb/usr/share/man/man1 mkdir -p kosmorro-deb/usr/lib/python3/dist-packages pip install --target=tmp kosmorro + rm -rf tmp/kosmorro/__pycache__ tmp/kosmorro/i18n/__pycache__ cp -r tmp/kosmorro kosmorro-deb/usr/lib/python3/dist-packages cp -r tmp/kosmorro-$(KOSMORRO_VERSION).dist-info kosmorro-deb/usr/lib/python3/dist-packages cp tmp/bin/kosmorro kosmorro-deb/usr/bin/kosmorro + + curl https://raw.githubusercontent.com/Kosmorro/kosmorro/refs/tags/v$(KOSMORRO_VERSION)/manpage/kosmorro.1.md | ronn --roff | gzip -9 > kosmorro-deb/usr/share/man/man1/kosmorro.1.gz + curl https://raw.githubusercontent.com/Kosmorro/kosmorro/refs/tags/v$(KOSMORRO_VERSION)/CHANGELOG.md | python deb/mkchangelogs.py python3-kosmorro Deuchnord "jerome@deuchnord.fr" | gzip -9 > kosmorro-deb/usr/share/doc/kosmorro/changelog.gz + curl https://raw.githubusercontent.com/Kosmorro/kosmorro/refs/tags/v$(KOSMORRO_VERSION)/LICENSE.md > kosmorro-deb/usr/share/doc/kosmorro/copyright + cp deb/kosmorro/control kosmorro-deb/DEBIAN/control chmod +x kosmorro-deb/usr/bin/kosmorro @@ -71,4 +90,4 @@ kosmorro.deb: fakeroot dpkg-deb --build kosmorro-deb mv kosmorro-deb.deb kosmorro_$(KOSMORRO_VERSION)_all.deb - rm -rf kosmorro-deb tmp \ No newline at end of file + rm -rf kosmorro-deb tmp diff --git a/deb/kosmorro/control b/deb/kosmorro/control index a5fad93..cb321f4 100644 --- a/deb/kosmorro/control +++ b/deb/kosmorro/control @@ -1,8 +1,16 @@ Package: kosmorro +Homepage: https://kosmorro.space Version: __VERSION__ Section: science Priority: optional Architecture: all Depends: python3, python3-kosmorrolib, python3-termcolor, python3-tabulate, python3-dateutil, python3-babel Maintainer: Deuchnord -Description: A program to calculate the ephemerides +Description: Ephemerides calculation program + Kosmorro is a program that calculates your astronomical ephemerides. + It provides the following features: + - Calculate the rise, culmination and set times for any date and any position + on Earth + - Get informed about interesting astronomical events + - Generate a PDF with all the information needed for your observation nights + All calculations are made offline, no Internet connection needed. diff --git a/deb/kosmorrolib/control b/deb/kosmorrolib/control index f0eb099..591e576 100644 --- a/deb/kosmorrolib/control +++ b/deb/kosmorrolib/control @@ -1,8 +1,17 @@ Package: python3-kosmorrolib +Homepage: https://kosmorro.space/lib Version: __VERSION__ Section: science Priority: optional Architecture: all Depends: python3, python3-skyfield, python3-skyfield-data, python3-dateutil Maintainer: Deuchnord -Description: A program to calculate the ephemerides +Description: Ephemerides calculation library + Kosmorrolib is a simple library that allows you to calculate astronomical + ephemerides. + It provides the following features: + - Calculate the rise, culmination and set times for any date and any position + on Earth + - Get informed about interesting astronomical events + - Generate a PDF with all the information needed for your observation nights + All calculations are made offline, no Internet connection needed. diff --git a/deb/mkchangelogs.py b/deb/mkchangelogs.py new file mode 100644 index 0000000..ad3ec66 --- /dev/null +++ b/deb/mkchangelogs.py @@ -0,0 +1,52 @@ +import sys +import re +import datetime +import time +import textwrap + +from argparse import ArgumentParser +from email import utils + +def main() -> int: + args = ArgumentParser(description="Generate a Debian-compatible changelog from a Markdown changelog file") + args.add_argument("package", type=str) + args.add_argument("maintainer_name", type=str) + args.add_argument("maintainer_email", type=str) + args = args.parse_args() + + started_list = False + change_lines = [] + version = None + date = None + + for line in sys.stdin: + markdown_line = line.strip() + if not started_list: + started_list = markdown_line.startswith(("* ", "- ")) + if not started_list: + if version is None and date is None and markdown_line.startswith(("# ", "## ")): + m = re.findall(r"(\d+\.\d+\.\d+).*\((\d+-\d+-\d+)\)$", markdown_line) + if len(m) == 1: + version, date = m[0] + date = datetime.datetime.fromisoformat(date) + date = utils.formatdate(float(date.strftime("%s")), localtime=True) + + continue + + if not markdown_line.startswith(("* ", "- ")): + break + + for l in textwrap.wrap(markdown_line, width=78): + change_lines.append(textwrap.indent(l, " ")) + + print(f"{args.package} ({version}) all; urgency=medium") + print() + print("\n".join(change_lines)) + print() + print(f" -- {args.maintainer_name} <{args.maintainer_email}> {date}") + + return 0 + + +if __name__ == "__main__": + exit(main()) diff --git a/deb/skyfield-data/control b/deb/skyfield-data/control index 324b405..b73700e 100644 --- a/deb/skyfield-data/control +++ b/deb/skyfield-data/control @@ -1,8 +1,26 @@ Package: python3-skyfield-data +Homepage: https://pypi.org/project/skyfield-data Version: __VERSION__ Section: science Priority: optional Architecture: all Depends: python3 Maintainer: Deuchnord -Description: A program to calculate the ephemerides +Description: Minimal data files to work with python3-skyfield + Skyfield is a Python library for astronomical computations. + It depends on various data files to accurately compute moon phases, planet + positions, etc. + Several issues are raised by these data files: + - If they're not found in the path of the Loader, they're downloaded at + runtime. Depending on the archive you're requesting, some files might be + very large, causing a long delay (directly related to your network + bandwidth). In the case of a web server app, you'd cause a timeout on + client's end. + - They come mainly from 2 sources: NASA's JPL, and the IERS. If one of them + is temporarily unavailable, you couldn't perform any computation. + - In some countries, or behind some filtering proxies, some hosts may be + blocked. + - These files have an expiration date (in a more or less distant future). As + a consequence, even if the files are already downloaded in the right path, + at each runtime you could possibly have to download one or more files + before making any computation using them.