forked from artix/artools
		
	Compare commits
	
		
			14 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| e00096d503 | |||
| f7ebc6bd11 | |||
| b5fa7084b2 | |||
| 7eabdb0e46 | |||
| 10c013bf33 | |||
| 74618d77a5 | |||
| 196761740b | |||
| a814655956 | |||
| 7b03050ab9 | |||
| 0b1ff8d060 | |||
| f66761aa57 | |||
| f33d9bdac1 | |||
| f50c66cdd7 | |||
| fd1bc87ef0 | 
							
								
								
									
										22
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								Makefile
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
V=0.27
 | 
			
		||||
V=0.28
 | 
			
		||||
 | 
			
		||||
TOOLS = artools
 | 
			
		||||
PREFIX ?= /usr
 | 
			
		||||
@@ -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)
 | 
			
		||||
 
 | 
			
		||||
@@ -23,7 +23,7 @@ artools
 | 
			
		||||
 | 
			
		||||
- pkg:
 | 
			
		||||
  * namcap
 | 
			
		||||
  * git-subrepo
 | 
			
		||||
  * ruby-braid
 | 
			
		||||
  * rsync
 | 
			
		||||
 | 
			
		||||
- iso:
 | 
			
		||||
 
 | 
			
		||||
@@ -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}" "$@"
 | 
			
		||||
 
 | 
			
		||||
@@ -65,10 +65,10 @@ batch_update() {
 | 
			
		||||
        local dest=${entry%:*}
 | 
			
		||||
        if ${runlist}; then
 | 
			
		||||
            buildtree -i -p "${pkg}"
 | 
			
		||||
            "${dest}"pkg -u -p "${pkg}"
 | 
			
		||||
            "${dest}"pkg -p "${pkg}"
 | 
			
		||||
        else
 | 
			
		||||
            msg "buildtree -i -p ${pkg}"
 | 
			
		||||
            msg2 "${dest}pkg -u -p ${pkg}"
 | 
			
		||||
            msg2 "${dest}pkg -p ${pkg}"
 | 
			
		||||
        fi
 | 
			
		||||
    done < "$pkglist"
 | 
			
		||||
}
 | 
			
		||||
@@ -78,8 +78,8 @@ batch_update() {
 | 
			
		||||
usage() {
 | 
			
		||||
    printf 'Usage: %s [optional listname]\n' "${0##*/}"
 | 
			
		||||
    printf '    -r                 Run generated commands\n'
 | 
			
		||||
    printf '    -c                 Create subrepos from list\n'
 | 
			
		||||
    printf '    -u                 Update subrepos from list\n'
 | 
			
		||||
    printf '    -c                 Create pkgrepos from list\n'
 | 
			
		||||
    printf '    -u                 Update pkgrepos from list\n'
 | 
			
		||||
    printf '    -h                 This help\n'
 | 
			
		||||
    printf '\n'
 | 
			
		||||
    printf '\n'
 | 
			
		||||
 
 | 
			
		||||
@@ -23,23 +23,27 @@ m4_include(lib/pkg/jenkins.sh)
 | 
			
		||||
 | 
			
		||||
#{{{ new git repo
 | 
			
		||||
 | 
			
		||||
subrepo_new(){
 | 
			
		||||
pkgrepo_new(){
 | 
			
		||||
    cd "${TREE_DIR_ARTIX}/${group}" || return
 | 
			
		||||
 | 
			
		||||
    local org gitname
 | 
			
		||||
    org=$(get_pkg_org "${package}")
 | 
			
		||||
    gitname=$(get_compliant_name "${package}")
 | 
			
		||||
 | 
			
		||||
    gitearepo -cr "$gitname"
 | 
			
		||||
    if [[ ! -d "${package}" ]]; then
 | 
			
		||||
        gitearepo -cr "$gitname"
 | 
			
		||||
 | 
			
		||||
    add_team_to_repo "$gitname" "$org" "${team}"
 | 
			
		||||
        add_team_to_repo "$gitname" "$org" "${team}"
 | 
			
		||||
 | 
			
		||||
    msg2 "Subrepo clone [%s] from (%s)" "${package}" "$org/$gitname"
 | 
			
		||||
    git subrepo clone "${GIT_SSH}":"$org/$gitname".git "${package}"
 | 
			
		||||
        msg2 "Adding [%s] from (%s)" "${package}" "$org/$gitname"
 | 
			
		||||
        braid add "${GIT_SSH}":"$org/$gitname".git "${package}"
 | 
			
		||||
 | 
			
		||||
    prepare_dir "${TREE_DIR_ARTIX}/${group}/${package}/trunk"
 | 
			
		||||
        prepare_dir "${TREE_DIR_ARTIX}/${group}/${package}/trunk"
 | 
			
		||||
 | 
			
		||||
    commit_jenkins_files "${package}"
 | 
			
		||||
        commit_jenkins_files "${package}"
 | 
			
		||||
    else
 | 
			
		||||
        die "Package %s already exists!" "${package}"
 | 
			
		||||
    fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#}}}
 | 
			
		||||
@@ -52,7 +56,7 @@ config_tree() {
 | 
			
		||||
        Artix)
 | 
			
		||||
            if "$vars"; then
 | 
			
		||||
                dist_tree=("${ARTIX_TREE[@]}")
 | 
			
		||||
                dist_url="${GIT_SSH}:artixlinux"
 | 
			
		||||
                dist_url="${GIT_SSH}:pkgbuild"
 | 
			
		||||
                dist_dir=${TREE_DIR_ARTIX}
 | 
			
		||||
            else
 | 
			
		||||
                git config --bool pull.rebase true
 | 
			
		||||
@@ -188,14 +192,14 @@ 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"
 | 
			
		||||
 | 
			
		||||
    if [[ -f "$artixpath"/.gitrepo ]]; then
 | 
			
		||||
    if [[ -f "$artixpath"/Jenkinsfile ]]; then
 | 
			
		||||
        artixpath="$artixpath"/trunk
 | 
			
		||||
 | 
			
		||||
        if [[ -d "$artixpath" ]];then
 | 
			
		||||
@@ -214,7 +218,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"
 | 
			
		||||
}
 | 
			
		||||
@@ -269,7 +273,7 @@ usage() {
 | 
			
		||||
    printf "    -a            Don't clone or pull arch repos\n"
 | 
			
		||||
    printf "    -b            Don't clone or pull artix repos\n"
 | 
			
		||||
    printf '    -i            Import a package from arch repos\n'
 | 
			
		||||
    printf '    -n            New remote subrepo and clone it\n'
 | 
			
		||||
    printf '    -n            New remote pkgrepo and add it\n'
 | 
			
		||||
    printf '    -v            Check if a package is in the artix tree(s)\n'
 | 
			
		||||
    printf '    -c            View package depends\n'
 | 
			
		||||
    printf '    -x            Exclude testing (only with -i)\n'
 | 
			
		||||
@@ -314,4 +318,4 @@ ${check} && check_tree
 | 
			
		||||
 | 
			
		||||
${import} && from_arch
 | 
			
		||||
 | 
			
		||||
${createnew} && subrepo_new
 | 
			
		||||
${createnew} && pkgrepo_new
 | 
			
		||||
 
 | 
			
		||||
@@ -22,30 +22,6 @@ m4_include(lib/pkg/repo.sh)
 | 
			
		||||
 | 
			
		||||
#{{{ functions
 | 
			
		||||
 | 
			
		||||
push_tree(){
 | 
			
		||||
    local tree="$1"
 | 
			
		||||
    msg "Update (%s)" "${tree}"
 | 
			
		||||
    git push origin master
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
subrepo_push(){
 | 
			
		||||
    local pkg="$1"
 | 
			
		||||
    msg2 "Subrepo push (%s)" "$pkg"
 | 
			
		||||
    git subrepo push "$pkg" || die "%s push failed" "$pkg"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
subrepo_clean(){
 | 
			
		||||
    local pkg="$1"
 | 
			
		||||
    msg2 "Subrepo clean (%s)" "$pkg"
 | 
			
		||||
    git subrepo clean "$pkg"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
subrepo_pull(){
 | 
			
		||||
    local pkg="$1"
 | 
			
		||||
    msg2 "Subrepo pull (%s)" "$pkg"
 | 
			
		||||
    git subrepo pull "$pkg"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
check_rebuild(){
 | 
			
		||||
    if [[ -d "$CARCH"/"${valid_names[10]}" ]] \
 | 
			
		||||
    && [[ "${repo_dest}" == "${valid_names[7]}" ]]; then
 | 
			
		||||
@@ -135,11 +111,11 @@ repo_commit_pkg() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
run(){
 | 
			
		||||
    local artixpath head group
 | 
			
		||||
    local artixpath head tree
 | 
			
		||||
    artixpath=$(find_pkg "${TREE_DIR_ARTIX}" "${package}")
 | 
			
		||||
    if [[ -n ${artixpath} ]];then
 | 
			
		||||
        group=${artixpath%/*}
 | 
			
		||||
        cd "${group}" || return
 | 
			
		||||
        tree=${artixpath%/*}
 | 
			
		||||
        cd "$tree" || return
 | 
			
		||||
        head=$(get_local_head)
 | 
			
		||||
 | 
			
		||||
        cd "${artixpath}" || return
 | 
			
		||||
@@ -152,17 +128,16 @@ run(){
 | 
			
		||||
            repo_commit_pkg
 | 
			
		||||
        fi
 | 
			
		||||
 | 
			
		||||
        cd "${group}" || return
 | 
			
		||||
        cd "$tree" || return
 | 
			
		||||
 | 
			
		||||
        if ${push}; then
 | 
			
		||||
            msg "Checking (%s) (Artix)" "${group##*/}"
 | 
			
		||||
            pull_tree "${group##*/}" "$head"
 | 
			
		||||
        fi
 | 
			
		||||
        msg "Checking (%s) (Artix)" "${tree##*/}"
 | 
			
		||||
        pull_tree "${tree##*/}" "$head"
 | 
			
		||||
 | 
			
		||||
        subrepo_push "${package}"
 | 
			
		||||
        subrepo_clean "${package}"
 | 
			
		||||
        braid push "${package}"
 | 
			
		||||
        braid update "${package}"
 | 
			
		||||
 | 
			
		||||
        ${push} && push_tree "${group##*/}"
 | 
			
		||||
        msg "Update (%s)" "${group##*/}"
 | 
			
		||||
        git push origin master
 | 
			
		||||
 | 
			
		||||
        git prune
 | 
			
		||||
 | 
			
		||||
@@ -192,7 +167,6 @@ load_valid_names
 | 
			
		||||
repo_src='trunk'
 | 
			
		||||
package=''
 | 
			
		||||
remove=false
 | 
			
		||||
push=false
 | 
			
		||||
 | 
			
		||||
pkgbuild=trunk/PKGBUILD
 | 
			
		||||
 | 
			
		||||
@@ -204,21 +178,19 @@ usage() {
 | 
			
		||||
    printf "    -s <name>          Source repository [default: %s]\n" "${repo_src}"
 | 
			
		||||
    printf '    -p <pkg>           Package name\n'
 | 
			
		||||
    printf '    -r                 Delete from repo (commitpkg only)\n'
 | 
			
		||||
    printf '    -u                 Push\n'
 | 
			
		||||
    printf '    -h                 This help\n'
 | 
			
		||||
    printf '\n'
 | 
			
		||||
    printf '\n'
 | 
			
		||||
    exit "$1"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
opts='p:s:urh'
 | 
			
		||||
opts='p:s:rh'
 | 
			
		||||
 | 
			
		||||
while getopts "${opts}" arg; do
 | 
			
		||||
    case "${arg}" in
 | 
			
		||||
        s) repo_src="$OPTARG" ;;
 | 
			
		||||
        p) package="$OPTARG" ;;
 | 
			
		||||
        r) remove=true ;;
 | 
			
		||||
        u) push=true ;;
 | 
			
		||||
        h|?) usage 0 ;;
 | 
			
		||||
    esac
 | 
			
		||||
done
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#}}}
 | 
			
		||||
@@ -165,7 +168,7 @@ upgrades=false
 | 
			
		||||
downgrades=false
 | 
			
		||||
move=false
 | 
			
		||||
 | 
			
		||||
readonly table="%-18s %-18s %-25s %-27s %-27s %-10s"
 | 
			
		||||
readonly table="%-18s %-18s %-29s %-27s %-27s %-7s"
 | 
			
		||||
 | 
			
		||||
usage() {
 | 
			
		||||
    printf 'Usage: %s [options]\n' "${0##*/}"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										77
									
								
								bin/pkg/mkdepgraph.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										77
									
								
								bin/pkg/mkdepgraph.in
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,77 @@
 | 
			
		||||
#!/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_tree_graph(){
 | 
			
		||||
    printf "%s\n" "$(pactree "${tree_args[@]}" "${package}")" \
 | 
			
		||||
        | dot -T "${ext}" > "${graph_dir}/${package}.${ext}"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
mk_rebuild_graph(){
 | 
			
		||||
    local tmpfile
 | 
			
		||||
    tmpfile=/tmp/rebuild.dot
 | 
			
		||||
    rebuild_args+=(-d "${tmpfile}")
 | 
			
		||||
    artix-rebuild-order "${packages[@]}" "${rebuild_args[@]}"
 | 
			
		||||
    dot -T "${ext}" "${tmpfile}" > "${graph_dir}/rebuild.${ext}"
 | 
			
		||||
    rm -f "${tmpfile}"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
usage() {
 | 
			
		||||
    printf "Usage: %s [options] <package|packages>\n" "${0##*/}"
 | 
			
		||||
    printf "    -m <tree|rebuild>    default mode: [%s]\n" "$mode"
 | 
			
		||||
    printf "                         rebuild mode accepts packages input\n"
 | 
			
		||||
    printf "    -r                   list packages that depend on the named package (tree)\n"
 | 
			
		||||
    printf "    -u                   show dependencies with no duplicates  (tree)\n"
 | 
			
		||||
    printf "    -d <#>               limit the depth of recursion  (tree)\n"
 | 
			
		||||
    printf "                         default: [%s]\n" "$depth"
 | 
			
		||||
    printf "    -o <#>               controls at which depth to stop printing optional deps\n"
 | 
			
		||||
    printf "                         default: [%s]\n" "$optdepth"
 | 
			
		||||
    printf "                         (-1 for no limit)  (tree)\n"
 | 
			
		||||
    printf "    -i                   only use the pkgnames provided as input (rebuild)\n"
 | 
			
		||||
    printf "    -h                   display this help message\n"
 | 
			
		||||
    exit "$1"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
graph_dir=${XDG_PICTURES_DIR:-$(xdg-user-dir PICTURES)/artix}
 | 
			
		||||
ext="png"
 | 
			
		||||
 | 
			
		||||
mode=tree
 | 
			
		||||
 | 
			
		||||
tree_args=(-gs)
 | 
			
		||||
rebuild_args=()
 | 
			
		||||
 | 
			
		||||
depth=0
 | 
			
		||||
optdepth=-1
 | 
			
		||||
 | 
			
		||||
opts=':m:d:o:iruh'
 | 
			
		||||
 | 
			
		||||
while getopts "$opts" arg; do
 | 
			
		||||
    case "${arg}" in
 | 
			
		||||
        m) mode="$OPTARG" ;;
 | 
			
		||||
        r) tree_args+=(-r) ;;
 | 
			
		||||
        u) tree_args+=(-ul) ;;
 | 
			
		||||
        d) depth="$OPTARG"; tree_args+=(-d "$depth") ;;
 | 
			
		||||
        o) optdepth="$OPTARG"; tree_args+=(-o"$optdepth") ;;
 | 
			
		||||
        i) rebuild_args+=(--no-reverse-depends) ;;
 | 
			
		||||
        h|?) usage 0 ;;
 | 
			
		||||
    esac
 | 
			
		||||
done
 | 
			
		||||
shift $(( OPTIND - 1 ))
 | 
			
		||||
 | 
			
		||||
[[ -d "${graph_dir}" ]] || mkdir -p "${graph_dir}"
 | 
			
		||||
 | 
			
		||||
case "$mode" in
 | 
			
		||||
    tree) package=("$@"); mk_tree_graph ;;
 | 
			
		||||
    rebuild) packages=("$@"); mk_rebuild_graph ;;
 | 
			
		||||
    *) usage 1 ;;
 | 
			
		||||
esac
 | 
			
		||||
@@ -7,47 +7,13 @@
 | 
			
		||||
 | 
			
		||||
# TREE_DIR_ARTIX=${WORKSPACE_DIR}/artixlinux
 | 
			
		||||
 | 
			
		||||
# customize buildtree; uncomment to include
 | 
			
		||||
# TREE_NAMES_ARTIX=(
 | 
			
		||||
#         packages-kernel
 | 
			
		||||
#         packages-llvm
 | 
			
		||||
#         packages-openrc
 | 
			
		||||
#         packages-runit
 | 
			
		||||
#         packages-s6
 | 
			
		||||
#         packages-suite66
 | 
			
		||||
#         packages-dinit
 | 
			
		||||
#         packages-perl
 | 
			
		||||
#         packages-java
 | 
			
		||||
#         packages-ruby
 | 
			
		||||
#         packages-gtk
 | 
			
		||||
#         packages-qt5
 | 
			
		||||
#         packages-qt6
 | 
			
		||||
#         packages-xorg
 | 
			
		||||
#         packages-plasma
 | 
			
		||||
#         kde-utils
 | 
			
		||||
#         kde-devel
 | 
			
		||||
#         kde-media
 | 
			
		||||
#         kde-games
 | 
			
		||||
#         kde-edu
 | 
			
		||||
