Compare commits

...

7 Commits
0.4.2 ... 0.5

Author SHA1 Message Date
artoo
e52f9b577e Merge pull request #22 from artix-linux/devel
Devel-0.5
2017-08-06 02:19:23 +02:00
udeved
31baa79248 start 0.5 2017-08-06 01:59:03 +02:00
udeved
fb1cead10a buildtree: pull testing optionally 2017-08-06 00:31:14 +02:00
artoo
01e37feb4e Merge pull request #21 from artix-linux/devel
buildtree: improve import
2017-08-05 22:32:02 +02:00
udeved
25e2755ffa buildtree: improve import 2017-08-05 22:20:44 +02:00
udeved
03fc8aea26 buildtree: adopt new arch import repos 2017-08-05 20:49:03 +02:00
udeved
fcc006f30f util-pkg-tree: just pull master and archlinux 2017-08-03 22:58:18 +02:00
8 changed files with 61 additions and 36 deletions

View File

@@ -1,4 +1,4 @@
Version=0.4
Version=0.5
PREFIX = /usr/local
SYSCONFDIR = /etc

View File

@@ -19,7 +19,7 @@ import ${LIBDIR}/util.sh
import ${LIBDIR}/util-pkg-tree.sh
show_imports(){
for repo in ${repo_tree_artix[@]};do
for repo in ${repo_tree_import[@]};do
read_import_list "$repo"
for p in ${import_list[@]};do
msg2 "%s: %s" ""$repo "$p"
@@ -34,18 +34,18 @@ display_settings(){
msg "REPOS:"
msg2 "repo_tree_artix: %s" "${repo_tree_artix[*]}"
msg2 "repo_tree_arch: %s" "${repo_tree_arch[*]}"
msg2 "repo_tree_import: %s" "${repo_tree_import[*]}"
msg "ARGS:"
msg2 "verbose: %s" "${verbose}"
msg2 "artix: %s" "${artix}"
msg2 "artix_stable: %s" "${artix_stable}"
msg2 "artix_testing: %s" "${artix_testing}"
msg2 "arch: %s" "${arch}"
msg2 "import_arch: %s" "${import_arch}"
msg "PATHS:"
msg2 "tree_dir_artix: %s" "${tree_dir_artix}"
msg2 "tree_dir_arch: %s" "${tree_dir_arch}"
# msg2 "host_tree_artix: %s" "${host_tree_artix}"
# msg2 "host_tree_arch: %s" "${host_tree_arch}"
if ${verbose}; then
if ${import_arch};then
@@ -59,19 +59,21 @@ load_user_info
load_config "${AT_USERCONFDIR}/artools.conf" || load_config "${SYSCONFDIR}/artools.conf"
artix=false
artix_stable=false
pretend=false
arch=false
import_arch=false
verbose=false
artix_testing=false
rsync_args=(-aWx --progress --delete --no-R --no-implied-dirs)
usage() {
echo "Usage: ${0##*/} [options]"
echo " -x Sync artix tree"
echo " -s Sync artix tree stable"
echo " -t Sync artix tree testing"
echo " -a Sync arch tree"
echo ' -i Import arch system packages'
echo ' -i Import arch packages'
echo ' -v Verbose import output'
echo ' -q Query settings'
echo ' -h This help'
@@ -82,11 +84,12 @@ usage() {
orig_argv=("$0" "$@")
opts='xaivqh'
opts='staivqh'
while getopts "${opts}" arg; do
case "${arg}" in
x) artix=true ;;
s) artix_stable=true ;;
t) artix_testing=true ;;
a) arch=true ;;
i) import_arch=true ;;
v) verbose=true; rsync_args+=(-v --stats) ;;
@@ -103,7 +106,7 @@ prepare_dir "${tree_dir_arch}"
${pretend} && display_settings && exit 1
${artix} && sync_tree_artix
${artix_stable} && sync_tree_artix "${artix_testing}"
${arch} && sync_tree_arch

View File

@@ -29,6 +29,7 @@
# artix package tree
# repo_tree_artix=('system' 'world' 'galaxy')
# repo_tree_import=('system-arch' 'world-arch' 'galaxy-arch')
# host_tree_artix=https://github.com/artix-linux

View File

