Issues while processing snap: - package contains external symlinks: usr/lib/jvm/java-11-openjdk-amd64/lib/security/blacklisted.certs -> /etc/java-11-openjdk/security/blacklisted.certs

Hello !

I have an error here during the uploading process, the error log was not useful to me due to little information found :face_with_monocle: .

Any help would be generous :slightly_smiling_face: .

snapcraft upload pdftool_1.0.1_amd64.snap --release=stable

Issues while processing snap:
- package contains external symlinks: usr/lib/jvm/java-11-openjdk-amd64/lib/security/blacklisted.certs -> /etc/java-11-openjdk/security/blacklisted.certs


Here the *.yaml file :

name: pdftool
version: '1.0.1'
summary: A command line tool for manipulating PDF files
description: |
  The <<pdftool>> is a program allowing to manipulate from the terminal pdf 
  files (extracting, concatenating, numbering , encrypting, decrypting, 
  stamping, rotating, bursting, including, excluding ...).
  

grade: stable
confinement: strict


base: core24


parts:
  pdftool:
    plugin: dump
    source: https://github.com/baldeuniversel/pdf-tool.git
    source-type: git
    source-tag: v1.0.1-electron 

    stage-packages:
      - bash
      - coreutils
      - software-properties-common
      - bc
      - gawk
      - grep
      - zsh
      - util-linux
      - pdftk
      - ghostscript
      - poppler-utils
      - findutils
      - libgdbm6
      - libsigsegv2
      - libpoppler-cpp-dev 
      - libpoppler-dev
      - procps
      - ncurses-bin
      - dash
      - openjdk-11-jre-headless

    build-packages:
      - wget
      - libnss3
      - ca-certificates
      - ca-certificates-java
      - openjdk-11-jre-headless

    override-pull: |
      snapcraftctl pull

      #
      cd "$SNAPCRAFT_PART_SRC"
      
      #
      curl -L -o pdf-tool-1.0.1.deb https://github.com/baldeuniversel/pdf-tool/raw/v1.0.1-electron/package/deb/pdf-tool-1.0.1.deb

      #
      dpkg-deb -x pdf-tool-1.0.1.deb "$SNAPCRAFT_PART_SRC" 

      #
      rm pdf-tool-1.0.1.deb 
    
    override-build: |
      snapcraftctl build

      # Download required JARs
      mkdir -p "$SNAPCRAFT_PART_INSTALL/usr/share/pdftool/lib/" 

      wget -P "$SNAPCRAFT_PART_INSTALL/usr/share/pdftool/lib/" \
        https://repo1.maven.org/maven2/org/bouncycastle/bcprov-jdk15on/1.69/bcprov-jdk15on-1.69.jar

      wget -P "$SNAPCRAFT_PART_INSTALL/usr/share/pdftool/lib/" \
        https://repo1.maven.org/maven2/org/apache/commons/commons-lang3/3.12.0/commons-lang3-3.12.0.jar

    organize:
      bin/pdf-tool: bin/pdftool

    override-prime: |

      sed -i 's|pdftk|java -cp \$SNAP/usr/share/pdftk/pdftk.jar:\$SNAP/usr/share/pdftool/lib/bcprov-jdk15on-1.69.jar:\$SNAP/usr/share/pdftool/lib/commons-lang3-3.12.0.jar com.gitlab.pdftk_java.pdftk|g' "$SNAPCRAFT_STAGE/bin/pdftool"

      sed -i 's|awk|gawk|g' "$SNAPCRAFT_STAGE/bin/pdftool"

      sed -i 's|/usr/lib/pdf-tool|\$SNAP/usr/lib/pdf-tool|g' "$SNAPCRAFT_STAGE/bin/pdftool"

      sed -i 's|convert|magick -font $SNAP/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf|g' "$SNAPCRAFT_STAGE/bin/pdftool"

      sed -i '690,731 s|Arial|DejaVu Sans|g' "$SNAPCRAFT_STAGE/bin/pdftool"

      snapcraftctl prime 
  
  imagemagick:
    plugin: dump
    source: .
    
    stage-packages:
      - libfuse2
      - libfontconfig1
      - libfreetype6
      - libx11-6
      - zlib1g
      - libharfbuzz0b
      - libfribidi0
      - libexpat1
      - libuuid1
      - libxcb1
      - libgraphite2-3
      - libxau6
      - libxdmcp6
      - libbsd0
      - fontconfig-config
      - fonts-dejavu-core
      - fonts-liberation
      - fonts-dejavu

    build-packages:
      - squashfs-tools
      - curl

    override-build: |
      
      #
      mkdir -p "$SNAPCRAFT_PART_INSTALL/usr/tmp/imagemagick" 
      mkdir -p "$SNAPCRAFT_PART_INSTALL/usr/local/bin"
      mkdir -p "$SNAPCRAFT_PART_INSTALL/usr/local/etc"
      mkdir -p "$SNAPCRAFT_PART_INSTALL/usr/local/include"
      mkdir -p "$SNAPCRAFT_PART_INSTALL/usr/local/lib"
      mkdir -p "$SNAPCRAFT_PART_INSTALL/usr/local/share"

      #
      curl -L -o "$SNAPCRAFT_PART_INSTALL/usr/tmp/imagemagick/magick" https://imagemagick.org/archive/binaries/magick

      #
      chmod +x $SNAPCRAFT_PART_INSTALL/usr/tmp/imagemagick/magick

      $SNAPCRAFT_PART_INSTALL/usr/tmp/imagemagick/magick --appimage-extract

      mv "$SNAPCRAFT_PART_BUILD/squashfs-root/AppRun" "$SNAPCRAFT_PART_BUILD/squashfs-root/magick-app"

      mv "$SNAPCRAFT_PART_BUILD/squashfs-root/magick-app" "$SNAPCRAFT_PART_INSTALL/usr/local/bin"
      mv $SNAPCRAFT_PART_BUILD/squashfs-root/usr/bin/* "$SNAPCRAFT_PART_INSTALL/usr/local/bin"
      mv $SNAPCRAFT_PART_BUILD/squashfs-root/usr/etc/* "$SNAPCRAFT_PART_INSTALL/usr/local/etc"
      mv $SNAPCRAFT_PART_BUILD/squashfs-root/usr/include/* "$SNAPCRAFT_PART_INSTALL/usr/local/include"
      mv $SNAPCRAFT_PART_BUILD/squashfs-root/usr/lib/* "$SNAPCRAFT_PART_INSTALL/usr/local/lib"
      mv $SNAPCRAFT_PART_BUILD/squashfs-root/usr/share/* "$SNAPCRAFT_PART_INSTALL/usr/local/share"

      #
      rm -rf "$SNAPCRAFT_PART_INSTALL/usr/tmp/imagemagick"

      #
      mkdir -p "$SNAPCRAFT_PART_INSTALL/usr/local/etc/ImageMagick-7"

      #
      sed -i -e 's/<!-- <policy domain="resource" name="memory" value="256MiB"\/> -->/<policy domain="resource" name="memory" value="8GiB"\/>/g' -e 's/<!-- <policy domain="resource" name="map" value="512MiB"\/> -->/<policy domain="resource" name="map" value="8GiB"\/>/g' -e 's/<!-- <policy domain="resource" name="area" value="16KP"\/> -->/<policy domain="resource" name="area" value="8192MP"\/>/g' -e 's/<!-- <policy domain="resource" name="disk" value="1GiB"\/> -->/<policy domain="resource" name="disk" value="16GiB"\/>/g' "$SNAPCRAFT_PART_INSTALL/usr/local/etc/ImageMagick-7/policy.xml"
      
      snapcraftctl build  


apps:
  pdftool:
    command: bin/pdftool
    plugs:
      - home
      - removable-media
    environment:
      JAVA_HOME: "$SNAP/usr/lib/jvm/java-11-openjdk-amd64"
      JAVA_BIN: "$SNAP/usr/lib/jvm/java-11-openjdk-amd64/bin"
      JAVA_LIB: "$SNAP/usr/lib/jvm/java-11-openjdk-amd64/lib"
      MAGICK_LIB_A: "$SNAP/usr/lib/x86_64-linux-gnu"
      MAGICK_LIB_B: "$SNAP/usr/local/lib"
      GS_LIB: "$SNAP/usr/share/ghostscript/10.02.1/Resource/Init"
      GS_FONTPATH: "$SNAP/usr/share/ghostscript/10.02.1/Resource/Font"
      MAGICK_CONFIGURE_PATH: "$SNAP/usr/local/etc/ImageMagick-7"
      LIB_HOME: "$SNAP/lib/x86_64-linux-gnu"
      FONTCONFIG_PATH: "$SNAP/etc/fonts"
      FONTCONFIG_FILE: "$SNAP/etc/fonts/fonts.conf"
      MAGICK_FONT_PATH: "$SNAP/etc/fonts"
      XDG_DATA_HOME: "$SNAP/usr/share"
      PATH: "$SNAP/usr/bin:$SNAP/bin:$JAVA_BIN:$SNAP/usr/local/bin:${PATH:-}"
      LD_LIBRARY_PATH: "$SNAP/lib:$SNAP/usr/lib/x86_64-linux-gnu:$SNAP/usr/lib:$JAVA_HOME:$JAVA_LIB:${MAGICK_LIB_A:-}:${MAGICK_LIB_B:-}:$LIB_HOME:$MAGICK_CONFIGURE_PATH:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET:${LD_LIBRARY_PATH:-}"


See:

Or one of the other posts a search for the error returns in the forum search function…

2 Likes

Thanks @ogra.

That works ! :+1: