Compare commits

..

12 Commits

Author SHA1 Message Date
b5fa7084b2 mkdepgraph: remove printf vars 2022-05-27 19:58:03 +02:00
7eabdb0e46 add mkdepgraph 2022-05-27 19:54:00 +02:00
10c013bf33 data: update makepkg.conf 2022-05-27 19:54:00 +02:00
74618d77a5 comparepkg: don't check for result when moving 2022-05-12 13:06:56 +02:00
196761740b repo: rename var 2022-05-09 15:24:05 +02:00
a814655956 repo: simplify find_repo() return 2022-05-08 23:37:02 +02:00
7b03050ab9 comparepkg: rename var 2022-05-08 20:59:38 +02:00
0b1ff8d060 comparepkg: fix var 2022-05-08 19:12:09 +02:00
f66761aa57 comparepkg: use get_group() 2022-05-08 19:10:30 +02:00
f33d9bdac1 artix-chroot: remove obsolete help 2022-05-03 22:54:52 +02:00
f50c66cdd7 artix-chroot: remove -a arg 2022-05-03 22:45:58 +02:00
fd1bc87ef0 makefile: remove compat symlink, remove deploypkg symlinks 2022-05-03 22:45:27 +02:00
7 changed files with 123 additions and 175 deletions

View File

@@ -41,7 +41,8 @@ PKG_BIN = \
bin/pkg/signpkg \ bin/pkg/signpkg \
bin/pkg/checkrepo \ bin/pkg/checkrepo \
bin/pkg/gitearepo \ bin/pkg/gitearepo \
bin/pkg/tidyarch bin/pkg/tidyarch \
bin/pkg/mkdepgraph
LN_COMMITPKG = \ LN_COMMITPKG = \
extrapkg \ extrapkg \
@@ -72,20 +73,6 @@ LN_BUILDPKG = \
buildpkg-kde-wobble \ buildpkg-kde-wobble \
buildpkg-gnome-wobble buildpkg-gnome-wobble
LN_DEPLOYPKG = \
deploypkg-system \
deploypkg-world \
deploypkg-gremlins \
deploypkg-goblins \
deploypkg-galaxy \
deploypkg-galaxy-gremlins \
deploypkg-galaxy-goblins \
deploypkg-lib32 \
deploypkg-lib32-gremlins \
deploypkg-lib32-goblins \
deploypkg-kde-wobble \
deploypkg-gnome-wobble
PKG_DATA = \ PKG_DATA = \
data/pacman/makepkg.conf \ data/pacman/makepkg.conf \
data/valid-names.conf data/valid-names.conf
@@ -156,9 +143,6 @@ install_pkg:
for l in $(LN_COMMITPKG); do $(LN) commitpkg $(DESTDIR)$(BINDIR)/$$l; done for l in $(LN_COMMITPKG); do $(LN) commitpkg $(DESTDIR)$(BINDIR)/$$l; done
for l in $(LN_BUILDPKG); do $(LN) buildpkg $(DESTDIR)$(BINDIR)/$$l; done for l in $(LN_BUILDPKG); do $(LN) buildpkg $(DESTDIR)$(BINDIR)/$$l; done
for l in $(LN_DEPLOYPKG); do $(LN) deploypkg $(DESTDIR)$(BINDIR)/$$l; done
$(LN) artix-chroot $(DESTDIR)$(BINDIR)/artools-chroot
install $(DIRMODE) $(DESTDIR)$(DATADIR)/$(TOOLS) install $(DIRMODE) $(DESTDIR)$(DATADIR)/$(TOOLS)
install $(FILEMODE) $(PKG_DATA) $(DESTDIR)$(DATADIR)/$(TOOLS) install $(FILEMODE) $(PKG_DATA) $(DESTDIR)$(DATADIR)/$(TOOLS)

View File

