diff options
author | merakor <cem@ckyln.com> | 2020-07-24 10:39:50 +0000 |
---|---|---|
committer | merakor <cem@ckyln.com> | 2020-07-24 10:39:50 +0000 |
commit | db779acfe1319f7cdbdc0c493f6e6fd6ae2412ef (patch) | |
tree | 9740efa1e1007c9e522e3d4c3b633b8fa4e85183 | |
parent | 1deb9398fa1d646995348bd92406580627dbaed7 (diff) | |
download | cpt-db779acfe1319f7cdbdc0c493f6e6fd6ae2412ef.tar.gz |
contrib: replace kiss usage with cpt tools
FossilOrigin-Name: 37f8991b3fe9af32f167b813e0a1a30ada525aa3e3f31507a267c7c3ba5f43b7
-rwxr-xr-x | contrib/cpt-cat | 6 | ||||
-rwxr-xr-x | contrib/cpt-chbuild | 8 | ||||
-rwxr-xr-x | contrib/cpt-chroot | 1 | ||||
-rwxr-xr-x | contrib/cpt-depends | 4 | ||||
-rwxr-xr-x | contrib/cpt-export | 18 | ||||
-rwxr-xr-x | contrib/cpt-fork | 16 | ||||
-rwxr-xr-x | contrib/cpt-link | 6 | ||||
-rwxr-xr-x | contrib/cpt-manifest | 4 | ||||
-rwxr-xr-x | contrib/cpt-manifest-tree | 4 | ||||
-rwxr-xr-x | contrib/cpt-new | 2 | ||||
-rwxr-xr-x | contrib/cpt-owns | 12 | ||||
-rwxr-xr-x | contrib/cpt-repodepends | 6 | ||||
-rwxr-xr-x | contrib/cpt-reset | 6 | ||||
-rwxr-xr-x | contrib/cpt-revdepends | 6 | ||||
-rwxr-xr-x | contrib/cpt-size | 6 |
15 files changed, 48 insertions, 57 deletions
diff --git a/contrib/cpt-cat b/contrib/cpt-cat index 7f21760..199eefc 100755 --- 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 index 3ee7c42..bfbbcd2 100755 --- 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 index 7d0585c..2524b68 100755 --- 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 index b549ff9..5f770b8 100755 --- 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 index c124822..45ab564 100755 --- 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 index bfaaa7d..b50e251 100755 --- 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 index e5368bf..b6a0c57 100755 --- 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 index bb9afc8..8f8b83c 100755 --- 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 index 0cc047e..823b013 100755 --- 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 index a068704..00b99c2 100755 --- 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 index e14d579..60c4633 100755 --- 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 index ca72605..1b0b391 100755 --- 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 index 326cb80..1226fe6 100755 --- 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 index 183849a..9824877 100755 --- 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 index d2e8259..63288a2 100755 --- 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 |