Compare commits

..

8 Commits

Author SHA1 Message Date
ea06ec0b2e util-pkg-subrepo: check master by default 2018-12-30 11:56:05 +01:00
e67990ae04 commitpkg: make check for pull work 2018-12-30 11:50:33 +01:00
b37d5f0236 buildtree & commitpkg: use same pull func 2018-12-30 03:45:17 +01:00
989af04593 pkg2yaml: include deps 2018-12-30 03:44:29 +01:00
90f46d7ecc buildtree: ensure trunk exists for newly cloned subrepos 2018-12-29 13:22:35 +01:00
8e872ca9ca buildtree: fix new repo sync & help 2018-12-28 17:08:08 +01:00
05c95b7025 comparepkg: fix help
buildtree: rm unstable flag
2018-12-21 18:29:11 +01:00
442aee08df fix move display 2018-12-21 12:27:50 +01:00
6 changed files with 228 additions and 155 deletions

View File

@@ -26,70 +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"
commit_jenkins_files "$pkg"
}
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/
}
@@ -122,46 +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"
commit_jenkins_files "$pkg"
# 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(){
@@ -170,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
@@ -210,8 +155,8 @@ usage() {
echo " -s Clone or pull repos"
echo " -z Don't clone or pull arch repos"
echo ' -i Import a package from arch repos'
echo ' -m Make new remote subrepo and clone it'
echo ' -C Configure subrepo url'
echo ' -n Make new remote subrepo and clone it'
echo ' -c Configure subrepo url'
echo ' -v View package depends'
echo ' -h This help'
echo ''
@@ -250,6 +195,6 @@ ${view} && view_build "${PACKAGE}"
${import} && from_arch "${PACKAGE}"
${createnew} && mkrepo "${PACKAGE}" "${TEAM}"
${createnew} && subrepo_new "${PACKAGE}" "${TEAM}"
${conf} && subrepo_config "${PACKAGE}" "${SUBORG}"

View File

@@ -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,12 +63,12 @@ commit_pkg(){
cd ${TREE_DIR_ARTIX}/${git_tree}
if ${push};then
mainrepo_pull "${git_tree}"
pull_tree "${git_tree}" "$head"
subrepo_push "${PACKAGE}"
subrepo_clean "${PACKAGE}"
# sleep 1
mainrepo_push "${git_tree}"
push_tree "${git_tree}"
fi
git prune
else
@@ -83,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"
@@ -112,12 +116,12 @@ symlink_commit_pkg(){
cd ${TREE_DIR_ARTIX}/${git_tree}
if ${push};then
mainrepo_pull "${git_tree}"
pull_tree "${git_tree}" "$head"
subrepo_push "${PACKAGE}"
subrepo_clean "${PACKAGE}"
# sleep 1
mainrepo_push "${git_tree}"
push_tree "${git_tree}"
fi
git prune
else

View File

@@ -29,7 +29,7 @@ show_version_table(){
for package in ${git[@]}; do
local pkg=${package##*/}
local artixrepo=$(find_repo "$package" "${unstable}" "${staging}")
local artixrepo=$(find_repo "$package" "${staging}" "${unstable}")
local artixshow=${artixrepo%-*}
local pkgbuild=$package/repos/$artixrepo/PKGBUILD
@@ -38,8 +38,10 @@ show_version_table(){
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 archpath=$(get_import_path $pkg)
local archrepo=$(find_repo "$archpath" "${staging}" "${unstable}")
local archshow=${archrepo%-*}
pkgbuild=$archpath/repos/$archrepo/PKGBUILD
@@ -48,19 +50,17 @@ show_version_table(){
local archver=$(get_full_version $pkg)
fi
local result=$(vercmp "$artixver" "$archver")
local repomatch=false
[[ "$archrepo" == "$artixrepo" ]] && repomatch=true
if ${move};then
if [ $(vercmp "$artixver" "$archver") -eq 0 ] || [ $(vercmp "$artixver" "$archver") -gt 0 ];then
if [ $result -gt -1 ];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
*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"
@@ -69,20 +69,22 @@ show_version_table(){
esac
fi
else
elif ${upgrades};then
if [ $(vercmp "$artixver" "$archver") -lt 0 ];then
${upgrades} && msg_row_upgrade "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
if [ $result -eq -1 ];then
msg_row_upgrade "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
fi
if [ $(vercmp "$artixver" "$archver") -gt 0 ];then
elif ${downgrades};then
if [ $result -eq 1 ];then
if [[ -n $archver ]] && [[ -n $archrepo ]];then
${downgrades} && msg_row_downgrade "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
msg_row_downgrade "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
fi
fi
fi
unset pkgver epoch pkgrel artixver archver
unset pkgver epoch pkgrel artixver archver pkgbuild archpath
fi
done
@@ -105,12 +107,11 @@ tree_names=(packages community)
usage() {
echo "Usage: ${0##*/} [options]"
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 ' -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 ''
@@ -119,15 +120,15 @@ usage() {
orig_argv=("$0" "$@")
opts='udmyxh'
opts='udmxyh'
while getopts "${opts}" arg; do
case "${arg}" in
u) upgrades=true ;;
d) downgrades=true ;;
m) move=true ;;
y) staging=false ;;
x) unstable=true ;;
x) staging=false ;;
y) unstable=true ;;
h|?) usage 0 ;;
*) echo "invalid argument '${arg}'"; usage 1 ;;
esac

View File

@@ -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}"

View File

@@ -9,6 +9,14 @@
# 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"
msg2 "Update (%s)" "$pkg"
@@ -41,16 +49,40 @@ subrepo_clone(){
git subrepo clone gitea@"${GIT_DOMAIN}":"$org"/"$gitname".git "$pkg"
}
mainrepo_pull(){
local tree="$1"
msg2 "Check (%s)" "${tree}"
git push origin master
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
}
mainrepo_push(){
pull_tree(){
local tree="$1"
msg2 "Update (%s)" "${tree}"
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
}
@@ -88,3 +120,35 @@ commit_jenkins_files(){
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"
}

View File

@@ -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