cpt

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

commit 215011517d034bf93eb99650932b270e3473a4f8
parent 1626a2bb6d78980723d87116f3247aa23753202c
Author: Cem Keylan <cem@ckyln.com>
Date:   Fri, 15 May 2020 13:27:38 +0300

contrib: move some utilities to kiss-extra

Diffstat:
Dcontrib/kiss-cargo-urlgen | 12------------
Dcontrib/kiss-cargolock-urlgen | 21---------------------
Dcontrib/kiss-changelog | 11-----------
Dcontrib/kiss-depends-finder | 43-------------------------------------------
Dcontrib/kiss-exec | 23-----------------------
Dcontrib/kiss-message | 21---------------------
Dcontrib/kiss-orphans | 20--------------------
Dcontrib/kiss-reporevdepends | 17-----------------
Mman/kiss-contrib.1 | 42------------------------------------------
9 files changed, 0 insertions(+), 210 deletions(-)

diff --git a/contrib/kiss-cargo-urlgen b/contrib/kiss-cargo-urlgen @@ -1,12 +0,0 @@ -#!/bin/sh -# Create static cargo sources for Rust packages -case "$1" in ''|--help|-h) printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/} [crate+ver] [crate+ver]"; exit 0 ; esac - -# We convert the name-version seperator from '+' to '-' to -# avoid issues that may arise from version numbers that include -# a '-'. - -for crate in "$@"; do - printf 'https://static.crates.io/crates/%s/%s.crate vendor\n' \ - "${crate%+*}" "$(echo "$crate" | sed 's/+/-/')" -done diff --git a/contrib/kiss-cargolock-urlgen b/contrib/kiss-cargolock-urlgen @@ -1,21 +0,0 @@ -#!/bin/sh -# Convert the given Cargo.lock file to sources - -case "$1" in - -) set -- /dev/stdin ;; - ''|--help|-h) printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/} <Cargo.lock file>" "" \ - "'-' can be used to read from stdin." ; exit 0 -esac - -# Word splitting is intentional -# shellcheck disable=2046 -set -- $(sed '/name =/b;/version =/b;d' "$1" | - sed 's/version = /#/g;s/name = //;s/"//g' | - tr '\n' ' ' | sed 's/ #/#/g') - -# We convert the name-version seperator to '#' and back to '-' -# to avoid issues that may arise from version names with a '-' -for crate in "$@" ; do - printf 'https://static.crates.io/crates/%s/%s.crate vendor\n' \ - "${crate%#*}" "$crate" | sed 's/#/-/g' -done diff --git a/contrib/kiss-changelog b/contrib/kiss-changelog @@ -1,11 +0,0 @@ -#!/bin/sh -e -# Print the git log of the specific package - -case "$1" in ''|--help|-h) printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/} [pkg]"; exit 0; esac - -kiss s "$1" >/dev/null -cd "$(kiss s "$1" | sed 1q)" - -# Pipe to cat so it doesn't automatically paged -# by git. -git log --format='<%as> [%an] %s - %h' . | cat diff --git a/contrib/kiss-depends-finder b/contrib/kiss-depends-finder @@ -1,43 +0,0 @@ -#!/bin/sh -e -# Find missing dependencies by parsing 'ldd' - -case "$1" in ''|--help|-h) printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/} <pkg>" ; exit 0 ; esac - -kiss l "$1" >/dev/null - -db_dir=$KISS_ROOT/var/db/kiss/installed -grep=$(command -v ggrep) || grep='grep' - -printf '=> Detected dependencies:\n' - -while read -r file; do - [ -d "$KISS_ROOT/$file" ] && continue - - ldd "$KISS_ROOT/$file" 2>/dev/null | while read -r dep; do - # Skip lines containing 'ldd'. - [ "${dep##*ldd*}" ] || continue - - # Extract the file path from 'ldd' output. - dep=${dep#* => } - dep=${dep% *} - - # Traverse symlinks to get the true path to the file. - pkg=$(readlink -f "$KISS_ROOT/${dep##$KISS_ROOT}") - - # Figure out which package owns the file. - pkg=$("$grep" -lFx "${pkg##$KISS_ROOT}" "$db_dir/"*/manifest) - pkg=${pkg%/*} - pkg=${pkg##*/} - - # Skip listing these packages as dependencies. - case $pkg in - musl|gcc|"$1") ;; - *) printf '%s\n' "$pkg" ;; - esac - done -done < "$db_dir/$1/manifest" | sort -u - -printf '\n=> Package dependencies:\n' - -[ -f "$db_dir/$1/depends" ] && - cat "$db_dir/$1/depends" diff --git a/contrib/kiss-exec b/contrib/kiss-exec @@ -1,23 +0,0 @@ -#!/bin/sh -# Execute a command inside the alternatives system - -usage() { - printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/} [pkg] [command]" - exit "$1" -} - -case "$1" in ''|--help|-h) usage 0; esac -[ "$2" ] || usage 1 - -pkg=$1 - -[ "${2##/*}" ] && command=">usr>bin>$2" || - command="$(printf '%s' "$2" | sed 's#/#>#g')" - -[ -h "${file:=/var/db/kiss/choices/$pkg$command}" ] && { - printf 'ERROR: %s\n' "$file is a symlink" - exit 1 -} - -shift 2 -exec "/var/db/kiss/choices/$pkg$command" "$@" diff --git a/contrib/kiss-message b/contrib/kiss-message @@ -1,21 +0,0 @@ -#!/bin/sh -# Show messages from a package in the system database - -case "$1" in ''|--help|-h) printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/} [pkg] [pkg]"; exit 0; esac - -for pkg do - # Apply basename stripping so a user could run - # 'kiss-message /var/db/kiss/installed/*' to see - # all the messages on the system. - pkg=${pkg##*/} - msg="$KISS_ROOT/var/db/kiss/installed/$pkg/message" - - # Continue if no messages are available for the package. - [ -f "$msg" ] || continue - - printf '%s\n\033[1m%s\033[m\n%s\n\n' \ - "==============================" \ - "$pkg" \ - "==============================" - cat "$msg" -done diff --git a/contrib/kiss-orphans b/contrib/kiss-orphans @@ -1,20 +0,0 @@ -#!/bin/sh -e -# List orphaned packages - -case "$1" in ''|--help|-h) - printf '\033[1;33m-> \033[m%s\n' \ - "${0##*/}: lists packages that do not have any packages depending on them" >&2 - exit 0 -esac - -cd "$KISS_ROOT/var/db/kiss/installed/" - -for pkg in *; do - case $pkg in - baseinit|baselayout|gcc|pkgconf|e2fsprogs|musl|\ - make|busybox|bzip2|grub|kiss|git|linux-headers) - continue - esac - - grep -q "^$pkg$" ./*/depends || printf '%s\n' "$pkg" -done diff --git a/contrib/kiss-reporevdepends b/contrib/kiss-reporevdepends @@ -1,17 +0,0 @@ -#!/bin/sh -# Display packages on the repository which depend on package -# shellcheck disable=2086 - -case "$1" in ''|--help|-h) printf 'usage: %s <pkg>\n' "${0##*/}"; exit 0; esac - -pkg="$1" -IFS=:; set -- $KISS_PATH; unset IFS - -for repo do - # Change directory to the upper directory of the repository - # so it outputs packages in this nice looking format. - # repository/package: - cd "$repo/.." ||: - # This grep only checks for the full word - grep "^$pkg\$\|^$pkg\s" -- "${repo##*/}"/*/depends 2>/dev/null ||: -done diff --git a/man/kiss-contrib.1 b/man/kiss-contrib.1 @@ -5,19 +5,6 @@ kiss utilities This manual page is not for a single program, but for multiple utilities. Programs are explained in their own sections. They are listed alphabetically. -.SH KISS-CARGO-URLGEN -.B kiss-cargo-urlgen -[pkg+ver] [pkg+ver] - -Creates a list of static cargo urls which can be added to the \fBsources\fR -file of a \fIRust\fR package. It takes arguments as the package name, plus -sign, and the version number. -.SH KISS-CARGOLOCK-URLGEN -.B kiss-cargolock-urlgen -<Cargo.lock file> - -Does the same as \fBkiss-cargo-urlgen\fR, but gets the package and version -information from a \fICargo.lock\fR file. .SH KISS-CAT .B kiss-cat <pkg> [file] [file] @@ -25,11 +12,6 @@ information from a \fICargo.lock\fR file. Concatanates a package's files inside the system database. If no file is specified, it looks for \fBbuild\fR, \fBdepends\fR, \fBsources\fR, and \fBversion\fR. -.SH KISS-CHANGELOG -.B kiss-changelog -<pkg> - -Shows a git log of the specified package in an oneline format .SH KISS-CHBUILD .B kiss-chbuild @@ -51,11 +33,6 @@ from host, and chroots into the given directory. Cleans up after exit. <pkg> Checks the dependencies of an installed package. -.SH KISS-DEPENDSFINDER -.B kiss-depends-finder -<pkg> - -Finds the missing dependencies of packages by checking linked libraries/files. .SH KISS-EXPORT .B kiss-export <pkg> @@ -102,25 +79,11 @@ Prints the manifest file. <pkg> Prints the manifest file in a tree view. -.SH KISS-MESSAGE -.B kiss-message -<pkg> [pkg] [pkg] - -Outputs the messages of the given packages. A user could run -.IP -kiss-message /var/db/kiss/installed/* -.PP -to see all the messages they have. .SH KISS-NEW .B kiss-new <name> [version] [sources] Creates a boilerplate KISS package. -.SH KISS-ORPHANS -.B kiss-orphans - -Shows orphaned packages. These packages do not have any dependent packages -installed and can be removed. .SH KISS-OUTDATED .B kiss-outdated @@ -141,11 +104,6 @@ A 'readlink -f' replacement to be used inside the package manager. <pkg> Prints the dependencies of the given package as they are defined in the repository. -.SH KISS-REPOREVDEPENDS -.B kiss-reporevdepends -<pkg> - -Prints all the packages on your \fIKISS_PATH\fR that depends on package. .SH KISS-RESET .B kiss-reset