forked from artix/artools
		
	Compare commits
	
		
			13 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 02edf46d6a | |||
| 860d2272ba | |||
| 0d9e54c4e3 | |||
| 26bd425d55 | |||
| c08f82044c | |||
| 74af21ca25 | |||
| e3b8439b04 | |||
| e00096d503 | |||
| f7ebc6bd11 | |||
| b5fa7084b2 | |||
| 7eabdb0e46 | |||
| 10c013bf33 | |||
| 74618d77a5 | 
							
								
								
									
										5
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								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 \ | ||||
|   | ||||
| @@ -23,7 +23,7 @@ artools | ||||
|  | ||||
| - pkg: | ||||
|   * namcap | ||||
|   * git-subrepo | ||||
|   * ruby-braid | ||||
|   * rsync | ||||
|  | ||||
| - iso: | ||||
|   | ||||
| @@ -28,9 +28,9 @@ batch_move() { | ||||
|         src=${src#*:} | ||||
|         local dest=${entry%%:*} | ||||
|         if ${runlist}; then | ||||
|             "${dest}"pkg -s "${src}" -u -p "${pkg}" | ||||
|             "${dest}"pkg -s "${src}" -p "${pkg}" | ||||
|         else | ||||
|             msg "%s" "${dest}pkg -s ${src} -u -p ${pkg}" | ||||
|             msg "%s" "${dest}pkg -s ${src} -p ${pkg}" | ||||
|         fi | ||||
|     done < "$pkglist" | ||||
| } | ||||
| @@ -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,31 @@ 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_ci "${package}" | ||||
|  | ||||
| #         if braid push "${package}"; then | ||||
| #             braid update "${package}" | ||||
| #         fi | ||||
|     else | ||||
|         die "Package %s already exists!" "${package}" | ||||
|     fi | ||||
| } | ||||
|  | ||||
| #}}} | ||||
| @@ -52,7 +60,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 | ||||
| @@ -102,11 +110,20 @@ update_tree() { | ||||
|  | ||||
| #{{{ patch | ||||
|  | ||||
| set_maintainer() { | ||||
|     local name email path="$1" | ||||
|     name=$(git config --get user.name) | ||||
|     email=$(git config --get user.email) | ||||
|     sed -e "1s|Maintainer:.*|Maintainer: $name <$email>|" \ | ||||
|         -i "$path"/PKGBUILD | ||||
| } | ||||
|  | ||||
| patch_pkg(){ | ||||
|     local pkgpath="$1" | ||||
|     local pkg=${pkgpath%/*} | ||||
|     pkg=${pkg##*/} | ||||
|     sed -e 's|arch-meson|artix-meson|' -i "$pkgpath"/PKGBUILD | ||||
|     set_maintainer "$pkgpath" | ||||
|     case $pkg in | ||||
|         glibc) | ||||
|             msg2 "Patching %s" "$pkg" | ||||
| @@ -195,7 +212,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 +286,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 +331,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,21 +128,20 @@ run(){ | ||||
|             repo_commit_pkg | ||||
|         fi | ||||
|  | ||||
|         cd "${group}" || return | ||||
|         cd "$tree" || return | ||||
|  | ||||
|         if ${push}; then | ||||
|             msg "Checking (%s) (Artix)" "${group##*/}" | ||||
|             pull_tree "${group##*/}" "$head" | ||||
|         msg "Checking (%s) (Artix)" "${tree##*/}" | ||||
|         pull_tree "${tree##*/}" "$head" | ||||
|  | ||||
|         if braid push "${package}"; then | ||||
|             braid update "${package}" | ||||
|             msg "Update (%s)" "${tree##*/}" | ||||
|             git push origin master | ||||
|             git prune | ||||
|             [[ "${cmd}" != 'commitpkg' ]] && check_team | ||||
|         else | ||||
|             warning "'braid push %s' failed.\n" "${package}" | ||||
|         fi | ||||
|  | ||||
|         subrepo_push "${package}" | ||||
|         subrepo_clean "${package}" | ||||
|  | ||||
|         ${push} && push_tree "${group##*/}" | ||||
|  | ||||
|         git prune | ||||
|  | ||||
|         [[ "${cmd}" != 'commitpkg' ]] && check_team | ||||
|     else | ||||
|         die "Package '%s' does not exist!" "${package}" | ||||
|     fi | ||||
| @@ -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 | ||||
|   | ||||
| @@ -39,7 +39,7 @@ get_group() { | ||||
| } | ||||
|  | ||||
| compare_m(){ | ||||
|     if [ "$result" -eq 0 ];then | ||||
| #     if [ "$result" -eq 0 ];then | ||||
|         case "$artixrepo" in | ||||
|             *testing*|*staging*|*rebuild) | ||||
|                 if [[ "${archrepo}" == "${artixrepo}" ]]; then | ||||
| @@ -56,7 +56,7 @@ compare_m(){ | ||||
|                 fi | ||||
|             ;; | ||||
|         esac | ||||
|     fi | ||||
| #     fi | ||||
| } | ||||
|  | ||||
| compare_u(){ | ||||
| @@ -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##*/}" | ||||
|   | ||||
							
								
								
									
										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" | ||||
| } | ||||
|   | ||||
| @@ -31,7 +31,7 @@ write_agentyaml(){ | ||||
|     git add "$agent" | ||||
| } | ||||
|  | ||||
| commit_jenkins_files(){ | ||||
| commit_ci(){ | ||||
|     local pkg="$1" | ||||
|  | ||||
|     write_jenkinsfile "$pkg" | ||||
|   | ||||
| @@ -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