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

Snap improvements #4298

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open

Commits on Aug 9, 2024

  1. snap: Switch Leptonica source to Git repository

    This patch mitigates risk of supply chain attack via tainted source
    release packages(e.g. CVE-2024-3094).
    
    Signed-off-by: 林博仁(Buo-ren Lin) <[email protected]>
    brlin-tw committed Aug 9, 2024
    Configuration menu
    Copy the full SHA
    b613c6d View commit details
    Browse the repository at this point in the history
  2. snap: Fix Leptonica part not build with OpenJPEG support

    This patch addresses the following Snapcraft linter warning:
    
    ```
    - library: libopenjp2.so.7: unused library 'usr/lib/x86_64-linux-gnu/libo
    penjp2.so.2.4.0'. (https://snapcraft.io/docs/linters-library)
    ```
    
    Signed-off-by: 林博仁(Buo-ren Lin) <[email protected]>
    brlin-tw committed Aug 9, 2024
    Configuration menu
    Copy the full SHA
    66afa2c View commit details
    Browse the repository at this point in the history
  3. snap: Fix missing {build,stage}-packages declaration for the Leptonic…

    …a part
    
    Signed-off-by: 林博仁(Buo-ren Lin) <[email protected]>
    brlin-tw committed Aug 9, 2024
    Configuration menu
    Copy the full SHA
    0649d0f View commit details
    Browse the repository at this point in the history
  4. snap: Ensure Leptonica features we need are built

    Signed-off-by: 林博仁(Buo-ren Lin) <[email protected]>
    brlin-tw committed Aug 9, 2024
    Configuration menu
    Copy the full SHA
    7e9dd2d View commit details
    Browse the repository at this point in the history
  5. snap: Optimize Leptonica part

    * Reduce part pull time by limiting the history depth to clone
    * Reduce part build time by disable components that we don't need.
    * Reduce overall snap size by only shipping files that are needed in
     runtime.
    
    Signed-off-by: 林博仁(Buo-ren Lin) <[email protected]>
    brlin-tw committed Aug 9, 2024
    Configuration menu
    Copy the full SHA
    064a6b0 View commit details
    Browse the repository at this point in the history
  6. snap: Update Leptonica to 1.84.1 version

    This is the current latest version.
    
    Signed-off-by: 林博仁(Buo-ren Lin) <[email protected]>
    brlin-tw committed Aug 9, 2024
    Configuration menu
    Copy the full SHA
    8d9174a View commit details
    Browse the repository at this point in the history
  7. snap: Fix missing WebP support in the Leptonica part

    Signed-off-by: 林博仁(Buo-ren Lin) <[email protected]>
    brlin-tw committed Aug 9, 2024
    Configuration menu
    Copy the full SHA
    b28ab15 View commit details
    Browse the repository at this point in the history
  8. snap: Fix missing stage-packages of the Tesseract part

    The application is still runnable due to some of the packages are
    already staged by the Leptonica part, however it should still be
    declared for clarity.
    
    Signed-off-by: 林博仁(Buo-ren Lin) <[email protected]>
    brlin-tw committed Aug 9, 2024
    Configuration menu
    Copy the full SHA
    ef199ef View commit details
    Browse the repository at this point in the history
  9. snap: Reduce package size by stripping out files not used in runtime

    This change reduces package size by 44%(73637888 -> 40894464).
    
    Signed-off-by: 林博仁(Buo-ren Lin) <[email protected]>
    brlin-tw committed Aug 9, 2024
    Configuration menu
    Copy the full SHA
    8782ee4 View commit details
    Browse the repository at this point in the history
  10. snap: Drop unused training tools build/runtime dependencies

    Currently this feature isn't exposed to the host, dropping the
    dependencies to reduce built package size.
    
    Signed-off-by: 林博仁(Buo-ren Lin) <[email protected]>
    brlin-tw committed Aug 9, 2024
    Configuration menu
    Copy the full SHA
    19270b4 View commit details
    Browse the repository at this point in the history
  11. snap: Explicitly declare features we don't want to be build

    Previously this is implicitly configured as the build dependency isn't
    available and the training tools build target isn't called.
    
    Signed-off-by: 林博仁(Buo-ren Lin) <[email protected]>
    brlin-tw committed Aug 9, 2024
    Configuration menu
    Copy the full SHA
    db818ac View commit details
    Browse the repository at this point in the history
  12. snap: Disable unused features to reduce snap size and built time

    Signed-off-by: 林博仁(Buo-ren Lin) <[email protected]>
    brlin-tw committed Aug 9, 2024
    Configuration menu
    Copy the full SHA
    7a7a984 View commit details
    Browse the repository at this point in the history
  13. snap: Fix incorrect dependency declaration for the Tesseract part

    The zlib library is Leptonica's dependency, not Tesseract's.
    
    Signed-off-by: 林博仁(Buo-ren Lin) <[email protected]>
    brlin-tw committed Aug 9, 2024
    Configuration menu
    Copy the full SHA
    7d2ba18 View commit details
    Browse the repository at this point in the history
  14. snap: Drop incorrect build-packages declaration of the Tesseract part

    These should be Leptonica part's build dependencies.
    
    Signed-off-by: 林博仁(Buo-ren Lin) <[email protected]>
    brlin-tw committed Aug 9, 2024
    Configuration menu
    Copy the full SHA
    23b31c6 View commit details
    Browse the repository at this point in the history
  15. snap: Add cosmetic blank line separator between the definition of the…

    … tesseract and leptonica part
    
    Signed-off-by: 林博仁(Buo-ren Lin) <[email protected]>
    brlin-tw committed Aug 9, 2024
    Configuration menu
    Copy the full SHA
    d05286d View commit details
    Browse the repository at this point in the history
  16. snap: Improve order of the after part property

    Signed-off-by: 林博仁(Buo-ren Lin) <[email protected]>
    brlin-tw committed Aug 9, 2024
    Configuration menu
    Copy the full SHA
    53f2b00 View commit details
    Browse the repository at this point in the history
  17. snap: Incorporate v3.0.6 selective-checkout scriptlet for ease of sta…

    …ble snap publishing
    
    This scriptlet allows stable builds to be always available for the
    downstream snap publisher to promote to the `stable` channel on
    the Snap Store.
    
    Higher risk builds(e.g. beta/edge) will only occur when the lower risk
    builds(rc/stable) are promoted.
    
    Refer the following Snapcraft Forum topic for more info:
    
        Selective-checkout: Check out the tagged release revision if it isn't promoted to the stable channel - doc - snapcraft.io
        https://forum.snapcraft.io/t/selective-checkout-check-out-the-tagged-release-revision-if-it-isnt-promoted-to-the-stable-channel/10617
    
    Here's a snippet of the scriptlet in action:
    
    ```
    :: selective-checkout: INFO: Detecting stable releases...
    :: selective-checkout: determine_stable_release_details: DEBUG: Last stable release tag determines to be "5.4.1".
    :: selective-checkout: determine_stable_release_details: DEBUG: Last stable version determines to be "5.4.1".
    :: selective-checkout: snap_query_version: DEBUG: Checking what snap revisions are available for the tesseract snap at the stable release channel...
    :: selective-checkout: determine_stable_release_details: DEBUG: Last stable version on the snap store determines to be "".
    :: selective-checkout: INFO: Detecting release candidate releases...
    :: selective-checkout: DEBUG: Last release candidate release tag determines to be "5.4.0-rc2".
    :: selective-checkout: DEBUG: Last release candidate version determines to be "5.4.0-rc2".
    :: selective-checkout: snap_query_version: DEBUG: Checking what snap revisions are available for the tesseract snap at the candidate release channel...
    :: selective-checkout: DEBUG: Last release candidate version on the snap store determines to be "".
    :: selective-checkout: INFO: Detecting beta releases...
    :: selective-checkout: DEBUG: Last beta release tag determines to be "5.0.0-beta-20210916".
    :: selective-checkout: DEBUG: Last beta version determines to be "5.0.0-beta-20210916".
    :: selective-checkout: snap_query_version: DEBUG: Checking what snap revisions are available for the tesseract snap at the beta release channel...
    :: selective-checkout: DEBUG: Last beta version on the snap store determines to be "".
    :: selective-checkout: determine_which_version_to_build: DEBUG: Stable version(5.4.1) is newer than the one on the Snap Store(none), stable release will be built.
    :: selective-checkout: Info: The last tagged stable release(5.4.1) hasn't been promoted to the stable channel() on the Snap Store yet, checking out 5.4.1.
    ```
    
    Signed-off-by: 林博仁(Buo-ren Lin) <[email protected]>
    brlin-tw committed Aug 9, 2024
    Configuration menu
    Copy the full SHA
    89a673c View commit details
    Browse the repository at this point in the history
  18. snap: Fix missing libarchive and libcurl support of the Tesseract part

    Signed-off-by: 林博仁(Buo-ren Lin) <[email protected]>
    brlin-tw committed Aug 9, 2024
    Configuration menu
    Copy the full SHA
    9717555 View commit details
    Browse the repository at this point in the history
  19. snap: Fix libraries under $SNAP/usr/local/lib aren't loaded in runtime

    Libraries under $SNAP/usr/local/lib isn't searched by the dynamic linker
    by default.
    
    Refer-to: Staging - Build and staging dependencies - doc - snapcraft.io <https://forum.snapcraft.io/t/build-and-staging-dependencies/11451>
    Signed-off-by: 林博仁(Buo-ren Lin) <[email protected]>
    brlin-tw committed Aug 9, 2024
    Configuration menu
    Copy the full SHA
    0331ab5 View commit details
    Browse the repository at this point in the history
  20. snap: Strip unused icu libraries from snap

    This patch addresses the following linter warnings:
    
    ```
    - library: libicuio.so.70: unused library 'usr/lib/x86_64-linux-gnu/libicuio.so.70.1'. (https://snapcraft.io/docs/linters-library)
    - library: libicutest.so.70: unused library 'usr/lib/x86_64-linux-gnu/libicutest.so.70.1'. (https://snapcraft.io/docs/linters-library)
    - library: libicutu.so.70: unused library 'usr/lib/x86_64-linux-gnu/libicutu.so.70.1'. (https://snapcraft.io/docs/linters-library
    - library: libicui18n.so.70: unused library 'usr/lib/x86_64-linux-gnu/libicui18n.so.70.1'. (https://snapcraft.io/docs/linters-library)
    ```
    
    Signed-off-by: 林博仁(Buo-ren Lin) <[email protected]>
    brlin-tw committed Aug 9, 2024
    Configuration menu
    Copy the full SHA
    b8b0fd0 View commit details
    Browse the repository at this point in the history
  21. fixup! snap: Fix missing libarchive and libcurl support of the Tesser…

    …act part
    
    libcurl functionality requires network access.
    
    Signed-off-by: 林博仁(Buo-ren Lin) <[email protected]>
    brlin-tw committed Aug 9, 2024
    Configuration menu
    Copy the full SHA
    3a2cbc1 View commit details
    Browse the repository at this point in the history