@@ -17,33 +17,38 @@ get_remote_head(){
echo $(git ls-remote origin -h refs/heads/$1 | cut -f1)
}
is_dirty() {
[[ $(git diff --shortstat 2> /dev/null | tail -n1) != "" ]] || return 1
return 0
}
sync_tree_branches(){
local branches=(master artix archlinux)
for b in ${branches[@]};do
git checkout $b &> /dev/null
local local_head=$(get_local_head "$b")
local remote_head=$(get_remote_head "$b")
local timer=$(get_timer) repo="$1"
msg "Checking [%s] (%s) ..." "$repo" "$b"
local branches=('master') repo="$1" testing="$2"
${testing} && branches+=('testing')
for branch in ${branches[@]};do
git checkout $branch &> /dev/null
local local_head=$(get_local_head "$branch")
local remote_head=$(get_remote_head "$branch")
local timer=$(get_timer)
msg "Checking [%s] (%s) ..." "$repo" "$branch"
msg2 "local: %s" "${local_head}"
msg2 "remote: %s" "${remote_head}"
if [[ "${local_head}" == "${remote_head}" ]]; then
info "nothing to do"
else
info "needs sync"
git pull origin $b
git pull origin $branch
fi
msg "Done [%s] (%s)" "$repo" "$b"
msg "Done [%s] (%s)" "$repo" "$branch"
done
git checkout master &> /dev/null
show_elapsed_time "${FUNCNAME}" "${timer}"
}
sync_tree(){
local branch="master"
local branch="master" repo="$1"
local local_head=$(get_local_head "$branch")
local remote_head=$(get_remote_head "$branch")
local timer=$(get_timer) repo="$1"
local timer=$(get_timer)
msg "Checking [%s] ..." "$repo"
msg2 "local: %s" "${local_head}"
msg2 "remote: %s" "${remote_head}"
@@ -67,11 +72,23 @@ clone_tree(){
}
sync_tree_artix(){
local testing="$1"
cd ${tree_dir_artix}
for repo in ${repo_tree_artix[@]};do
if [[ -d ${repo} ]];then
cd ${repo}
sync_tree_branches "${repo}"
$(is_dirty) && die "[%s] has uncommited changes!" "${repo}"
sync_tree_branches "${repo}" "${testing}"
cd ..
else
clone_tree "${repo}" "${host_tree_artix}/${repo}"
fi
done
for repo in ${repo_tree_import[@]};do
if [[ -d ${repo} ]];then
cd ${repo}
$(is_dirty) && die "[%s] has uncommited changes!" "${repo}"
sync_tree "${repo}"
cd ..
else
clone_tree "${repo}" "${host_tree_artix}/${repo}"
@@ -100,33 +117,35 @@ read_import_list(){
import_list=$(sed "$_com_rm" "${list_dir_import}/$name.list" | sed "$_space" | sed "$_clean")
}
is_dirty() {
[[ $(git diff --shortstat 2> /dev/null | tail -n1) != "" ]] || return 1
return 0
}
get_pkgver(){
source PKGBUILD
echo $pkgver-$pkgrel
}
is_untracked(){
[[ $(git ls-files --others --exclude-standard) != "" ]] || return 1
return 0
}
import_from_arch(){
local timer=$(get_timer)
for repo in ${repo_tree_artix[@]};do
for repo in ${repo_tree_import[@]};do
read_import_list "$repo"
if [[ -n ${import_list[@]} ]];then
cd ${tree_dir_artix}/$repo
git checkout archlinux &> /dev/null
git checkout master &> /dev/null
$(is_dirty) && die "[%s] has uncommited changes!" "${repo}"
local arch_dir=packages
[[ $repo == "galaxy" ]] && arch_dir=community
msg "Import into [%s] branch (archlinux)" "$repo"
[[ $repo == "galaxy-arch" ]] && arch_dir=community
msg "Import into [%s]" "$repo"
for pkg in ${import_list[@]};do
msg2 "Importing [%s] ..." "$pkg"
rsync "${rsync_args[@]}" ${tree_dir_arch}/$arch_dir/$pkg/trunk/ ${tree_dir_artix}/$repo/$pkg/
if $(is_dirty); then
if $(is_dirty) || $(is_untracked); then
git add $pkg
cd $pkg
git commit -m "Archlinux $pkg-$(get_pkgver) import"
local ver=$(get_pkgver)
msg2 "Archlinux import: [%s]" "$pkg-$ver"
git commit -m "Archlinux import: $pkg-$ver"
cd ..
fi
done

View File

@@ -93,6 +93,8 @@ init_artools_pkg(){
[[ -z ${repo_tree_artix[@]} ]] && repo_tree_artix=('system' 'world' 'galaxy')
[[ -z ${repo_tree_import[@]} ]] && repo_tree_import=('system-arch' 'world-arch' 'galaxy-arch')
[[ -z ${host_tree_artix} ]] && host_tree_artix='https://github.com/artix-linux'
[[ -z ${tree_dir_arch} ]] && tree_dir_arch=${workspace_dir}/archlinux