@@ -18,112 +18,21 @@ m4_include(lib/base/message.sh)
m4_include(lib/base/chroot.sh) m4_include(lib/base/chroot.sh)
m4_include(lib/base/mount.sh) m4_include(lib/base/mount.sh)
#{{{ functions
chroot_part_mount() {
msg2 "mount: [%s]" "$2"
mount "$@" && CHROOT_ACTIVE_PART_MOUNTS=("$2" "${CHROOT_ACTIVE_PART_MOUNTS[@]}")
}
chroot_part_umount() {
chroot_api_umount
msg2 "umount: [%s]" "${CHROOT_ACTIVE_PART_MOUNTS[@]}"
umount "${CHROOT_ACTIVE_PART_MOUNTS[@]}"
unset CHROOT_ACTIVE_PART_MOUNTS
}
detect(){
local detected
detected="$(os-prober | tr ' ' '_' | paste -s -d ' ')"
printf "%s\n" "${detected}"
}
# $1: os-prober array
get_os_name(){
local str=$1
str="${str#*:}"
str="${str#*:}"
str="${str%:*}"
printf "%s\n" "$str"
}
mount_os(){
CHROOT_ACTIVE_PART_MOUNTS=()
CHROOT_ACTIVE_MOUNTS=()
trap_setup chroot_part_umount
chroot_part_mount "$2" "$1"
local mounts
mounts=$(perl -ane 'printf("%s:%s\n", @F[0,1]) if $F[0] =~ m#^UUID=#;' "$1"/etc/fstab)
for entry in ${mounts}; do
entry=${entry//UUID=}
local dev=${entry%:*} mp=${entry#*:}
case "${entry#*:}" in
'/'|'swap'|'none') continue ;;
*) chroot_part_mount "/dev/disk/by-uuid/${dev}" "$1${mp}" ;;
esac
done
chroot_setup "$1" true
chroot_add_resolv_conf "$1"
}
select_os(){
local os_list=( "$(detect)" ) count=${#os_list[@]}
if [[ ${count} -gt 1 ]];then
msg "Detected systems:"
local i=0
for os in "${os_list[@]}"; do
local last=${os##*:}
case $last in
'efi') count=$((count-1)) ;;
*) msg2 "$i) $(get_os_name "$os")"; i=$((i+1)) ;;
esac
done
i=0
msg "Select system to mount [0-%s] : " "$((count-1))"
read -r select
else
select=0
fi
local os_str=${os_list[$select]} type
type=$os_str
root=${os_str%%:*}
type=${type##*:}
if [[ "${type##*:}" == 'linux' ]];then
msg "Mounting (%s) [%s]" "$(get_os_name "$os_str")" "$root"
mount_os "$1" "$root"
else
die "You can't mount %s!" "$select"
fi
}
#}}}
automount=false
usage() { usage() {
printf 'usage: %s -a [or] %s chroot-dir [command]\n' "${0##*/}" "${0##*/}" printf 'usage: %s chroot-dir [command]\n' "${0##*/}"
printf ' -a Automount detected linux system\n'
printf ' -h Print this help message\n' printf ' -h Print this help message\n'
printf '\n' printf '\n'
printf " If 'command' is unspecified, %s will launch /bin/sh.\n" "${0##*/}" printf " If 'command' is unspecified, %s will launch /bin/sh.\n" "${0##*/}"
printf '\n' printf '\n'
printf " If 'automount' is true, %s will launch /bin/bash\n" "${0##*/}"
printf ' and %s\n' "${chrootdir}"
printf '\n'
printf '\n' printf '\n'
exit "$1" exit "$1"
} }
opts=':ha' opts=':h'
while getopts ${opts} arg; do while getopts ${opts} arg; do
case "${arg}" in case "${arg}" in
a) automount=true ;;
h|?) usage 0 ;; h|?) usage 0 ;;
esac esac
done done
@@ -131,20 +40,12 @@ shift $(( OPTIND - 1 ))
check_root check_root
if ${automount};then chrootdir=$1
chrootdir=/mnt shift
run_args=(/bin/bash)
select_os "${chrootdir}" [[ -d ${chrootdir} ]] || die "Can't create chroot on non-directory %s" "${chrootdir}"
else
chrootdir=$1
shift
run_args=("$@")
[[ -d ${chrootdir} ]] || die "Can't create chroot on non-directory %s" "${chrootdir}" chroot_api_mount "${chrootdir}" || die "failed to setup API filesystems in chroot %s" "${chrootdir}"
chroot_add_resolv_conf "${chrootdir}"
chroot_api_mount "${chrootdir}" || die "failed to setup API filesystems in chroot %s" "${chrootdir}" SHELL=/bin/sh unshare --fork --pid chroot "${chrootdir}" "$@"
chroot_add_resolv_conf "${chrootdir}"
fi
SHELL=/bin/sh unshare --fork --pid chroot "${chrootdir}" "${run_args[@]}"