#         kde-net
 | 
			
		||||
#         kde-pim
 | 
			
		||||
#         packages-gnome
 | 
			
		||||
#         packages-cinnamon
 | 
			
		||||
#         packages-lxqt
 | 
			
		||||
#         packages-lxde
 | 
			
		||||
#         packages-mate
 | 
			
		||||
#         packages-xfce
 | 
			
		||||
#         packages-wm
 | 
			
		||||
#         packages-devel
 | 
			
		||||
#         packages-qt6
 | 
			
		||||
#         packages-office
 | 
			
		||||
#         packages-misc
 | 
			
		||||
#         python-world
 | 
			
		||||
#         python-galaxy
 | 
			
		||||
#         python-galaxy-groups
 | 
			
		||||
#         python-misc
 | 
			
		||||
#         packages-python
 | 
			
		||||
#         packages-lib32
 | 
			
		||||
# customize buildtree
 | 
			
		||||
# ARTIX_TREE=(
 | 
			
		||||
#     main
 | 
			
		||||
#     initsys
 | 
			
		||||
#     desktop
 | 
			
		||||
#     addons
 | 
			
		||||
#     lib32
 | 
			
		||||
# )
 | 
			
		||||
 | 
			
		||||
# TREE_DIR_ARCH=${WORKSPACE_DIR}/archlinux
 | 
			
		||||
 
 | 
			
		||||