Commits on Aug 10, 2024

  1. snap: Implement fallback config loading mechanism

    This patch fixes configuration files in the readonly snap filesystem
    not loadable by Tesseract due to missing datadir fallback logic.
    
    If the config file with the same name doesn't appear in the
    $SNAP_USER_COMMON directory, the one in the $SNAP/usr/local/share/tessdata
    directory will be loaded, allow Tesseract to work properly.
    
    Signed-off-by: 林博仁(Buo-ren Lin) <[email protected]>
    brlin-tw committed Aug 10, 2024
    Configuration menu
    Copy the full SHA
    bdccad5 View commit details
    Browse the repository at this point in the history
  2. snap: Replace deprecated CRAFT_ARCH_TRIPLET Snapcraft part environmen…

    …t variable
    
    This patch addresses the following Snapcraft linter warnings:
    
    ```
    CRAFT_ARCH_TRIPLET is deprecated, use CRAFT_ARCH_TRIPLET_BUILD_{ON|FOR}
    ```
    
    Refer-to: core22 | Parts environment variables | Snapcraft documentation <https://snapcraft.io/docs/parts-environment-variables#heading--snapcraft-configuration-core22>
    Signed-off-by: 林博仁(Buo-ren Lin) <[email protected]>
    brlin-tw committed Aug 10, 2024
    Configuration menu
    Copy the full SHA
    32c4320 View commit details
    Browse the repository at this point in the history

Commits on Aug 11, 2024

  1. snap: Fix incorrect compiled-in datadir

    This patch fixes the incorrect compiled-in datadir path and as a
    side-effect, simplifies the fallback config loading patch.
    
    Signed-off-by: 林博仁(Buo-ren Lin) <[email protected]>
    brlin-tw committed Aug 11, 2024
    Configuration menu
    Copy the full SHA
    88c3e33 View commit details
    Browse the repository at this point in the history
  2. snap: Avoid hardcoding the TESSDATA_PREFIX environment variable

    This patch allows the user to store Tesseract data in custom paths
    using the TESSDATA_PREFIX environment variable.
    
    Previously it is hardcoded to $SNAP_USER_COMMON.
    
    Signed-off-by: 林博仁(Buo-ren Lin) <[email protected]>
    brlin-tw committed Aug 11, 2024
    Configuration menu
    Copy the full SHA
    ca47315 View commit details
    Browse the repository at this point in the history