forked from artix/artools
Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
b5fa7084b2 | |||
7eabdb0e46 | |||
10c013bf33 | |||
74618d77a5 | |||
196761740b | |||
a814655956 | |||
7b03050ab9 | |||
0b1ff8d060 | |||
f66761aa57 | |||
f33d9bdac1 | |||
f50c66cdd7 | |||
fd1bc87ef0 |
20
Makefile
20
Makefile
@@ -41,7 +41,8 @@ PKG_BIN = \
|
||||
bin/pkg/signpkg \
|
||||
bin/pkg/checkrepo \
|
||||
bin/pkg/gitearepo \
|
||||
bin/pkg/tidyarch
|
||||
bin/pkg/tidyarch \
|
||||
bin/pkg/mkdepgraph
|
||||
|
||||
LN_COMMITPKG = \
|
||||
extrapkg \
|
||||
@@ -72,20 +73,6 @@ LN_BUILDPKG = \
|
||||
buildpkg-kde-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 = \
|
||||
data/pacman/makepkg.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_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 $(FILEMODE) $(PKG_DATA) $(DESTDIR)$(DATADIR)/$(TOOLS)
|
||||
|
@@ -18,112 +18,21 @@ m4_include(lib/base/message.sh)
|
||||
m4_include(lib/base/chroot.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() {
|
||||
printf 'usage: %s -a [or] %s chroot-dir [command]\n' "${0##*/}" "${0##*/}"
|
||||
printf ' -a Automount detected linux system\n'
|
||||
printf 'usage: %s chroot-dir [command]\n' "${0##*/}"
|
||||
printf ' -h Print this help message\n'
|
||||
printf '\n'
|
||||
printf " If 'command' is unspecified, %s will launch /bin/sh.\n" "${0##*/}"
|
||||
printf '\n'
|
||||
printf " If 'automount' is true, %s will launch /bin/bash\n" "${0##*/}"
|
||||
printf ' and %s\n' "${chrootdir}"
|
||||
printf '\n'
|
||||
printf '\n'
|
||||
exit "$1"
|
||||
}
|
||||
|
||||
opts=':ha'
|
||||
opts=':h'
|
||||
|
||||
while getopts ${opts} arg; do
|
||||
case "${arg}" in
|
||||
a) automount=true ;;
|
||||
h|?) usage 0 ;;
|
||||
esac
|
||||
done
|
||||
@@ -131,20 +40,12 @@ shift $(( OPTIND - 1 ))
|
||||
|
||||
check_root
|
||||
|
||||
if ${automount};then
|
||||
chrootdir=/mnt
|
||||
run_args=(/bin/bash)
|
||||
chrootdir=$1
|
||||
shift
|
||||
|
||||
select_os "${chrootdir}"
|
||||
else
|
||||
chrootdir=$1
|
||||
shift
|
||||
run_args=("$@")
|
||||
[[ -d ${chrootdir} ]] || die "Can't create chroot on non-directory %s" "${chrootdir}"
|
||||
|
||||
[[ -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}"
|
||||
chroot_add_resolv_conf "${chrootdir}"
|
||||
fi
|
||||
|
||||
SHELL=/bin/sh unshare --fork --pid chroot "${chrootdir}" "${run_args[@]}"
|
||||
SHELL=/bin/sh unshare --fork --pid chroot "${chrootdir}" "$@"
|
||||
|
@@ -188,9 +188,9 @@ from_arch(){
|
||||
[[ -z $srcpath ]] && die "Package '%s' does not exist!" "${package}"
|
||||
|
||||
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}")
|
||||
|
||||
show_deps "$archpath"
|
||||
@@ -214,7 +214,7 @@ view_build(){
|
||||
archpath=$(find_pkg "${TREE_DIR_ARCH}" "${package}")
|
||||
[[ -z $archpath ]] && die "Package '%s' does not exist!" "${package}"
|
||||
repo=$(find_repo "${archpath}")
|
||||
archpath=$archpath/$repo
|
||||
archpath=$archpath/repos/$repo
|
||||
msg "repo: %s" "${repo#*/}"
|
||||
show_deps "$archpath"
|
||||
}
|
||||
|
@@ -31,23 +31,32 @@ write_list(){
|
||||
printf "%s\n" "$line" >> "${TREE_DIR_ARTIX}"/"$name".list
|
||||
}
|
||||
|
||||
get_group() {
|
||||
local group
|
||||
group="${artixpath%/*}"
|
||||
group=${group##*/}
|
||||
printf "%s\n" "${group#*-}"
|
||||
}
|
||||
|
||||
compare_m(){
|
||||
case ${artixrepo} in
|
||||
*testing*|*staging*|*rebuild)
|
||||
if [[ "${a}" == "${b}" ]]; then
|
||||
msg_row "${table}" "${a}" "${b}" "$pkg" "$archver" "$artixver" "${group#*-}"
|
||||
elif [[ "${a}" == 'staging' && "${b}" == 'rebuild' ]]; then
|
||||
msg_row_yellow "${table}" "${a}" "${b}" "$pkg" "$archver" "$artixver" "${group#*-}"
|
||||
else
|
||||
msg_row_green "${table}" "${a}" "${b}" "$pkg" "$archver" "$artixver" "${group#*-}"
|
||||
if [[ -n "$archrepo" ]]; then
|
||||
write_list "${a}:${b}:$pkg" pkg_moves
|
||||
# if [ "$result" -eq 0 ];then
|
||||
case "$artixrepo" in
|
||||
*testing*|*staging*|*rebuild)
|
||||
if [[ "${archrepo}" == "${artixrepo}" ]]; then
|
||||
msg_row "${table}" "${archrepo}" "${artixrepo}" "$pkg" "$archver" "$artixver" "$(get_group)"
|
||||
elif [[ "${archrepo}" == 'staging' && "${artixrepo}" == 'rebuild' ]]; then
|
||||
msg_row_yellow "${table}" "${archrepo}" "${artixrepo}" "$pkg" "$archver" "$artixver" "$(get_group)"
|
||||
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
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
# fi
|
||||
}
|
||||
|
||||
compare_u(){
|
||||
@@ -55,15 +64,15 @@ compare_u(){
|
||||
# local arel=${archver##*-} brel=${artixver##*-}
|
||||
# local reldiff
|
||||
# reldiff=$(( $arel-${brel%.*} ))
|
||||
msg_row_red "${table}" "${a}" "${b}" "$pkg" "$archver" "$artixver" "${group#*-}"
|
||||
write_list "${a}:$pkg" pkg_upgrades
|
||||
msg_row_red "${table}" "${archrepo}" "${artixrepo}" "$pkg" "$archver" "$artixver" "$(get_group)"
|
||||
write_list "${archrepo}:$pkg" pkg_upgrades
|
||||
fi
|
||||
}
|
||||
|
||||
compare_d(){
|
||||
if [ "$result" -eq 1 ];then
|
||||
if [[ -n "$archver" ]] && [[ -n "$archrepo" ]];then
|
||||
msg_row_yellow "${table}" "${a}" "${b}" "$pkg" "$archver" "$artixver" "${group#*-}"
|
||||
if [[ -n "$archver" ]] && [[ -n "${archrepo}" ]];then
|
||||
msg_row_yellow "${table}" "${archrepo}" "${artixrepo}" "$pkg" "$archver" "$artixver" "$(get_group)"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@@ -78,27 +87,22 @@ get_archpath(){
|
||||
}
|
||||
|
||||
pre_compare(){
|
||||
local func="$1" pkgpath="$2" result group pkg
|
||||
group="${pkgpath%/*}"
|
||||
group=${group##*/}
|
||||
pkg=${pkgpath##*/}
|
||||
local artixpath="$1" func="$2" pkg
|
||||
pkg=${artixpath##*/}
|
||||
|
||||
local artixrepo archrepo pkgbuild artixver archver archpath node a b
|
||||
artixrepo=$(find_repo "$pkgpath")
|
||||
pkgbuild=$pkgpath/$artixrepo/PKGBUILD
|
||||
local artixrepo archrepo pkgbuild artixver archver archpath epoch
|
||||
|
||||
if [[ -f $pkgbuild ]]; then
|
||||
artixrepo=$(find_repo "$artixpath")
|
||||
pkgbuild=$artixpath/$CARCH/$artixrepo/PKGBUILD
|
||||
|
||||
if [[ -f "$pkgbuild" ]]; then
|
||||
# shellcheck disable=1090
|
||||
. "$pkgbuild" 2>/dev/null
|
||||
artixver=$(get_full_version)
|
||||
archpath=$(get_archpath "$pkg")
|
||||
archrepo=$(find_repo "${archpath}")
|
||||
pkgbuild=$archpath/$archrepo/PKGBUILD
|
||||
node=${artixrepo%/*}
|
||||
a=${archrepo#*/} b=${artixrepo#*/}
|
||||
a="${a%-*}"
|
||||
|
||||
[[ "$node" != "$CARCH" ]] && b=${b%-*}
|
||||
archrepo=$(find_repo "$archpath")
|
||||
pkgbuild=$archpath/repos/$archrepo/PKGBUILD
|
||||
archrepo="${archrepo%-*}"
|
||||
|
||||
if [[ -f "$pkgbuild" ]]; then
|
||||
# shellcheck disable=1090
|
||||
@@ -106,27 +110,26 @@ pre_compare(){
|
||||
archver=$(get_full_version)
|
||||
fi
|
||||
|
||||
local result
|
||||
result=$(vercmp "$artixver" "$archver")
|
||||
|
||||
"$func"
|
||||
|
||||
unset epoch
|
||||
fi
|
||||
}
|
||||
|
||||
compare_upgrades(){
|
||||
local pkgpath="${1%/*}"
|
||||
pre_compare compare_u "$pkgpath"
|
||||
local artixpath="${1%/*}"
|
||||
pre_compare "$artixpath" compare_u
|
||||
}
|
||||
|
||||
compare_downgrades(){
|
||||
local pkgpath="${1%/*}"
|
||||
pre_compare compare_d "$pkgpath"
|
||||
local artixpath="${1%/*}"
|
||||
pre_compare "$artixpath" compare_d
|
||||
}
|
||||
|
||||
compare_move(){
|
||||
local pkgpath="${1%/*}"
|
||||
pre_compare compare_m "$pkgpath"
|
||||
local artixpath="${1%/*}"
|
||||
pre_compare "$artixpath" compare_m
|
||||
}
|
||||
|
||||
#}}}
|
||||
|
59
bin/pkg/mkdepgraph.in
Normal file
59
bin/pkg/mkdepgraph.in
Normal 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
|
@@ -45,12 +45,13 @@ CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions \
|
||||
-fstack-clash-protection -fcf-protection"
|
||||
CXXFLAGS="$CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS"
|
||||
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now"
|
||||
LTOFLAGS="-flto=auto"
|
||||
#RUSTFLAGS="-C opt-level=2"
|
||||
#-- Make Flags: change this for DistCC/SMP systems
|
||||
#MAKEFLAGS="-j2"
|
||||
#-- Debugging flags
|
||||
DEBUG_CFLAGS="-g"
|
||||
DEBUG_CXXFLAGS="-g"
|
||||
DEBUG_CXXFLAGS="$DEBUG_CFLAGS"
|
||||
#DEBUG_RUSTFLAGS="-C debuginfo=2"
|
||||
|
||||
#########################################################################
|
||||
|
@@ -25,9 +25,9 @@ set_arch_repos(){
|
||||
find_repo(){
|
||||
local pkg="$1" pkgarch="${2:-${CARCH}}" repo
|
||||
for r in "${ARCH_REPOS[@]}"; do
|
||||
[[ -f $pkg/repos/$r-$pkgarch/PKGBUILD ]] && repo=repos/"$r-$pkgarch"
|
||||
[[ -f $pkg/repos/$r-any/PKGBUILD ]] && repo=repos/"$r"-any
|
||||
[[ -f $pkg/$pkgarch/$r/PKGBUILD ]] && repo="$pkgarch/$r"
|
||||
[[ -f $pkg/repos/$r-$pkgarch/PKGBUILD ]] && repo="$r-$pkgarch"
|
||||
[[ -f $pkg/repos/$r-any/PKGBUILD ]] && repo="$r"-any
|
||||
[[ -f $pkg/$pkgarch/$r/PKGBUILD ]] && repo="$r"
|
||||
done
|
||||
printf "%s\n" "$repo"
|
||||
}
|
||||
@@ -42,8 +42,8 @@ tree_loop(){
|
||||
local func="$1" pkgs
|
||||
for tree in "${ARTIX_TREE[@]}"; do
|
||||
mapfile -t pkgs < <(find "${TREE_DIR_ARTIX}/$tree" -name "$CARCH" | sort)
|
||||
for _package in "${pkgs[@]}"; do
|
||||
"$func" "$_package"
|
||||
for p in "${pkgs[@]}"; do
|
||||
"$func" "$p"
|
||||
done
|
||||
done
|
||||
}
|
||||
|
Reference in New Issue
Block a user