Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add new slice definitions for 'git' and dependancies #282

Merged
merged 34 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
58dd5c4
feat: add new slice definitions for 'git' and dependancy 'libcurl3t64…
clay-lake Jul 14, 2024
ecd23aa
fix(git.yaml): essential entries in core are not sorted
clay-lake Jul 15, 2024
127747b
fix(git.yaml): duplicate essential entries in dependant slice
clay-lake Jul 15, 2024
e226db8
fix(git.yaml): removed documentation not required in slice
clay-lake Jul 15, 2024
705e014
fix(git.yaml): removed perl library slice. Unused
clay-lake Jul 15, 2024
0a79b04
Merge branch 'ubuntu-24.04' into create-git-slice
cjdcordeiro Aug 21, 2024
872b340
Merge branch 'ubuntu-24.04' into create-git-slice
clay-lake Oct 2, 2024
d75840b
fea: blank task for git tests, wip
clay-lake Oct 2, 2024
46209f5
refactor: git sdf
clay-lake Oct 2, 2024
ed83599
refactor: minimize SDF according to TDD
clay-lake Oct 21, 2024
e937318
refactor: linter warnings
clay-lake Oct 22, 2024
aefaa73
refactor: linter warnings. Missing changes
clay-lake Oct 22, 2024
6b6a925
Merge branch 'ubuntu-24.04' into create-git-slice
clay-lake Nov 7, 2024
1ca91ec
feat: sliced python3-pyftpdlib
clay-lake Nov 8, 2024
75e15ae
feat: added support for git daemon, ftp clone
clay-lake Nov 8, 2024
efa3af3
Merge branch 'ubuntu-24.04' into create-git-slice
clay-lake Nov 8, 2024
1d4aafb
fix: linting issue
clay-lake Nov 8, 2024
547aa0d
trigger build
clay-lake Nov 8, 2024
9833a85
refactor: remove busybox from tests
clay-lake Nov 15, 2024
f8420f5
feat: restore case if server exits early
clay-lake Nov 15, 2024
8538c23
fix: make all tests run in rootfs dir
clay-lake Nov 15, 2024
2e35356
fix: linting error
clay-lake Nov 15, 2024
73dc281
fix: bad path in git task
clay-lake Nov 15, 2024
0ed31a9
fix: git SDF bad content sorting
clay-lake Nov 15, 2024
9e746b2
refactor: remove unused symlinks
clay-lake Nov 15, 2024
a470e55
feat: integration test for python3-pyftpdlib
lengau Nov 15, 2024
6290be3
refactor(slices/git.yaml): remove excess content
clay-lake Nov 18, 2024
9484438
fix(tests/spread/integration/python3-pyftpdlib/task.yaml): fix path t…
clay-lake Nov 18, 2024
6dbecb3
refactor(git.yaml): removed unused library
clay-lake Nov 21, 2024
09e2324
fix(git.yaml, git/task.yaml): apply slice name suggestion
clay-lake Nov 21, 2024
972f3f4
Merge branch 'ubuntu-24.04' into create-git-slice
clay-lake Nov 25, 2024
107b89e
refactor: migrate git to use python3 slices
clay-lake Nov 25, 2024
f7cecff
refactor: changes from pair programming with Rafid
clay-lake Nov 25, 2024
792cb6f
Update slices/git.yaml with comment on git symlink
clay-lake Nov 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions slices/git.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package: git

essential:
- git_copyright

slices:
bins:
clay-lake marked this conversation as resolved.
Show resolved Hide resolved
clay-lake marked this conversation as resolved.
Show resolved Hide resolved
# basic functionality including:
# - add
# - blame
# - branch
# - checkout
# - commit
# - config
# - diff
# - fetch
# - init
# - log
# - merge
# - rev-list
# - status
essential:
- libc6_libs
- libpcre2-8-0_libs
- zlib1g_libs
contents:
/usr/bin/git: { symlink: /usr/lib/git-core/git }
clay-lake marked this conversation as resolved.
Show resolved Hide resolved
/usr/lib/git-core/git:

