app-emulation/cloud-utils: new package, add 0.33

Signed-off-by: Artemis Everfree <artemis@artemis.sh>
This commit is contained in:
Artemis Everfree
2024-07-20 04:11:58 -07:00
parent ee435e3dda
commit b6bee48d7c
4 changed files with 139 additions and 0 deletions

View File

@@ -0,0 +1 @@
DIST cloud-utils-0.33.tar.gz 58817 BLAKE2B 92c42844a7c1f826d43c9a715e56d05c77d7b37c721079165ffb008205e412327e39ecba5d2755c84e2d80e4ee752ef95ce099da25625010327f957e419195d7 SHA512 1e58e085bde295d4adf8ff219a7f22382fadff798f5398f3e2a62cb0926c740babba76ea6326f6042b46dbdeb12c15d1e080fb9890b10482e31c3acb64014c95

View File

@@ -0,0 +1,96 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{8..13} )
inherit python-single-r1
DESCRIPTION="Useful set of utilities for interacting with a cloud."
HOMEPAGE="https://github.com/canonical/cloud-utils"
SRC_URI="https://github.com/canonical/cloud-utils/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64"
# image-utils vs guest-utils is a distinction that does not actually exist
# upstream, but is rather one that arch linux makes. alpine goes even more
# fine-grained, creating a single package for each individual utility. I ain't
# maintaining all that, but I do think the distinction arch makes is worthwhile.
#
# The difference is this: is the tool something you would want to use within a
# cloud VM, or use outside of a cloud VM to manipulate your VM's disk image?
# This is useful, because the image manipulation scripts need qemu-img and
# cdrtools around, which you might not want to install onto a VM just to run
# something like `ec2metadata` or `growpart`
IUSE="+guest-utils +image-utils"
REQUIRED_USE="
${PYTHON_REQUIRED_USE}
|| ( guest-utils image-utils )
"
# cloud-utils also provides its own growpart, which is I think different from
# sys-fs/growpart.
RDEPEND="
${PYTHON_DEPS}
guest-utils? (
!sys-fs/growpart
)
image-utils? (
app-cdr/cdrtools
app-emulation/qemu
app-misc/ca-certificates
net-misc/wget
sys-apps/util-linux
sys-fs/dosfstools
sys-fs/e2fsprogs
sys-fs/mtools
)
"
PATCHES=(
"${FILESDIR}"/use-mkisofs.patch
)
src_install() {
# This package really is just a pile of scripts, with a simple Makefile that
# installs them. We can implement the USE flags most easily by ignoring the
# Makefile and installing the files ourselves.
local wanted_bin=()
local wanted_man=()
if use 'guest-utils'; then
wanted_bin+=(
bin/ec2metadata
bin/growpart
bin/vcs-run
)
wanted_man+=(
man/growpart.1
)
fi
if use 'image-utils'; then
wanted_bin+=(
bin/cloud-localds
bin/mount-image-callback
bin/resize-part-image
bin/write-mime-multipart
)
wanted_man+=(
man/cloud-localds.1
man/resize-part-image.1
man/write-mime-multipart.1
)
fi
local bindir="${D}/usr/bin"
local mandir="${D}/usr/share/man/man1"
mkdir -p "${bindir}" "${mandir}" || die
install "${wanted_bin[@]}" "${bindir}" || die
install "${wanted_man[@]}" "${mandir}" --mode=0644 || die
}

View File

@@ -0,0 +1,27 @@
diff --git a/bin/cloud-localds b/bin/cloud-localds
index a9ddc74..50bc46e 100755
--- a/bin/cloud-localds
+++ b/bin/cloud-localds
@@ -146,8 +146,8 @@ case "$filesystem" in
fail "missing 'mcopy'. Required for --filesystem=vfat."
;;
iso9660)
- has_cmd genisoimage ||
- fail "missing 'genisoimage'. Required for --filesystem=iso9660."
+ has_cmd mkisofs ||
+ fail "missing 'mkisofs'. Required for --filesystem=iso9660."
;;
*) fail "unknown filesystem $filesystem";;
esac
@@ -232,9 +232,9 @@ case "$filesystem" in
fail "failed to create tarball with $path"
;;
iso9660)
- genisoimage -output "$img" -volid cidata \
+ mkisofs -output "$img" -volid cidata \
-joliet -rock "${files[@]}" > "$TEMP_D/err" 2>&1 ||
- { cat "$TEMP_D/err" 1>&2; fail "failed to genisoimage"; }
+ { cat "$TEMP_D/err" 1>&2; fail "failed to mkisofs"; }
;;
vfat)
truncate -s 128K "$img" || fail "failed truncate image"

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>artemis@artemis.sh</email>
<name>Artemis Everfree</name>
</maintainer>
<upstream>
<remote-id type="github">canonical/cloud-utils</remote-id>
</upstream>
<use>
<flag name="guest-utils">Installs utilities useful within a guest VM</flag>
<flag name="image-utils">Installs utilities useful for manipulating guest images from outside a guest VM</flag>
</use>
</pkgmetadata>