forked from artix/artools
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
ea66cb27fc | |||
3e7c4e371c | |||
8dbd07ff55 | |||
d88ede3984 | |||
04a1da9dd9 |
110
bin/buildtree.in
110
bin/buildtree.in
@@ -23,7 +23,7 @@ import ${LIBDIR}/util-pkg-subrepo.sh
|
||||
|
||||
pull_tree_arch(){
|
||||
cd ${TREE_DIR_ARCH}
|
||||
for tree in packages community;do
|
||||
for tree in ${TREE_NAMES_ARCH[@]};do
|
||||
if [[ -d ${tree} ]];then
|
||||
cd ${tree}
|
||||
msg "Checking (%s)" "${tree}"
|
||||
@@ -51,7 +51,7 @@ config_tree(){
|
||||
|
||||
pull_tree_artix(){
|
||||
cd ${TREE_DIR_ARTIX}
|
||||
for tree in packages packages-galaxy;do
|
||||
for tree in ${TREE_NAMES_ARTIX[@]};do
|
||||
if [[ -d ${tree} ]];then
|
||||
config_tree "${tree}"
|
||||
cd ${tree}
|
||||
@@ -68,53 +68,69 @@ pull_tree_artix(){
|
||||
|
||||
show_version_table(){
|
||||
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)
|
||||
for pkg_path in ${git[@]}; do
|
||||
local artixrepo=$(find_repo "$pkg_path" "${unstable}" "${staging}")
|
||||
if [[ -d $pkg_path/repos/$artixrepo ]];then
|
||||
source $pkg_path/repos/$artixrepo/PKGBUILD 2>/dev/null
|
||||
local pkg=${pkg_path##*/}
|
||||
|
||||
for package in ${git[@]}; do
|
||||
|
||||
local pkg=${package##*/}
|
||||
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 src=$(get_import_path "$tree" "$pkg")
|
||||
local archrepo=$(find_repo "$src/$pkg" "${unstable}" "${staging}")
|
||||
if [[ -d $src/$pkg/repos/$archrepo ]];then
|
||||
source $src/$pkg/repos/$archrepo/PKGBUILD 2>/dev/null
|
||||
|
||||
local archpath=${TREE_DIR_ARCH}/$tree/$pkg
|
||||
local archrepo=$(find_repo "$archpath" "${unstable}" "${staging}")
|
||||
local archshow=${archrepo%-*}
|
||||
pkgbuild=$archpath/repos/$archrepo/PKGBUILD
|
||||
|
||||
if [[ -f $pkgbuild ]];then
|
||||
source $pkgbuild 2>/dev/null
|
||||
local archver=$(get_full_version $pkg)
|
||||
fi
|
||||
|
||||
if ${artix};then
|
||||
|
||||
if [ $(vercmp "$artixver" "$archver") -eq 0 ] || [ $(vercmp "$artixver" "$archver") -gt 0 ];then
|
||||
local ar=$(find_artix_name "$artixrepo")
|
||||
case $ar in
|
||||
*goblins)
|
||||
case $artixrepo in
|
||||
*staging*)
|
||||
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
|
||||
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
|
||||
;;
|
||||
*gremlins)
|
||||
*testing*)
|
||||
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
|
||||
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
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
else
|
||||
|
||||
if [ $(vercmp "$artixver" "$archver") -lt 0 ];then
|
||||
local ar=$(find_artix_name "$artixrepo")
|
||||
${upgrades} && msg_row_upgrade "%-20s %-20s %-25s %-30s %-30s" "${archrepo%-*}" "${ar}" "$pkg" "$archver" "$artixver"
|
||||
${upgrades} && msg_row_upgrade "%-20s %-20s %-25s %-30s %-30s" "$archshow" "$artixshow" "$pkg" "$archver" "$artixver"
|
||||
fi
|
||||
|
||||
if [ $(vercmp "$artixver" "$archver") -gt 0 ];then
|
||||
local ar=$(find_artix_name "$artixrepo")
|
||||
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
|
||||
unset pkgver epoch pkgrel artixver archver
|
||||
|
||||
fi
|
||||
done
|
||||
done
|
||||
@@ -122,14 +138,19 @@ show_version_table(){
|
||||
|
||||
show_deps(){
|
||||
local src="$1" repo="$2"
|
||||
|
||||
source $src/PKGBUILD 2>/dev/null
|
||||
|
||||
[[ $arch == 'any' ]] && CARCH=any
|
||||
|
||||
local archver=$(get_full_version $pkg)
|
||||
|
||||
msg "git tree: %s" "$git_tree_arch"
|
||||
msg2 "repo: %s" "$repo"
|
||||
msg2 "Package Name: %s" "$pkg"
|
||||
msg2 "Arch Version: %s" "$archver"
|
||||
msg2 "arch: %s" "$CARCH"
|
||||
|
||||
[[ -n ${makedepends[@]} ]] && msg2 "makedepends: %s" "${makedepends[*]}"
|
||||
[[ -n ${checkdepends[@]} ]] && msg2 "checkdepends: %s" "${checkdepends[*]}"
|
||||
[[ -n ${depends[@]} ]] && msg2 "depends: %s" "${depends[*]}"
|
||||
@@ -141,18 +162,15 @@ from_arch(){
|
||||
local git_tree_arch=$(find_tree "${TREE_DIR_ARCH}" "$pkg")
|
||||
[[ -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 package=${TREE_DIR_ARCH}/$git_tree_arch/$pkg
|
||||
local repo=$(find_repo "$package" "${unstable}")
|
||||
|
||||
src=$pkg_path/repos/$repo
|
||||
$trunk && src=$pkg_path/trunk
|
||||
src=$package/repos/$repo
|
||||
|
||||
local git_tree_artix=$(find_tree "${TREE_DIR_ARTIX}" "$pkg")
|
||||
dest=${TREE_DIR_ARTIX}/$git_tree_artix/$pkg/trunk
|
||||
|
||||
cd ${TREE_DIR_ARCH}/$git_tree_arch
|
||||
|
||||
show_deps "$src" "$repo"
|
||||
show_deps "${TREE_DIR_ARCH}/$git_tree_arch/$src" "$repo"
|
||||
|
||||
if [[ -d $dest ]];then
|
||||
cd ${TREE_DIR_ARTIX}/$git_tree_artix
|
||||
@@ -163,22 +181,30 @@ from_arch(){
|
||||
msg2 "Artix Version: %s" "$artixver"
|
||||
info "Update from archlinux (%s)" "$git_tree_arch"
|
||||
rsync "${rsync_args[@]}" $src/ $dest/
|
||||
patch_pkg "$pkg" "$tree"
|
||||
patch_pkg "$pkg"
|
||||
else
|
||||
[[ $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
|
||||
|
||||
dest=${TREE_DIR_ARTIX}/$git_tree_artix/$pkg/trunk
|
||||
local org=$(get_pkg_org "$pkg")
|
||||
|
||||
create_repo "$pkg"
|
||||
add_repo_to_team "$pkg" "$pkg_path"
|
||||
subrepo_clone "$pkg"
|
||||
create_repo "$pkg" "$org"
|
||||
|
||||
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"
|
||||
rsync "${rsync_args[@]}" $src/ $dest/
|
||||
patch_pkg "$pkg" "$tree"
|
||||
patch_pkg "$pkg"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -218,7 +244,6 @@ display_settings(){
|
||||
msg2 "unstable: %s" "${unstable}"
|
||||
msg2 "import: %s" "${import}"
|
||||
msg2 "view: %s" "${view}"
|
||||
msg2 "trunk: %s" "${trunk}"
|
||||
|
||||
msg "PATHS:"
|
||||
msg2 "TREE_DIR_ARTIX: %s" "${TREE_DIR_ARTIX}"
|
||||
@@ -242,7 +267,7 @@ downgrades=false
|
||||
artix=false
|
||||
import=false
|
||||
view=false
|
||||
trunk=false
|
||||
|
||||
PACKAGE=''
|
||||
|
||||
rsync_args=(-aWxvci --progress --delete-before --no-R --no-implied-dirs)
|
||||
@@ -259,7 +284,7 @@ usage() {
|
||||
echo " -y Don't inlcude staging packages"
|
||||
echo ' -x Include unstable kde and gnome'
|
||||
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 ' -q Query settings'
|
||||
echo ' -h This help'
|
||||
@@ -270,7 +295,7 @@ usage() {
|
||||
|
||||
orig_argv=("$0" "$@")
|
||||
|
||||
opts='p:csudayiztxvqh'
|
||||
opts='p:csudayizxvqh'
|
||||
|
||||
while getopts "${opts}" arg; do
|
||||
case "${arg}" in
|
||||
@@ -283,7 +308,6 @@ while getopts "${opts}" arg; do
|
||||
a) artix=true ;;
|
||||
y) staging=false ;;
|
||||
i) import=true ;;
|
||||
t) trunk=true ;;
|
||||
v) view=true ;;
|
||||
x) unstable=true ;;
|
||||
q) pretend=true ;;
|
||||
|
@@ -20,6 +20,14 @@ import ${LIBDIR}/util.sh
|
||||
import ${LIBDIR}/util-pkg.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(){
|
||||
local git_tree=$(find_tree "${TREE_DIR_ARTIX}" "${PACKAGE}")
|
||||
if [[ -n ${git_tree} ]];then
|
||||
@@ -53,10 +61,13 @@ commit_pkg(){
|
||||
cd ${TREE_DIR_ARTIX}/${git_tree}
|
||||
|
||||
if ${push};then
|
||||
msg "Checking (%s)" "${git_tree}"
|
||||
msg2 "Check (%s)" "${git_tree}"
|
||||
git pull origin master
|
||||
|
||||
msg2 "Update (%s)" "${PACKAGE}"
|
||||
subrepo_push "${PACKAGE}"
|
||||
sleep 1
|
||||
# sleep 1
|
||||
msg2 "Update (%s)" "${git_tree}"
|
||||
git push origin master
|
||||
fi
|
||||
git prune
|
||||
@@ -103,10 +114,13 @@ symlink_commit_pkg(){
|
||||
cd ${TREE_DIR_ARTIX}/${git_tree}
|
||||
|
||||
if ${push};then
|
||||
msg "Checking (%s)" "${git_tree}"
|
||||
msg2 "Check (%s)" "${git_tree}"
|
||||
git pull origin master
|
||||
|
||||
msg2 "Update (%s)" "${PACKAGE}"
|
||||
subrepo_push "${PACKAGE}"
|
||||
sleep 1
|
||||
# sleep 1
|
||||
msg2 "Update (%s)" "${git_tree}"
|
||||
git push origin master
|
||||
fi
|
||||
git prune
|
||||
|
@@ -18,8 +18,7 @@ SYSCONFDIR='@sysconfdir@'
|
||||
import ${LIBDIR}/util.sh
|
||||
|
||||
connect(){
|
||||
local home="/home/frs/project/${project}"
|
||||
echo "${ACCOUNT},${project}@frs.${file_host}:${home}"
|
||||
echo "${ACCOUNT}@${FILE_HOST}:${FILE_HOME}"
|
||||
}
|
||||
|
||||
prepare_transfer(){
|
||||
@@ -58,14 +57,11 @@ load_user_info
|
||||
|
||||
load_config "${AT_USERCONFDIR}/artools.conf" || load_config "${SYSCONFDIR}/artools.conf"
|
||||
|
||||
project='artix-linux'
|
||||
file_host='sourceforge.net'
|
||||
|
||||
pretend=false
|
||||
update=false
|
||||
verbose=false
|
||||
|
||||
rsync_args=(-aP --progress -e ssh)
|
||||
rsync_args=(-aP --progress -e "ssh -p ${FILE_PORT}")
|
||||
|
||||
usage() {
|
||||
echo "Usage: ${0##*/} [options]"
|
||||
|
@@ -31,7 +31,7 @@ update_repo(){
|
||||
if ${add_pkg};then
|
||||
local action='add'
|
||||
packages+=("$pkg")
|
||||
# checkpkg $pkg
|
||||
checkpkg "${pkgfile}"
|
||||
if ${sign_pkg};then
|
||||
[[ -e ${pkgfile}.sig ]] && rm ${pkgfile}.sig
|
||||
signfile ${pkgfile}
|
||||
|
@@ -16,6 +16,23 @@ LIBDIR='@libdir@'
|
||||
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.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
|
||||
shopt -s extglob
|
||||
|
||||
|
@@ -9,51 +9,211 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
get_compliant_name(){
|
||||
local gitname="$1"
|
||||
case $gitname in
|
||||
*+) gitname=${gitname//+/plus}
|
||||
esac
|
||||
echo $gitname
|
||||
}
|
||||
|
||||
|
||||
create_repo(){
|
||||
local pkg="$1"
|
||||
local pkg="$1" org="$2"
|
||||
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(){
|
||||
local pkg="$1"
|
||||
local pkg="$1" org="$2"
|
||||
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(){
|
||||
local pkg="$1" team_id=
|
||||
load_team_id(){
|
||||
local org="$1" tree="$2" id=0
|
||||
|
||||
if [[ -f $pkg/repos/core-x86_64/PKGBUILD ]];then
|
||||
team_id=18
|
||||
elif [[ -f $pkg/repos/core-any/PKGBUILD ]];then
|
||||
team_id=18
|
||||
elif [[ -f $pkg/repos/extra-x86_64/PKGBUILD ]];then
|
||||
team_id=19
|
||||
elif [[ -f $pkg/repos/extra-any/PKGBUILD ]];then
|
||||
team_id=19
|
||||
elif [[ -f $pkg/repos/community-x86_64/PKGBUILD ]];then
|
||||
team_id=20
|
||||
elif [[ -f $pkg/repos/community-any/PKGBUILD ]];then
|
||||
team_id=20
|
||||
elif [[ -f $pkg/repos/multilib-x86_64/PKGBUILD ]];then
|
||||
team_id=21
|
||||
fi
|
||||
echo $team_id
|
||||
case $org in
|
||||
packagesA)
|
||||
case $tree in
|
||||
packages) id=70 ;;
|
||||
community) id=71 ;;
|
||||
esac
|
||||
;;
|
||||
packagesB)
|
||||
case $tree in
|
||||
packages) id=72 ;;
|
||||
community) id=73 ;;
|
||||
esac
|
||||
;;
|
||||
packagesC)
|
||||
case $tree in
|
||||
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(){
|
||||
local pkg="$1" path="$2"
|
||||
local id=$(find_team "$path")
|
||||
local pkg="$1" org="$2" tree="$3"
|
||||
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
|
||||
# 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(){
|
||||
local pkg="$1" branch=master
|
||||
git subrepo push "$pkg" -u -b "$branch"
|
||||
local pkg="$1"
|
||||
git subrepo push "$pkg" --clean
|
||||
}
|
||||
|
||||
subrepo_pull(){
|
||||
local pkg="$1" name="${2:-$1}" branch=master org=packages
|
||||
git subrepo pull "$pkg" -r gitea@"${GIT_DOMAIN}":"$org"/"$name".git -u -b "$branch"
|
||||
local pkg="$1"
|
||||
git subrepo pull "$pkg"
|
||||
}
|
||||
|
||||
subrepo_clone(){
|
||||
local pkg="$1" name="${2:-$1}" branch=master org=packages
|
||||
git subrepo clone gitea@"${GIT_DOMAIN}":"$org"/"$name".git "$pkg" -b "$branch"
|
||||
local pkg="$1" org="$2"
|
||||
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)
|
||||
}
|
||||
|
||||
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(){
|
||||
local pkg="$1" repo="$2"
|
||||
local pkg="$1"
|
||||
case $pkg in
|
||||
'glibc')
|
||||
sed -e 's|{locale,systemd/system,tmpfiles.d}|{locale,tmpfiles.d}|' \
|
||||
@@ -76,12 +66,12 @@ patch_pkg(){
|
||||
esac
|
||||
}
|
||||
|
||||
write_jenkinsfile(){
|
||||
local pkg="$1" jenkins=Jenkinsfile
|
||||
echo '@Library(["PackagePipeline", "BuildPkg", "DeployPkg", "Notify", "PostBuild", "RepoPackage"]) import org.artixlinux.RepoPackage' > $pkg/$jenkins
|
||||
echo '' >> $pkg/$jenkins
|
||||
echo 'PackagePipeline(new RepoPackage(this))' >> $pkg/$jenkins
|
||||
echo '' >> $pkg/$jenkins
|
||||
get_compliant_name(){
|
||||
local gitname="$1"
|
||||
case $gitname in
|
||||
*+) gitname=${gitname//+/plus}
|
||||
esac
|
||||
echo $gitname
|
||||
}
|
||||
|
||||
find_tree(){
|
||||
@@ -91,6 +81,20 @@ find_tree(){
|
||||
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(){
|
||||
local timer=$(get_timer) host_tree="$1"
|
||||
git clone $host_tree.git
|
||||
@@ -109,85 +113,16 @@ pull_tree(){
|
||||
fi
|
||||
}
|
||||
|
||||
push_tree(){
|
||||
local branch="master"
|
||||
git push origin "$branch"
|
||||
}
|
||||
|
||||
get_import_path(){
|
||||
local tree="$1" import_path=
|
||||
case $tree in
|
||||
packages) import_path=${TREE_DIR_ARCH}/packages ;;
|
||||
packages-galaxy) import_path=${TREE_DIR_ARCH}/community ;;
|
||||
get_pkg_org(){
|
||||
local pkg="$1" org= sub=
|
||||
case ${pkg} in
|
||||
perl-*) org=${pkg:0:6}; sub="${org:5}"; echo "packagesPerl" ;;
|
||||
python-*) org=${pkg:0:8}; sub="${org:7}"; echo "packagesPython" ;;
|
||||
python2-*) org=${pkg:0:9}; sub="${org:8}"; echo "packagesPython" ;;
|
||||
lib32*) org=${pkg:0:7}; sub="${org:6}"; echo "packagesL" ;; #"packages${sub^^}" ;;
|
||||
# lib*) org=${pkg:0:4}; sub="${org:3}"; echo "packagesLib${sub^^}" ;;
|
||||
*) org=${pkg:0:1}; echo "packages${org^^}" ;;
|
||||
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() {
|
||||
|
20
lib/util.sh
20
lib/util.sh
@@ -60,15 +60,21 @@ init_artools_base(){
|
||||
|
||||
init_artools_pkg(){
|
||||
|
||||
GIT_DOMAIN='gitea.artixlinux.org'
|
||||
DOMAIN='artixlinux.org'
|
||||
|
||||
GIT_DOMAIN="gitea.${DOMAIN}"
|
||||
|
||||
GIT_URL="https://${GIT_DOMAIN}"
|
||||
|
||||
[[ -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@gitea.artixlinux.org: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"
|
||||
|
||||
@@ -96,7 +102,13 @@ init_artools_iso(){
|
||||
|
||||
[[ -z ${UPLIMIT} ]] && UPLIMIT=1000
|
||||
|
||||
[[ -z ${ACCOUNT} ]] && ACCOUNT="[SetUser]"
|
||||
FILE_HOST="download.${DOMAIN}"
|
||||
|
||||
[[ -z ${FILE_HOME} ]] && FILE_HOME="/srv/iso"
|
||||
|
||||
[[ -z ${FILE_PORT} ]] && FILE_PORT=65432
|
||||
|
||||
[[ -z ${ACCOUNT} ]] && ACCOUNT="naughtyISOuploader"
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user