Skip to content

Commit

Permalink
Merge branch 'ubuntu-24.04' into apache2_noble
Browse files Browse the repository at this point in the history
  • Loading branch information
eunufe authored Feb 18, 2025
2 parents 869ca6d + 1c0a3be commit ea47919
Show file tree
Hide file tree
Showing 10 changed files with 239 additions and 0 deletions.
41 changes: 41 additions & 0 deletions slices/bzip2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package: bzip2

essential:
- bzip2_copyright

slices:
bins:
essential:
- libbz2-1.0_libs
- libc6_libs
contents:
/usr/bin/bunzip2:
/usr/bin/bzcat: { symlink: /usr/bin/bunzip2 }
/usr/bin/bzip2: { symlink: /usr/bin/bunzip2 }
/usr/bin/bzip2recover:

scripts:
essential:
- base-files_bin
- base-files_tmp
- bzip2_bins
- coreutils_bins
- diffutils_bins
- grep_bins
- grep_deprecated
- less_bins
- sed_bins
- util-linux_file-manipulation
contents:
/usr/bin/bzcmp:
/usr/bin/bzdiff:
/usr/bin/bzegrep:
/usr/bin/bzexe:
/usr/bin/bzfgrep:
/usr/bin/bzgrep:
/usr/bin/bzless:
/usr/bin/bzmore:

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

essential:
- less_copyright

slices:
bins:
essential:
- libc6_libs
- libtinfo6_libs
contents:
/usr/bin/less:
/usr/bin/lessecho:
# Note that lesskey is deprecated since less version 582.
/usr/bin/lesskey:

# pager conflicts with the one generated in util-linux_generated slice.
# Manually link pager to less if required.
# TODO: Add `prefer` to /usr/bin/pager when conflict resolution
# is merged for chisel.
# pager:
# essential:
# - less_bins
# contents:
# /usr/bin/pager: {symlink: /usr/bin/less}

copyright:
contents:
/usr/share/doc/less/copyright:
16 changes: 16 additions & 0 deletions slices/netcat-openbsd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package: netcat-openbsd

essential:
- netcat-openbsd_copyright

slices:
bins:
essential:
- libbsd0_libs
- libc6_libs
contents:
/bin/nc.openbsd:

copyright:
contents:
/usr/share/doc/netcat-openbsd/copyright:
33 changes: 33 additions & 0 deletions slices/unzip.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package: unzip

essential:
- unzip_copyright

slices:
bins:
essential:
- libbz2-1.0_libs
- libc6_libs
contents:
/usr/bin/funzip:
/usr/bin/unzip:
/usr/bin/unzipsfx:
# Should be a hard link, but Chisel does not yet support hard links
# not yet support hard links.
# TODO update this to a hard link once a
# newer version of Chisel is released with
# https://github.com/canonical/chisel/commit/9d9d2144cf47586d02ff7566b8764e70057987a4
/usr/bin/zipinfo: {symlink: /usr/bin/unzip}

scripts:
essential:
- dash_bins
- grep_deprecated
- sed_bins
- unzip_bins
contents:
/usr/bin/zipgrep:

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

essential:
- zip_copyright

slices:
bins:
essential:
- libbz2-1.0_libs
- libc6_libs
contents:
/usr/bin/zip:
/usr/bin/zipcloak:
/usr/bin/zipnote:
/usr/bin/zipsplit:

copyright:
contents:
/usr/share/doc/zip/copyright:
50 changes: 50 additions & 0 deletions tests/spread/integration/bzip2/task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
summary: Integration tests for bzip2

