github.com/canonical/ubuntu-image@v0.0.0-20240430122802-2202fe98b290/snapcraft.yaml (about)

     1  name: ubuntu-image
     2  summary: Create Ubuntu images
     3  description: |
     4    Official tool for building Ubuntu images, currently supporing Ubuntu Core
     5    snap-based images and preinstalled Ubuntu classic images.
     6  version: "3.4+snap3"
     7  grade: stable
     8  confinement: classic
     9  base: core22
    10  source-code: https://github.com/canonical/ubuntu-image
    11  issues: https://bugs.launchpad.net/ubuntu-image/+filebug
    12  
    13  # Force the snap to use fakeroot staged within the snap
    14  environment:
    15    FAKEROOT_FLAGS: "--lib $SNAP/usr/lib/lib-arch/libfakeroot/libfakeroot-tcp.so --faked $SNAP/usr/bin/faked-tcp"
    16    PATH: $SNAP/usr/bin:$SNAP/bin:$SNAP/usr/sbin:$SNAP/sbin:$PATH
    17    GCONV_PATH: /snap/core22/current/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/gconv
    18    PYTHONPATH: $SNAP/usr/lib/python3/dist-packages:$PYTHONPATH
    19    DEBOOTSTRAP_DIR: $SNAP/usr/share/debootstrap
    20    PERL5LIB: $SNAP/usr/share/perl5:$SNAP/usr/share/perl:$PERL5LIB
    21  
    22  apps:
    23    ubuntu-image:
    24      command: bin/ubuntu-image
    25  
    26  parts:
    27    ubuntu-image:
    28      plugin: nil
    29      source: .
    30      source-type: git
    31      build-snaps:
    32        - go
    33      stage-packages:
    34        - binfmt-support
    35        - dirmngr
    36        - fdisk
    37        - gdisk
    38        - fakeroot
    39        - debootstrap
    40        - gpg
    41        - germinate
    42        - git
    43        - mtools
    44        - make
    45        - qemu-user-static
    46        - qemu-utils
    47        - u-boot-tools
    48        - devscripts
    49        - grub-common
    50        - libpython3-stdlib
    51        - libpython3.10-stdlib
    52        - libpython3.10-minimal
    53        - python3
    54        - python3-apt
    55        - python3-minimal
    56        - python3.10-minimal
    57      build-attributes: [ enable-patchelf ]
    58      override-build: |
    59        ins_bin=$SNAPCRAFT_PART_INSTALL/bin/
    60        mkdir -p "$ins_bin"
    61        # Make ubuntu-image statically compiled to avoid libc deps.
    62        # We need this as setting interpreter/rpath is known to cause
    63        # issues with go binaries (https://github.com/NixOS/patchelf/issues/146).
    64        # On compiling statically go, see https://mt165.co.uk/blog/static-link-go/
    65        CGO_ENABLED=0 go build -o "$ins_bin" ./cmd/ubuntu-image/
    66        # create a symlink /usr/bin/fakeroot -> /usr/bin/fakeroot-tcp
    67        cd $SNAPCRAFT_PART_INSTALL/usr/bin/
    68        ln -s fakeroot-tcp fakeroot
    69        # Create a symbolic link to /usr/lib/<arch> where libfakeroot will live
    70        cd $SNAPCRAFT_PART_INSTALL/usr/lib/
    71        ln -s ${SNAPCRAFT_ARCH_TRIPLET} lib-arch