View File

@@ -188,9 +188,9 @@ from_arch(){
[[ -z $srcpath ]] && die "Package '%s' does not exist!" "${package}" [[ -z $srcpath ]] && die "Package '%s' does not exist!" "${package}"
repo=$(find_repo "$srcpath") repo=$(find_repo "$srcpath")
msg "repo: %s" "${repo#*/}" msg "repo: %s" "$repo"
archpath=$srcpath/$repo archpath=$srcpath/repos/$repo
artixpath=$(find_pkg "${TREE_DIR_ARTIX}" "${package}") artixpath=$(find_pkg "${TREE_DIR_ARTIX}" "${package}")
show_deps "$archpath" show_deps "$archpath"
@@ -214,7 +214,7 @@ view_build(){
archpath=$(find_pkg "${TREE_DIR_ARCH}" "${package}") archpath=$(find_pkg "${TREE_DIR_ARCH}" "${package}")
[[ -z $archpath ]] && die "Package '%s' does not exist!" "${package}" [[ -z $archpath ]] && die "Package '%s' does not exist!" "${package}"
repo=$(find_repo "${archpath}") repo=$(find_repo "${archpath}")
archpath=$archpath/$repo archpath=$archpath/repos/$repo
msg "repo: %s" "${repo#*/}" msg "repo: %s" "${repo#*/}"
show_deps "$archpath" show_deps "$archpath"
} }

View File