execute: |
# testing for only bins slice
rootfs_bins="$(install-slices bzip2_bins)"
mkdir "${rootfs_bins}"/dev
mount --rbind /dev "${rootfs_bins}"/dev
# generate a test file
echo "this is a test file we use for compression with bzip2" > "${rootfs_bins}/input.txt"
# test compression commands
chroot "${rootfs_bins}" /usr/bin/bzip2 -k input.txt
cmp "${rootfs_bins}/input.txt" <(chroot "${rootfs_bins}" bzip2 -d -c input.txt.bz2)
cmp "${rootfs_bins}/input.txt" <(chroot "${rootfs_bins}" bunzip2 -c input.txt.bz2)
cmp "${rootfs_bins}/input.txt" <(chroot "${rootfs_bins}" bzcat input.txt.bz2)
# test bzip2recover
chroot "${rootfs_bins}" bzip2recover input.txt.bz2
umount "${rootfs_bins}"/dev -l
# testing for only scripts slice
rootfs_script="$(install-slices bzip2_scripts)"
mkdir "${rootfs_script}"/dev
mount --rbind /dev "${rootfs_script}"/dev
# generate a test file
echo "this is a test file we use for compression with bzip2" > "${rootfs_script}/input.txt"
cp $SHELL "${rootfs_script}/shell"
chroot "${rootfs_script}" /usr/bin/bzip2 -k input.txt
# test executable util
chroot "${rootfs_script}" bzexe shell
head -n1 "${rootfs_script}/shell" | grep "/bin/sh"
# test text utils
chroot "${rootfs_script}" bzcmp input.txt.bz2 input.txt.bz2 | exit_code=$?
chroot "${rootfs_script}" bzdiff input.txt.bz2 input.txt.bz2 | exit_code=$?
chroot "${rootfs_script}" bzgrep "test" input.txt.bz2
chroot "${rootfs_script}" bzfgrep "test" input.txt.bz2
chroot "${rootfs_script}" bzegrep "test" input.txt.bz2
# test pagers
chroot "${rootfs_script}" bzless "test" input.txt.bz2 > /dev/null
chroot "${rootfs_script}" bzmore "test" input.txt.bz2 > /dev/null
umount "${rootfs_script}"/dev -l
10 changes: 10 additions & 0 deletions tests/spread/integration/less/task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
summary: Integration tests for less

execute: |
rootfs="$(install-slices less_bins)"
chroot "${rootfs}/" less --version
chroot "${rootfs}/" lesskey --version
echo "Hello, World" > "${rootfs}/testfile.txt"
test "$(chroot "${rootfs}/" less -F -X -R testfile.txt)" = "Hello, World"
test "$(chroot "${rootfs}/" lessecho -m: a:b )" = "a\:b"
9 changes: 9 additions & 0 deletions tests/spread/integration/netcat-openbsd/task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
summary: Integration tests for netcat-openbsd

execute: |
rootfs="$(install-slices netcat-openbsd_bins)"
chroot "${rootfs}/" nc.openbsd -h
chroot "${rootfs}/" nc.openbsd -l 1234 >testfile &
echo "Hello World" | chroot "${rootfs}/" nc.openbsd -q 1 -w 1 127.0.0.1 1234
test "$(cat testfile)" = "Hello World"
14 changes: 14 additions & 0 deletions tests/spread/integration/unzip/task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
summary: Integration tests for unzip

execute: |
rootfs="$(install-slices base-files_bin unzip_bins unzip_scripts zip_bins)"
chroot "${rootfs}/" unzip -hh
chroot "${rootfs}/" unzipsfx -hh
echo "Hello, World" > "${rootfs}/testfile.txt"
chroot "${rootfs}" zip testfile.zip testfile.txt
test "$(chroot "${rootfs}" unzip -p testfile.zip testfile.txt)" = "Hello, World"
test "$(chroot "${rootfs}" zipinfo -1 testfile.zip)" = "testfile.txt"
test "$( chroot "${rootfs}" funzip testfile.zip )" = "Hello, World"
chroot "${rootfs}" zipgrep "Hello" testfile.zip
18 changes: 18 additions & 0 deletions tests/spread/integration/zip/task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
summary: Integration tests for zip

execute: |
rootfs="$(install-slices unzip_bins zip_bins)"
chroot "${rootfs}/" zip -h2
chroot "${rootfs}/" zipcloak -h
chroot "${rootfs}/" zipnote -h
chroot "${rootfs}/" zipsplit -h
echo "Hello, World" > "${rootfs}/testfile.txt"
chroot "${rootfs}" zip testfile.zip testfile.txt
chroot "${rootfs}" zipnote testfile.zip > foo.tmp
echo -e "@ This is a test comment" >> foo.tmp
chroot "${rootfs}" zipnote -w testfile.zip < foo.tmp
test "$(chroot "${rootfs}" zipnote testfile.zip | tail -n1)" = "\@ This is a test comment"
chroot "${rootfs}" zipsplit testfile.zip
test "$(chroot "${rootfs}" unzip -p testfil1.zip testfile.txt)" = "Hello, World"

0 comments on commit ea47919

Please sign in to comment.