forked from artix/artools
		
	Compare commits
	
		
			8 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | a98a7b5100 | ||
|   | 3c80f711da | ||
|   | 501272464b | ||
|   | c6ddda2773 | ||
|   | 2bed948636 | ||
|   | 98c1d950f8 | ||
|   | 6941b3ce3b | ||
|   | 1972ee936e | 
| @@ -28,6 +28,9 @@ display_settings(){ | ||||
|     msg2 "repo_tree_arch: %s" "${repo_tree_arch[*]}" | ||||
|     msg2 "repo_tree_artix: %s" "${repo_tree_artix[*]}" | ||||
|  | ||||
|     msg "OPTIONS:" | ||||
|     msg2 "repository: %s" "${repository}" | ||||
|  | ||||
|     msg "ARGS:" | ||||
|     msg2 "artix: %s" "${artix}" | ||||
|     msg2 "arch: %s" "${arch}" | ||||
| @@ -51,11 +54,13 @@ artix=false | ||||
| compare=false | ||||
| import_arch=false | ||||
| gitpush=false | ||||
| repository=${PWD##*/} | ||||
|  | ||||
| rsync_args=(-aWxv --progress --delete-before --no-R --no-implied-dirs) | ||||
|  | ||||
| usage() { | ||||
|     echo "Usage: ${0##*/} [options]" | ||||
|     echo "    -r <repo>     Repository [default:${repository}]" | ||||
|     echo "    -a            Sync arch tree" | ||||
|     echo "    -s            Sync artix tree" | ||||
|     echo "    -c            Compare artix and arch versions" | ||||
| @@ -70,10 +75,11 @@ usage() { | ||||
|  | ||||
| orig_argv=("$0" "$@") | ||||
|  | ||||
| opts='aipscqh' | ||||
| opts='r:aipscqh' | ||||
|  | ||||
| while getopts "${opts}" arg; do | ||||
|     case "${arg}" in | ||||
|         r) repository="$OPTARG" ;; | ||||
|         a) arch=true ;; | ||||
|         s) artix=true ;; | ||||
|         c) compare=true ;; | ||||
| @@ -97,6 +103,6 @@ ${artix} && sync_tree_artix | ||||
|  | ||||
| ${arch} && sync_tree_arch | ||||
|  | ||||
| ${compare} && show_version_table | ||||
| ${compare} && show_version_table "${repository}" | ||||
|  | ||||
| ${import_arch} && import_from_arch ${gitpush} | ||||
| ${import_arch} && import_from_arch "${repository}" "${gitpush}" | ||||
|   | ||||
| @@ -16,6 +16,8 @@ LIBDIR='@libdir@' | ||||
| [[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh | ||||
| import ${LIBDIR}/util.sh | ||||
|  | ||||
| load_user_info | ||||
|  | ||||
| load_vars "${PAC_USERCONFDIR}/makepkg.conf" || load_vars "$USER_HOME/.makepkg.conf" | ||||
| load_vars /etc/makepkg.conf | ||||
|  | ||||
| @@ -30,9 +32,5 @@ msg2 "Signing [%s] with key %s" "${file_to_sign##*/}" "${GPGKEY}..." | ||||
| if [[ -n "${BUILDBOT_GPGP}" ]]; then | ||||
|     gpg --batch --passphrase "${BUILDBOT_GPGP}" --detach-sign "$file_to_sign" | ||||
| else | ||||
|     if [[ -f /usr/bin/hellhound ]]; then | ||||
|         gpg --batch --passphrase $(hellhound retrieve) --detach-sign "$file_to_sign" | ||||
|     else | ||||
|         gpg --detach-sign --use-agent -u "${GPGKEY}" "$file_to_sign" | ||||
|     fi | ||||
|     gpg --detach-sign --use-agent -u "${GPGKEY}" "$file_to_sign" | ||||
| fi | ||||
|   | ||||
| @@ -68,7 +68,6 @@ libqmi | ||||
| glib-networking | ||||
| gsettings-desktop-schemas | ||||
| slang | ||||
| dhcp | ||||
| dbus-python | ||||
| lirc | ||||
| qt5-3d | ||||
|   | ||||
| @@ -52,6 +52,13 @@ move_to_repo(){ | ||||
|  | ||||
| add_to_repo(){ | ||||
|     local repo="$1" destarch="$2" pkg="$3" ver pkgfile result | ||||
|     if [[ $pkg == 'llvm' ]];then | ||||
|         if [[ ${repo#*-} == 'testing' ]];then | ||||
|             repo='world-testing' | ||||
|         else | ||||
|             repo='world' | ||||
|         fi | ||||
|     fi | ||||
|     local repo_path=${repos_root}/$repo/os/$destarch | ||||
|     source $pkg/PKGBUILD | ||||
|     local dest=$pkg | ||||
|   | ||||
| @@ -22,35 +22,6 @@ is_dirty() { | ||||
|     return 0 | ||||
| } | ||||
|  | ||||
| show_version_table(){ | ||||
|     declare -A UPDATES | ||||
|     msg_table_header "%-30s %-30s %-30s %-30s" "Repository" "Package" "Artix version" "Arch version" | ||||
|     for repo in ${repo_tree_artix[@]}; do | ||||
|         for pkg in ${tree_dir_artix}/$repo/*; do | ||||
|             if [[ -f $pkg/PKGBUILD ]];then | ||||
|                 source $pkg/PKGBUILD 2>/dev/null | ||||
|                 package=${pkg##*/} | ||||
|                 artixver=$(get_full_version $package) | ||||
|                 set_import_path "$repo" "$package" | ||||
|                 if [[ -f $src/PKGBUILD ]];then | ||||
|                     source $src/PKGBUILD 2>/dev/null | ||||
|                     archver=$(get_full_version $package) | ||||
|                 fi | ||||
|                 if [ $(vercmp $artixver $archver) -lt 0 ];then | ||||
|                     UPDATES[$package]="$pkg/PKGBUILD $src/PKGBUILD" | ||||
|                     msg_row_update "%-30s %-30s %-30s %-30s" "$repo" "$package" "$artixver" "$archver" | ||||
|                 fi | ||||
|             fi | ||||
|             unset pkgver epoch pkgrel artixver archver package | ||||
|         done | ||||
|     done | ||||
|     rm ${patches_dir}/*.patch | ||||
|     for upd in "${!UPDATES[@]}"; do | ||||
|         msg "Writing %s update patch ..." "$upd" | ||||
|         diff -u ${UPDATES[$upd]} > ${patches_dir}/"$upd"-archlinux.patch | ||||
|     done | ||||
| } | ||||
|  | ||||
| sync_tree(){ | ||||
|     local branch="master" repo="$1" | ||||
|     git checkout $branch | ||||
| @@ -80,6 +51,7 @@ clone_tree(){ | ||||
| } | ||||
|  | ||||
| sync_tree_arch(){ | ||||
|     local repo="$1" | ||||
|     cd ${tree_dir_arch} | ||||
|         for repo in ${repo_tree_arch[@]};do | ||||
|             if [[ -d ${repo} ]];then | ||||
| @@ -94,6 +66,7 @@ sync_tree_arch(){ | ||||
| } | ||||
|  | ||||
| sync_tree_artix(){ | ||||
|     local repo="$1" | ||||
|     cd ${tree_dir_artix} | ||||
|         for repo in ${repo_tree_artix[@]};do | ||||
|             if [[ -d ${repo} ]];then | ||||
| @@ -158,12 +131,15 @@ set_import_path(){ | ||||
|                 arch_dir=packages | ||||
|             fi | ||||
|             import_path=${tree_dir_arch}/$arch_dir/$pkg/repos | ||||
|  | ||||
|             src=$import_path/$arch_repo-x86_64 | ||||
|             if [[ -d $import_path/testing-x86_64 ]];then | ||||
|                 src=$import_path/testing-x86_64 | ||||
|             fi | ||||
|             if [[ -d $import_path/$arch_repo-any ]];then | ||||
|                 src=$import_path/$arch_repo-any | ||||
|             elif [[ -d $import_path/testing-x86_64 ]];then | ||||
|                 src=$import_path/testing-x86_64 | ||||
|             elif [[ -d $import_path/testing-any ]];then | ||||
|             fi | ||||
|             if [[ -d $import_path/testing-any ]];then | ||||
|                 src=$import_path/testing-any | ||||
|             fi | ||||
|         ;; | ||||
| @@ -171,12 +147,15 @@ set_import_path(){ | ||||
|             arch_repo=community | ||||
|             arch_dir=$arch_repo | ||||
|             import_path=${tree_dir_arch}/$arch_dir/$pkg/repos/$arch_repo | ||||
|  | ||||
|             src=$import_path-x86_64 | ||||
|             if [[ -d $import_path-testing-x86_64 ]];then | ||||
|                 src=$import_path-testing-x86_64 | ||||
|             fi | ||||
|             if [[ -d $import_path-any ]];then | ||||
|                 src=$import_path-any | ||||
|             elif [[ -d $import_path-testing-x86_64 ]];then | ||||
|                 src=$import_path-testing-x86_64 | ||||
|             elif [[ -d $import_path-testing-any ]];then | ||||
|             fi | ||||
|             if [[ -d $import_path-testing-any ]];then | ||||
|                 src=$import_path-testing-any | ||||
|             fi | ||||
|         ;; | ||||
| @@ -202,35 +181,58 @@ set_import_path(){ | ||||
|     esac | ||||
| } | ||||
|  | ||||
| import_from_arch(){ | ||||
|     local timer=$(get_timer) branch='testing' push="$1" | ||||
|     for repo in ${repo_tree_artix[@]};do | ||||
|         read_import_list "$repo" | ||||
|         if [[ -n ${import_list[@]} ]];then | ||||
|             cd ${tree_dir_artix}/$repo | ||||
|             git checkout $branch &> /dev/null | ||||
|             $(is_dirty) && die "[%s] has uncommited changes!" "${repo}" | ||||
|             git pull origin "$branch" | ||||
|             msg "Import into [%s]" "$repo" | ||||
|             for pkg in ${import_list[@]};do | ||||
|                 source $pkg/PKGBUILD 2>/dev/null | ||||
|                 local ver=$(get_full_version $pkg) | ||||
|                 msg2 "package: %s-%s" "$pkg" "$ver" | ||||
|                 set_import_path "$repo" "$pkg" | ||||
|                 rsync "${rsync_args[@]}"  $src/ ${tree_dir_artix}/$repo/$pkg/ | ||||
|                 if $(is_dirty) || $(is_untracked); then | ||||
|                     patch_pkg "$pkg" | ||||
|                     ${push} && git add "$pkg" | ||||
|                     msg2 "Archlinux import: [%s]" "$pkg-$ver" | ||||
|                     if ${push};then | ||||
|                         git commit -m "Archlinux import: $pkg-$ver" | ||||
|                         sleep 10 | ||||
|                         git push origin "$branch" | ||||
|                     fi | ||||
|                 fi | ||||
|                 unset pkgver epoch pkgrel ver | ||||
|             done | ||||
| show_version_table(){ | ||||
|     local repo="$1" | ||||
|     declare -A UPDATES | ||||
|     msg_table_header "%-30s %-30s %-30s %-30s" "Repository" "Package" "Artix version" "Arch version" | ||||
|     for pkg in ${tree_dir_artix}/$repo/*; do | ||||
|         if [[ -f $pkg/PKGBUILD ]];then | ||||
|             source $pkg/PKGBUILD 2>/dev/null | ||||
|             package=${pkg##*/} | ||||
|             artixver=$(get_full_version $package) | ||||
|             set_import_path "$repo" "$package" | ||||
|             if [[ -f $src/PKGBUILD ]];then | ||||
|                 source $src/PKGBUILD 2>/dev/null | ||||
|                 archver=$(get_full_version $package) | ||||
|             fi | ||||
|             if [ $(vercmp $artixver $archver) -lt 0 ];then | ||||
|                 UPDATES[$package]="$pkg/PKGBUILD $src/PKGBUILD" | ||||
|                 msg_row_update "%-30s %-30s %-30s %-30s" "$repo" "$package" "$artixver" "$archver" | ||||
|             fi | ||||
|         fi | ||||
|         unset pkgver epoch pkgrel artixver archver package | ||||
|     done | ||||
|     rm ${patches_dir}/*.patch | ||||
|     for upd in "${!UPDATES[@]}"; do | ||||
|         msg "Writing %s update patch ..." "$upd" | ||||
|         diff -u ${UPDATES[$upd]} > ${patches_dir}/"$upd"-archlinux.patch | ||||
|     done | ||||
| } | ||||
|  | ||||
| import_from_arch(){ | ||||
|     local timer=$(get_timer) branch='testing' repo="$1" push="$2" | ||||
|     read_import_list "$repo" | ||||
|     if [[ -n ${import_list[@]} ]];then | ||||
|         cd ${tree_dir_artix}/$repo | ||||
|         git checkout $branch &> /dev/null | ||||
|         $(is_dirty) && die "[%s] has uncommited changes!" "${repo}" | ||||
|         git pull origin "$branch" | ||||
|         for pkg in ${import_list[@]};do | ||||
|             set_import_path "$repo" "$pkg" | ||||
|             source $src/PKGBUILD 2>/dev/null | ||||
|             local ver=$(get_full_version $pkg) | ||||
|             msg "Package: %s-%s" "$pkg" "$ver" | ||||
| #             msg2 "src: %s" "$src" | ||||
|             rsync "${rsync_args[@]}"  $src/ ${tree_dir_artix}/$repo/$pkg/ | ||||
|             patch_pkg "$pkg" | ||||
|             if ${push};then | ||||
|                 git add "$pkg" | ||||
|                 git commit -m "$pkg-$ver" | ||||
|                 sleep 10 | ||||
|                 git push origin "$branch" | ||||
|             fi | ||||
|             unset pkgver epoch pkgrel ver | ||||
|         done | ||||
|     fi | ||||
|     show_elapsed_time "${FUNCNAME}" "${timer}" | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user