Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework archive names and version numbering; generate archives through Meson #200

Merged
merged 5 commits into from
Dec 7, 2023

Conversation

bgilbert
Copy link
Member

@bgilbert bgilbert commented Dec 7, 2023

Change sdist names to openslide-bin-<version>.tar.gz and bdist names to openslide-bin-<version>-<platform>-<arch>.<ext> (currently -windows-x64.zip).

Change versions to <openslide-version>.<release>+<suffix>, e.g. 4.0.0.1+20231207.nightly, for clarity and for compatibility with Python package versioning.

Generate bdist archives as a Meson artifact, rather than in build.sh, allowing us to avoid the meson install step.

Generate sdist archives with meson dist rather than building them ourselves. Switch the archive format to tar.gz for compatibility with Python source distributions. Meson distributes subproject sources as unpacked file trees, so we lose some compression ratio this way, but the difference isn't too substantial. Embed the configured version suffix in the sdist archive and reuse it by default (with .local appended) during bdist.

Drop the -s option for suffixing OpenSlide's version string, and do this automatically from the OpenSlide commit hash if OpenSlide is overridden.

Include support for building Linux and macOS tar.xz archives.  Change the
filename of the Windows ZIP to fully spell out the OS and CPU
architecture, and to place the version number before the platform name.
Add a machine file property specifying the platform name for use in the
archive filename.

By generating the archive inside Meson, we can avoid running
`meson install` and copying files out of the resulting directory tree.
Remove install configuration for artifacts we've generated.

Since we're not installing, we need to handle operations that Meson would
normally perform at install time, such as updating RPATHs (in
postprocess-binary.py), creating compatibility symlinks to libraries (in
write-bdist.py), and copying the import library (in
write-import-library.py).  We also need to extract the external headers
from the OpenSlide subproject, which is supported via the existing
openslide-bdist.patch.

Signed-off-by: Benjamin Gilbert <[email protected]>
Reuse existing Meson functionality, rather than manually maintaining a
list of files to include in the archive.  As a consequence, rather than
shipping a nested compressed tarball for each dependency, ship the actual
unpacked source trees.

Meson supports tar.xz, tar.gz, and ZIP.  It's no longer necessary for the
sdist archive format to be natively supported by Windows, since Windows
builds now always use a Linux container.  ZIP is less efficient because
each file is compressed individually, so avoid it.  tar.xz would be ideal,
but PyPI requires tar.gz, and it would be nice to reuse the same sdist
archive when we add support for Python wheels.  The source archive
shouldn't be used too often, so avoid generating both tar.gz and tar.xz
archives and accept the lower compression ratio.

Embed the currently configured version number in the generated source
archive.  When building from a source archive, allow overriding the
version in the usual way; otherwise append "-local" to the embedded
version, if missing, to make it clear that the resulting bdist is a
rebuild.  This prevents builds of old sdists from using a version derived
from the current date.

Normally, each platform build only enables the dependencies needed for
that platform.  The Windows build currently enables all dependencies, but
that may not always be true.  Add a Meson option that enables all
dependencies, for use when generating sdist archives, so they all end up
in the tarball.

When working from an unpacked sdist archive, avoid purging subproject
sources, since those are now canonical.

Closes: openslide#159
Signed-off-by: Benjamin Gilbert <[email protected]>
The "-" in the current versioning scheme (for builds other than official
releases) isn't compatible with Python package versioning:

    https://packaging.python.org/en/latest/specifications/version-specifiers/

This will matter when we're releasing Python wheels.  Also, datestamps
don't make it especially clear what's changed since the last release.

Define an openslide-bin version consisting of the OpenSlide version
number, plus a fourth component which represents the openslide-bin package
release and starts from 1.  For builds other than official releases,
append "+" followed by a suffix, which normally consists of a datestamp
plus ".local" but can be overridden with the "-x" option.  Nightly builds
will use a datestamp plus ".nightly".

Update the version embedding mechanism for sdist archives to embed the
suffix (or lack of one) instead of the complete version string.

Add a `version` subcommand to report the calculated version string,
optionally with the specified suffix.

Fixes: openslide#193
Signed-off-by: Benjamin Gilbert <[email protected]>
Confusingly, we now have two suffixes: the one appended to the version
number in artifact names (`+<datestamp>.local`) and the one appended to
the OpenSlide version number (7 characters of the OpenSlide commit hash).
build.sh can calculate the latter by examining the override directory,
rather than requiring CI to pass it in, so do that to simplify.

Signed-off-by: Benjamin Gilbert <[email protected]>
We're about to add other platforms.

Signed-off-by: Benjamin Gilbert <[email protected]>
@openslide-bot
Copy link
Contributor

DCO signed off ✔️

All commits have been signed off. You have certified to the terms of the Developer Certificate of Origin, version 1.1. In particular, you certify that this contribution has not been developed using information obtained under a non-disclosure agreement or other license terms that forbid you from contributing it under the GNU Lesser General Public License, version 2.1.

@bgilbert bgilbert merged commit 16ceb66 into openslide:main Dec 7, 2023
12 checks passed
@bgilbert bgilbert deleted the meson branch December 7, 2023 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants