Skip to content

Commit

Permalink
Use more of snapcraft's default pull mechanisms (5.0-edge) (canonical…
Browse files Browse the repository at this point in the history
  • Loading branch information
tomponline authored Nov 7, 2024
2 parents 368ef75 + fd74e9b commit 9f02418
Showing 1 changed file with 13 additions and 25 deletions.
38 changes: 13 additions & 25 deletions snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ parts:
- nasm
source: https://github.com/tianocore/edk2
source-depth: 1
source-tag: IRRELEVANT
source-commit: ba0e0e4c6a174b71b18ccd6e47319cc45878893c # edk2-stable202208
source-submodules: []
source-type: git
plugin: nil
build-packages:
Expand All @@ -294,9 +295,12 @@ parts:
craftctl default
override-pull: |-
[ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && exit 0
craftctl default
set -ex
git config --global transfer.fsckobjects true
git clone https://github.com/tianocore/edk2 . -b edk2-stable202208
# Pull submodules after switching to source-commit
git submodule update --init --recursive
override-build: |-
[ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && exit 0
set -ex
Expand All @@ -305,10 +309,6 @@ parts:
git config user.email "[email protected]"
git config user.name "LXD snap builder"
# Fix submodules
sed -i "s#https://git.cryptomilk.org/projects/cmocka#https://gitlab.com/cmocka/cmocka#g" .gitmodules
git submodule update --init --recursive
# Apply patches
patch -p1 < "${CRAFT_PROJECT_DIR}/patches/edk2-0001-force-DUID-LLT.patch"
cp "${CRAFT_PROJECT_DIR}/patches/edk2-0002-logo.bmp" MdeModulePkg/Logo/Logo.bmp
Expand Down Expand Up @@ -750,8 +750,10 @@ parts:
- libusb
- spice-protocol
- spice-server
source: https://github.com/qemu/qemu
source: https://gitlab.com/qemu-project/qemu
source-commit: 6bbce8b464206e6622216b62841cb3e953d56eb8 # v8.0.5
source-depth: 1
source-submodules: []
source-type: git
plugin: autotools
autotools-configure-parameters:
Expand Down Expand Up @@ -816,25 +818,11 @@ parts:
craftctl default
override-pull: |-
[ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && [ "$(uname -m)" != "ppc64le" ] && [ "$(uname -m)" != "s390x" ] && exit 0
set -ex
# We have to do this manual git clone because of edk2/subhook submodule URL has changed.
# See https://github.com/tianocore/edk2/commit/95d8a1c255cfb8e063d679930d08ca6426eb5701
# What is interesting is that we don't even need to do:
# git config --global url.https://github.com/tianocore/edk2-subhook.git.insteadOf https://github.com/Zeex/subhook.git
# because QEMU version which we checkout points to that version of edk2 which does not depends on subhook submodule.
# And as we do `git submodule update --init --recursive` *after* `git checkout ..` we have no problems.
# While if we do the same with built-in functionality in snapcraft it fails, because snapcraft does
# `git clone --recurse-submodules ...` and pulls master branch and fails on edk2/subhook before snapcraft does
# `git checkout ...` to the specified commit.
git config --global transfer.fsckobjects true
git clone https://github.com/qemu/qemu .
craftctl default
# FIXME: check if we can get rid of override-pull after the next QEMU version bump
git checkout 6bbce8b464206e6622216b62841cb3e953d56eb8 # v8.0.5
set -ex
# Pull submodules after switching to source-commit
git submodule update --init --recursive
override-build: |-
[ "$(uname -m)" != "x86_64" ] && [ "$(uname -m)" != "aarch64" ] && [ "$(uname -m)" != "ppc64le" ] && [ "$(uname -m)" != "s390x" ] && exit 0
Expand Down

0 comments on commit 9f02418

Please sign in to comment.