daemon:
essential:
- git_bins
contents:
/usr/lib/git-core/git-daemon:

http-support:
# requirements for cloning over http`git clone https://`:
essential:
- git_bins
- libcurl3t64-gnutls_libs
- libexpat1_libs
contents:
/usr/lib/git-core/git-remote-http:
clay-lake marked this conversation as resolved.
Show resolved Hide resolved
/usr/lib/git-core/git-remote-https: # link pointing to git-remote-http

ftp-support:
# requirements for cloning over ftp`git clone ftp://`:
essential:
- git_http-support
contents:
/usr/lib/git-core/git-remote-ftp:

copyright:
contents:
/usr/share/doc/git/copyright:
27 changes: 27 additions & 0 deletions slices/libcurl3t64-gnutls.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package: libcurl3t64-gnutls

essential:
- libcurl3t64-gnutls_copyright

slices:
libs:
essential:
- libbrotli1_libs
- libc6_libs
- libgnutls30t64_libs
- libgssapi-krb5-2_libs
- libidn2-0_libs
- libldap2_libs
- libnettle8t64_libs
- libnghttp2-14_libs
- libpsl5t64_libs
- librtmp1_libs
- libssh-4_libs
- libzstd1_libs
- zlib1g_libs
contents:
/usr/lib/*-linux-*/libcurl-gnutls.so.*:

copyright:
contents:
/usr/share/doc/libcurl3t64-gnutls/copyright:
15 changes: 15 additions & 0 deletions slices/python3-pyftpdlib.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package: python3-pyftpdlib
clay-lake marked this conversation as resolved.
Show resolved Hide resolved

essential:
- python3-pyftpdlib_copyright

slices:
libs:
essential:
- python3_standard
contents:
/usr/lib/python3/dist-packages/pyftpdlib/*.py:

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

environment:
EXTRA_SLICES: "" # No extra slices by default.
# test git_bins
RUN/bins: test_bins
SLICE/bins: git_bins
# test git_http-support
RUN/http_support: test_http_support
SLICE/http_support: git_http-support
EXTRA_SLICES/http_support: ca-certificates_data
# test git_ftp-support
RUN/ftp_support: test_ftp_support
SLICE/ftp_support: git_ftp-support
# test git_daemon
RUN/daemon_support: test_daemon_support
SLICE/daemon_support: git_daemon

execute: |
clay-lake marked this conversation as resolved.
Show resolved Hide resolved
git_rootfs="/"
function chroot_git(){
# execute git within chroot. We use -C to cd since
# we have no $SHELL to navigate with.
repo="$(realpath -e --relative-to="$git_rootfs" "$PWD")"
chroot "$git_rootfs" /usr/bin/git -C "$repo" "$@"
}
function setup(){
mkdir -p "$1/dev/"
mkdir -p "$1/etc/"
# fake essentials
touch "$1/dev/null"
head -c 500 /dev/urandom > "$1/dev/urandom"
cp /etc/resolv.conf $1/etc/
mkdir "$1/root"
# configure
git_rootfs="$1"
pushd "$1"
}
function cleanup(){
popd
}
function test_bins(){
chroot_git init
chroot_git config user.email "root@localhost"
chroot_git config user.name "Test Runner"
echo "Test" > "$1/test.txt"
chroot_git add test.txt
chroot_git commit -m 'test commit'
chroot_git --no-pager status
chroot_git --no-pager log
chroot_git blame -L 1,1 test.txt
[[ $(chroot_git ls-files) == "test.txt" ]]
chroot_git checkout -b test
chroot_git --no-pager diff master
chroot_git branch
chroot_git checkout master
chroot_git merge test
}
function test_http_support(){
chroot_git clone --depth 1 https://git.launchpad.net/ubuntu/+source/hello hello
cd $_
chroot_git --no-pager log
chroot_git fetch origin
chroot_git --no-pager branch --remotes --contains $(chroot_git rev-list -n 1 HEAD)
}
function test_ftp_support(){
ftp_root=$(install-slices python3-pyftpdlib_libs)
clay-lake marked this conversation as resolved.
Show resolved Hide resolved
mkdir -p srv/git/ftp-src
pushd $_
chroot_git init --bare
chroot_git update-server-info
popd
cp -r $1/srv $ftp_root
pushd $ftp_root/srv/git
chroot $ftp_root /usr/bin/python3 -m pyftpdlib -V -p 2121 -d /srv/git &
pyftpdlib_pid=$!
popd
# wait for server port to become available
while ! fuser 2121/tcp > /dev/null 2>&1
do
if ! test -d /proc/$pyftpdlib_pid
then
echo "pyftpdlib exited early"
exit 1
fi
sleep 1
done
# Test cloning the repo
chroot_git clone ftp://localhost:2121/ftp-src ftp-dst
# cleanup
kill -TERM $(fuser 2121/tcp 2>/dev/null)
}
function test_daemon_support(){
mkdir -p $1/srv/git/daemon-src
pushd $1/srv/git/daemon-src
git init
touch test-file
chroot_git add test-file
chroot_git config user.email "root@localhost"
chroot_git config user.name "Test Runner"
chroot_git commit -m "Hello daemon"
popd
chroot_git daemon \
--base-path=/srv/git \
--reuseaddr \
--listen=127.0.0.1 \
--verbose \
--export-all &
daemon_pid=$!
# Wait for daemon to start
while ! fuser 9418/tcp > /dev/null 2>&1
do
if ! test -d /proc/$daemon_pid
then
echo "daemon exited early"
exit 1
fi
sleep 1
done
# Test cloning the repo
chroot_git clone git://localhost/daemon-src daemon-dst
# Cleanup. TERM or KILL cause git to return an en error.
kill -INT $(fuser 9418/tcp 2>/dev/null)
}
rootfs=$(install-slices $SLICE $EXTRA_SLICES)
setup $rootfs
$RUN $rootfs
cleanup
clay-lake marked this conversation as resolved.
Show resolved Hide resolved
64 changes: 64 additions & 0 deletions tests/spread/integration/python3-pyftpdlib/task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
summary: Integration tests for python3-pyftpdlib

execute: |
function wait_for_ftp(){
sleep 0.3
while ! nc -z 127.0.0.1 2121
do
test -d /proc/$pyftpdlib_pid || (echo "pyftpdlib exited early"; exit 1)
sleep 1
done
}
function cleanup(){
while [[ -d /proc/$pyftpdlib_pid ]]; do
kill $pyftpdlib_pid || true
sleep 0.1
done
}
# Still run the cleanup even on test failure.
trap cleanup EXIT
rootfs="$(install-slices python3-pyftpdlib_libs)"
mkdir "${rootfs}/dev"
mount --bind /dev "${rootfs}/dev"
mkdir -p "${rootfs}"/srv/subdir
echo "Test file" > "${rootfs}"/srv/subdir/test-file
# Basic install smoke test
chroot "${rootfs}" python3 -m pyftpdlib --help
# Anonymous hosting
chroot "${rootfs}" /usr/bin/python3 -m pyftpdlib \
--verbose \
--interface=127.0.0.1 \
--port=2121 \
--directory=/srv &
export pyftpdlib_pid=$!
wait_for_ftp
[[ "$(curl ftp://127.0.0.1:2121/subdir/test-file)" == "Test file" ]]
cleanup
# With login and file upload.
chroot "${rootfs}" /usr/bin/python3 -m pyftpdlib \
--verbose \
--interface=127.0.0.1 \
--port=2121 \
--directory=/srv \
--write \
--username=testy \
--password=testy &
export pyftpdlib_pid=$!
wait_for_ftp
[[ "$(curl ftp://testy:[email protected]:2121/subdir/test-file)" == "Test file" ]]
echo "Test upload" > test-upload
curl -T test-upload ftp://testy:[email protected]:2121/test-upload
[[ "$(cat "${rootfs}/srv/test-upload")" == "$(cat test-upload)" ]]
cleanup
Loading