forked from kiss-community/kiss
Compare commits
26 Commits
fix-file-t
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
b9a8f9fc28 | ||
|
7740c929a3 | ||
|
9f88746487 | ||
|
584b905d17 | ||
|
37e6a59ed3 | ||
|
a6bb1c5a26 | ||
|
1492cfa0a7 | ||
|
4e809ddf6b | ||
|
5e338034ec | ||
|
9e1394c897 | ||
|
61b24f4d7b | ||
|
b66a2c4203 | ||
|
4f739a6589 | ||
|
38b71d01b2 | ||
|
6a41ce4f7e | ||
|
b04a707130 | ||
|
ed4b6b7534 | ||
|
cbbfd857f0 | ||
|
d240830906 | ||
|
65b5140de5 | ||
|
b71f27c891 | ||
|
fabe05b37d | ||
|
8caca48504 | ||
|
3309146e61 | ||
|
a27fcec564 | ||
|
8a1a88e0d3 |
9
.woodpecker.yml
Normal file
9
.woodpecker.yml
Normal file
@ -0,0 +1,9 @@
|
||||
steps:
|
||||
build:
|
||||
image: alpine
|
||||
when:
|
||||
branch: [ master ]
|
||||
commands: |
|
||||
apk add --no-cache shellcheck
|
||||
|
||||
shellcheck kiss contrib/*
|
@ -8,11 +8,9 @@
|
||||
}
|
||||
|
||||
kiss search "$@" | sort -u | while read -r repo; do cd "$repo"
|
||||
m=$(git log -1 version 2>/dev/null) ||:
|
||||
m=${m##*Author: }
|
||||
m=${m%%>*}
|
||||
m=$(git log -1 --format='%an <%ae>' -- version 2>/dev/null) ||:
|
||||
|
||||
[ "$m" ] || continue
|
||||
|
||||
printf '=> %s\n%s>\n' "$PWD" "$m"
|
||||
printf '=> %s\n%s\n' "$PWD" "$m"
|
||||
done
|
||||
|
@ -76,6 +76,10 @@ EOF
|
||||
remote=fd-find
|
||||
;;
|
||||
|
||||
fdm)
|
||||
remote=fdm-email-fetcher
|
||||
;;
|
||||
|
||||
fetsh)
|
||||
# TODO [community]: Rename package?
|
||||
remote=fet.sh
|
||||
@ -109,7 +113,7 @@ EOF
|
||||
;;
|
||||
|
||||
gtk+3)
|
||||
remote=gtk3+classic
|
||||
remote=gtk3-classic
|
||||
;;
|
||||
|
||||
gst-*)
|
||||
@ -236,6 +240,18 @@ EOF
|
||||
remote=python
|
||||
;;
|
||||
|
||||
python-docutils)
|
||||
remote=python:docutils
|
||||
;;
|
||||
|
||||
python-mako)
|
||||
remote=python:mako
|
||||
;;
|
||||
|
||||
python-markupsafe)
|
||||
remote=python:markupsafe
|
||||
;;
|
||||
|
||||
qt5*)
|
||||
remote=qt
|
||||
;;
|
||||
@ -370,8 +386,7 @@ get_outdated() {
|
||||
main() {
|
||||
set -e
|
||||
|
||||
[ "$1" ] ||
|
||||
die 'usage: kiss [ou]tdated /path/to/repo...'
|
||||
[ "$1" ] || set -- "$PWD"
|
||||
|
||||
mkdir -p "${tmp:=${XDG_CACHE_HOME:-"$HOME/.cache"}/kiss/repology}"
|
||||
|
||||
|
@ -1,12 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
# Lists the owners of all files with conflicts
|
||||
|
||||
kiss a | while read -r _ path; do
|
||||
if owner=$(kiss owns "$path" 2>/dev/null) && [ "$owner" ]; then
|
||||
printf '%s %s\n' "$owner" "$path"
|
||||
|
||||
else
|
||||
printf 'warning: %s has no owner\n' "$path" >&2
|
||||
fi
|
||||
done
|
||||
|
16
contrib/kiss-repodepends
Executable file
16
contrib/kiss-repodepends
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/sh -ef
|
||||
# Display a package's dependencies in repositories
|
||||
|
||||
pkg=${1:-"${PWD##*/}"}
|
||||
|
||||
kiss search "$pkg" >/dev/null || {
|
||||
printf 'usage: kiss-depends [pkg]\n' >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
kiss search "$pkg" | while read -r pkgpath; do
|
||||
printf '=> %s\n' "$pkgpath"
|
||||
while read -r dep mak || [ "$dep" ]; do
|
||||
printf '%s%s\n' "$dep" "${mak:+ "$mak"}"
|
||||
done 2>/dev/null < "$pkgpath/depends"
|
||||
done
|
19
contrib/kiss-reporevdepends
Executable file
19
contrib/kiss-reporevdepends
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
# Display packages in all repositories which depend on a package
|
||||
|
||||
[ "$1" ] || set -- "${PWD##*/}"
|
||||
|
||||
suffix () {
|
||||
case "$1" in *"$2") return 0; esac; return 1
|
||||
}
|
||||
|
||||
IFS=:
|
||||
for repo in $KISS_PATH; do
|
||||
# remove trailing slashes
|
||||
while suffix "$repo" /; do repo="${repo%/}"; done
|
||||
gitdir="$(git -C "$repo" rev-parse --show-toplevel 2>/dev/null || echo "$repo")"
|
||||
case "$gitdir" in "$repo") unset prefix ;; *) prefix="${repo##*/}/" ;; esac
|
||||
|
||||
cd "$gitdir/.." || continue
|
||||
grep -E "^$1([[:space:]]|$)" -- "${gitdir##*/}/$prefix"*/depends 2>/dev/null ||:
|
||||
done
|
193
kiss
193
kiss
@ -94,9 +94,7 @@ prompt() {
|
||||
null "$1" || log "$1"
|
||||
|
||||
log "Continue?: Press Enter to continue or Ctrl+C to abort"
|
||||
|
||||
# korn-shell does not exit on interrupt of read.
|
||||
equ "$KISS_PROMPT" 0 || read -r _ || exit 1
|
||||
equ "$KISS_PROMPT" 0 || dd bs=1 count=1 >/dev/null 2>&1 || exit 1
|
||||
}
|
||||
|
||||
mkcd() {
|
||||
@ -194,15 +192,26 @@ run_hook_pkg() {
|
||||
fi
|
||||
}
|
||||
|
||||
compress() {
|
||||
case $KISS_COMPRESS in
|
||||
bz2) bzip2 -c ;;
|
||||
gz) gzip -c ;;
|
||||
lz) lzip -c ;;
|
||||
lzma) lzma -cT0 ;;
|
||||
xz) xz -cT0 ;;
|
||||
zst) zstd -cT0 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
decompress() {
|
||||
case $1 in
|
||||
*.tbz|*.bz2) bzip2 -d ;;
|
||||
*.lzma) lzma -dc ;;
|
||||
*.lz) lzip -dc ;;
|
||||
*.tar) cat ;;
|
||||
*.tgz|*.gz) gzip -d ;;
|
||||
*.xz|*.txz) xz -dc ;;
|
||||
*.zst) zstd -dc ;;
|
||||
*.tar) cat ;;
|
||||
*.tbz|*.bz2) bzip2 -dc ;;
|
||||
*.lz) lzip -dc ;;
|
||||
*.tgz|*.gz) gzip -dc ;;
|
||||
*.lzma) lzma -dcT0 ;;
|
||||
*.xz|*.txz) xz -dcT0 ;;
|
||||
*.zst) zstd -dcT0 ;;
|
||||
esac < "$1"
|
||||
}
|
||||
|
||||
@ -305,15 +314,6 @@ pkg_find_version() {
|
||||
die "$pkg" "Build file not found or not executable"
|
||||
}
|
||||
|
||||
pkg_find_version_split() {
|
||||
pkg_find_version "$@"
|
||||
|
||||
# Split the version on '.+-_' to obtain individual components.
|
||||
IFS=.+-_ read -r repo_major repo_minor repo_patch repo_ident <<EOF
|
||||
$repo_ver
|
||||
EOF
|
||||
}
|
||||
|
||||
pkg_find() {
|
||||
_pkg_find "$@" || die "'$1' not found"
|
||||
}
|
||||
@ -328,6 +328,7 @@ _pkg_find() {
|
||||
# Intentional.
|
||||
# shellcheck disable=2086
|
||||
for _find_path in $4 "${3:-$sys_db}"; do set +f
|
||||
ok "$_find_path" || continue
|
||||
for _find_pkg in "$_find_path/"$1; do
|
||||
test "${3:--d}" "$_find_pkg" && set -f -- "$@" "$_find_pkg"
|
||||
done
|
||||
@ -378,24 +379,11 @@ pkg_cache() {
|
||||
pkg_source_resolve() {
|
||||
# Given a line of input from the sources file, return an absolute
|
||||
# path to the source if it already exists, error if not.
|
||||
unset _res _des _fnr
|
||||
unset _res _des
|
||||
|
||||
ok "${2##\#*}" || return 0
|
||||
|
||||
# Surround each replacement with substitutions to handled escaped markers.
|
||||
# First substitution turns '\MARKER' into ' ' (can't appear in sources as
|
||||
# they're already split on whitespace), second replaces 'MARKER' with its
|
||||
# value and the third, turns ' ' into 'MARKER' (dropping \\).
|
||||
fnr "${2%"${2##*[!/]}"}" \
|
||||
\\VERSION \ VERSION "$repo_ver" \ VERSION \
|
||||
\\RELEASE \ RELEASE "$repo_rel" \ RELEASE \
|
||||
\\MAJOR \ MAJOR "$repo_major" \ MAJOR \
|
||||
\\MINOR \ MINOR "$repo_minor" \ MINOR \
|
||||
\\PATCH \ PATCH "$repo_patch" \ PATCH \
|
||||
\\IDENT \ IDENT "$repo_ident" \ IDENT \
|
||||
\\PACKAGE \ PACKAGE "$repo_name" \ PACKAGE
|
||||
|
||||
set -- "$1" "$_fnr" "${3%"${3##*[!/]}"}" "$4"
|
||||
set -- "$1" "$2" "${3%"${3##*[!/]}"}" "$4"
|
||||
|
||||
# Git repository.
|
||||
if null "${2##git+*}"; then
|
||||
@ -442,7 +430,7 @@ pkg_source_resolve() {
|
||||
pkg_source() {
|
||||
# Download any remote package sources. The existence of local files is
|
||||
# also checked.
|
||||
pkg_find_version_split "$1"
|
||||
pkg_find_version "$1"
|
||||
|
||||
# Support packages without sources. Simply do nothing.
|
||||
[ -f "$repo_dir/sources" ] || return 0
|
||||
@ -454,9 +442,8 @@ pkg_source() {
|
||||
|
||||
# arg1: pre-source
|
||||
# arg2: package name
|
||||
# arg3: verbatim source
|
||||
# arg4: resolved source
|
||||
run_hook pre-source "$1" "$src" "$_fnr"
|
||||
# arg3: source
|
||||
run_hook pre-source "$1" "$src"
|
||||
|
||||
# '$2' is set when this function is called from 'kiss c' and it is used
|
||||
# here to skip calling the Git code.
|
||||
@ -467,8 +454,8 @@ pkg_source() {
|
||||
|
||||
# arg1: post-source
|
||||
# arg2: package name
|
||||
# arg3: verbatim source
|
||||
# arg4: resolved source
|
||||
# arg3: source
|
||||
# arg4: destination
|
||||
run_hook post-source "$1" "$src" "${_des:-"$_res"}"
|
||||
done < "$repo_dir/sources"
|
||||
}
|
||||
@ -476,6 +463,17 @@ pkg_source() {
|
||||
pkg_source_url() {
|
||||
log "$repo_name" "Downloading $2"
|
||||
|
||||
# Download to a temporary file and only move it to the destination if
|
||||
# everything completed successfully, to avoid leaving incomplete downloads
|
||||
# in the cache if it is interrupted.
|
||||
download_source=$2
|
||||
download_dest=$1
|
||||
tmp_file "${1##*/}" download
|
||||
shift
|
||||
|
||||
set -- "$_tmp_file" "$@"
|
||||
rm -f "$_tmp_file"
|
||||
|
||||
# Set the arguments based on found download utility.
|
||||
case ${cmd_get##*/} in
|
||||
aria2c) set -- -d / -o "$@" ;;
|
||||
@ -485,9 +483,11 @@ pkg_source_url() {
|
||||
esac
|
||||
|
||||
"$cmd_get" "$@" || {
|
||||
rm -f "$2"
|
||||
die "$repo_name" "Failed to download $3"
|
||||
rm -f "$_tmp_file"
|
||||
die "$repo_name" "Failed to download $download_source"
|
||||
}
|
||||
|
||||
mv "$_tmp_file" "$download_dest"
|
||||
}
|
||||
|
||||
pkg_source_git() {
|
||||
@ -935,9 +935,16 @@ pkg_etcsums() {
|
||||
# Minor optimization - skip packages without /etc/.
|
||||
[ -d "$pkg_dir/$repo_name/etc" ] || return 0
|
||||
|
||||
# Create a list of all files in etc but do it in reverse.
|
||||
while read -r etc; do case $etc in /etc/*[!/])
|
||||
set -- "$pkg_dir/$repo_name/$etc" "$@"
|
||||
etc="$pkg_dir/$repo_name/$etc"
|
||||
# Always use hash of /dev/null as the hash for symlinks as it's
|
||||
# possible that they can never be resolved/hashed
|
||||
# (eg. directory, non-existent path, ...)
|
||||
# So they leave missing lines in etcsums which breaks removal of all
|
||||
# other unmodified files in /etc aswell
|
||||
[ -h "$etc" ] && etc=/dev/null
|
||||
|
||||
set -- "$@" "$etc"
|
||||
esac done < manifest
|
||||
|
||||
b3 "$@" > etcsums
|
||||
@ -957,14 +964,7 @@ pkg_tar() {
|
||||
cd "$pkg_dir/$1"
|
||||
|
||||
# Create a tarball from the contents of the built package.
|
||||
tar cf - . | case $KISS_COMPRESS in
|
||||
bz2) bzip2 -z ;;
|
||||
gz) gzip -6 ;;
|
||||
lzma) lzma -z ;;
|
||||
lz) lzip -z ;;
|
||||
xz) xz -z ;;
|
||||
zst) zstd -z ;;
|
||||
esac > "$_tar_file"
|
||||
tar cf - . | compress > "$_tar_file"
|
||||
|
||||
cd "$OLDPWD"
|
||||
|
||||
@ -1039,7 +1039,7 @@ pkg_build_all() {
|
||||
for pkg do
|
||||
log "$pkg" "Building package ($((_build_cur+=1))/$#)"
|
||||
|
||||
pkg_find_version_split "$pkg"
|
||||
pkg_find_version "$pkg"
|
||||
|
||||
# arg1: queue-status
|
||||
# arg2: package name
|
||||
@ -1097,16 +1097,14 @@ pkg_build() {
|
||||
# Give the script a modified environment. Define toolchain program
|
||||
# environment variables assuming a generic environment by default.
|
||||
#
|
||||
# Define DESTDIR and GOPATH to sane defaults as their use is mandatory
|
||||
# in anything using autotools, meson, cmake, etc. Define KISS_ROOT as
|
||||
# the sanitized value used internally by the package manager. This is
|
||||
# safe to join with other paths.
|
||||
# Define GOPATH to sane defaults as its use is mandatory for Go projects.
|
||||
# Define KISS_ROOT as the sanitized value used internally by the package
|
||||
# manager. This is safe to join with other paths.
|
||||
AR="${AR:-ar}" \
|
||||
CC="${CC:-cc}" \
|
||||
CXX="${CXX:-c++}" \
|
||||
NM="${NM:-nm}" \
|
||||
RANLIB="${RANLIB:-ranlib}" \
|
||||
DESTDIR="$pkg_dir/$1" \
|
||||
RUSTFLAGS="--remap-path-prefix=$PWD=. $RUSTFLAGS" \
|
||||
GOFLAGS="-trimpath -modcacherw $GOFLAGS" \
|
||||
GOPATH="$PWD/go" \
|
||||
@ -1320,6 +1318,27 @@ pkg_alternatives() {
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_preferred() {
|
||||
cd "$sys_db"
|
||||
|
||||
# We only respect first argument
|
||||
if ok "$1"; then
|
||||
[ -d "$1" ] || die "'$1' not found"
|
||||
set -- "$1/manifest"
|
||||
else
|
||||
set +f; set -f -- */manifest
|
||||
fi
|
||||
|
||||
# Pass /dev/null to grep to always ensure that the file name
|
||||
# is printed even if we have a single file
|
||||
pkg_alternatives |
|
||||
cut -d' ' -f2- |
|
||||
grep -Fxf - "$@" /dev/null |
|
||||
sed 's/\/manifest:/ /'
|
||||
|
||||
cd "$OLDPWD"
|
||||
}
|
||||
|
||||
pkg_swap() {
|
||||
# Swap between package alternatives.
|
||||
[ -d "$sys_db/$1" ] || die "'$1' not found"
|
||||
@ -1384,9 +1403,6 @@ pkg_install_files() {
|
||||
# Skip directories if they already exist in the file system.
|
||||
# (Think /usr/bin, /usr/lib, etc).
|
||||
[ -d "$_file" ] || {
|
||||
# The file could be a symlink or a regular file
|
||||
rm -f "$_file"
|
||||
|
||||
file_rwx "$2/${file#/}"
|
||||
mkdir -m "$oct" "$_file"
|
||||
}
|
||||
@ -1414,24 +1430,6 @@ pkg_install_files() {
|
||||
cp -fP "$2$file" "${_file%/*}/."
|
||||
|
||||
else
|
||||
# Don't copy the file inside a directory if a directory with
|
||||
# that name already exists. Defer it's creation to after
|
||||
# package removal
|
||||
# This statement will be reached again on the second call to
|
||||
# pkg_install_files
|
||||
# TODO maybe add a sanity check before installation for
|
||||
# checking if the directory will actually be gone by the
|
||||
# second installation i.e no other packages have files inside
|
||||
# that dir (Eg. if you created a file at /usr)
|
||||
[ -d "$_file" ] &&
|
||||
if equ "$1" '-z'; then
|
||||
war "Deferring creation of '$_file' as it overlaps with an existing directory"
|
||||
continue
|
||||
else
|
||||
war "Refusing to replace non-empty directory '$_file' with file"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Construct a temporary filename which is a) unique and
|
||||
# b) identifiable as related to the package manager.
|
||||
__tmp=${_file%/*}/__kiss-tmp-$_pkg-${file##*/}-$KISS_PID
|
||||
@ -1458,7 +1456,7 @@ pkg_remove_files() {
|
||||
|
||||
case "${#sum_pkg}" in
|
||||
64) sh256 "$KISS_ROOT/$file" >/dev/null ;;
|
||||
66) b3 "$KISS_ROOT/$file" >/dev/null ;;
|
||||
*) b3 "$KISS_ROOT/$file" >/dev/null ;;
|
||||
esac
|
||||
|
||||
equ "$hash" "$sum_pkg" || {
|
||||
@ -1496,7 +1494,7 @@ pkg_etc() {
|
||||
|
||||
case "${#sum_old}" in
|
||||
64) sh256 "$tar_dir/$_pkg$file" "$KISS_ROOT$file" >/dev/null ;;
|
||||
66) b3 "$tar_dir/$_pkg$file" "$KISS_ROOT$file" >/dev/null ;;
|
||||
*) b3 "$tar_dir/$_pkg$file" "$KISS_ROOT$file" >/dev/null ;;
|
||||
esac
|
||||
|
||||
sum_new=${hash%%"$newline"*}
|
||||
@ -1539,6 +1537,14 @@ pkg_removable() {
|
||||
|
||||
set -f
|
||||
cd "$OLDPWD"
|
||||
|
||||
# Check if a package would leave dangling "orphaned" alternatives.
|
||||
tmp_file "$1" owned-conflicts
|
||||
pkg_preferred "$1" | tee "$_tmp_file"
|
||||
|
||||
cnt=$(wc -l < "$_tmp_file")
|
||||
equ "$cnt" 0 ||
|
||||
die "$1" "Not removable, package leaves behind $cnt orphaned alternatives"
|
||||
}
|
||||
|
||||
pkg_remove() {
|
||||
@ -1932,7 +1938,7 @@ args() {
|
||||
# Ensure that arguments do not contain invalid characters. Wildcards can
|
||||
# not be used here as they would conflict with kiss extensions.
|
||||
case $action in
|
||||
a|alternatives)
|
||||
a|alternatives|p|preferred)
|
||||
case $1 in *\**|*\!*|*\[*|*\ *|*\]*|*/*|*"$newline"*)
|
||||
die "Invalid argument: '!*[ ]/\\n' ($1)"
|
||||
esac
|
||||
@ -1992,14 +1998,16 @@ args() {
|
||||
LOGNAME="$user" \
|
||||
HOME="$HOME" \
|
||||
XDG_CACHE_HOME="$XDG_CACHE_HOME" \
|
||||
KISS_COMPRESS="$KISS_COMPRESS" \
|
||||
KISS_PATH="$KISS_PATH" \
|
||||
KISS_FORCE="$KISS_FORCE" \
|
||||
KISS_ROOT="$KISS_ROOT" \
|
||||
KISS_CHOICE="$KISS_CHOICE" \
|
||||
KISS_COLOR="$KISS_COLOR" \
|
||||
KISS_TMPDIR="$KISS_TMPDIR" \
|
||||
KISS_COMPRESS="$KISS_COMPRESS" \
|
||||
KISS_FORCE="$KISS_FORCE" \
|
||||
KISS_HOOK="$KISS_HOOK" \
|
||||
KISS_PATH="$KISS_PATH" \
|
||||
KISS_PID="$KISS_PID" \
|
||||
KISS_ROOT="$KISS_ROOT" \
|
||||
KISS_TMPDIR="$KISS_TMPDIR" \
|
||||
_KISS_DATE="$time" \
|
||||
_KISS_LVL="$_KISS_LVL" \
|
||||
"$0" "$action" "$@"
|
||||
|
||||
@ -2018,20 +2026,22 @@ args() {
|
||||
H|help-ext) pkg_help_ext "$@" ;;
|
||||
i|install) for pkg do pkg_install "$pkg"; done ;;
|
||||
l|list) pkg_list_version "$@" ;;
|
||||
p|preferred) pkg_preferred "$@" ;;
|
||||
r|remove) for pkg in $redro; do pkg_remove "$pkg"; done ;;
|
||||
s|search) for pkg do pkg_find "$pkg" all; done ;;
|
||||
u|update) pkg_update ;;
|
||||
U|upgrade) pkg_upgrade ;;
|
||||
v|version) printf '5.6.3\n' ;;
|
||||
v|version) printf '5.6.4\n' ;;
|
||||
|
||||
'')
|
||||
log 'kiss [a|b|c|d|i|l|r|s|u|U|v] [pkg]...'
|
||||
log 'kiss [a|b|c|d|i|l|p|r|s|u|U|v] [pkg]...'
|
||||
log 'alternatives List and swap alternatives'
|
||||
log 'build Build packages'
|
||||
log 'checksum Generate checksums'
|
||||
log 'download Download sources'
|
||||
log 'install Install packages'
|
||||
log 'list List installed packages'
|
||||
log 'preferred List owners of files with alternatives'
|
||||
log 'remove Remove packages'
|
||||
log 'search Search for packages'
|
||||
log 'update Update the repositories'
|
||||
@ -2151,7 +2161,10 @@ main() {
|
||||
|
||||
# Store the date and time of script invocation to be used as the name of
|
||||
# the log files the package manager creates during builds.
|
||||
time=$(date +%Y-%m-%d-%H:%M)
|
||||
# Accept _KISS_DATE in case this process has been called by a kiss process
|
||||
# started on a different day, which could cause permission issues if we
|
||||
# create log_dir as root.
|
||||
time=${_KISS_DATE:-"$(date +%Y-%m-%d-%H:%M)"}
|
||||
|
||||
create_tmp_dirs
|
||||
trap_on
|
||||
|
Loading…
Reference in New Issue
Block a user