forked from artix/artools
		
	Compare commits
	
		
			10 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| ea06ec0b2e | |||
| e67990ae04 | |||
| b37d5f0236 | |||
| 989af04593 | |||
| 90f46d7ecc | |||
| 8e872ca9ca | |||
| 05c95b7025 | |||
| 442aee08df | |||
| 2c497f663b | |||
| 9a84cdedd5 | 
							
								
								
									
										1
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								Makefile
									
									
									
									
									
								
							@@ -41,6 +41,7 @@ BIN_PKG = \
 | 
			
		||||
	bin/buildtree \
 | 
			
		||||
	bin/deploypkg \
 | 
			
		||||
	bin/commitpkg \
 | 
			
		||||
	bin/comparepkg \
 | 
			
		||||
	bin/pkg2yaml
 | 
			
		||||
 | 
			
		||||
LIBS_PKG = \
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										193
									
								
								bin/buildtree.in
									
									
									
									
									
								
							
							
						
						
									
										193
									
								
								bin/buildtree.in
									
									
									
									
									
								
							@@ -26,141 +26,33 @@ pull_tree_arch(){
 | 
			
		||||
    for tree in ${tree_names[@]};do
 | 
			
		||||
        if [[ -d ${tree} ]];then
 | 
			
		||||
            cd ${tree}
 | 
			
		||||
            msg "Checking (%s)" "${tree}"
 | 
			
		||||
            pull_tree
 | 
			
		||||
            pull_tree "${tree}"
 | 
			
		||||
            cd ..
 | 
			
		||||
        else
 | 
			
		||||
            msg "Cloning (%s) ..." "$tree"
 | 
			
		||||
            clone_tree "${HOST_TREE_ARCH}/${tree}"
 | 
			
		||||
            clone_tree "${HOST_TREE_ARCH}" "${tree}"
 | 
			
		||||
        fi
 | 
			
		||||
    done
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
config_tree(){
 | 
			
		||||
    local tree="$1"
 | 
			
		||||
    cd $tree
 | 
			
		||||
        git config --bool pull.rebase true
 | 
			
		||||
        git config commit.gpgsign true
 | 
			
		||||
        if [[ -n "${GPGKEY}" ]];then
 | 
			
		||||
            git config user.signingkey "${GPGKEY}"
 | 
			
		||||
        else
 | 
			
		||||
            warning "No GPGKEY configured in makepkg.conf!"
 | 
			
		||||
        fi
 | 
			
		||||
    cd ..
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pull_tree_artix(){
 | 
			
		||||
    cd ${TREE_DIR_ARTIX}
 | 
			
		||||
    for tree in ${tree_names[@]};do
 | 
			
		||||
        if [[ -d ${tree} ]];then
 | 
			
		||||
            config_tree "${tree}"
 | 
			
		||||
            cd ${tree}
 | 
			
		||||
            msg "Checking (%s)" "${tree}"
 | 
			
		||||
            pull_tree
 | 
			
		||||
            pull_tree "${tree}"
 | 
			
		||||
            cd ..
 | 
			
		||||
        else
 | 
			
		||||
            msg "Cloning (%s) ..." "$tree"
 | 
			
		||||
            clone_tree "${HOST_TREE_ARTIX}/${tree}"
 | 
			
		||||
            clone_tree "${HOST_TREE_ARTIX}" "${tree}"
 | 
			
		||||
            config_tree "${tree}"
 | 
			
		||||
        fi
 | 
			
		||||
    done
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
mkrepo(){
 | 
			
		||||
    local pkg="$1" team="$2"
 | 
			
		||||
    local pkg_path=${TREE_DIR_ARTIX}/$team/$pkg
 | 
			
		||||
 | 
			
		||||
    cd ${TREE_DIR_ARTIX}/$team
 | 
			
		||||
 | 
			
		||||
    local org=$(get_pkg_org "$pkg")
 | 
			
		||||
 | 
			
		||||
    create_repo "$pkg" "$org"
 | 
			
		||||
 | 
			
		||||
    add_repo_to_team "$pkg" "$org" "$team"
 | 
			
		||||
 | 
			
		||||
    subrepo_clone "$pkg" "$org"
 | 
			
		||||
 | 
			
		||||
    prepare_dir "$pkg_path/trunk"
 | 
			
		||||
 | 
			
		||||
    cd $pkg_path
 | 
			
		||||
    commit_jenkins_files
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
show_version_table(){
 | 
			
		||||
    msg_table_header "%-20s %-20s %-25s %-30s %-30s" "Arch Repo" "Artix Repo" "Package" "Arch version" "Artix version"
 | 
			
		||||
 | 
			
		||||
    for tree in ${tree_names[@]};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" "${unstable}" "${staging}")
 | 
			
		||||
            local artixshow=${artixrepo%-*}
 | 
			
		||||
            local pkgbuild=$package/repos/$artixrepo/PKGBUILD
 | 
			
		||||
 | 
			
		||||
            if [[ -f $pkgbuild ]];then
 | 
			
		||||
 | 
			
		||||
                source $pkgbuild 2>/dev/null
 | 
			
		||||
                local artixver=$(get_full_version $pkg)
 | 
			
		||||
 | 
			
		||||
                local archpath=$(get_import_path "$pkg")
 | 
			
		||||
                local archrepo=$(find_repo "$archpath" "${unstable}" "${staging}")
 | 
			
		||||
                local archshow=${archrepo%-*}
 | 
			
		||||
                pkgbuild=$archpath/repos/$archrepo/PKGBUILD
 | 
			
		||||
 | 
			
		||||
                if [[ -f $pkgbuild ]];then
 | 
			
		||||
                    source $pkgbuild 2>/dev/null
 | 
			
		||||
                    local archver=$(get_full_version $pkg)
 | 
			
		||||
                fi
 | 
			
		||||
 | 
			
		||||
                if ${artix};then
 | 
			
		||||
 | 
			
		||||
                    if [ $(vercmp "$artixver" "$archver") -eq 0 ] || [ $(vercmp "$artixver" "$archver") -gt 0 ];then
 | 
			
		||||
                        case $artixrepo in
 | 
			
		||||
                            *staging*)
 | 
			
		||||
                                if [[ "$archrepo" == "$artixrepo" ]];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
 | 
			
		||||
                            ;;
 | 
			
		||||
                            *testing*)
 | 
			
		||||
                                if [[ "$archrepo" == "$artixrepo" ]];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
 | 
			
		||||
 | 
			
		||||
                else
 | 
			
		||||
 | 
			
		||||
                    if [ $(vercmp "$artixver" "$archver") -lt 0 ];then
 | 
			
		||||
                        ${upgrades} && msg_row_upgrade "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
 | 
			
		||||
                    fi
 | 
			
		||||
 | 
			
		||||
                    if [ $(vercmp "$artixver" "$archver") -gt 0 ];then
 | 
			
		||||
                        if [[ -n $archver ]] && [[ -n $archrepo ]];then
 | 
			
		||||
                            ${downgrades} && msg_row_downgrade "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
 | 
			
		||||
                        fi
 | 
			
		||||
                    fi
 | 
			
		||||
 | 
			
		||||
                fi
 | 
			
		||||
                unset pkgver epoch pkgrel artixver archver
 | 
			
		||||
 | 
			
		||||
            fi
 | 
			
		||||
        done
 | 
			
		||||
    done
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sync_pkg(){
 | 
			
		||||
    local rsync_args=(-aWxvci --progress --delete-before --no-R --no-implied-dirs)
 | 
			
		||||
    local src="$1" dest="$2" tree="$3"
 | 
			
		||||
    local src="$1" dest="$2"
 | 
			
		||||
 | 
			
		||||
    info "Sync from archlinux (%s)" "$git_tree_arch"
 | 
			
		||||
    rsync "${rsync_args[@]}" $src/ $dest/
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -193,47 +85,28 @@ from_arch(){
 | 
			
		||||
    [[ -z $git_tree_arch ]] && die "Package '%s' does not exist!" "$pkg"
 | 
			
		||||
 | 
			
		||||
    local package=${TREE_DIR_ARCH}/$git_tree_arch/$pkg
 | 
			
		||||
    local repo=$(find_repo "$package" "${unstable}")
 | 
			
		||||
    local repo=$(find_repo "$package")
 | 
			
		||||
 | 
			
		||||
    src=$package/repos/$repo
 | 
			
		||||
 | 
			
		||||
    local git_tree_artix=$(find_tree "${TREE_DIR_ARTIX}" "$pkg")
 | 
			
		||||
    dest=${TREE_DIR_ARTIX}/$git_tree_artix/$pkg/trunk
 | 
			
		||||
    dest=${TREE_DIR_ARTIX}/$git_tree_arch/$pkg/trunk
 | 
			
		||||
 | 
			
		||||
    show_deps "$src" "$repo"
 | 
			
		||||
 | 
			
		||||
    if [[ -d $dest ]];then
 | 
			
		||||
        cd ${TREE_DIR_ARTIX}/$git_tree_artix
 | 
			
		||||
        cd ${TREE_DIR_ARTIX}/$git_tree_arch
 | 
			
		||||
 | 
			
		||||
        source $dest/PKGBUILD 2>/dev/null
 | 
			
		||||
        local artixver=$(get_full_version $pkg)
 | 
			
		||||
 | 
			
		||||
        msg2 "Artix Version: %s" "$artixver"
 | 
			
		||||
        sync_pkg "$src" "$dest" "$git_tree_arch"
 | 
			
		||||
        patch_pkg "$pkg"
 | 
			
		||||
    else
 | 
			
		||||
        [[ $git_tree_arch == 'packages' ]] && git_tree_artix=$git_tree_arch
 | 
			
		||||
        [[ $git_tree_arch == 'community' ]] && git_tree_artix=$git_tree_arch
 | 
			
		||||
 | 
			
		||||
        local pkg_path=${TREE_DIR_ARTIX}/$git_tree_artix/$pkg
 | 
			
		||||
 | 
			
		||||
        cd ${TREE_DIR_ARTIX}/$git_tree_artix
 | 
			
		||||
 | 
			
		||||
        local org=$(get_pkg_org "$pkg")
 | 
			
		||||
 | 
			
		||||
        create_repo "$pkg" "$org"
 | 
			
		||||
 | 
			
		||||
        add_repo_to_team "$pkg" "$org" "$git_tree_artix"
 | 
			
		||||
 | 
			
		||||
        subrepo_clone "$pkg" "$org"
 | 
			
		||||
 | 
			
		||||
        cd $pkg_path
 | 
			
		||||
        commit_jenkins_files
 | 
			
		||||
 | 
			
		||||
        dest=$pkg_path/trunk
 | 
			
		||||
 | 
			
		||||
        sync_pkg "$src" "$dest" "$git_tree_arch"
 | 
			
		||||
        subrepo_new "$pkg" "$git_tree_arch"
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    info "Sync from archlinux (%s)" "$git_tree_arch"
 | 
			
		||||
    sync_pkg "$src" "$dest"
 | 
			
		||||
    patch_pkg "$pkg"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
view_build(){
 | 
			
		||||
@@ -242,7 +115,7 @@ view_build(){
 | 
			
		||||
    [[ -z $git_tree_arch ]] && die "Package '%s' does not exist!" "$pkg"
 | 
			
		||||
 | 
			
		||||
    local pkg_path=${TREE_DIR_ARCH}/$git_tree_arch/$pkg
 | 
			
		||||
    local repo=$(find_repo "$pkg_path" "${unstable}")
 | 
			
		||||
    local repo=$(find_repo "$pkg_path")
 | 
			
		||||
 | 
			
		||||
    src=$pkg_path/repos/$repo
 | 
			
		||||
 | 
			
		||||
@@ -262,36 +135,28 @@ load_vars /etc/makepkg.conf
 | 
			
		||||
 | 
			
		||||
sync=false
 | 
			
		||||
sync_arch=true
 | 
			
		||||
compare=false
 | 
			
		||||
unstable=false
 | 
			
		||||
staging=true
 | 
			
		||||
upgrades=false
 | 
			
		||||
downgrades=false
 | 
			
		||||
artix=false
 | 
			
		||||
import=false
 | 
			
		||||
view=false
 | 
			
		||||
createnew=false
 | 
			
		||||
conf=false
 | 
			
		||||
 | 
			
		||||
PACKAGE=''
 | 
			
		||||
 | 
			
		||||
tree_names=(packages community)
 | 
			
		||||
TEAM=${tree_names[0]}
 | 
			
		||||
SUBORG=''
 | 
			
		||||
 | 
			
		||||
usage() {
 | 
			
		||||
    echo "Usage: ${0##*/} [options]"
 | 
			
		||||
    echo '    -p <pkg>      Package name'
 | 
			
		||||
    echo '    -t <team>     Team name (only with -m)'
 | 
			
		||||
    echo '    -t <team>     Team name (only with -n)'
 | 
			
		||||
    echo "                  [default: ${TEAM}]"
 | 
			
		||||
    echo '    -o <org>      Org of subrepo (only with -c)'
 | 
			
		||||
    echo "    -s            Clone or pull repos"
 | 
			
		||||
    echo "    -z            Don't clone or pull arch repos"
 | 
			
		||||
    echo '    -c            Compare packages'
 | 
			
		||||
    echo '    -u            Show upgrade packages'
 | 
			
		||||
    echo '    -d            Show downgrade packages'
 | 
			
		||||
    echo '    -a            Show testing packages'
 | 
			
		||||
    echo "    -y            Don't inlcude staging packages"
 | 
			
		||||
    echo '    -x            Include unstable kde and gnome'
 | 
			
		||||
    echo '    -i            Import a package from arch repos'
 | 
			
		||||
    echo '    -m            Make new remote subrepo and clone it'
 | 
			
		||||
    echo '    -n            Make new remote subrepo and clone it'
 | 
			
		||||
    echo '    -c            Configure subrepo url'
 | 
			
		||||
    echo '    -v            View package depends'
 | 
			
		||||
    echo '    -h            This help'
 | 
			
		||||
    echo ''
 | 
			
		||||
@@ -301,23 +166,19 @@ usage() {
 | 
			
		||||
 | 
			
		||||
orig_argv=("$0" "$@")
 | 
			
		||||
 | 
			
		||||
opts='p:t:csudayimzxvh'
 | 
			
		||||
opts='p:t:o:csinzvh'
 | 
			
		||||
 | 
			
		||||
while getopts "${opts}" arg; do
 | 
			
		||||
    case "${arg}" in
 | 
			
		||||
        p) PACKAGE="$OPTARG" ;;
 | 
			
		||||
        t) TEAM="$OPTARG" ;;
 | 
			
		||||
        o) SUBORG="$OPTARG" ;;
 | 
			
		||||
        s) sync=true ;;
 | 
			
		||||
        z) sync_arch=false ;;
 | 
			
		||||
        c) compare=true ;;
 | 
			
		||||
        u) upgrades=true ;;
 | 
			
		||||
        d) downgrades=true ;;
 | 
			
		||||
        a) artix=true ;;
 | 
			
		||||
        y) staging=false ;;
 | 
			
		||||
        i) import=true ;;
 | 
			
		||||
        m) createnew=true ;;
 | 
			
		||||
        n) createnew=true ;;
 | 
			
		||||
        v) view=true ;;
 | 
			
		||||
        x) unstable=true ;;
 | 
			
		||||
        c) conf=true ;;
 | 
			
		||||
        h|?) usage 0 ;;
 | 
			
		||||
        *) echo "invalid argument '${arg}'"; usage 1 ;;
 | 
			
		||||
    esac
 | 
			
		||||
@@ -332,8 +193,8 @@ ${sync} && sync_repos
 | 
			
		||||
 | 
			
		||||
${view} && view_build "${PACKAGE}"
 | 
			
		||||
 | 
			
		||||
${compare} && show_version_table
 | 
			
		||||
 | 
			
		||||
${import} && from_arch "${PACKAGE}"
 | 
			
		||||
 | 
			
		||||
${createnew} && mkrepo "${PACKAGE}" "${TEAM}"
 | 
			
		||||
${createnew} && subrepo_new "${PACKAGE}" "${TEAM}"
 | 
			
		||||
 | 
			
		||||
${conf} && subrepo_config "${PACKAGE}" "${SUBORG}"
 | 
			
		||||
 
 | 
			
		||||
@@ -38,6 +38,8 @@ commit_pkg(){
 | 
			
		||||
        local ver=$(get_full_version "${PACKAGE}")
 | 
			
		||||
        local commit_msg=""
 | 
			
		||||
 | 
			
		||||
        local head=$(get_local_head)
 | 
			
		||||
 | 
			
		||||
        if ${remove};then
 | 
			
		||||
            local action='remove'
 | 
			
		||||
            if [[ "${REPO_SRC}" == 'trunk' ]];then
 | 
			
		||||
@@ -61,14 +63,12 @@ commit_pkg(){
 | 
			
		||||
        cd ${TREE_DIR_ARTIX}/${git_tree}
 | 
			
		||||
 | 
			
		||||
        if ${push};then
 | 
			
		||||
            msg2 "Check (%s)" "${git_tree}"
 | 
			
		||||
            git pull origin master
 | 
			
		||||
            pull_tree "${git_tree}" "$head"
 | 
			
		||||
 | 
			
		||||
            msg2 "Update (%s)" "${PACKAGE}"
 | 
			
		||||
            subrepo_push "${PACKAGE}"
 | 
			
		||||
            subrepo_clean "${PACKAGE}"
 | 
			
		||||
#             sleep 1
 | 
			
		||||
            msg2 "Update (%s)" "${git_tree}"
 | 
			
		||||
            git push origin master
 | 
			
		||||
            push_tree "${git_tree}"
 | 
			
		||||
        fi
 | 
			
		||||
        git prune
 | 
			
		||||
    else
 | 
			
		||||
@@ -85,6 +85,8 @@ symlink_commit_pkg(){
 | 
			
		||||
        [[ $arch == 'any' ]] && CARCH=any
 | 
			
		||||
        local ver=$(get_full_version "${PACKAGE}")
 | 
			
		||||
 | 
			
		||||
        local head=$(get_local_head)
 | 
			
		||||
 | 
			
		||||
        if [[ ${REPO_SRC} == 'trunk' ]];then
 | 
			
		||||
            local action='add'
 | 
			
		||||
            local dest="${REPO_DEST}-$CARCH"
 | 
			
		||||
@@ -114,14 +116,12 @@ symlink_commit_pkg(){
 | 
			
		||||
        cd ${TREE_DIR_ARTIX}/${git_tree}
 | 
			
		||||
 | 
			
		||||
        if ${push};then
 | 
			
		||||
            msg2 "Check (%s)" "${git_tree}"
 | 
			
		||||
            git pull origin master
 | 
			
		||||
            pull_tree "${git_tree}" "$head"
 | 
			
		||||
 | 
			
		||||
            msg2 "Update (%s)" "${PACKAGE}"
 | 
			
		||||
            subrepo_push "${PACKAGE}"
 | 
			
		||||
            subrepo_clean "${PACKAGE}"
 | 
			
		||||
#             sleep 1
 | 
			
		||||
            msg2 "Update (%s)" "${git_tree}"
 | 
			
		||||
            git push origin master
 | 
			
		||||
            push_tree "${git_tree}"
 | 
			
		||||
        fi
 | 
			
		||||
        git prune
 | 
			
		||||
    else
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										139
									
								
								bin/comparepkg.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										139
									
								
								bin/comparepkg.in
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,139 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
#
 | 
			
		||||
# 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.
 | 
			
		||||
 | 
			
		||||
VERSION=@version@
 | 
			
		||||
 | 
			
		||||
LIBDIR='@libdir@'
 | 
			
		||||
SYSCONFDIR='@sysconfdir@'
 | 
			
		||||
DATADIR='@datadir@'
 | 
			
		||||
 | 
			
		||||
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
 | 
			
		||||
import ${LIBDIR}/util.sh
 | 
			
		||||
import ${LIBDIR}/util-pkg.sh
 | 
			
		||||
 | 
			
		||||
show_version_table(){
 | 
			
		||||
    msg_table_header "%-20s %-20s %-25s %-30s %-30s" "Arch Repo" "Artix Repo" "Package" "Arch version" "Artix version"
 | 
			
		||||
 | 
			
		||||
    for tree in ${tree_names[@]};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
 | 
			
		||||
 | 
			
		||||
                source $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
 | 
			
		||||
                    source $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
 | 
			
		||||
        done
 | 
			
		||||
    done
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
load_user_info
 | 
			
		||||
 | 
			
		||||
load_config "${AT_USERCONFDIR}/artools.conf" || load_config "${SYSCONFDIR}/artools.conf"
 | 
			
		||||
load_vars "${PAC_USERCONFDIR}/makepkg.conf" || load_vars "$USER_HOME/.makepkg.conf"
 | 
			
		||||
load_vars /etc/makepkg.conf
 | 
			
		||||
 | 
			
		||||
unstable=false
 | 
			
		||||
staging=true
 | 
			
		||||
upgrades=false
 | 
			
		||||
downgrades=false
 | 
			
		||||
move=false
 | 
			
		||||
 | 
			
		||||
tree_names=(packages community)
 | 
			
		||||
 | 
			
		||||
usage() {
 | 
			
		||||
    echo "Usage: ${0##*/} [options]"
 | 
			
		||||
    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 '    -h            This help'
 | 
			
		||||
    echo ''
 | 
			
		||||
    echo ''
 | 
			
		||||
    exit $1
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
orig_argv=("$0" "$@")
 | 
			
		||||
 | 
			
		||||
opts='udmxyh'
 | 
			
		||||
 | 
			
		||||
while getopts "${opts}" arg; do
 | 
			
		||||
    case "${arg}" in
 | 
			
		||||
        u) upgrades=true ;;
 | 
			
		||||
        d) downgrades=true ;;
 | 
			
		||||
        m) move=true ;;
 | 
			
		||||
        x) staging=false ;;
 | 
			
		||||
        y) unstable=true ;;
 | 
			
		||||
        h|?) usage 0 ;;
 | 
			
		||||
        *) echo "invalid argument '${arg}'"; usage 1 ;;
 | 
			
		||||
    esac
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
shift $(($OPTIND - 1))
 | 
			
		||||
 | 
			
		||||
