Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
ea66cb27fc |
110
bin/buildtree.in
110
bin/buildtree.in
@@ -23,7 +23,7 @@ import ${LIBDIR}/util-pkg-subrepo.sh
|
|||||||
|
|
||||||
pull_tree_arch(){
|
pull_tree_arch(){
|
||||||
cd ${TREE_DIR_ARCH}
|
cd ${TREE_DIR_ARCH}
|
||||||
for tree in packages community;do
|
for tree in ${TREE_NAMES_ARCH[@]};do
|
||||||
if [[ -d ${tree} ]];then
|
if [[ -d ${tree} ]];then
|
||||||
cd ${tree}
|
cd ${tree}
|
||||||
msg "Checking (%s)" "${tree}"
|
msg "Checking (%s)" "${tree}"
|
||||||
@@ -51,7 +51,7 @@ config_tree(){
|
|||||||
|
|
||||||
pull_tree_artix(){
|
pull_tree_artix(){
|
||||||
cd ${TREE_DIR_ARTIX}
|
cd ${TREE_DIR_ARTIX}
|
||||||
for tree in packages packages-galaxy;do
|
for tree in ${TREE_NAMES_ARTIX[@]};do
|
||||||
if [[ -d ${tree} ]];then
|
if [[ -d ${tree} ]];then
|
||||||
config_tree "${tree}"
|
config_tree "${tree}"
|
||||||
cd ${tree}
|
cd ${tree}
|
||||||
@@ -68,53 +68,69 @@ pull_tree_artix(){
|
|||||||
|
|
||||||
show_version_table(){
|
show_version_table(){
|
||||||
msg_table_header "%-20s %-20s %-25s %-30s %-30s" "Arch Repo" "Artix Repo" "Package" "Arch version" "Artix version"
|
msg_table_header "%-20s %-20s %-25s %-30s %-30s" "Arch Repo" "Artix Repo" "Package" "Arch version" "Artix version"
|
||||||
for tree in packages packages-galaxy;do
|
|
||||||
|
for tree in ${TREE_NAMES_ARTIX[@]};do
|
||||||
|
|
||||||
local git=$(find ${TREE_DIR_ARTIX}/$tree/ -mindepth 1 -maxdepth 1 -type d)
|
local git=$(find ${TREE_DIR_ARTIX}/$tree/ -mindepth 1 -maxdepth 1 -type d)
|
||||||
for pkg_path in ${git[@]}; do
|
|
||||||
local artixrepo=$(find_repo "$pkg_path" "${unstable}" "${staging}")
|
for package in ${git[@]}; do
|
||||||
if [[ -d $pkg_path/repos/$artixrepo ]];then
|
|
||||||
source $pkg_path/repos/$artixrepo/PKGBUILD 2>/dev/null
|
local pkg=${package##*/}
|
||||||
local pkg=${pkg_path##*/}
|
local artixrepo=$(find_repo "$package" "${unstable}" "${staging}")
|
||||||
|
local artixshow=${artixrepo%-*}
|
||||||
|
local pkgbuild=$package/repos/$artixrepo/PKGBUILD
|
||||||
|
|
||||||
|
if [[ -f $pkgbuild ]];then
|
||||||
|
|
||||||
|
source $pkgbuild 2>/dev/null
|
||||||
local artixver=$(get_full_version $pkg)
|
local artixver=$(get_full_version $pkg)
|
||||||
local src=$(get_import_path "$tree" "$pkg")
|
|
||||||
local archrepo=$(find_repo "$src/$pkg" "${unstable}" "${staging}")
|
local archpath=${TREE_DIR_ARCH}/$tree/$pkg
|
||||||
if [[ -d $src/$pkg/repos/$archrepo ]];then
|
local archrepo=$(find_repo "$archpath" "${unstable}" "${staging}")
|
||||||
source $src/$pkg/repos/$archrepo/PKGBUILD 2>/dev/null
|
local archshow=${archrepo%-*}
|
||||||
|
pkgbuild=$archpath/repos/$archrepo/PKGBUILD
|
||||||
|
|
||||||
|
if [[ -f $pkgbuild ]];then
|
||||||
|
source $pkgbuild 2>/dev/null
|
||||||
local archver=$(get_full_version $pkg)
|
local archver=$(get_full_version $pkg)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ${artix};then
|
if ${artix};then
|
||||||
|
|
||||||
if [ $(vercmp "$artixver" "$archver") -eq 0 ] || [ $(vercmp "$artixver" "$archver") -gt 0 ];then
|
if [ $(vercmp "$artixver" "$archver") -eq 0 ] || [ $(vercmp "$artixver" "$archver") -gt 0 ];then
|
||||||
local ar=$(find_artix_name "$artixrepo")
|
case $artixrepo in
|
||||||
case $ar in
|
*staging*)
|
||||||
*goblins)
|
|
||||||
if [[ "$archrepo" == "$artixrepo" ]];then
|
if [[ "$archrepo" == "$artixrepo" ]];then
|
||||||
msg_row "%-20s %-20s %-25s %-30s %-30s" "${archrepo%-*}" "${ar}" "$pkg" "$archver" "$artixver"
|
msg_row "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
|
||||||
else
|
else
|
||||||
msg_row_notify "%-20s %-20s %-25s %-30s %-30s" "${archrepo%-*}" "${ar}" "$pkg" "$archver" "$artixver"
|
msg_row_notify "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*gremlins)
|
*testing*)
|
||||||
if [[ "$archrepo" == "$artixrepo" ]];then
|
if [[ "$archrepo" == "$artixrepo" ]];then
|
||||||
msg_row "%-20s %-20s %-25s %-30s %-30s" "${archrepo%-*}" "${ar}" "$pkg" "$archver" "$artixver"
|
msg_row "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
|
||||||
else
|
else
|
||||||
msg_row_notify "%-20s %-20s %-25s %-30s %-30s" "${archrepo%-*}" "${ar}" "$pkg" "$archver" "$artixver"
|
msg_row_notify "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
if [ $(vercmp "$artixver" "$archver") -lt 0 ];then
|
if [ $(vercmp "$artixver" "$archver") -lt 0 ];then
|
||||||
local ar=$(find_artix_name "$artixrepo")
|
${upgrades} && msg_row_upgrade "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
|
||||||
${upgrades} && msg_row_upgrade "%-20s %-20s %-25s %-30s %-30s" "${archrepo%-*}" "${ar}" "$pkg" "$archver" "$artixver"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $(vercmp "$artixver" "$archver") -gt 0 ];then
|
if [ $(vercmp "$artixver" "$archver") -gt 0 ];then
|
||||||
local ar=$(find_artix_name "$artixrepo")
|
|
||||||
if [[ -n $archver ]] && [[ -n $archrepo ]];then
|
if [[ -n $archver ]] && [[ -n $archrepo ]];then
|
||||||
${downgrades} && msg_row_downgrade "%-20s %-20s %-25s %-30s %-30s" "${archrepo%-*}" "${ar}" "$pkg" "$archver" "$artixver"
|
${downgrades} && msg_row_downgrade "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
unset pkgver epoch pkgrel artixver archver
|
unset pkgver epoch pkgrel artixver archver
|
||||||
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
@@ -122,14 +138,19 @@ show_version_table(){
|
|||||||
|
|
||||||
show_deps(){
|
show_deps(){
|
||||||
local src="$1" repo="$2"
|
local src="$1" repo="$2"
|
||||||
|
|
||||||
source $src/PKGBUILD 2>/dev/null
|
source $src/PKGBUILD 2>/dev/null
|
||||||
|
|
||||||
[[ $arch == 'any' ]] && CARCH=any
|
[[ $arch == 'any' ]] && CARCH=any
|
||||||
|
|
||||||
local archver=$(get_full_version $pkg)
|
local archver=$(get_full_version $pkg)
|
||||||
|
|
||||||
msg "git tree: %s" "$git_tree_arch"
|
msg "git tree: %s" "$git_tree_arch"
|
||||||
msg2 "repo: %s" "$repo"
|
msg2 "repo: %s" "$repo"
|
||||||
msg2 "Package Name: %s" "$pkg"
|
msg2 "Package Name: %s" "$pkg"
|
||||||
msg2 "Arch Version: %s" "$archver"
|
msg2 "Arch Version: %s" "$archver"
|
||||||
msg2 "arch: %s" "$CARCH"
|
msg2 "arch: %s" "$CARCH"
|
||||||
|
|
||||||
[[ -n ${makedepends[@]} ]] && msg2 "makedepends: %s" "${makedepends[*]}"
|
[[ -n ${makedepends[@]} ]] && msg2 "makedepends: %s" "${makedepends[*]}"
|
||||||
[[ -n ${checkdepends[@]} ]] && msg2 "checkdepends: %s" "${checkdepends[*]}"
|
[[ -n ${checkdepends[@]} ]] && msg2 "checkdepends: %s" "${checkdepends[*]}"
|
||||||
[[ -n ${depends[@]} ]] && msg2 "depends: %s" "${depends[*]}"
|
[[ -n ${depends[@]} ]] && msg2 "depends: %s" "${depends[*]}"
|
||||||
@@ -141,18 +162,15 @@ from_arch(){
|
|||||||
local git_tree_arch=$(find_tree "${TREE_DIR_ARCH}" "$pkg")
|
local git_tree_arch=$(find_tree "${TREE_DIR_ARCH}" "$pkg")
|
||||||
[[ -z $git_tree_arch ]] && die "Package '%s' does not exist!" "$pkg"
|
[[ -z $git_tree_arch ]] && die "Package '%s' does not exist!" "$pkg"
|
||||||
|
|
||||||
local pkg_path=${TREE_DIR_ARCH}/$git_tree_arch/$pkg
|
local package=${TREE_DIR_ARCH}/$git_tree_arch/$pkg
|
||||||
local repo=$(find_repo "$pkg_path" "${unstable}")
|
local repo=$(find_repo "$package" "${unstable}")
|
||||||
|
|
||||||
src=$pkg_path/repos/$repo
|
src=$package/repos/$repo
|
||||||
$trunk && src=$pkg_path/trunk
|
|
||||||
|
|
||||||
local git_tree_artix=$(find_tree "${TREE_DIR_ARTIX}" "$pkg")
|
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_artix/$pkg/trunk
|
||||||
|
|
||||||
cd ${TREE_DIR_ARCH}/$git_tree_arch
|
show_deps "${TREE_DIR_ARCH}/$git_tree_arch/$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_artix
|
||||||
@@ -163,22 +181,30 @@ from_arch(){
|
|||||||
msg2 "Artix Version: %s" "$artixver"
|
msg2 "Artix Version: %s" "$artixver"
|
||||||
info "Update from archlinux (%s)" "$git_tree_arch"
|
info "Update from archlinux (%s)" "$git_tree_arch"
|
||||||
rsync "${rsync_args[@]}" $src/ $dest/
|
rsync "${rsync_args[@]}" $src/ $dest/
|
||||||
patch_pkg "$pkg" "$tree"
|
patch_pkg "$pkg"
|
||||||
else
|
else
|
||||||
[[ $git_tree_arch == 'packages' ]] && git_tree_artix=$git_tree_arch
|
[[ $git_tree_arch == 'packages' ]] && git_tree_artix=$git_tree_arch
|
||||||
[[ $git_tree_arch == 'community' ]] && git_tree_artix='packages-galaxy'
|
[[ $git_tree_arch == 'community' ]] && git_tree_artix=$git_tree_arch
|
||||||
|
|
||||||
cd ${TREE_DIR_ARTIX}/$git_tree_artix
|
cd ${TREE_DIR_ARTIX}/$git_tree_artix
|
||||||
|
|
||||||
dest=${TREE_DIR_ARTIX}/$git_tree_artix/$pkg/trunk
|
local org=$(get_pkg_org "$pkg")
|
||||||
|
|
||||||
create_repo "$pkg"
|
create_repo "$pkg" "$org"
|
||||||
add_repo_to_team "$pkg" "$pkg_path"
|
|
||||||
subrepo_clone "$pkg"
|
add_repo_to_team "$pkg" "$org" "$git_tree_artix"
|
||||||
|
|
||||||
|
subrepo_clone "$pkg" "$org"
|
||||||
|
|
||||||
|
cd ${TREE_DIR_ARTIX}/$git_tree_artix/$pkg
|
||||||
|
|
||||||
|
commit_jenkins_files
|
||||||
|
|
||||||
|
cd ${TREE_DIR_ARTIX}/$git_tree_artix
|
||||||
|
|
||||||
info "Import from archlinux (%s)" "$git_tree_arch"
|
info "Import from archlinux (%s)" "$git_tree_arch"
|
||||||
rsync "${rsync_args[@]}" $src/ $dest/
|
rsync "${rsync_args[@]}" $src/ $dest/
|
||||||
patch_pkg "$pkg" "$tree"
|
patch_pkg "$pkg"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,7 +244,6 @@ display_settings(){
|
|||||||
msg2 "unstable: %s" "${unstable}"
|
msg2 "unstable: %s" "${unstable}"
|
||||||
msg2 "import: %s" "${import}"
|
msg2 "import: %s" "${import}"
|
||||||
msg2 "view: %s" "${view}"
|
msg2 "view: %s" "${view}"
|
||||||
msg2 "trunk: %s" "${trunk}"
|
|
||||||
|
|
||||||
msg "PATHS:"
|
msg "PATHS:"
|
||||||
msg2 "TREE_DIR_ARTIX: %s" "${TREE_DIR_ARTIX}"
|
msg2 "TREE_DIR_ARTIX: %s" "${TREE_DIR_ARTIX}"
|
||||||
@@ -242,7 +267,7 @@ downgrades=false
|
|||||||
artix=false
|
artix=false
|
||||||
import=false
|
import=false
|
||||||
view=false
|
view=false
|
||||||
trunk=false
|
|
||||||
PACKAGE=''
|
PACKAGE=''
|
||||||
|
|
||||||
rsync_args=(-aWxvci --progress --delete-before --no-R --no-implied-dirs)
|
rsync_args=(-aWxvci --progress --delete-before --no-R --no-implied-dirs)
|
||||||
@@ -259,7 +284,7 @@ usage() {
|
|||||||
echo " -y Don't inlcude staging packages"
|
echo " -y Don't inlcude staging packages"
|
||||||
echo ' -x Include unstable kde and gnome'
|
echo ' -x Include unstable kde and gnome'
|
||||||
echo ' -i Import a package from arch repos'
|
echo ' -i Import a package from arch repos'
|
||||||
echo ' -t Import from arch trunk'
|
echo " -w Don't write Jenkinsfile and agent.yaml on import"
|
||||||
echo ' -v View package depends'
|
echo ' -v View package depends'
|
||||||
echo ' -q Query settings'
|
echo ' -q Query settings'
|
||||||
echo ' -h This help'
|
echo ' -h This help'
|
||||||
@@ -270,7 +295,7 @@ usage() {
|
|||||||
|
|
||||||
orig_argv=("$0" "$@")
|
orig_argv=("$0" "$@")
|
||||||
|
|
||||||
opts='p:csudayiztxvqh'
|
opts='p:csudayizxvqh'
|
||||||
|
|
||||||
while getopts "${opts}" arg; do
|
while getopts "${opts}" arg; do
|
||||||
case "${arg}" in
|
case "${arg}" in
|
||||||
@@ -283,7 +308,6 @@ while getopts "${opts}" arg; do
|
|||||||
a) artix=true ;;
|
a) artix=true ;;
|
||||||
y) staging=false ;;
|
y) staging=false ;;
|
||||||
i) import=true ;;
|
i) import=true ;;
|
||||||
t) trunk=true ;;
|
|
||||||
v) view=true ;;
|
v) view=true ;;
|
||||||
x) unstable=true ;;
|
x) unstable=true ;;
|
||||||
q) pretend=true ;;
|
q) pretend=true ;;
|
||||||
|
@@ -20,6 +20,14 @@ import ${LIBDIR}/util.sh
|
|||||||
import ${LIBDIR}/util-pkg.sh
|
import ${LIBDIR}/util-pkg.sh
|
||||||
import ${LIBDIR}/util-pkg-subrepo.sh
|
import ${LIBDIR}/util-pkg-subrepo.sh
|
||||||
|
|
||||||
|
is_valid_repo(){
|
||||||
|
local src="$1"
|
||||||
|
case $src in
|
||||||
|
core|extra|community|multilib|testing|staging|community-testing|community-staging|multilib-testing|multilib-staging|trunk) return 0 ;;
|
||||||
|
*) return 1 ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
commit_pkg(){
|
commit_pkg(){
|
||||||
local git_tree=$(find_tree "${TREE_DIR_ARTIX}" "${PACKAGE}")
|
local git_tree=$(find_tree "${TREE_DIR_ARTIX}" "${PACKAGE}")
|
||||||
if [[ -n ${git_tree} ]];then
|
if [[ -n ${git_tree} ]];then
|
||||||
@@ -53,10 +61,13 @@ commit_pkg(){
|
|||||||
cd ${TREE_DIR_ARTIX}/${git_tree}
|
cd ${TREE_DIR_ARTIX}/${git_tree}
|
||||||
|
|
||||||
if ${push};then
|
if ${push};then
|
||||||
msg "Checking (%s)" "${git_tree}"
|
msg2 "Check (%s)" "${git_tree}"
|
||||||
git pull origin master
|
git pull origin master
|
||||||
|
|
||||||
|
msg2 "Update (%s)" "${PACKAGE}"
|
||||||
subrepo_push "${PACKAGE}"
|
subrepo_push "${PACKAGE}"
|
||||||
sleep 1
|
# sleep 1
|
||||||
|
msg2 "Update (%s)" "${git_tree}"
|
||||||
git push origin master
|
git push origin master
|
||||||
fi
|
fi
|
||||||
git prune
|
git prune
|
||||||
@@ -103,10 +114,13 @@ symlink_commit_pkg(){
|
|||||||
cd ${TREE_DIR_ARTIX}/${git_tree}
|
cd ${TREE_DIR_ARTIX}/${git_tree}
|
||||||
|
|
||||||
if ${push};then
|
if ${push};then
|
||||||
msg "Checking (%s)" "${git_tree}"
|
msg2 "Check (%s)" "${git_tree}"
|
||||||
git pull origin master
|
git pull origin master
|
||||||
|
|
||||||
|
msg2 "Update (%s)" "${PACKAGE}"
|
||||||
subrepo_push "${PACKAGE}"
|
subrepo_push "${PACKAGE}"
|
||||||
sleep 1
|
# sleep 1
|
||||||
|
msg2 "Update (%s)" "${git_tree}"
|
||||||
git push origin master
|
git push origin master
|
||||||
fi
|
fi
|
||||||
git prune
|
git prune
|
||||||
|
@@ -31,7 +31,7 @@ update_repo(){
|
|||||||
if ${add_pkg};then
|
if ${add_pkg};then
|
||||||
local action='add'
|
local action='add'
|
||||||
packages+=("$pkg")
|
packages+=("$pkg")
|
||||||
# checkpkg $pkg
|
checkpkg "${pkgfile}"
|
||||||
if ${sign_pkg};then
|
if ${sign_pkg};then
|
||||||
[[ -e ${pkgfile}.sig ]] && rm ${pkgfile}.sig
|
[[ -e ${pkgfile}.sig ]] && rm ${pkgfile}.sig
|
||||||
signfile ${pkgfile}
|
signfile ${pkgfile}
|
||||||
|
@@ -16,6 +16,23 @@ LIBDIR='@libdir@'
|
|||||||
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
||||||
import ${LIBDIR}/util-pkg.sh
|
import ${LIBDIR}/util-pkg.sh
|
||||||
|
|
||||||
|
# $1: sofile
|
||||||
|
# $2: soarch
|
||||||
|
process_sofile() {
|
||||||
|
# extract the library name: libfoo.so
|
||||||
|
local soname="${1%.so?(+(.+([0-9])))}".so
|
||||||
|
# extract the major version: 1
|
||||||
|
soversion="${1##*\.so\.}"
|
||||||
|
if [[ "$soversion" = "$1" ]] && (($IGNORE_INTERNAL)); then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
if ! in_array "${soname}=${soversion}-$2" ${soobjects[@]}; then
|
||||||
|
# libfoo.so=1-64
|
||||||
|
msg "${soname}=${soversion}-$2"
|
||||||
|
soobjects+=("${soname}=${soversion}-$2")
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
shopt -s extglob
|
shopt -s extglob
|
||||||
|
|
||||||
|
@@ -9,51 +9,211 @@
|
|||||||
# 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_compliant_name(){
|
|
||||||
local gitname="$1"
|
|
||||||
case $gitname in
|
|
||||||
*+) gitname=${gitname//+/plus}
|
|
||||||
esac
|
|
||||||
echo $gitname
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
create_repo(){
|
create_repo(){
|
||||||
local pkg="$1"
|
local pkg="$1" org="$2"
|
||||||
local gitname=$(get_compliant_name "$pkg")
|
local gitname=$(get_compliant_name "$pkg")
|
||||||
curl -X POST "${GIT_URL}/api/v1/org/packages/repos?access_token=${GIT_TOKEN}" -H "accept: application/json" -H "content-type: application/json" -d "{ \"auto_init\": true, \"name\":\"$gitname\", \"readme\": \"Default\" }"
|
local json="{ \"auto_init\": true, \"name\":\"$gitname\", \"gitignores\":\"ArchLinuxPackages\", \"readme\": \"Default\" }"
|
||||||
|
|
||||||
|
msg2 "Create package repo [%s] in org (%s)" "${pkg}" "${org}"
|
||||||
|
|
||||||
|
curl -X POST "${GIT_URL}/api/v1/org/$org/repos?access_token=${GIT_TOKEN}" \
|
||||||
|
-H "accept: application/json" \
|
||||||
|
-H "content-type: application/json" \
|
||||||
|
-d "$json"
|
||||||
}
|
}
|
||||||
|
|
||||||
delete_repo(){
|
delete_repo(){
|
||||||
local pkg="$1"
|
local pkg="$1" org="$2"
|
||||||
local gitname=$(get_compliant_name "$pkg")
|
local gitname=$(get_compliant_name "$pkg")
|
||||||
curl -X DELETE "${GIT_URL}/api/v1/repos/packages/$gitname?access_token=${GIT_TOKEN}" -H "accept: application/json"
|
|
||||||
|
msg2 "Delete package repo [%s] in org (%s)" "${pkg}" "${org}"
|
||||||
|
|
||||||
|
curl -X DELETE "${GIT_URL}/api/v1/repos/$org/$gitname?access_token=${GIT_TOKEN}" \
|
||||||
|
-H "accept: application/json"
|
||||||
}
|
}
|
||||||
|
|
||||||
find_team(){
|
load_team_id(){
|
||||||
local pkg="$1" team_id=
|
local org="$1" tree="$2" id=0
|
||||||
|
|
||||||
if [[ -f $pkg/repos/core-x86_64/PKGBUILD ]];then
|
case $org in
|
||||||
team_id=18
|
packagesA)
|
||||||
elif [[ -f $pkg/repos/core-any/PKGBUILD ]];then
|
case $tree in
|
||||||
team_id=18
|
packages) id=70 ;;
|
||||||
elif [[ -f $pkg/repos/extra-x86_64/PKGBUILD ]];then
|
community) id=71 ;;
|
||||||
team_id=19
|
esac
|
||||||
elif [[ -f $pkg/repos/extra-any/PKGBUILD ]];then
|
;;
|
||||||
team_id=19
|
packagesB)
|
||||||
elif [[ -f $pkg/repos/community-x86_64/PKGBUILD ]];then
|
case $tree in
|
||||||
team_id=20
|
packages) id=72 ;;
|
||||||
elif [[ -f $pkg/repos/community-any/PKGBUILD ]];then
|
community) id=73 ;;
|
||||||
team_id=20
|
esac
|
||||||
elif [[ -f $pkg/repos/multilib-x86_64/PKGBUILD ]];then
|
;;
|
||||||
team_id=21
|
packagesC)
|
||||||
fi
|
case $tree in
|
||||||
echo $team_id
|
packages) id=74 ;;
|
||||||
|
community) id=75 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
packagesD)
|
||||||
|
case $tree in
|
||||||
|
packages) id=76 ;;
|
||||||
|
community) id=77 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
packagesE)
|
||||||
|
case $tree in
|
||||||
|
packages) id=78 ;;
|
||||||
|
community) id=79 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
packagesF)
|
||||||
|
case $tree in
|
||||||
|
packages) id=80 ;;
|
||||||
|
community) id=81 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
packagesG)
|
||||||
|
case $tree in
|
||||||
|
packages) id=82 ;;
|
||||||
|
community) id=83 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
packagesH)
|
||||||
|
case $tree in
|
||||||
|
packages) id=84 ;;
|
||||||
|
community) id=85 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
packagesI)
|
||||||
|
case $tree in
|
||||||
|
packages) id=86 ;;
|
||||||
|
community) id=87 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
packagesJ)
|
||||||
|
case $tree in
|
||||||
|
packages) id=88 ;;
|
||||||
|
community) id=89 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
packagesK)
|
||||||
|
case $tree in
|
||||||
|
packages) id=90 ;;
|
||||||
|
community) id=91 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
packagesL)
|
||||||
|
case $tree in
|
||||||
|
packages) id=92 ;;
|
||||||
|
community) id=93 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
packagesM)
|
||||||
|
case $tree in
|
||||||
|
packages) id=94 ;;
|
||||||
|
community) id=95 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
packagesN)
|
||||||
|
case $tree in
|
||||||
|
packages) id=96 ;;
|
||||||
|
community) id=97 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
packagesO)
|
||||||
|
case $tree in
|
||||||
|
packages) id=98 ;;
|
||||||
|
community) id=99 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
packagesP)
|
||||||
|
case $tree in
|
||||||
|
packages) id=100 ;;
|
||||||
|
community) id=101 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
packagesQ)
|
||||||
|
case $tree in
|
||||||
|
packages) id=105 ;;
|
||||||
|
community) id=106 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
packagesR)
|
||||||
|
case $tree in
|
||||||
|
packages) id=107 ;;
|
||||||
|
community) id=108 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
packagesS)
|
||||||
|
case $tree in
|
||||||
|
packages) id=109 ;;
|
||||||
|
community) id=110 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
packagesT)
|
||||||
|
case $tree in
|
||||||
|
packages) id=111 ;;
|
||||||
|
community) id=112 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
packagesU)
|
||||||
|
case $tree in
|
||||||
|
packages) id=113 ;;
|
||||||
|
community) id=114 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
packagesV)
|
||||||
|
case $tree in
|
||||||
|
packages) id=115 ;;
|
||||||
|
community) id=116 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
packagesW)
|
||||||
|
case $tree in
|
||||||
|
packages) id=117 ;;
|
||||||
|
community) id=118 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
packagesX)
|
||||||
|
case $tree in
|
||||||
|
packages) id=119 ;;
|
||||||
|
community) id=120 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
packagesY)
|
||||||
|
case $tree in
|
||||||
|
packages) id=121 ;;
|
||||||
|
community) id=122 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
packagesZ)
|
||||||
|
case $tree in
|
||||||
|
packages) id=123 ;;
|
||||||
|
community) id=124 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
packagesPython)
|
||||||
|
case $tree in
|
||||||
|
packages) id=103 ;;
|
||||||
|
community) id=104 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
packagesPerl)
|
||||||
|
case $tree in
|
||||||
|
packages) id=102 ;;
|
||||||
|
community) id=125 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
echo $id
|
||||||
}
|
}
|
||||||
|
|
||||||
add_repo_to_team(){
|
add_repo_to_team(){
|
||||||
local pkg="$1" path="$2"
|
local pkg="$1" org="$2" tree="$3"
|
||||||
local id=$(find_team "$path")
|
local id=$(load_team_id "$org" "$tree")
|
||||||
|
|
||||||
curl -X PUT "${GIT_URL}/api/v1/teams/$id/repos/packages/$pkg?access_token=${GIT_TOKEN}" -H "accept: application/json"
|
msg2 "Adding package repo [%s] to team (%s)" "$pkg" "$tree"
|
||||||
|
|
||||||
|
curl -X PUT "${GIT_URL}/api/v1/teams/$id/repos/$org/$pkg?access_token=${GIT_TOKEN}" \
|
||||||
|
-H "accept: application/json"
|
||||||
}
|
}
|
||||||
|
@@ -9,22 +9,44 @@
|
|||||||
# 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.
|
||||||
|
|
||||||
subrepo_init(){
|
|
||||||
local pkg="$1" branch=master org=packages
|
|
||||||
git subrepo init "$pkg" -r gitea@"${GIT_DOMAIN}":"$org"/"$pkg".git -b "$branch"
|
|
||||||
}
|
|
||||||
|
|
||||||
subrepo_push(){
|
subrepo_push(){
|
||||||
local pkg="$1" branch=master
|
local pkg="$1"
|
||||||
git subrepo push "$pkg" -u -b "$branch" --clean
|
git subrepo push "$pkg" --clean
|
||||||
}
|
}
|
||||||
|
|
||||||
subrepo_pull(){
|
subrepo_pull(){
|
||||||
local pkg="$1" name="${2:-$1}" branch=master org=packages
|
local pkg="$1"
|
||||||
git subrepo pull "$pkg" -r gitea@"${GIT_DOMAIN}":"$org"/"$name".git -u -b "$branch" #--clean
|
git subrepo pull "$pkg"
|
||||||
}
|
}
|
||||||
|
|
||||||
subrepo_clone(){
|
subrepo_clone(){
|
||||||
local pkg="$1" name="${2:-$1}" branch=master org=packages
|
local pkg="$1" org="$2"
|
||||||
git subrepo clone gitea@"${GIT_DOMAIN}":"$org"/"$name".git "$pkg" -b "$branch"
|
local gitname=$(get_compliant_name "$pkg")
|
||||||
|
git subrepo clone gitea@"${GIT_DOMAIN}":"$org"/"$gitname".git "$pkg"
|
||||||
|
}
|
||||||
|
|
||||||
|
write_jenkinsfile(){
|
||||||
|
local jenkins=Jenkinsfile
|
||||||
|
echo '@Library(["PackagePipeline", "RepoPackage"]) import org.artixlinux.RepoPackage' > $jenkins
|
||||||
|
echo '' >> $jenkins
|
||||||
|
echo 'PackagePipeline(new RepoPackage(this))' >> $jenkins
|
||||||
|
echo '' >> $jenkins
|
||||||
|
}
|
||||||
|
|
||||||
|
write_agentyaml(){
|
||||||
|
local agent=.artixlinux/agent.yaml label='master'
|
||||||
|
[[ -d .artixlinux ]] || mkdir .artixlinux
|
||||||
|
echo '%YAML 1.2' > $agent
|
||||||
|
echo '---' >> $agent
|
||||||
|
echo '' >> $agent
|
||||||
|
echo "label: $label" >> $agent
|
||||||
|
echo '' >> $agent
|
||||||
|
}
|
||||||
|
|
||||||
|
commit_jenkins_files(){
|
||||||
|
write_jenkinsfile
|
||||||
|
write_agentyaml
|
||||||
|
git add Jenkinsfile
|
||||||
|
git add .artixlinux
|
||||||
|
git commit -m "add jenkinsfile & .artixlinux/agent.yaml"
|
||||||
}
|
}
|
||||||
|
125
lib/util-pkg.sh
125
lib/util-pkg.sh
@@ -17,18 +17,8 @@ get_remote_head(){
|
|||||||
echo $(git ls-remote origin -h refs/heads/$1 | cut -f1)
|
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
|
|
||||||
}
|
|
||||||
|
|
||||||
is_untracked(){
|
|
||||||
[[ $(git ls-files --others --exclude-standard) != "" ]] || return 1
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
patch_pkg(){
|
patch_pkg(){
|
||||||
local pkg="$1" repo="$2"
|
local pkg="$1"
|
||||||
case $pkg in
|
case $pkg in
|
||||||
'glibc')
|
'glibc')
|
||||||
sed -e 's|{locale,systemd/system,tmpfiles.d}|{locale,tmpfiles.d}|' \
|
sed -e 's|{locale,systemd/system,tmpfiles.d}|{locale,tmpfiles.d}|' \
|
||||||
@@ -76,12 +66,12 @@ patch_pkg(){
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
write_jenkinsfile(){
|
get_compliant_name(){
|
||||||
local pkg="$1" jenkins=Jenkinsfile
|
local gitname="$1"
|
||||||
echo '@Library(["PackagePipeline", "BuildPkg", "DeployPkg", "Notify", "PostBuild", "RepoPackage"]) import org.artixlinux.RepoPackage' > $pkg/$jenkins
|
case $gitname in
|
||||||
echo '' >> $pkg/$jenkins
|
*+) gitname=${gitname//+/plus}
|
||||||
echo 'PackagePipeline(new RepoPackage(this))' >> $pkg/$jenkins
|
esac
|
||||||
echo '' >> $pkg/$jenkins
|
echo $gitname
|
||||||
}
|
}
|
||||||
|
|
||||||
find_tree(){
|
find_tree(){
|
||||||
@@ -91,6 +81,20 @@ find_tree(){
|
|||||||
echo ${result##*/}
|
echo ${result##*/}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
find_repo(){
|
||||||
|
local pkg="$1" unst="$2" stag="$3" repo=
|
||||||
|
local repos=(core extra testing community community-testing mulitilib multilib-testing)
|
||||||
|
|
||||||
|
$stag && repos+=(staging community-staging mulitilib-staging)
|
||||||
|
$unst && repos+=(gnome-unstable kde-unstable)
|
||||||
|
|
||||||
|
for r in ${repos[@]};do
|
||||||
|
[[ -f $pkg/repos/$r-x86_64/PKGBUILD ]] && repo=$r-x86_64
|
||||||
|
[[ -f $pkg/repos/$r-any/PKGBUILD ]] && repo=$r-any
|
||||||
|
done
|
||||||
|
echo $repo
|
||||||
|
}
|
||||||
|
|
||||||
clone_tree(){
|
clone_tree(){
|
||||||
local timer=$(get_timer) host_tree="$1"
|
local timer=$(get_timer) host_tree="$1"
|
||||||
git clone $host_tree.git
|
git clone $host_tree.git
|
||||||
@@ -109,85 +113,16 @@ pull_tree(){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
push_tree(){
|
get_pkg_org(){
|
||||||
local branch="master"
|
local pkg="$1" org= sub=
|
||||||
git push origin "$branch"
|
case ${pkg} in
|
||||||
}
|
perl-*) org=${pkg:0:6}; sub="${org:5}"; echo "packagesPerl" ;;
|
||||||
|
python-*) org=${pkg:0:8}; sub="${org:7}"; echo "packagesPython" ;;
|
||||||
get_import_path(){
|
python2-*) org=${pkg:0:9}; sub="${org:8}"; echo "packagesPython" ;;
|
||||||
local tree="$1" import_path=
|
lib32*) org=${pkg:0:7}; sub="${org:6}"; echo "packagesL" ;; #"packages${sub^^}" ;;
|
||||||
case $tree in
|
# lib*) org=${pkg:0:4}; sub="${org:3}"; echo "packagesLib${sub^^}" ;;
|
||||||
packages) import_path=${TREE_DIR_ARCH}/packages ;;
|
*) org=${pkg:0:1}; echo "packages${org^^}" ;;
|
||||||
packages-galaxy) import_path=${TREE_DIR_ARCH}/community ;;
|
|
||||||
esac
|
esac
|
||||||
echo $import_path
|
|
||||||
}
|
|
||||||
|
|
||||||
is_valid_repo(){
|
|
||||||
local src="$1"
|
|
||||||
case $src in
|
|
||||||
core|extra|community|multilib|testing|staging|community-testing|community-staging|multilib-testing|multilib-staging|trunk) return 0 ;;
|
|
||||||
*) return 1 ;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
find_repo(){
|
|
||||||
local pkg="$1" unst="$2" stag="$3" repo=
|
|
||||||
local repos=(core extra testing community community-testing mulitilib multilib-testing)
|
|
||||||
|
|
||||||
$stag && repos+=(staging community-staging mulitilib-staging)
|
|
||||||
$unst && repos+=(gnome-unstable kde-unstable)
|
|
||||||
|
|
||||||
for r in ${repos[@]};do
|
|
||||||
[[ -f $pkg/repos/$r-x86_64/PKGBUILD ]] && repo=$r-x86_64
|
|
||||||
[[ -f $pkg/repos/$r-any/PKGBUILD ]] && repo=$r-any
|
|
||||||
done
|
|
||||||
echo $repo
|
|
||||||
}
|
|
||||||
|
|
||||||
find_artix_name(){
|
|
||||||
local repo="$1"
|
|
||||||
case $repo in
|
|
||||||
core-*) repo=system ;;
|
|
||||||
extra-*) repo=world ;;
|
|
||||||
community-x86_64|community-any) repo=galaxy ;;
|
|
||||||
multilib-x86_64) repo=lib32 ;;
|
|
||||||
testing-*) repo=gremlins ;;
|
|
||||||
staging-*) repo=goblins ;;
|
|
||||||
multilib-testing-x86_64) repo=lib32-gremlins ;;
|
|
||||||
multilib-staging-x86_64) repo=lib32-goblins ;;
|
|
||||||
community-testing-*) repo=galaxy-gremlins ;;
|
|
||||||
community-staging-*) repo=galaxy-goblins ;;
|
|
||||||
kde-unstable-*|gnome-unstable-*) repo=goblins ;;
|
|
||||||
esac
|
|
||||||
echo $repo
|
|
||||||
}
|
|
||||||
|
|
||||||
# $1: sofile
|
|
||||||
# $2: soarch
|
|
||||||
process_sofile() {
|
|
||||||
# extract the library name: libfoo.so
|
|
||||||
local soname="${1%.so?(+(.+([0-9])))}".so
|
|
||||||
# extract the major version: 1
|
|
||||||
soversion="${1##*\.so\.}"
|
|
||||||
if [[ "$soversion" = "$1" ]] && (($IGNORE_INTERNAL)); then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
if ! in_array "${soname}=${soversion}-$2" ${soobjects[@]}; then
|
|
||||||
# libfoo.so=1-64
|
|
||||||
msg "${soname}=${soversion}-$2"
|
|
||||||
soobjects+=("${soname}=${soversion}-$2")
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
pkgver_equal() {
|
|
||||||
if [[ $1 = *-* && $2 = *-* ]]; then
|
|
||||||
# if both versions have a pkgrel, then they must be an exact match
|
|
||||||
[[ $1 = "$2" ]]
|
|
||||||
else
|
|
||||||
# otherwise, trim any pkgrel and compare the bare version.
|
|
||||||
[[ ${1%%-*} = "${2%%-*}" ]]
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
find_cached_package() {
|
find_cached_package() {
|
||||||
|
@@ -68,9 +68,13 @@ init_artools_pkg(){
|
|||||||
|
|
||||||
[[ -z ${GIT_TOKEN} ]] && GIT_TOKEN=''
|
[[ -z ${GIT_TOKEN} ]] && GIT_TOKEN=''
|
||||||
|
|
||||||
[[ -z ${TREE_DIR_ARTIX} ]] && TREE_DIR_ARTIX="${WORKSPACE_DIR}/artix"
|
TREE_NAMES_ARTIX=(packages community)
|
||||||
|
|
||||||
[[ -z ${HOST_TREE_ARTIX} ]] && HOST_TREE_ARTIX="gitea@${GIT_DOMAIN}:artix"
|
[[ -z ${TREE_DIR_ARTIX} ]] && TREE_DIR_ARTIX="${WORKSPACE_DIR}/artixlinux"
|
||||||
|
|
||||||
|
[[ -z ${HOST_TREE_ARTIX} ]] && HOST_TREE_ARTIX="gitea@${GIT_DOMAIN}:artixlinux"
|
||||||
|
|
||||||
|
TREE_NAMES_ARCH=(packages community)
|
||||||
|
|
||||||
[[ -z ${TREE_DIR_ARCH} ]] && TREE_DIR_ARCH="${WORKSPACE_DIR}/archlinux"
|
[[ -z ${TREE_DIR_ARCH} ]] && TREE_DIR_ARCH="${WORKSPACE_DIR}/archlinux"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user