@@ -31,23 +31,32 @@ write_list(){
printf "%s\n" "$line" >> "${TREE_DIR_ARTIX}"/"$name".list printf "%s\n" "$line" >> "${TREE_DIR_ARTIX}"/"$name".list
} }
get_group() {
local group
group="${artixpath%/*}"
group=${group##*/}
printf "%s\n" "${group#*-}"
}
compare_m(){ compare_m(){
case ${artixrepo} in # if [ "$result" -eq 0 ];then
*testing*|*staging*|*rebuild) case "$artixrepo" in
if [[ "${a}" == "${b}" ]]; then *testing*|*staging*|*rebuild)
msg_row "${table}" "${a}" "${b}" "$pkg" "$archver" "$artixver" "${group#*-}" if [[ "${archrepo}" == "${artixrepo}" ]]; then
elif [[ "${a}" == 'staging' && "${b}" == 'rebuild' ]]; then msg_row "${table}" "${archrepo}" "${artixrepo}" "$pkg" "$archver" "$artixver" "$(get_group)"
msg_row_yellow "${table}" "${a}" "${b}" "$pkg" "$archver" "$artixver" "${group#*-}" elif [[ "${archrepo}" == 'staging' && "${artixrepo}" == 'rebuild' ]]; then
else msg_row_yellow "${table}" "${archrepo}" "${artixrepo}" "$pkg" "$archver" "$artixver" "$(get_group)"
msg_row_green "${table}" "${a}" "${b}" "$pkg" "$archver" "$artixver" "${group#*-}"
if [[ -n "$archrepo" ]]; then
write_list "${a}:${b}:$pkg" pkg_moves
else else
write_list "@repo@:${b}:$pkg" artix msg_row_green "${table}" "${archrepo}" "${artixrepo}" "$pkg" "$archver" "$artixver" "$(get_group)"
if [[ -n "${archrepo}" ]]; then
write_list "${archrepo}:${artixrepo}:$pkg" pkg_moves
else
write_list "@repo@:${artixrepo}:$pkg" artix
fi
fi fi
fi ;;
;; esac
esac # fi
} }
compare_u(){ compare_u(){
@@ -55,15 +64,15 @@ compare_u(){
# local arel=${archver##*-} brel=${artixver##*-} # local arel=${archver##*-} brel=${artixver##*-}
# local reldiff # local reldiff
# reldiff=$(( $arel-${brel%.*} )) # reldiff=$(( $arel-${brel%.*} ))
msg_row_red "${table}" "${a}" "${b}" "$pkg" "$archver" "$artixver" "${group#*-}" msg_row_red "${table}" "${archrepo}" "${artixrepo}" "$pkg" "$archver" "$artixver" "$(get_group)"
write_list "${a}:$pkg" pkg_upgrades write_list "${archrepo}:$pkg" pkg_upgrades
fi fi
} }
compare_d(){ compare_d(){
if [ "$result" -eq 1 ];then if [ "$result" -eq 1 ];then
if [[ -n "$archver" ]] && [[ -n "$archrepo" ]];then if [[ -n "$archver" ]] && [[ -n "${archrepo}" ]];then
msg_row_yellow "${table}" "${a}" "${b}" "$pkg" "$archver" "$artixver" "${group#*-}" msg_row_yellow "${table}" "${archrepo}" "${artixrepo}" "$pkg" "$archver" "$artixver" "$(get_group)"
fi fi
fi fi
} }
@@ -78,27 +87,22 @@ get_archpath(){
} }
pre_compare(){ pre_compare(){
local func="$1" pkgpath="$2" result group pkg local artixpath="$1" func="$2" pkg
group="${pkgpath%/*}" pkg=${artixpath##*/}
group=${group##*/}
pkg=${pkgpath##*/}
local artixrepo archrepo pkgbuild artixver archver archpath node a b local artixrepo archrepo pkgbuild artixver archver archpath epoch
artixrepo=$(find_repo "$pkgpath")
pkgbuild=$pkgpath/$artixrepo/PKGBUILD
if [[ -f $pkgbuild ]]; then artixrepo=$(find_repo "$artixpath")
pkgbuild=$artixpath/$CARCH/$artixrepo/PKGBUILD
if [[ -f "$pkgbuild" ]]; then
# shellcheck disable=1090 # shellcheck disable=1090
. "$pkgbuild" 2>/dev/null . "$pkgbuild" 2>/dev/null
artixver=$(get_full_version) artixver=$(get_full_version)
archpath=$(get_archpath "$pkg") archpath=$(get_archpath "$pkg")
archrepo=$(find_repo "${archpath}") archrepo=$(find_repo "$archpath")
pkgbuild=$archpath/$archrepo/PKGBUILD pkgbuild=$archpath/repos/$archrepo/PKGBUILD
node=${artixrepo%/*} archrepo="${archrepo%-*}"
a=${archrepo#*/} b=${artixrepo#*/}
a="${a%-*}"
[[ "$node" != "$CARCH" ]] && b=${b%-*}
if [[ -f "$pkgbuild" ]]; then if [[ -f "$pkgbuild" ]]; then
# shellcheck disable=1090 # shellcheck disable=1090
@@ -106,27 +110,26 @@ pre_compare(){
archver=$(get_full_version) archver=$(get_full_version)
fi fi
local result
result=$(vercmp "$artixver" "$archver") result=$(vercmp "$artixver" "$archver")
"$func" "$func"
unset epoch
fi fi
} }
compare_upgrades(){ compare_upgrades(){
local pkgpath="${1%/*}" local artixpath="${1%/*}"
pre_compare compare_u "$pkgpath" pre_compare "$artixpath" compare_u
} }
compare_downgrades(){ compare_downgrades(){
local pkgpath="${1%/*}" local artixpath="${1%/*}"
pre_compare compare_d "$pkgpath" pre_compare "$artixpath" compare_d
} }
compare_move(){ compare_move(){
local pkgpath="${1%/*}" local artixpath="${1%/*}"
pre_compare compare_m "$pkgpath" pre_compare "$artixpath" compare_m
} }
#}}} #}}}

59
bin/pkg/mkdepgraph.in Normal file
View File

@@ -0,0 +1,59 @@
#!/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.
mk_graph(){
printf "%s\n" "$(pactree "${pactree_args[@]}" "${package}")" \
| dot -T "${ext}" > "${graph_dir}/${package}.${ext}"
}
usage() {
printf "Usage: %s [options] <package>\n" "${0##*/}"
printf " -l enable linear output\n"
printf " -r list packages that depend on the named package\n"
printf " -u show dependencies with no duplicates (implies -l)\n"
printf " -d <#> limit the depth of recursion\n"
printf " -o <#> controls at which depth to stop printing optional deps\n"
printf " (-1 for no limit)\n"
printf " -h display this help message\n"
exit "$1"
}
graph_dir=${XDG_PICTURES_DIR:-$(xdg-user-dir PICTURES)/artix}
ext="png"
pactree_args=(-gs)
depth=0
optdepth=-1
while getopts :d:o:rluh arg; do
case "${arg}" in
r) pactree_args+=(-r) ;;
l) pactree_args+=(-l) ;;
u) pactree_args+=(-u) ;;
d) depth="$OPTARG"; pactree_args+=(-d "$depth") ;;
o) optdepth="$OPTARG"; pactree_args+=(-o"$optdepth") ;;
h|?) usage 0 ;;
esac
done
shift $(( OPTIND - 1 ))
package="$1"
if [[ ! -d "${graph_dir}" ]];then
mkdir -p "${graph_dir}"
fi
mk_graph