show_version_table
 | 
			
		||||
							
								
								
									
										121
									
								
								bin/pkg2yaml.in
									
									
									
									
									
								
							
							
						
						
									
										121
									
								
								bin/pkg2yaml.in
									
									
									
									
									
								
							@@ -11,7 +11,105 @@
 | 
			
		||||
 | 
			
		||||
VERSION=@version@
 | 
			
		||||
 | 
			
		||||
VERSION=0.10.4.r2.gd0e3c4e
 | 
			
		||||
write_attr() {
 | 
			
		||||
    # $1: attr name
 | 
			
		||||
    # $2: attr values
 | 
			
		||||
 | 
			
		||||
    local attrname=$1 attrvalues=("${@:2}")
 | 
			
		||||
 | 
			
		||||
    # normalize whitespace, strip leading and trailing
 | 
			
		||||
    attrvalues=("${attrvalues[@]//+([[:space:]])/ }")
 | 
			
		||||
    attrvalues=("${attrvalues[@]#[[:space:]]}")
 | 
			
		||||
    attrvalues=("${attrvalues[@]%[[:space:]]}")
 | 
			
		||||
 | 
			
		||||
    case $attrname in
 | 
			
		||||
        depends|makedepends|checkdepends|provides)
 | 
			
		||||
            Yaml+="    $attrname:"$NL
 | 
			
		||||
            for v in ${attrvalues[@]};do
 | 
			
		||||
                Yaml+="      - $v"$NL
 | 
			
		||||
            done
 | 
			
		||||
        ;;
 | 
			
		||||
        *)
 | 
			
		||||
            for v in ${attrvalues[@]};do
 | 
			
		||||
                Yaml+="  $attrname: ${v}"$NL
 | 
			
		||||
            done
 | 
			
		||||
        ;;
 | 
			
		||||
    esac
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
extract_info() {
 | 
			
		||||
    # $1: pkgname
 | 
			
		||||
    # $2: attr name
 | 
			
		||||
    # $3: multivalued
 | 
			
		||||
 | 
			
		||||
    local pkgname=$1 attrname=$2 isarray=$3 outvalue=
 | 
			
		||||
 | 
			
		||||
    if get_pkgbuild_attribute "$pkgname" "$attrname" "$isarray" 'outvalue'; then
 | 
			
		||||
        write_attr "$attrname" "${outvalue[@]}"
 | 
			
		||||
    fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
write_details() {
 | 
			
		||||
    local attr package_arch a
 | 
			
		||||
    local multivalued_arch_attrs=(provides depends makedepends checkdepends)
 | 
			
		||||
 | 
			
		||||
    for attr in "${singlevalued[@]}"; do
 | 
			
		||||
        extract_info "$1" "$attr" 0
 | 
			
		||||
    done
 | 
			
		||||
 | 
			
		||||
    for attr in "${multivalued[@]}"; do
 | 
			
		||||
        extract_info "$1" "$attr" 1
 | 
			
		||||
    done
 | 
			
		||||
 | 
			
		||||
    get_pkgbuild_attribute "$1" 'arch' 1 'package_arch'
 | 
			
		||||
    for a in "${package_arch[@]}"; do
 | 
			
		||||
        # 'any' is special. there's no support for, e.g. depends_any.
 | 
			
		||||
        [[ $a = any ]] && continue
 | 
			
		||||
 | 
			
		||||
        for attr in "${multivalued_arch_attrs[@]}"; do
 | 
			
		||||
            extract_info "$1" "${attr}_$a" 1
 | 
			
		||||
        done
 | 
			
		||||
    done
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
write_pkginfo_global() {
 | 
			
		||||
    local singlevalued=(pkgver pkgrel epoch)
 | 
			
		||||
    local multivalued=(arch groups provides depends makedepends checkdepends)
 | 
			
		||||
 | 
			
		||||
    write_details ''
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
write_pkginfo() {
 | 
			
		||||
    local singlevalued=()
 | 
			
		||||
    local multivalued=(arch groups provides depends checkdepends)
 | 
			
		||||
 | 
			
		||||
    write_details "$1"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
write_yaml(){
 | 
			
		||||
    Yaml+="---"$NL
 | 
			
		||||
 | 
			
		||||
    Yaml+=$NL
 | 
			
		||||
 | 
			
		||||
    Yaml+="pkgfile:"$NL
 | 
			
		||||
    for f in ${pkgfile[@]};do
 | 
			
		||||
        Yaml+="  - ${f##*/}"$NL
 | 
			
		||||
    done
 | 
			
		||||
    Yaml+=$NL
 | 
			
		||||
 | 
			
		||||
    Yaml+="pkgbase: ${pkgbase:-$pkgname}"$NL
 | 
			
		||||
    write_pkginfo_global
 | 
			
		||||
    Yaml+=$NL
 | 
			
		||||
 | 
			
		||||
    Yaml+="pkgname:"$NL
 | 
			
		||||
    for pkg in "${pkgname[@]}"; do
 | 
			
		||||
        Yaml+="  - $pkg"$NL
 | 
			
		||||
        write_pkginfo "$pkg"
 | 
			
		||||
    done
 | 
			
		||||
 | 
			
		||||
    printf '%s' "${Yaml}"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if [[ -f "$1"/PKGBUILD ]]; then
 | 
			
		||||
    LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
 | 
			
		||||
@@ -24,21 +122,8 @@ if [[ -f "$1"/PKGBUILD ]]; then
 | 
			
		||||
    . "$1"/PKGBUILD
 | 
			
		||||
 | 
			
		||||
    pkgfile=$(print_all_package_names)
 | 
			
		||||
 | 
			
		||||
    NL=$'\n'
 | 
			
		||||
    Yaml="%YAML 1.2"$NL
 | 
			
		||||
    write_yaml
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
NL=$'\n'
 | 
			
		||||
 | 
			
		||||
Yaml="%YAML 1.2"$NL
 | 
			
		||||
Yaml+="---"$NL
 | 
			
		||||
 | 
			
		||||
Yaml+="pkgfile:"$NL
 | 
			
		||||
for f in ${pkgfile[@]};do
 | 
			
		||||
    Yaml+="  - ${f##*/}"$NL
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
Yaml+="pkgname:"$NL
 | 
			
		||||
for n in ${pkgname[@]};do
 | 
			
		||||
    Yaml+="  - ${n##*/}"$NL
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
printf '%s' "${Yaml}"
 | 
			
		||||
 
 | 
			
		||||
@@ -9,9 +9,32 @@
 | 
			
		||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
# GNU General Public License for more details.
 | 
			
		||||
 | 
			
		||||
get_local_head(){
 | 
			
		||||
    echo $(git log --pretty=%H ...refs/heads/master^ | head -n 1)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
get_remote_head(){
 | 
			
		||||
    echo $(git ls-remote origin -h refs/heads/master | cut -f1)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
subrepo_push(){
 | 
			
		||||
    local pkg="$1"
 | 
			
		||||
    git subrepo push "$pkg" --clean
 | 
			
		||||
    msg2 "Update (%s)" "$pkg"
 | 
			
		||||
    git subrepo push "$pkg"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
subrepo_config(){
 | 
			
		||||
    local pkg="$1" org="$2"
 | 
			
		||||
    local gitname=$(get_compliant_name "$pkg")
 | 
			
		||||
    local url=gitea@"${GIT_DOMAIN}":"$org"/"$gitname".git
 | 
			
		||||
    msg2 "Update .gitrepo (%s) [%s]" "$pkg" "$url"
 | 
			
		||||
    git subrepo config "$pkg" remote "$url"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
subrepo_clean(){
 | 
			
		||||
    local pkg="$1"
 | 
			
		||||
    msg2 "Clean (%s)" "$pkg"
 | 
			
		||||
    git subrepo clean "$pkg"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
subrepo_pull(){
 | 
			
		||||
@@ -26,28 +49,106 @@ subrepo_clone(){
 | 
			
		||||
    git subrepo clone gitea@"${GIT_DOMAIN}":"$org"/"$gitname".git "$pkg"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
clone_tree(){
 | 
			
		||||
    local timer=$(get_timer) url="$1" tree="$2"
 | 
			
		||||
 | 
			
		||||
    msg "Cloning (%s) ..." "$tree"
 | 
			
		||||
 | 
			
		||||
    git clone $url/$tree.git
 | 
			
		||||
    show_elapsed_time "${FUNCNAME}" "${timer}"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
has_changes(){
 | 
			
		||||
    local head_l="$1" head_r="$2"
 | 
			
		||||
    if [[ "$head_l" == "$head_r" ]]; then
 | 
			
		||||
        msg2 "remote changes: no"
 | 
			
		||||
        return 1
 | 
			
		||||
    else
 | 
			
		||||
        msg2 "remote changes: yes"
 | 
			
		||||
        return 0
 | 
			
		||||
    fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pull_tree(){
 | 
			
		||||
    local tree="$1"
 | 
			
		||||
    local local_head=${2:-$(get_local_head)}
 | 
			
		||||
    local remote_head=$(get_remote_head)
 | 
			
		||||
 | 
			
		||||
    msg "Checking (%s)" "${tree}"
 | 
			
		||||
    if $(has_changes "${local_head}" "${remote_head}");then
 | 
			
		||||
        git pull origin master
 | 
			
		||||
    fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
push_tree(){
 | 
			
		||||
    local tree="$1"
 | 
			
		||||
    msg "Update (%s)" "${tree}"
 | 
			
		||||
    git push origin master
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
write_jenkinsfile(){
 | 
			
		||||
    local jenkins=Jenkinsfile
 | 
			
		||||
    echo '@Library(["PackagePipeline", "RepoPackage"]) import org.artixlinux.RepoPackage' > $jenkins
 | 
			
		||||
    local pkg="$1"
 | 
			
		||||
    local jenkins=$pkg/Jenkinsfile
 | 
			
		||||
 | 
			
		||||
    echo "@Library('artix-ci') import org.artixlinux.RepoPackage" > $jenkins
 | 
			
		||||
    echo '' >> $jenkins
 | 
			
		||||
    echo 'PackagePipeline(new RepoPackage(this))' >> $jenkins
 | 
			
		||||
    echo '' >> $jenkins
 | 
			
		||||
 | 
			
		||||
    git add $jenkins
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
write_agentyaml(){
 | 
			
		||||
    local agent=.artixlinux/agent.yaml label='master'
 | 
			
		||||
    [[ -d .artixlinux ]] || mkdir .artixlinux
 | 
			
		||||
    local pkg="$1"
 | 
			
		||||
    local agent=$pkg/.artixlinux/agent.yaml label='master'
 | 
			
		||||
    [[ -d $pkg/.artixlinux ]] || mkdir $pkg/.artixlinux
 | 
			
		||||
 | 
			
		||||
    echo '%YAML 1.2' > $agent
 | 
			
		||||
    echo '---' >> $agent
 | 
			
		||||
    echo '' >> $agent
 | 
			
		||||
    echo "label: $label" >> $agent
 | 
			
		||||
    echo '' >> $agent
 | 
			
		||||
 | 
			
		||||
    git add $agent
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
commit_jenkins_files(){
 | 
			
		||||
    write_jenkinsfile
 | 
			
		||||
    write_agentyaml
 | 
			
		||||
    git add Jenkinsfile
 | 
			
		||||
    git add .artixlinux
 | 
			
		||||
    local pkg="$1"
 | 
			
		||||
 | 
			
		||||
    write_jenkinsfile "$pkg"
 | 
			
		||||
    write_agentyaml "$pkg"
 | 
			
		||||
 | 
			
		||||
    git commit -m "add jenkinsfile & .artixlinux/agent.yaml"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
config_tree(){
 | 
			
		||||
    local tree="$1"
 | 
			
		||||
    cd $tree
 | 
			
		||||
        git config --bool pull.rebase true
 | 
			
		||||
        git config commit.gpgsign true
 | 
			
		||||
        if [[ -n "${GPGKEY}" ]];then
 | 
			
		||||
            git config user.signingkey "${GPGKEY}"
 | 
			
		||||
        else
 | 
			
		||||
            warning "No GPGKEY configured in makepkg.conf!"
 | 
			
		||||
        fi
 | 
			
		||||
    cd ..
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
subrepo_new(){
 | 
			
		||||
    local pkg="$1" team="$2"
 | 
			
		||||
    local dest=${TREE_DIR_ARTIX}/$team/$pkg/trunk
 | 
			
		||||
 | 
			
		||||
    cd ${TREE_DIR_ARTIX}/$team
 | 
			
		||||
 | 
			
		||||
    local org=$(get_pkg_org "$pkg")
 | 
			
		||||
 | 
			
		||||
    create_repo "$pkg" "$org"
 | 
			
		||||
 | 
			
		||||
    add_repo_to_team "$pkg" "$org" "$team"
 | 
			
		||||
 | 
			
		||||
    subrepo_clone "$pkg" "$org"
 | 
			
		||||
 | 
			
		||||
    prepare_dir "$dest"
 | 
			
		||||
 | 
			
		||||
    commit_jenkins_files "$pkg"
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -9,14 +9,6 @@
 | 
			
		||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
# GNU General Public License for more details.
 | 
			
		||||
 | 
			
		||||
get_local_head(){
 | 
			
		||||
    echo $(git log --pretty=%H ...refs/heads/$1^ | head -n 1)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
get_remote_head(){
 | 
			
		||||
    echo $(git ls-remote origin -h refs/heads/$1 | cut -f1)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
patch_pkg(){
 | 
			
		||||
    local pkg="$1"
 | 
			
		||||
    case $pkg in
 | 
			
		||||
@@ -82,10 +74,10 @@ find_tree(){
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
find_repo(){
 | 
			
		||||
    local pkg="$1" unst="$2" stag="$3" repo=
 | 
			
		||||
    local repos=(core extra testing community community-testing mulitilib multilib-testing)
 | 
			
		||||
    local pkg="$1" stag="$2" unst="$3" repo=
 | 
			
		||||
    local repos=(core extra testing community community-testing multilib multilib-testing)
 | 
			
		||||
 | 
			
		||||
    $stag && repos+=(staging community-staging mulitilib-staging)
 | 
			
		||||
    $stag && repos+=(staging community-staging multilib-staging)
 | 
			
		||||
    $unst && repos+=(gnome-unstable kde-unstable)
 | 
			
		||||
 | 
			
		||||
    for r in ${repos[@]};do
 | 
			
		||||
@@ -103,24 +95,6 @@ get_import_path(){
 | 
			
		||||
    echo $import_path
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
clone_tree(){
 | 
			
		||||
    local timer=$(get_timer) host_tree="$1"
 | 
			
		||||
    git clone $host_tree.git
 | 
			
		||||
    show_elapsed_time "${FUNCNAME}" "${timer}"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pull_tree(){
 | 
			
		||||
    local branch="master"
 | 
			
		||||
    local local_head=$(get_local_head "$branch")
 | 
			
		||||
    local remote_head=$(get_remote_head "$branch")
 | 
			
		||||
    if [[ "${local_head}" == "${remote_head}" ]]; then
 | 
			
		||||
        msg2 "remote changes: no"
 | 
			
		||||
    else
 | 
			
		||||
        msg2 "remote changes: yes"
 | 
			
		||||
        git pull origin "$branch"
 | 
			
		||||
    fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pkgver_equal() {
 | 
			
		||||
    if [[ $1 = *-* && $2 = *-* ]]; then
 | 
			
		||||
        # if both versions have a pkgrel, then they must be an exact match
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user