@@ -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"
 | 
			
		||||
 | 
			
		||||
#########################################################################
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,8 @@
 | 
			
		||||
get_compliant_name(){
 | 
			
		||||
    local gitname="$1"
 | 
			
		||||
    case "$gitname" in
 | 
			
		||||
        *+) gitname=${gitname//+/plus}
 | 
			
		||||
        *+) gitname=${gitname//+/plus} ;;
 | 
			
		||||
        *+*) gitname=${gitname//+/-} ;;
 | 
			
		||||
    esac
 | 
			
		||||
    printf "%s\n" "$gitname"
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -21,35 +21,8 @@ load_pkg_config(){
 | 
			
		||||
 | 
			
		||||
    TREE_DIR_ARTIX=${TREE_DIR_ARTIX:-"${WORKSPACE_DIR}/artixlinux"}
 | 
			
		||||
 | 
			
		||||
    ARTIX_TREE=(
 | 
			
		||||
        packages community
 | 
			
		||||
        packages-{llvm,gfx,media,net}
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    local dev_tree=(
 | 
			
		||||
        packages-{python,perl,java,ruby,misc}
 | 
			
		||||
        python-{world,galaxy,galaxy-groups,misc}
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    local init_tree=(packages-{openrc,runit,s6,suite66,dinit})
 | 
			
		||||
 | 
			
		||||
    local desktop_tree=(
 | 
			
		||||
        packages-{xorg,gtk,qt5,qt6,kf5,plasma}
 | 
			
		||||
        kde-{utils,devel,net,pim,media,edu,games}
 | 
			
		||||
        packages-{lxqt,gnome,cinnamon,mate,xfce,wm,lxde}
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    [[ -z ${TREE_NAMES_ARTIX[*]} ]] && \
 | 
			
		||||
    TREE_NAMES_ARTIX=(
 | 
			
		||||
        packages-kernel
 | 
			
		||||
        "${init_tree[@]}"
 | 
			
		||||
        "${dev_tree[@]}"
 | 
			
		||||
        "${desktop_tree[@]}"
 | 
			
		||||
        packages-devel
 | 
			
		||||
        packages-lib32
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    ARTIX_TREE+=("${TREE_NAMES_ARTIX[@]}")
 | 
			
		||||
    [[ -z ${ARTIX_TREE[*]} ]] && \
 | 
			
		||||
    ARTIX_TREE=(main initsys desktop addons lib32)
 | 
			
		||||
 | 
			
		||||
    TREE_DIR_ARCH=${TREE_DIR_ARCH:-"${WORKSPACE_DIR}/archlinux"}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user