Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ea06ec0b2e | |||
| e67990ae04 | |||
| b37d5f0236 | |||
| 989af04593 |
@@ -26,70 +26,33 @@ pull_tree_arch(){
|
|||||||
for tree in ${tree_names[@]};do
|
for tree in ${tree_names[@]};do
|
||||||
if [[ -d ${tree} ]];then
|
if [[ -d ${tree} ]];then
|
||||||
cd ${tree}
|
cd ${tree}
|
||||||
msg "Checking (%s)" "${tree}"
|
pull_tree "${tree}"
|
||||||
pull_tree
|
|
||||||
cd ..
|
cd ..
|
||||||
else
|
else
|
||||||
msg "Cloning (%s) ..." "$tree"
|
clone_tree "${HOST_TREE_ARCH}" "${tree}"
|
||||||
clone_tree "${HOST_TREE_ARCH}/${tree}"
|
|
||||||
fi
|
fi
|
||||||
done
|
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(){
|
pull_tree_artix(){
|
||||||
cd ${TREE_DIR_ARTIX}
|
cd ${TREE_DIR_ARTIX}
|
||||||
for tree in ${tree_names[@]};do
|
for tree in ${tree_names[@]};do
|
||||||
if [[ -d ${tree} ]];then
|
if [[ -d ${tree} ]];then
|
||||||
config_tree "${tree}"
|
config_tree "${tree}"
|
||||||
cd ${tree}
|
cd ${tree}
|
||||||
msg "Checking (%s)" "${tree}"
|
pull_tree "${tree}"
|
||||||
pull_tree
|
|
||||||
cd ..
|
cd ..
|
||||||
else
|
else
|
||||||
msg "Cloning (%s) ..." "$tree"
|
clone_tree "${HOST_TREE_ARTIX}" "${tree}"
|
||||||
clone_tree "${HOST_TREE_ARTIX}/${tree}"
|
|
||||||
config_tree "${tree}"
|
config_tree "${tree}"
|
||||||
fi
|
fi
|
||||||
done
|
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(){
|
sync_pkg(){
|
||||||
local rsync_args=(-aWxvci --progress --delete-before --no-R --no-implied-dirs)
|
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)" "$tree"
|
|
||||||
rsync "${rsync_args[@]}" $src/ $dest/
|
rsync "${rsync_args[@]}" $src/ $dest/
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,41 +89,24 @@ from_arch(){
|
|||||||
|
|
||||||
src=$package/repos/$repo
|
src=$package/repos/$repo
|
||||||
|
|
||||||
local git_tree_artix=$(find_tree "${TREE_DIR_ARTIX}" "$pkg")
|
dest=${TREE_DIR_ARTIX}/$git_tree_arch/$pkg/trunk
|
||||||
dest=${TREE_DIR_ARTIX}/$git_tree_artix/$pkg/trunk
|
|
||||||
|
|
||||||
show_deps "$src" "$repo"
|
show_deps "$src" "$repo"
|
||||||
|
|
||||||
if [[ -d $dest ]];then
|
if [[ -d $dest ]];then
|
||||||
cd ${TREE_DIR_ARTIX}/$git_tree_artix
|
cd ${TREE_DIR_ARTIX}/$git_tree_arch
|
||||||
|
|
||||||
source $dest/PKGBUILD 2>/dev/null
|
source $dest/PKGBUILD 2>/dev/null
|
||||||
local artixver=$(get_full_version $pkg)
|
local artixver=$(get_full_version $pkg)
|
||||||
|
|
||||||
msg2 "Artix Version: %s" "$artixver"
|
msg2 "Artix Version: %s" "$artixver"
|
||||||
sync_pkg "$src" "$dest" "$git_tree_arch"
|
|
||||||
patch_pkg "$pkg"
|
|
||||||
else
|
else
|
||||||
git_tree_artix=$git_tree_arch
|
subrepo_new "$pkg" "$git_tree_arch"
|
||||||
|
|
||||||
dest=${TREE_DIR_ARTIX}/$git_tree_artix/$pkg/trunk
|
|
||||||
|
|
||||||
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"
|
|
||||||
|
|
||||||
prepare_dir "$dest"
|
|
||||||
|
|
||||||
sync_pkg "$src" "$dest" "$git_tree_artix"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
info "Sync from archlinux (%s)" "$git_tree_arch"
|
||||||
|
sync_pkg "$src" "$dest"
|
||||||
|
patch_pkg "$pkg"
|
||||||
}
|
}
|
||||||
|
|
||||||
view_build(){
|
view_build(){
|
||||||
@@ -209,7 +155,7 @@ usage() {
|
|||||||
echo " -s Clone or pull repos"
|
echo " -s Clone or pull repos"
|
||||||
echo " -z Don't clone or pull arch repos"
|
echo " -z Don't clone or pull arch repos"
|
||||||
echo ' -i Import a package from arch repos'
|
echo ' -i Import a package from arch repos'
|
||||||
echo ' -m Make new remote subrepo and clone it'
|
echo ' -n Make new remote subrepo and clone it'
|
||||||
echo ' -c Configure subrepo url'
|
echo ' -c Configure subrepo url'
|
||||||
echo ' -v View package depends'
|
echo ' -v View package depends'
|
||||||
echo ' -h This help'
|
echo ' -h This help'
|
||||||
@@ -249,6 +195,6 @@ ${view} && view_build "${PACKAGE}"
|
|||||||
|
|
||||||
${import} && from_arch "${PACKAGE}"
|
${import} && from_arch "${PACKAGE}"
|
||||||
|
|
||||||
${createnew} && mkrepo "${PACKAGE}" "${TEAM}"
|
${createnew} && subrepo_new "${PACKAGE}" "${TEAM}"
|
||||||
|
|
||||||
${conf} && subrepo_config "${PACKAGE}" "${SUBORG}"
|
${conf} && subrepo_config "${PACKAGE}" "${SUBORG}"
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ commit_pkg(){
|
|||||||
local ver=$(get_full_version "${PACKAGE}")
|
local ver=$(get_full_version "${PACKAGE}")
|
||||||
local commit_msg=""
|
local commit_msg=""
|
||||||
|
|
||||||
|
local head=$(get_local_head)
|
||||||
|
|
||||||
if ${remove};then
|
if ${remove};then
|
||||||
local action='remove'
|
local action='remove'
|
||||||
if [[ "${REPO_SRC}" == 'trunk' ]];then
|
if [[ "${REPO_SRC}" == 'trunk' ]];then
|
||||||
@@ -61,12 +63,12 @@ commit_pkg(){
|
|||||||
cd ${TREE_DIR_ARTIX}/${git_tree}
|
cd ${TREE_DIR_ARTIX}/${git_tree}
|
||||||
|
|
||||||
if ${push};then
|
if ${push};then
|
||||||
mainrepo_pull "${git_tree}"
|
pull_tree "${git_tree}" "$head"
|
||||||
|
|
||||||
subrepo_push "${PACKAGE}"
|
subrepo_push "${PACKAGE}"
|
||||||
subrepo_clean "${PACKAGE}"
|
subrepo_clean "${PACKAGE}"
|
||||||
# sleep 1
|
# sleep 1
|
||||||
mainrepo_push "${git_tree}"
|
push_tree "${git_tree}"
|
||||||
fi
|
fi
|
||||||
git prune
|
git prune
|
||||||
else
|
else
|
||||||
@@ -83,6 +85,8 @@ symlink_commit_pkg(){
|
|||||||
[[ $arch == 'any' ]] && CARCH=any
|
[[ $arch == 'any' ]] && CARCH=any
|
||||||
local ver=$(get_full_version "${PACKAGE}")
|
local ver=$(get_full_version "${PACKAGE}")
|
||||||
|
|
||||||
|
local head=$(get_local_head)
|
||||||
|
|
||||||
if [[ ${REPO_SRC} == 'trunk' ]];then
|
if [[ ${REPO_SRC} == 'trunk' ]];then
|
||||||
local action='add'
|
local action='add'
|
||||||
local dest="${REPO_DEST}-$CARCH"
|
local dest="${REPO_DEST}-$CARCH"
|
||||||
@@ -112,12 +116,12 @@ symlink_commit_pkg(){
|
|||||||
cd ${TREE_DIR_ARTIX}/${git_tree}
|
cd ${TREE_DIR_ARTIX}/${git_tree}
|
||||||
|
|
||||||
if ${push};then
|
if ${push};then
|
||||||
mainrepo_pull "${git_tree}"
|
pull_tree "${git_tree}" "$head"
|
||||||
|
|
||||||
subrepo_push "${PACKAGE}"
|
subrepo_push "${PACKAGE}"
|
||||||
subrepo_clean "${PACKAGE}"
|
subrepo_clean "${PACKAGE}"
|
||||||
# sleep 1
|
# sleep 1
|
||||||
mainrepo_push "${git_tree}"
|
push_tree "${git_tree}"
|
||||||
fi
|
fi
|
||||||
git prune
|
git prune
|
||||||
else
|
else
|
||||||
|
|||||||
121
bin/pkg2yaml.in
121
bin/pkg2yaml.in
@@ -11,7 +11,105 @@
|
|||||||
|
|
||||||
VERSION=@version@
|
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
|
if [[ -f "$1"/PKGBUILD ]]; then
|
||||||
LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
|
LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
|
||||||
@@ -24,21 +122,8 @@ if [[ -f "$1"/PKGBUILD ]]; then
|
|||||||
. "$1"/PKGBUILD
|
. "$1"/PKGBUILD
|
||||||
|
|
||||||
pkgfile=$(print_all_package_names)
|
pkgfile=$(print_all_package_names)
|
||||||
|
|
||||||
|
NL=$'\n'
|
||||||
|
Yaml="%YAML 1.2"$NL
|
||||||
|
write_yaml
|
||||||
fi
|
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}"
|
|
||||||
|
|||||||
@@ -9,6 +9,14 @@
|
|||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# 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(){
|
subrepo_push(){
|
||||||
local pkg="$1"
|
local pkg="$1"
|
||||||
msg2 "Update (%s)" "$pkg"
|
msg2 "Update (%s)" "$pkg"
|
||||||
@@ -41,16 +49,40 @@ subrepo_clone(){
|
|||||||
git subrepo clone gitea@"${GIT_DOMAIN}":"$org"/"$gitname".git "$pkg"
|
git subrepo clone gitea@"${GIT_DOMAIN}":"$org"/"$gitname".git "$pkg"
|
||||||
}
|
}
|
||||||
|
|
||||||
mainrepo_pull(){
|
clone_tree(){
|
||||||
local tree="$1"
|
local timer=$(get_timer) url="$1" tree="$2"
|
||||||
msg2 "Check (%s)" "${tree}"
|
|
||||||
git push origin master
|
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"
|
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
|
git push origin master
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,3 +120,35 @@ commit_jenkins_files(){
|
|||||||
|
|
||||||
git commit -m "add jenkinsfile & .artixlinux/agent.yaml"
|
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"
|
||||||
|
}
|
||||||
|
|||||||
@@ -9,14 +9,6 @@
|
|||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# 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(){
|
patch_pkg(){
|
||||||
local pkg="$1"
|
local pkg="$1"
|
||||||
case $pkg in
|
case $pkg in
|
||||||
@@ -103,24 +95,6 @@ get_import_path(){
|
|||||||
echo $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() {
|
pkgver_equal() {
|
||||||
if [[ $1 = *-* && $2 = *-* ]]; then
|
if [[ $1 = *-* && $2 = *-* ]]; then
|
||||||
# if both versions have a pkgrel, then they must be an exact match
|
# if both versions have a pkgrel, then they must be an exact match
|
||||||
|
|||||||
Reference in New Issue
Block a user