View File

@@ -45,12 +45,13 @@ CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions \
-fstack-clash-protection -fcf-protection" -fstack-clash-protection -fcf-protection"
CXXFLAGS="$CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS" CXXFLAGS="$CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS"
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now" LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now"
LTOFLAGS="-flto=auto"
#RUSTFLAGS="-C opt-level=2" #RUSTFLAGS="-C opt-level=2"
#-- Make Flags: change this for DistCC/SMP systems #-- Make Flags: change this for DistCC/SMP systems
#MAKEFLAGS="-j2" #MAKEFLAGS="-j2"
#-- Debugging flags #-- Debugging flags
DEBUG_CFLAGS="-g" DEBUG_CFLAGS="-g"
DEBUG_CXXFLAGS="-g" DEBUG_CXXFLAGS="$DEBUG_CFLAGS"
#DEBUG_RUSTFLAGS="-C debuginfo=2" #DEBUG_RUSTFLAGS="-C debuginfo=2"
######################################################################### #########################################################################

View File

@@ -25,9 +25,9 @@ set_arch_repos(){
find_repo(){ find_repo(){
local pkg="$1" pkgarch="${2:-${CARCH}}" repo local pkg="$1" pkgarch="${2:-${CARCH}}" repo
for r in "${ARCH_REPOS[@]}"; do for r in "${ARCH_REPOS[@]}"; do
[[ -f $pkg/repos/$r-$pkgarch/PKGBUILD ]] && repo=repos/"$r-$pkgarch" [[ -f $pkg/repos/$r-$pkgarch/PKGBUILD ]] && repo="$r-$pkgarch"
[[ -f $pkg/repos/$r-any/PKGBUILD ]] && repo=repos/"$r"-any [[ -f $pkg/repos/$r-any/PKGBUILD ]] && repo="$r"-any
[[ -f $pkg/$pkgarch/$r/PKGBUILD ]] && repo="$pkgarch/$r" [[ -f $pkg/$pkgarch/$r/PKGBUILD ]] && repo="$r"
done done
printf "%s\n" "$repo" printf "%s\n" "$repo"
} }
@@ -42,8 +42,8 @@ tree_loop(){
local func="$1" pkgs local func="$1" pkgs
for tree in "${ARTIX_TREE[@]}"; do for tree in "${ARTIX_TREE[@]}"; do
mapfile -t pkgs < <(find "${TREE_DIR_ARTIX}/$tree" -name "$CARCH" | sort) mapfile -t pkgs < <(find "${TREE_DIR_ARTIX}/$tree" -name "$CARCH" | sort)
for _package in "${pkgs[@]}"; do for p in "${pkgs[@]}"; do
"$func" "$_package" "$func" "$p"
done done
done done
} }