forked from artix/artools
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
0123e6d044 | |||
e2b2a21ed1 | |||
0e2e2875db | |||
a4d006adef |
8
Makefile
8
Makefile
@@ -34,15 +34,11 @@ PKG_BIN = \
|
||||
bin/pkg/deploypkg \
|
||||
bin/pkg/commitpkg \
|
||||
bin/pkg/comparepkg \
|
||||
bin/pkg/checkpkg \
|
||||
bin/pkg/mkchrootpkg \
|
||||
bin/pkg/pkg2yaml \
|
||||
bin/pkg/buildtree \
|
||||
bin/pkg/lddd \
|
||||
bin/pkg/finddeps \
|
||||
bin/pkg/find-libdeps \
|
||||
bin/pkg/links-add \
|
||||
bin/pkg/sogrep
|
||||
bin/pkg/links-add
|
||||
|
||||
LN_COMMITPKG = \
|
||||
extrapkg \
|
||||
@@ -171,8 +167,6 @@ install_pkg:
|
||||
install $(DIRMODE) $(DESTDIR)$(BINDIR)
|
||||
install $(MODE) $(PKG_BIN) $(DESTDIR)$(BINDIR)
|
||||
|
||||
$(LN) find-libdeps $(DESTDIR)$(BINDIR)/find-libprovides
|
||||
|
||||
$(LN) links-add $(DESTDIR)$(BINDIR)/links-remove
|
||||
|
||||
for l in $(LN_COMMITPKG); do $(LN) commitpkg $(DESTDIR)$(BINDIR)/$$l; done
|
||||
|
@@ -1,80 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (C) 2018-19 artoo@artixlinux.org
|
||||
# Copyright (C) 2018 Artix Linux Developers
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; version 2 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
. @libdir@/artools/util-base.sh
|
||||
. @libdir@/artools/util-pkg.sh
|
||||
|
||||
shopt -s extglob
|
||||
|
||||
load_user_info
|
||||
|
||||
load_vars "${USERCONFDIR}/pacman/makepkg.conf" || load_vars "$USER_HOME/.makepkg.conf"
|
||||
load_vars /etc/makepkg.conf
|
||||
|
||||
if [[ ! -f PKGBUILD ]]; then
|
||||
die 'This must be run in the directory of a built package.'
|
||||
fi
|
||||
|
||||
. ./PKGBUILD
|
||||
if [[ $arch == 'any' ]]; then
|
||||
CARCH='any'
|
||||
fi
|
||||
|
||||
STARTDIR=$(pwd)
|
||||
TEMPDIR=$(mktemp -d --tmpdir checkpkg-script.XXXX)
|
||||
|
||||
for _pkgname in "${pkgname[@]}"; do
|
||||
target_pkgver=$(get_full_version "$_pkgname")
|
||||
if ! pkgfile=$(find_cached_package "$_pkgname" "$target_pkgver" "$CARCH"); then
|
||||
die 'tarball not found for package: %s' "${_pkgname}-$target_pkgver"
|
||||
fi
|
||||
|
||||
ln -s "$pkgfile" "$TEMPDIR"
|
||||
|
||||
pkgurl=$(pacman -Spdd --print-format '%l' --noconfirm "$_pkgname")
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
die "Couldn't download previous package for %s." "$_pkgname"
|
||||
fi
|
||||
|
||||
oldpkg=${pkgurl##*://*/}
|
||||
|
||||
if [[ ${oldpkg##*/} = ${pkgfile##*/} ]]; then
|
||||
die "The built package (%s) is the one in the repo right now!" "$_pkgname"
|
||||
fi
|
||||
|
||||
if [[ $pkgurl = file://* ]]; then
|
||||
ln -s "${pkgurl#file://}" "$TEMPDIR/$oldpkg"
|
||||
elif [[ -f "$PKGDEST/$oldpkg" ]]; then
|
||||
ln -s "$PKGDEST/$oldpkg" "$TEMPDIR/$oldpkg"
|
||||
elif [[ -f "$STARTDIR/$oldpkg" ]]; then
|
||||
ln -s "$STARTDIR/$oldpkg" "$TEMPDIR/$oldpkg"
|
||||
else
|
||||
curl -fsLC - --retry 3 --retry-delay 3 -o "$TEMPDIR/$oldpkg" "$pkgurl"
|
||||
fi
|
||||
|
||||
bsdtar tf "$TEMPDIR/$oldpkg" | sort > "$TEMPDIR/filelist-$_pkgname-old"
|
||||
bsdtar tf "$pkgfile" | sort > "$TEMPDIR/filelist-$_pkgname"
|
||||
|
||||
sdiff -s "$TEMPDIR/filelist-$_pkgname-old" "$TEMPDIR/filelist-$_pkgname"
|
||||
|
||||
find-libprovides "$TEMPDIR/$oldpkg" 2>/dev/null | sort > "$TEMPDIR/libraries-$_pkgname-old"
|
||||
find-libprovides "$pkgfile" 2>/dev/null | sort > "$TEMPDIR/libraries-$_pkgname"
|
||||
if ! diff_output="$(sdiff -s "$TEMPDIR/libraries-$_pkgname-old" "$TEMPDIR/libraries-$_pkgname")"; then
|
||||
msg "Sonames differ in %s!" "$_pkgname"
|
||||
echo "$diff_output"
|
||||
else
|
||||
msg "No soname differences for %s" "$_pkgname."
|
||||
fi
|
||||
done
|
@@ -15,73 +15,162 @@
|
||||
. @libdir@/artools/util-base.sh
|
||||
. @libdir@/artools/util-pkg.sh
|
||||
|
||||
compare(){
|
||||
local pkgpath="$1"
|
||||
local pkg=${pkgpath##*/}
|
||||
local artixrepo=$(find_repo "$package" "${staging}" "${unstable}")
|
||||
local artixshow=${artixrepo%-*}
|
||||
local pkgbuild=$pkgpath/repos/$artixrepo/PKGBUILD
|
||||
|
||||
if [[ -f $pkgbuild ]];then
|
||||
|
||||
. $pkgbuild 2>/dev/null
|
||||
local artixver=$(get_full_version $pkg)
|
||||
|
||||
local archpath=$(get_import_path $pkg)
|
||||
|
||||
local archrepo=$(find_repo "$archpath" "${staging}" "${unstable}")
|
||||
|
||||
local archshow=${archrepo%-*}
|
||||
pkgbuild=$archpath/repos/$archrepo/PKGBUILD
|
||||
|
||||
if [[ -f $pkgbuild ]];then
|
||||
. $pkgbuild 2>/dev/null
|
||||
local archver=$(get_full_version $pkg)
|
||||
fi
|
||||
|
||||
local result=$(vercmp "$artixver" "$archver")
|
||||
|
||||
local repomatch=false
|
||||
[[ "$archrepo" == "$artixrepo" ]] && repomatch=true
|
||||
|
||||
if ${move};then
|
||||
|
||||
if [ $result -gt -1 ];then
|
||||
case $artixrepo in
|
||||
*testing*|*staging*)
|
||||
if $repomatch;then
|
||||
msg_row "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
|
||||
else
|
||||
msg_row_notify "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
elif ${upgrades};then
|
||||
|
||||
if [ $result -eq -1 ];then
|
||||
msg_row_upgrade "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
|
||||
fi
|
||||
|
||||
elif ${downgrades};then
|
||||
|
||||
if [ $result -eq 1 ];then
|
||||
if [[ -n $archver ]] && [[ -n $archrepo ]];then
|
||||
msg_row_downgrade "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
|
||||
fi
|
||||
fi
|
||||
|
||||
fi
|
||||
unset pkgver epoch pkgrel artixver archver pkgbuild archpath
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
is_db_entry() {
|
||||
local pkgname="$1" repo="$(arch2artix $2)"
|
||||
if [[ -d ${USERCACHEDIR}/${LINKSDBEXT}/${ARCH}/$repo/$pkgname ]];then
|
||||
return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
check_db(){
|
||||
local pkgpath="$1"
|
||||
local pkg=${pkgpath##*/}
|
||||
local sarch=(any ${ARCH})
|
||||
local arch_repos=$(arch_repos "${staging}" "${unstable}")
|
||||
|
||||
for repo in ${arch_repos[@]};do
|
||||
|
||||
for a in ${sarch[@]};do
|
||||
|
||||
local pkgbuild=$pkgpath/repos/$repo-$a/PKGBUILD
|
||||
|
||||
if [[ -f $pkgbuild ]];then
|
||||
|
||||
. $pkgbuild 2>/dev/null
|
||||
local artixver=$(get_full_version $pkg)
|
||||
local is_entry=false
|
||||
|
||||
for name in ${pkgname[@]};do
|
||||
|
||||
if is_db_entry "$name-$artixver" "$repo";then
|
||||
is_entry=true
|
||||
fi
|
||||
if ! $is_entry; then
|
||||
msg_row "%-20s %-35s %-20s %-10s" "$repo" "$name" "$artixver" "$is_entry"
|
||||
fi
|
||||
done
|
||||
unset artixver is_entry pkgbuild pkgver epoch pkgname pkgbase
|
||||
fi
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
update_db_cache(){
|
||||
msg "Updating database cache"
|
||||
for repo in "${searchrepos[@]}"; do
|
||||
local cachedir=${USERCACHEDIR}/${LINKSDBEXT}/${ARCH}/${repo}
|
||||
rm -rf "$cachedir"
|
||||
mkdir -p "$cachedir"
|
||||
msg2 "%s" "$repo"
|
||||
curl -s "${REPOS_MIRROR}/${repo}/os/${ARCH}/${repo}.${LINKSDBEXT}" \
|
||||
| bsdtar -xf - -C "$cachedir"
|
||||
done
|
||||
msg "Done"
|
||||
}
|
||||
|
||||
query_db() {
|
||||
msg_table_header "%-20s %-45s %s" "Repo" "Package" "Library"
|
||||
for repo in "${searchrepos[@]}"; do
|
||||
local prefix=
|
||||
local db=${USERCACHEDIR}/${LINKSDBEXT}/${ARCH}/${repo}/
|
||||
if [[ -d ${db} ]]; then
|
||||
while read -rd '' pkg; do
|
||||
read -r match
|
||||
pkg=${pkg#${db}}
|
||||
pkg="${pkg%/*}"
|
||||
|
||||
msg_row "%-20s %-45s %s" "${repo}" "${pkg}" "${match}"
|
||||
done < <(grep -rZ "${library}" "${db}") | sort -u
|
||||
fi
|
||||
done
|
||||
exit 0
|
||||
}
|
||||
|
||||
show_version_table(){
|
||||
msg_table_header "%-20s %-20s %-25s %-30s %-30s" "Arch Repo" "Artix Repo" "Package" "Arch version" "Artix version"
|
||||
|
||||
if ${check};then
|
||||
${sync} && update_db_cache
|
||||
msg_table_header "%-20s %-35s %-20s %-10s" "Repo" "Package" "Version" "Database"
|
||||
elif ${query};then
|
||||
${sync} && update_db_cache
|
||||
query_db
|
||||
else
|
||||
msg_table_header "%-20s %-20s %-25s %-30s %-30s" "Arch Repo" "Artix Repo" "Package" "Arch version" "Artix version"
|
||||
fi
|
||||
|
||||
for tree in ${TREE_NAMES_ARTIX[@]};do
|
||||
|
||||
local git=$(find ${TREE_DIR_ARTIX}/$tree/ -mindepth 1 -maxdepth 1 -type d)
|
||||
|
||||
for package in ${git[@]}; do
|
||||
|
||||
local pkg=${package##*/}
|
||||
local artixrepo=$(find_repo "$package" "${staging}" "${unstable}")
|
||||
local artixshow=${artixrepo%-*}
|
||||
local pkgbuild=$package/repos/$artixrepo/PKGBUILD
|
||||
|
||||
if [[ -f $pkgbuild ]];then
|
||||
|
||||
. $pkgbuild 2>/dev/null
|
||||
local artixver=$(get_full_version $pkg)
|
||||
|
||||
local archpath=$(get_import_path $pkg)
|
||||
|
||||
local archrepo=$(find_repo "$archpath" "${staging}" "${unstable}")
|
||||
|
||||
local archshow=${archrepo%-*}
|
||||
pkgbuild=$archpath/repos/$archrepo/PKGBUILD
|
||||
|
||||
if [[ -f $pkgbuild ]];then
|
||||
. $pkgbuild 2>/dev/null
|
||||
local archver=$(get_full_version $pkg)
|
||||
fi
|
||||
|
||||
local result=$(vercmp "$artixver" "$archver")
|
||||
|
||||
local repomatch=false
|
||||
[[ "$archrepo" == "$artixrepo" ]] && repomatch=true
|
||||
|
||||
if ${move};then
|
||||
|
||||
if [ $result -gt -1 ];then
|
||||
case $artixrepo in
|
||||
*testing*|*staging*)
|
||||
if $repomatch;then
|
||||
msg_row "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
|
||||
else
|
||||
msg_row_notify "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
elif ${upgrades};then
|
||||
|
||||
if [ $result -eq -1 ];then
|
||||
msg_row_upgrade "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
|
||||
fi
|
||||
|
||||
elif ${downgrades};then
|
||||
|
||||
if [ $result -eq 1 ];then
|
||||
if [[ -n $archver ]] && [[ -n $archrepo ]];then
|
||||
msg_row_downgrade "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
|
||||
fi
|
||||
fi
|
||||
|
||||
fi
|
||||
unset pkgver epoch pkgrel artixver archver pkgbuild archpath
|
||||
|
||||
if ${check};then
|
||||
check_db "$package"
|
||||
else
|
||||
compare "$package"
|
||||
fi
|
||||
done
|
||||
done
|
||||
@@ -98,14 +187,31 @@ staging=true
|
||||
upgrades=false
|
||||
downgrades=false
|
||||
move=false
|
||||
check=false
|
||||
sync=false
|
||||
query=false
|
||||
|
||||
artix_repos=(
|
||||
'goblins' 'gremlins' 'system' 'world'
|
||||
'galaxy-goblins' 'galaxy-gremlins' 'galaxy'
|
||||
'lib32-goblins' 'lib32-gremlins' 'lib32'
|
||||
'gnome-wobble' 'kde-wobble'
|
||||
)
|
||||
|
||||
searchrepos=(${artix_repos[@]})
|
||||
|
||||
usage() {
|
||||
echo "Usage: ${0##*/} [options]"
|
||||
echo "Usage: ${0##*/} [options] (with -q [libname])"
|
||||
echo ' -u Show upgrade packages'
|
||||
echo ' -d Show downgrade packages'
|
||||
echo ' -m Show packages to move'
|
||||
echo " -x Don't inlcude staging packages"
|
||||
echo ' -y Include unstable kde and gnome'
|
||||
echo ' -c Check repos'
|
||||
echo " -s Sync repo databases"
|
||||
echo " -q Query repo databases for so libs"
|
||||
echo ' -r <repo> Repo name to query'
|
||||
echo ' [default: all]'
|
||||
echo ' -h This help'
|
||||
echo ''
|
||||
echo ''
|
||||
@@ -114,7 +220,7 @@ usage() {
|
||||
|
||||
orig_argv=("$0" "$@")
|
||||
|
||||
opts='udmxyh'
|
||||
opts='r:qcsudmxyh'
|
||||
|
||||
while getopts "${opts}" arg; do
|
||||
case "${arg}" in
|
||||
@@ -123,6 +229,10 @@ while getopts "${opts}" arg; do
|
||||
m) move=true ;;
|
||||
x) staging=false ;;
|
||||
y) unstable=true ;;
|
||||
c) check=true ;;
|
||||
s) sync=true ;;
|
||||
q) query=true ;;
|
||||
r) searchrepos=("$OPTARG") ;;
|
||||
h|?) usage 0 ;;
|
||||
*) echo "invalid argument '${arg}'"; usage 1 ;;
|
||||
esac
|
||||
@@ -130,4 +240,6 @@ done
|
||||
|
||||
shift $(($OPTIND - 1))
|
||||
|
||||
library="$1"; shift
|
||||
|
||||
show_version_table
|
||||
|
@@ -1,102 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (C) 2018-19 artoo@artixlinux.org
|
||||
# Copyright (C) 2018 Artix Linux Developers
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; version 2 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
. @libdir@/artools/util-base.sh
|
||||
. @libdir@/artools/util-pkg.sh
|
||||
|
||||
# $1: sofile
|
||||
# $2: soarch
|
||||
process_sofile() {
|
||||
# extract the library name: libfoo.so
|
||||
local soname="${1%.so?(+(.+([0-9])))}".so
|
||||
# extract the major version: 1
|
||||
soversion="${1##*\.so\.}"
|
||||
if [[ "$soversion" = "$1" ]] && (($IGNORE_INTERNAL)); then
|
||||
return
|
||||
fi
|
||||
if ! in_array "${soname}=${soversion}-$2" ${soobjects[@]}; then
|
||||
# libfoo.so=1-64
|
||||
msg "${soname}=${soversion}-$2"
|
||||
soobjects+=("${soname}=${soversion}-$2")
|
||||
fi
|
||||
}
|
||||
|
||||
set -e
|
||||
shopt -s extglob
|
||||
|
||||
IGNORE_INTERNAL=0
|
||||
|
||||
if [[ $1 = "--ignore-internal" ]]; then
|
||||
IGNORE_INTERNAL=1
|
||||
shift
|
||||
fi
|
||||
|
||||
script_mode=${0##*/find-lib}
|
||||
|
||||
case $script_mode in
|
||||
deps|provides) true;;
|
||||
*) die "Unknown mode %s" "$script_mode" ;;
|
||||
esac
|
||||
|
||||
if [[ -z $1 ]]; then
|
||||
echo "${0##*/} [options] <package file|extracted package dir>"
|
||||
echo "Options:"
|
||||
echo " --ignore-internal ignore internal libraries"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -d $1 ]]; then
|
||||
pushd $1 >/dev/null
|
||||
else
|
||||
WORKDIR=$(mktemp -d --tmpdir "${0##*/}.XXXXXXXXXX")
|
||||
|
||||
case ${script_mode} in
|
||||
deps) bsdtar -C "$WORKDIR" -xf "$1";;
|
||||
provides) bsdtar -C "$WORKDIR" -xf "$1" --include="*.so*";;
|
||||
esac
|
||||
|
||||
pushd "$WORKDIR" >/dev/null
|
||||
fi
|
||||
|
||||
case $script_mode in
|
||||
deps) find_args=(-perm -u+x);;
|
||||
provides) find_args=(-name *.so*);;
|
||||
esac
|
||||
|
||||
find $PWD -type f "${find_args[@]}" | while read filename; do
|
||||
if [[ $script_mode = "provides" ]]; then
|
||||
# ignore if we don't have a shared object
|
||||
if ! LC_ALL=C readelf -h "$filename" 2>/dev/null | grep -q '.*Type:.*DYN (Shared object file).*'; then
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
||||
# get architecture of the file; if soarch is empty it's not an ELF binary
|
||||
soarch=$(LC_ALL=C readelf -h "$filename" 2>/dev/null | sed -n 's/.*Class.*ELF\(32\|64\)/\1/p')
|
||||
[[ -n $soarch ]] || continue
|
||||
|
||||
if [[ $script_mode = "provides" ]]; then
|
||||
# get the string binaries link to: libfoo.so.1.2 -> libfoo.so.1
|
||||
sofile=$(LC_ALL=C readelf -d "$filename" 2>/dev/null | sed -n 's/.*Library soname: \[\(.*\)\].*/\1/p')
|
||||
[[ -z $sofile ]] && sofile="${filename##*/}"
|
||||
process_sofile "${sofile}" "${soarch}"
|
||||
elif [[ $script_mode = "deps" ]]; then
|
||||
# process all libraries needed by the binary
|
||||
for sofile in $(LC_ALL=C readelf -d "$filename" 2>/dev/null | sed -nr 's/.*Shared library: \[(.*)\].*/\1/p'); do
|
||||
process_sofile "${sofile}" "${soarch}"
|
||||
done
|
||||
fi
|
||||
done
|
||||
|
||||
popd >/dev/null
|
@@ -1,48 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (C) 2018-19 artoo@artixlinux.org
|
||||
# Copyright (C) 2018 Artix Linux Developers
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; version 2 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
. @libdir@/artools/util-base.sh
|
||||
|
||||
match=$1
|
||||
|
||||
if [[ -z $match ]]; then
|
||||
echo 'Usage: finddeps <depname>'
|
||||
echo ''
|
||||
echo 'Find packages that depend on a given depname.'
|
||||
echo 'Run this script from the top-level directory of your ABS tree.'
|
||||
echo ''
|
||||
exit 1
|
||||
fi
|
||||
|
||||
find $PWD -type d | while read d; do
|
||||
if [[ -f "$d/PKGBUILD" ]]; then
|
||||
unset pkgname depends makedepends optdepends
|
||||
. "$d/PKGBUILD"
|
||||
for dep in "${depends[@]}"; do
|
||||
# lose the version comparator, if any
|
||||
depname=${dep%%[<>=]*}
|
||||
[[ $depname = $match ]] && msg "$d (depends)"
|
||||
done
|
||||
for dep in "${makedepends[@]}"; do
|
||||
# lose the version comparator, if any
|
||||
depname=${dep%%[<>=]*}
|
||||
[[ $depname = $match ]] && msg "$d (makedepends)"
|
||||
done
|
||||
for dep in "${optdepends[@]/:*}"; do
|
||||
# lose the version comaparator, if any
|
||||
depname=${dep%%[<>=]*}
|
||||
[[ $depname = $match ]] && msg "$d (optdepends)"
|
||||
done
|
||||
fi
|
||||
done
|
@@ -1,140 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# sogrep - find shared library links in an Arch Linux repository.
|
||||
#
|
||||
# Copyright (c) 2019 by Eli Schwartz <eschwartz@archlinux.org>
|
||||
# Copyright (c) 2019 artoo@artixlinux.org
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
. @libdir@/artools/util-base.sh
|
||||
|
||||
load_user_info
|
||||
|
||||
load_config "${USERCONFDIR}/artools/artools.conf" || load_config "${SYSCONFDIR}/artools.conf"
|
||||
|
||||
# options
|
||||
REFRESH=0
|
||||
VERBOSE=0
|
||||
|
||||
recache() {
|
||||
local repo verbosity=-s
|
||||
|
||||
(( VERBOSE )) && verbosity=--progress-bar
|
||||
|
||||
for repo in "${ARTIX_REPOS[@]}"; do
|
||||
rm -rf "${SOCACHE_DIR}/${ARCH}/${repo}"
|
||||
mkdir -p "${SOCACHE_DIR}/${ARCH}/${repo}"
|
||||
curl "$verbosity" "${SOLINKS_MIRROR}/${repo}/os/${ARCH}/${repo}.${LINKSDBEXT}" | bsdtar -xf - -C "${SOCACHE_DIR}/${ARCH}/${repo}"
|
||||
done
|
||||
}
|
||||
|
||||
search() {
|
||||
local repo=$1 lib=$2 srepos=("${ARTIX_REPOS[@]}")
|
||||
|
||||
if [[ $repo != all ]]; then
|
||||
if ! in_array "${repo}" "${ARTIX_REPOS[@]}"; then
|
||||
echo "${BASH_SOURCE[0]##*/}: unrecognized repo '$repo'"
|
||||
echo "Try '${BASH_SOURCE[0]##*/} --help' for more information."
|
||||
exit 1
|
||||
fi
|
||||
srepos=("${repo}")
|
||||
fi
|
||||
|
||||
for repo in "${srepos[@]}"; do
|
||||
local prefix=
|
||||
(( VERBOSE && ${#srepos[@]} > 1 )) && prefix=${repo}/
|
||||
db=${SOCACHE_DIR}/${ARCH}/${repo}/
|
||||
if [[ -d ${db} ]]; then
|
||||
while read -rd '' pkg; do
|
||||
read -r match
|
||||
pkg=${pkg#${db}}
|
||||
pkg="${prefix}${pkg%-*-*/links}"
|
||||
|
||||
if (( VERBOSE )); then
|
||||
printf '%-45s %s\n' "${pkg}" "${match}"
|
||||
else
|
||||
printf '%s\n' "${pkg}"
|
||||
fi
|
||||
done < <(grep -rZ "${lib}" "${db}") | sort -u
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
usage() {
|
||||
cat <<- _EOF_
|
||||
Usage: ${BASH_SOURCE[0]##*/} [OPTIONS] REPO LIBNAME
|
||||
|
||||
Check the soname links database for Artix Linux repositories containing
|
||||
packages linked to a given shared library. If the repository specified
|
||||
is "all", then all repositories will be searched, otherwise only the
|
||||
named repository will be searched.
|
||||
|
||||
If the links database does not exist, it will be downloaded first.
|
||||
|
||||
OPTIONS
|
||||
-v, --verbose Show matched links in addition to pkgname
|
||||
-r, --refresh Refresh the links databases
|
||||
-h, --help Show this help text
|
||||
_EOF_
|
||||
}
|
||||
|
||||
# utility function to resort with multiple repos + no-verbose
|
||||
resort() { sort -u; }
|
||||
|
||||
if (( $# == 0 )); then
|
||||
echo "error: No arguments passed."
|
||||
echo "Try '${BASH_SOURCE[0]##*/} --help' for more information."
|
||||
exit 1
|
||||
fi
|
||||
OPT_SHORT='vrh'
|
||||
OPT_LONG=('verbose' 'refresh' 'help')
|
||||
if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then
|
||||
exit 1
|
||||
fi
|
||||
set -- "${OPTRET[@]}"
|
||||
|
||||
while :; do
|
||||
case $1 in
|
||||
-v|--verbose)
|
||||
resort() { cat; }
|
||||
VERBOSE=1
|
||||
;;
|
||||
-r|--refresh)
|
||||
REFRESH=1
|
||||
;;
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
--)
|
||||
shift; break
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if ! (( ( REFRESH && $# == 0 ) || $# == 2 )); then
|
||||
echo "error: Incorrect number of arguments passed."
|
||||
echo "Try '${BASH_SOURCE[0]##*/} --help' for more information."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if (( REFRESH )) || [[ ! -d ${SOCACHE_DIR} ]]; then
|
||||
recache
|
||||
(( $# == 2 )) || exit 0
|
||||
fi
|
||||
|
||||
search "$@"
|
@@ -42,7 +42,7 @@
|
||||
# REPOS_ROOT=${WORKSPACE_DIR}/repos
|
||||
|
||||
# default mirror for sogrep
|
||||
# SOLINKS_MIRROR="http://mirror1.artixlinux.org/repos"
|
||||
# REPOS_MIRROR="http://mirror1.artixlinux.org/repos"
|
||||
|
||||
#############################################
|
||||
################ artools-iso ################
|
||||
|
@@ -103,23 +103,13 @@ init_artools_pkg(){
|
||||
|
||||
REPOS_ROOT=${REPOS_ROOT:-"${WORKSPACE_DIR}/repos"}
|
||||
|
||||
SOLINKS_MIRROR=${SOLINKS_MIRROR:-'http://mirror1.artixlinux.org/repos'}
|
||||
|
||||
SOCACHE_DIR="${XDG_CACHE_HOME:-$USER_HOME/.cache}/sogrep"
|
||||
REPOS_MIRROR=${REPOS_MIRROR:-'http://mirror1.artixlinux.org/repos'}
|
||||
|
||||
DBEXT=${DBEXT:-'xz'}
|
||||
|
||||
LINKSDBEXT=${LINKSDBEXT:-"links.tar.${DBEXT}"}
|
||||
|
||||
PKGDBEXT=${PKGDBEXT:-"db.tar.${DBEXT}"}
|
||||
|
||||
[[ -z ${ARTIX_REPOS[@]} ]] && \
|
||||
ARTIX_REPOS=(
|
||||
'goblins' 'gremlins' 'system' 'world'
|
||||
'galaxy-goblins' 'galaxy-gremlins' 'galaxy'
|
||||
'lib32-goblins' 'lib32-gremlns' 'lib32'
|
||||
'gnome-wobble' 'kde-wobble'
|
||||
)
|
||||
}
|
||||
|
||||
init_artools_iso(){
|
||||
@@ -185,6 +175,8 @@ load_user_info(){
|
||||
|
||||
USERCONFDIR="${XDG_CONFIG_HOME:-$USER_HOME/.config}"
|
||||
prepare_dir "${USERCONFDIR}"
|
||||
|
||||
USERCACHEDIR="${XDG_CACHE_HOME:-$USER_HOME/.cache}/artools"
|
||||
}
|
||||
|
||||
# orig_argv=("$0" "$@")
|
||||
|
@@ -136,6 +136,17 @@ write_servicescfg_conf(){
|
||||
printf '%s' "${yaml}"
|
||||
}
|
||||
|
||||
write_unpackfs_conf(){
|
||||
local yaml=$(write_yaml_header)
|
||||
yaml+=$(write_empty_line)
|
||||
yaml+=$(write_yaml_map 0 'unpack')
|
||||
yaml+=$(write_yaml_seq_map 2 'source' "/run/artix/bootmnt/artix/x86_64/rootfs.sfs")
|
||||
yaml+=$(write_yaml_map 4 'sourcefs' 'squashfs')
|
||||
yaml+=$(write_yaml_map 4 'destination' '')
|
||||
yaml+=$(write_empty_line)
|
||||
printf '%s' "${yaml}"
|
||||
}
|
||||
|
||||
configure_calamares(){
|
||||
local mods="$1/etc/calamares/modules"
|
||||
if [[ -d "$mods" ]];then
|
||||
@@ -144,6 +155,7 @@ configure_calamares(){
|
||||
write_servicescfg_conf > "$mods"/services-"${INITSYS}".conf
|
||||
sed -e "s|openrc|${INITSYS}|" -i "$mods"/postcfg.conf
|
||||
sed -e "s|services-openrc|services-${INITSYS}|" -i "$1"/etc/calamares/settings.conf
|
||||
[[ -z ${DESKTOP_LIST} ]] && write_unpackfs_conf > "$mods"/unpackfs.conf
|
||||
fi
|
||||
}
|
||||
|
||||
|
@@ -69,6 +69,25 @@ patch_pkg(){
|
||||
esac
|
||||
}
|
||||
|
||||
arch2artix(){
|
||||
local repo="$1" artix=none
|
||||
case "$repo" in
|
||||
core) artix=system ;;
|
||||
extra) artix=world ;;
|
||||
community) artix=galaxy ;;
|
||||
multilib) artix=lib32 ;;
|
||||
staging) artix=goblins ;;
|
||||
testing) artix=gremlins ;;
|
||||
community-staging) artix=galaxy-goblins ;;
|
||||
community-testing) artix=galaxy-gremlins ;;
|
||||
multilib-staging) artix=lib32-goblins ;;
|
||||
multilib-testing) artix=lib32-gremlins ;;
|
||||
kde-unstable) artix=kde-wobble ;;
|
||||
gnome-unstable) artix=gnome-wobble ;;
|
||||
esac
|
||||
echo $artix
|
||||
}
|
||||
|
||||
find_tree(){
|
||||
local tree="$1" pkg="$2"
|
||||
local result=$(find $tree -mindepth 2 -maxdepth 2 -type d -name "$pkg")
|
||||
@@ -76,20 +95,37 @@ find_tree(){
|
||||
echo ${result##*/}
|
||||
}
|
||||
|
||||
find_repo(){
|
||||
local pkg="$1" stag="$2" unst="$3" repo=
|
||||
arch_repos(){
|
||||
local stag="$1" unst="$2"
|
||||
local repos=(core extra testing community community-testing multilib multilib-testing)
|
||||
|
||||
$stag && repos+=(staging community-staging multilib-staging)
|
||||
$unst && repos+=(gnome-unstable kde-unstable)
|
||||
|
||||
for r in ${repos[@]};do
|
||||
echo ${repos[@]}
|
||||
}
|
||||
|
||||
find_repo(){
|
||||
local pkg="$1" stag="$2" unst="$3" repo=
|
||||
|
||||
for r in $(arch_repos "$stag" "$unst");do
|
||||
[[ -f $pkg/repos/$r-x86_64/PKGBUILD ]] && repo=$r-x86_64
|
||||
[[ -f $pkg/repos/$r-any/PKGBUILD ]] && repo=$r-any
|
||||
done
|
||||
echo $repo
|
||||
}
|
||||
|
||||
is_valid_repo(){
|
||||
local src="$1" cases=
|
||||
for r in $(arch_repos true true);do
|
||||
cases=${cases:-}${cases:+|}${r}
|
||||
done
|
||||
eval "case $src in
|
||||
${cases}|trunk) return 0 ;;
|
||||
*) return 1 ;;
|
||||
esac"
|
||||
}
|
||||
|
||||
get_cases(){
|
||||
local pkglist="${DATADIR}/pkglists/$1.list"
|
||||
local _space="s| ||g" _clean=':a;N;$!ba;s/\n/ /g' _com_rm="s|#.*||g"
|
||||
@@ -143,14 +179,6 @@ pkgver_equal() {
|
||||
fi
|
||||
}
|
||||
|
||||
is_valid_repo(){
|
||||
local src="$1"
|
||||
case $src in
|
||||
core|extra|community|multilib|testing|staging|community-testing|community-staging|multilib-testing|multilib-staging|trunk) return 0 ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
find_cached_package() {
|
||||
local searchdirs=("$PKGDEST" "$PWD") results=()
|
||||
local targetname=$1 targetver=$2 targetarch=$3
|
||||
|
Reference in New Issue
Block a user