cpt

[ARCHIVED] Carbs Packaging Tools
git clone git://git.ckyln.com/~cem/cpt.git
Log | Files | Refs | README | LICENSE

commit f65dccce9b7e04ed82e3debdb6b500313243c8fd
parent ec47e9a682f838716453d960ceb58a1c0146d2a5
Author: Cem Keylan <cem@ckyln.com>
Date:   Fri, 24 Jul 2020 13:39:50 +0300

contrib: replace kiss usage with cpt tools

Diffstat:
Mcontrib/cpt-cat | 6+++---
Mcontrib/cpt-chbuild | 8++++----
Mcontrib/cpt-chroot | 1-
Mcontrib/cpt-depends | 4++--
Mcontrib/cpt-export | 18+++++++++---------
Mcontrib/cpt-fork | 16++++------------
Mcontrib/cpt-link | 6+++---
Mcontrib/cpt-manifest | 4++--
Mcontrib/cpt-manifest-tree | 4++--
Mcontrib/cpt-new | 2+-
Mcontrib/cpt-owns | 12++++++------
Mcontrib/cpt-repodepends | 6+++---
Mcontrib/cpt-reset | 6+++---
Mcontrib/cpt-revdepends | 6+++---
Mcontrib/cpt-size | 6+++---
15 files changed, 48 insertions(+), 57 deletions(-)

diff --git a/contrib/cpt-cat b/contrib/cpt-cat @@ -3,11 +3,11 @@ # File names are printed to stderr. case "$1" in ''|--help|-h) printf '\033[1;33m-> \033[musage: %s [pkg] [file...]\n' "${0##*/}" ; exit 0; esac -kiss l "${pkg:=$1}" >/dev/null ; shift +cpt-list "${pkg:=$1}" >/dev/null ; shift for file in ${*:-build depends sources version} ; do - [ -f "/var/db/kiss/installed/$pkg/$file" ] && { + [ -f "/var/db/cpt/installed/$pkg/$file" ] && { printf '\033[1m%s:\033[m\n' "$file" >&2 - cat "/var/db/kiss/installed/$pkg/$file" + cat "/var/db/cpt/installed/$pkg/$file" } done diff --git a/contrib/cpt-chbuild b/contrib/cpt-chbuild @@ -10,7 +10,7 @@ die() { rm -f carbs-rootfs.tar.xz carbs-rootfs.tar.xz.sum log "$@" - log "Re-run 'kiss-chbuild' to try again." + log "Re-run 'cpt-chbuild' to try again." exit 1 } @@ -37,7 +37,7 @@ case "$(uname -m)" in i*86) arch=i686; esac url="https://dl.carbslinux.org/releases/${arch:-$(uname -m)}/carbs-rootfs.tar.xz" pid=$$ -cd "${cac_dir:=$KISS_ROOT${XDG_CACHE_HOME:-$HOME/.cache}/kiss}" +cd "${cac_dir:=$CPT_ROOT${CPT_CACHE:=${XDG_CACHE_HOME:-$HOME/.cache}/cpt}}" [ -f carbs-rootfs.tar.xz ] || { log "Downloading chroot tarball" @@ -66,8 +66,8 @@ cp -a carbs-chroot "chroot-$pid" [ "$1" ] && { log "Installing extra packages" - KISS_ROOT=$PWD/chroot-$pid kiss i "$@" + CPT_ROOT=$PWD/chroot-$pid cpt-install "$@" } log "Entering chroot" -su -c "kiss-chroot chroot-$pid; rm -rf chroot-$pid" +su -c "cpt-chroot chroot-$pid; rm -rf chroot-$pid" diff --git a/contrib/cpt-chroot b/contrib/cpt-chroot @@ -57,7 +57,6 @@ main() { TERM="$TERM" \ SHELL=/bin/sh \ USER=root \ - KISS_ASROOT=1 \ CFLAGS="${CFLAGS:--march=$march -mtune=generic -pipe -Os}" \ CXXFLAGS="${CXXFLAGS:--march=$march -mtune=generic -pipe -Os}" \ MAKEFLAGS="${MAKFLAGS:--j$(nproc 2>/dev/null || echo 1)}" \ diff --git a/contrib/cpt-depends b/contrib/cpt-depends @@ -3,5 +3,5 @@ case "$1" in ''|--help|-h) printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/} [pkg]" ; exit 0 ; esac -kiss l "$1" >/dev/null -cat "$KISS_ROOT/var/db/kiss/installed/$1/depends" 2>/dev/null +cpt-list "$1" >/dev/null +cat "$CPT_ROOT/var/db/cpt/installed/$1/depends" 2>/dev/null diff --git a/contrib/cpt-export b/contrib/cpt-export @@ -1,13 +1,13 @@ #!/bin/sh -ef -# Turn an installed package into a KISS tarball +# Turn an installed package into a CPT tarball case "$1" in ''|--help|-h) printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/} [pkg]" ; exit 0 ; esac -kiss l "${1:-null}" >/dev/null +cpt-list "${1:-null}" >/dev/null # Grab the package's version.. read -r ver rel 2>/dev/null < \ - "$KISS_ROOT/var/db/kiss/installed/$1/version" + "$CPT_ROOT/var/db/cpt/installed/$1/version" # Reset the argument list. pkg=$1 @@ -15,17 +15,17 @@ set -- # Construct the argument list using each file. while read -r file; do - [ -d "$KISS_ROOT/$file" ] || set -- "$@" ".$file" -done < "$KISS_ROOT/var/db/kiss/installed/$pkg/manifest" + [ -d "$CPT_ROOT/$file" ] || set -- "$@" ".$file" +done < "$CPT_ROOT/var/db/cpt/installed/$pkg/manifest" # Turn the list of files back into a package. -: "${KISS_COMPRESS:=gz}" -tar cf - -C / -- "$@" | case "$KISS_COMPRESS" in +: "${CPT_COMPRESS:=gz}" +tar cf - -C / -- "$@" | case "$CPT_COMPRESS" in bz2) bzip2 -z ;; gz) gzip -6 ;; xz) xz -zT 0 ;; zst) zstd -3 ;; *) gzip -6 ;; # Fallback to gzip -esac > "$pkg#$ver-$rel.tar.$KISS_COMPRESS" +esac > "$pkg#$ver-$rel.tar.$CPT_COMPRESS" -printf 'tarball created in %s\n' "$PWD/$pkg#$ver-$rel.tar.$KISS_COMPRESS" +printf 'tarball created in %s\n' "$PWD/$pkg#$ver-$rel.tar.$CPT_COMPRESS" diff --git a/contrib/cpt-fork b/contrib/cpt-fork @@ -2,23 +2,15 @@ # Fork a package to the current directory case "$1" in ''|--help|-h) printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/} [pkg]" ; exit 0 ; esac -[ "$KISS_FORCE" ] || { +[ "$CPT_FORCE" ] || { [ -d "$1" ] && { printf '\033[1;31m!> \033[m%s\n' "$1 already exists on the current directory" \ - "You can set KISS_FORCE=1 to ignore this." + "You can set CPT_FORCE=1 to ignore this." exit 1 } } -kiss s "$1" >/dev/null - -# Disable this warning as globbing is disabled and word splitting -# is intentional. This grabs the location of the package's files. -# shellcheck disable=2046 -( - set -- $(kiss s "$1") - - cp -r "$1" . -) +cpt-search "$1" >/dev/null +cp -r "$(cpt-search --single "$1")" . printf 'forked package to %s\n' "$PWD/$1" diff --git a/contrib/cpt-link b/contrib/cpt-link @@ -1,14 +1,14 @@ #!/bin/sh -ef # Link a forked package's files to the other repository -case "$1" in ''|--help|-h) printf '\033[1;33m-> \033[musage: kiss-link [file...]\n' ; exit 0 ; esac +case "$1" in ''|--help|-h) printf '\033[1;33m-> \033[musage: %s [file...]\n' "${0##*/}" ; exit 0 ; esac # Check if the package exists in a repository and error out here # if it does not. The error message from the package manager will # be displayed. -kiss s "${PKG:=${PWD##*/}}" >/dev/null +cpt-search "${PKG:=${PWD##*/}}" >/dev/null -oPKG="$(kiss s "$PKG" | grep -v "^$PWD\$\|/var/db/kiss/installed/$PKG" | sed 1q)" +oPKG="$(cpt-search "$PKG" | grep -v "^$PWD\$\|/var/db/cpt/installed/$PKG" | sed 1q)" for file in "$@" ; do [ -e "${oPKG:?}/$file" ] diff --git a/contrib/cpt-manifest b/contrib/cpt-manifest @@ -2,5 +2,5 @@ # Display all files owned by a package case "$1" in ''|--help|-h) printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/} [pkg]" ; exit 0 ; esac -kiss l "$1" >/dev/null -cat "$KISS_ROOT/var/db/kiss/installed/$1/manifest" 2>/dev/null +cpt-list "$1" >/dev/null +cat "$CPT_ROOT/var/db/cpt/installed/$1/manifest" 2>/dev/null diff --git a/contrib/cpt-manifest-tree b/contrib/cpt-manifest-tree @@ -2,6 +2,6 @@ # Display all files owned by a package with a tree view case "$1" in ''|--help|-h) printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/} [pkg]" ; exit 0 ; esac -kiss l "$1" >/dev/null +cpt-list "$1" >/dev/null printf '%s\n' "[$1]:" -tree -C --fromfile "$KISS_ROOT/var/db/kiss/installed/$1/manifest" | sed 1,2d +tree -C --fromfile "$CPT_ROOT/var/db/cpt/installed/$1/manifest" | sed 1,2d diff --git a/contrib/cpt-new b/contrib/cpt-new @@ -1,5 +1,5 @@ #!/bin/sh -e -# Create a boilerplate KISS package +# Create a boilerplate CPT package out() { printf '\033[1;33m-> \033[m%s\n' "$@" >&2 ;} die() { printf '\033[1;31m!> \033[m%s\n' "$@" >&2 ; exit 1 ;} diff --git a/contrib/cpt-owns b/contrib/cpt-owns @@ -1,12 +1,12 @@ #!/bin/sh -e # Check which package owns a file -case "$1" in ''|--help|-h) printf '%s\n' "usage: kiss-owns [file]" ; exit 0 ; esac +case "$1" in ''|--help|-h) printf '%s\n' "usage: ${0##*/} [file]" ; exit 0 ; esac -# Strip 'KISS_ROOT' from the file path if passed and +# Strip 'CPT_ROOT' from the file path if passed and # follow symlinks. -file="${1#$KISS_ROOT}" -dirname=$(kiss-readlink "$KISS_ROOT/${file%/*}") +file="${1#$CPT_ROOT}" +dirname=$(cpt-readlink "$CPT_ROOT/${file%/*}") file="$dirname/${file##*/}" # Check if the file exists and exit if it is not. @@ -19,8 +19,8 @@ file="$dirname/${file##*/}" # Print the full path to the manifest file which contains # the match to our search. -pkg_owns=$(grep -lFx "${file#$KISS_ROOT}" \ - "$KISS_ROOT/var/db/kiss/installed/"*/manifest) +pkg_owns=$(grep -lFx "${file#$CPT_ROOT}" \ + "$CPT_ROOT/var/db/cpt/installed/"*/manifest) # Extract the package name from the path above. diff --git a/contrib/cpt-repodepends b/contrib/cpt-repodepends @@ -1,7 +1,7 @@ #!/bin/sh -e # Display a package's dependencies in the repository -case "$1" in ''|--help|-h) printf '%s\n' "usage: kiss-repodepends [pkg]" ; exit 0 ; esac -kiss s "$1" >/dev/null +case "$1" in ''|--help|-h) printf '%s\n' "usage: ${0##*/} [pkg]" ; exit 0 ; esac +cpt-search "$1" >/dev/null -cat "$(kiss s "$1" | sed 1q)/depends" 2>/dev/null +cat "$(cpt-search --single "$1")/depends" 2>/dev/null diff --git a/contrib/cpt-reset b/contrib/cpt-reset @@ -9,16 +9,16 @@ set -- while read -r pkg _; do case $pkg in baselayout|binutils|bison|busybox|bzip2|curl|flex|gcc|rsync|\ - gzip|kiss|libressl|linux-headers|m4|make|musl|pkgconf|xz|zlib) ;; + gzip|cpt|libressl|linux-headers|m4|make|musl|pkgconf|xz|zlib) ;; *) set -- "$@" "$pkg" ;; esac done <<EOF -$(kiss l) +$(cpt-list) EOF [ "$1" ] && { printf 'WARNING: This will remove \033[1m%s\033[m package(s).\n' "$#" printf 'Continue? [Enter/Ctrl+C]\n' - read -r _ && KISS_FORCE=1 kiss r "$@" + read -r _ && CPT_FORCE=1 cpt-remove "$@" } diff --git a/contrib/cpt-revdepends b/contrib/cpt-revdepends @@ -1,12 +1,12 @@ #!/bin/sh -e # Display packages which depend on package -case "$1" in ''|--help|-h) printf '%s\n' "usage: kiss-revdepends [pkg]" ; exit 0 ; esac -kiss s "$1" >/dev/null +case "$1" in ''|--help|-h) printf '%s\n' "usage: ${0##*/} [pkg]" ; exit 0 ; esac +cpt-search "$1" >/dev/null # 'cd' to the database directory as a simple way of # stripping the path and performing a 'basename'. -cd "$KISS_ROOT/var/db/kiss/installed" +cd "$CPT_ROOT/var/db/cpt/installed" # Use a simple 'grep' to display packages depending on '$1'. grep "^$1" -- */depends diff --git a/contrib/cpt-size b/contrib/cpt-size @@ -1,12 +1,12 @@ #!/bin/sh -ef # Show the size on disk for a package -case "$1" in ''|--help|-h) printf '%s\n' "usage: kiss-size [pkg]" ; exit 0 ; esac -kiss s "$1" >/dev/null +case "$1" in ''|--help|-h) printf '%s\n' "usage: ${0##*/} [pkg]" ; exit 0 ; esac +cpt-search "$1" >/dev/null # Filter directories from manifest and leave only files. # Directories in the manifest end in a trailing '/'. -files=$(sed 's|.*/$||' "$KISS_ROOT/var/db/kiss/installed/$1/manifest") +files=$(sed 's|.*/$||' "$CPT_ROOT/var/db/cpt/installed/$1/manifest") # Send the file list to 'du'. # This unquoted variable is safe as word splitting is intended