forked from artix/artools
		
	Compare commits
	
		
			2 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| e00096d503 | |||
| f7ebc6bd11 | 
| @@ -23,7 +23,7 @@ artools | ||||
|  | ||||
| - pkg: | ||||
|   * namcap | ||||
|   * git-subrepo | ||||
|   * ruby-braid | ||||
|   * rsync | ||||
|  | ||||
| - iso: | ||||
|   | ||||
| @@ -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 | ||||
| @@ -195,7 +199,7 @@ from_arch(){ | ||||
|  | ||||
|     show_deps "$archpath" | ||||
|  | ||||
|     if [[ -f "$artixpath"/.gitrepo ]]; then | ||||
|     if [[ -f "$artixpath"/Jenkinsfile ]]; then | ||||
|         artixpath="$artixpath"/trunk | ||||
|  | ||||
|         if [[ -d "$artixpath" ]];then | ||||
| @@ -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 | ||||
|   | ||||
| @@ -168,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##*/}" | ||||
|   | ||||
| @@ -12,48 +12,66 @@ | ||||
| # 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}")" \ | ||||
| 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>\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" | ||||
|     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" | ||||
|  | ||||
| pactree_args=(-gs) | ||||
| mode=tree | ||||
|  | ||||
| tree_args=(-gs) | ||||
| rebuild_args=() | ||||
|  | ||||
| depth=0 | ||||
| optdepth=-1 | ||||
|  | ||||
| while getopts :d:o:rluh arg; do | ||||
| opts=':m:d:o:iruh' | ||||
|  | ||||
| while getopts "$opts" 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") ;; | ||||
|         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 )) | ||||
|  | ||||
| package="$1" | ||||
| [[ -d "${graph_dir}" ]] || mkdir -p "${graph_dir}" | ||||
|  | ||||
| if [[ ! -d "${graph_dir}" ]];then | ||||
|     mkdir -p "${graph_dir}" | ||||
| fi | ||||
|  | ||||
| mk_graph | ||||
| 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 | ||||
|   | ||||
| @@ -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" | ||||
| } | ||||
|   | ||||
| @@ -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