Skip to content

Commit

Permalink
Merge branch 'ubuntu-24.04' into 24.04-openjdk-21-jre-headless
Browse files Browse the repository at this point in the history
  • Loading branch information
cjdcordeiro authored Sep 30, 2024
2 parents 82cafc0 + 8265ea3 commit 1c8ab69
Show file tree
Hide file tree
Showing 8 changed files with 198 additions and 0 deletions.
18 changes: 18 additions & 0 deletions slices/diffutils.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package: diffutils

essential:
- diffutils_copyright

slices:
bins:
essential:
- libc6_libs
contents:
/usr/bin/cmp:
/usr/bin/diff:
/usr/bin/diff3:
/usr/bin/sdiff:

copyright:
contents:
/usr/share/doc/diffutils/copyright:
59 changes: 59 additions & 0 deletions slices/dpkg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package: dpkg

essential:
- dpkg_copyright

slices:
bins:
essential:
- dpkg_config
- dpkg_var
- libbz2-1.0_libs
- libc-bin_ldconfig
- libc6_libs
- liblzma5_libs
- libmd0_libs
- libselinux1_libs
- libzstd1_libs
- tar_tar
- zlib1g_libs
contents:
/usr/bin/dpkg:
/usr/bin/dpkg-deb:
/usr/bin/dpkg-divert:
/usr/bin/dpkg-maintscript-helper:
/usr/bin/dpkg-query:
/usr/bin/dpkg-realpath:
/usr/bin/dpkg-split:
/usr/bin/dpkg-statoverride:
/usr/bin/dpkg-trigger:
/usr/bin/update-alternatives:
/usr/libexec/dpkg/*:
/usr/sbin/start-stop-daemon:

copyright:
contents:
/usr/share/doc/dpkg/copyright:

config:
contents:
/etc/dpkg/dpkg.cfg:
/etc/dpkg/dpkg.cfg.d/:

locales:
essential:
- dpkg_bins
contents:
/usr/share/locale/**/dpkg.mo:

tables:
contents:
/usr/share/dpkg/*table:

var:
# Directories that are included in the tarball because they need to exist in /var
contents:
/var/lib/dpkg/alternatives/:
/var/lib/dpkg/info/:
/var/lib/dpkg/parts/:
/var/lib/dpkg/updates/:
7 changes: 7 additions & 0 deletions slices/libc-bin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ slices:
contents:
/etc/nsswitch.conf: {copy: /usr/share/libc-bin/nsswitch.conf}

ldconfig:
essential:
- dash_bins
contents:
/usr/sbin/ldconfig:
/usr/sbin/ldconfig.real:

locale:
contents:
/usr/lib/locale/C.utf8/LC_ADDRESS:
Expand Down
15 changes: 15 additions & 0 deletions slices/ocl-icd-libopencl1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package: ocl-icd-libopencl1

essential:
- ocl-icd-libopencl1_copyright

slices:
libs:
essential:
- libc6_libs
contents:
/usr/lib/*-linux-*/libOpenCL.so.1*:

copyright:
contents:
/usr/share/doc/ocl-icd-libopencl1/copyright:
31 changes: 31 additions & 0 deletions slices/tar.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package: tar

essential:
- tar_copyright

slices:
bins:
essential:
- tar_rmt
- tar_tar
contents:
/usr/sbin/tarcat:

copyright:
contents:
/usr/share/doc/tar/copyright:

rmt:
essential:
- libc6_libs
contents:
/etc/rmt: {symlink: /usr/sbin/rmt-tar}
/usr/sbin/rmt-tar:

tar:
essential:
- libacl1_libs
- libc6_libs
- libselinux1_libs
contents:
/usr/bin/tar:
23 changes: 23 additions & 0 deletions tests/spread/integration/diffutils/task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
summary: Integration tests for diffutils

execute: |
# Chisel a minimum number of slices to give us a runnable system that we can
# test in.
rootfs="$(install-slices diffutils_bins)"
mkdir "${rootfs}/test"
echo "This is a test file" > "${rootfs}/test1.txt"
echo "This is another test file" > "${rootfs}/test2.txt"
# Compare two different files with cmp
chroot "${rootfs}/" cmp -b /test1.txt /test2.txt | grep -q '/test1.txt /test2.txt differ: byte 10, line 1'
# Compare with diff
cp "${rootfs}/test1.txt" "${rootfs}/test3.txt"
[[ "$(chroot "${rootfs}/" diff /test1.txt /test3.txt)" == "" ]]
# Compare with diff3
chroot "${rootfs}/" diff3 -a /test1.txt /test2.txt /test3.txt | grep -q -e '====2' -e '[1-3]:1c'
# ...and sdiff
chroot "${rootfs}/" sdiff /test1.txt /test2.txt | grep -q -E 'This is a test file\s+| This is another test file'
12 changes: 12 additions & 0 deletions tests/spread/integration/dpkg/task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
summary: Integration tests for dpkg

execute: |
# Chisel a minimum number of slices to give us a runnable system that we can
# test in.
rootfs="$(install-slices coreutils_bins diffutils_bins dpkg_bins)"
# Get a sample deb file to install. Contains no dependencies or install scripts.
wget -P "${rootfs}/" http://archive.ubuntu.com/ubuntu/pool/main/l/lsb-release-minimal/lsb-release_12.1-1_all.deb
# Run a smoke test for dpkg to ensure that it does not throw an error
chroot "${rootfs}/" dpkg --install ./lsb-release_12.1-1_all.deb
33 changes: 33 additions & 0 deletions tests/spread/integration/tar/task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
summary: Integration tests for tar

execute: |
# Chisel a minimum number of slices to give us a runnable system that we can
# test in.
rootfs="$(install-slices tar_tar)"
mkdir "${rootfs}/test"
echo "This is a test file" > "${rootfs}/test/test.txt"
touch --date=2020-01-01T00:00:00Z "${rootfs}/test/test.txt"
touch --date=2020-01-01T00:00:00Z "${rootfs}/test/"
# Create an uncompressed tarball and compare to a known hash.
chroot "${rootfs}/" tar -cf test.tar /test/
[[ $(sha256sum "${rootfs}/test.tar" | cut -d' ' -f1) == f5893661db55f15954c90dee860ee6c93042ea482c303f5f162c8078cdc79928 ]]
# Decompress back to a new directory and ensure the file is correct.
mkdir "${rootfs}/test-result"
chroot "${rootfs}/" tar -xf test.tar -C /test-result
[[ "$(cat ${rootfs}/test/test.txt)" == "$(cat ${rootfs}/test-result/test/test.txt)" ]]
# Check modification times
[[ $(stat -c %Y ${rootfs}/test-result/test) == 1577836800 ]]
[[ $(stat -c %Y ${rootfs}/test-result/test) == 1577836800 ]]
# Expect an error gzipping a tarball since gzip is not installed in the chroot.
! chroot "${rootfs}/" tar -czf test.tar.gz /test/ 2| grep -q "tar (child): gzip: Cannot exec: No such file or directory"
# New environment for rmt slice.
rootfs="$(install-slices tar_rmt)"
# We can't really do much with rmt, so just check that the executable works.
chroot "${rootfs}/" rmt-tar --version

0 comments on commit 1c8ab69

Please sign in to comment.