Compare commits

...

18 Commits

Author SHA1 Message Date
7b67601e44 artixpkg ci: remove parallel agent config, leads to problems with gpg agents signing the commit
All checks were successful
Artools shellcheck / lint (push) Successful in 42s
2024-03-30 21:37:58 +01:00
8db0c1ca39 artixpkg admin: fix maintainer parallel
All checks were successful
Artools shellcheck / lint (push) Successful in 41s
2024-03-27 10:12:14 +01:00
190340e375 artixpkg admin: fix maintainer usage example
All checks were successful
Artools shellcheck / lint (push) Successful in 45s
2024-03-27 00:45:44 +01:00
f7a61731ba agent-branches (#118)
All checks were successful
Artools shellcheck / lint (push) Successful in 38s
Reviewed-on: #118
2024-03-26 18:27:50 +01:00
e959ce10c3 artixpkg admin: fix maintainer parallel (#121)
All checks were successful
Artools shellcheck / lint (push) Successful in 35s
Reviewed-on: #121
2024-03-25 23:14:22 +01:00
d2bbf9d8c4 Merge pull request 'packagersign: fix signing' (#120) from psign into master
Some checks failed
Artools shellcheck / lint (push) Has been cancelled
Reviewed-on: #120
2024-03-25 23:13:48 +01:00
1dafa0fb38 packagersign: fix signing
All checks were successful
Artools shellcheck / lint (pull_request) Successful in 52s
2024-03-25 22:50:11 +01:00
982a9ed678 artixpkg: fix ci usage
All checks were successful
Artools shellcheck / lint (push) Successful in 48s
2024-03-23 14:25:20 +01:00
19a6ff09f1 minor-fixes (#117)
All checks were successful
Artools shellcheck / lint (push) Successful in 46s
Co-authored-by: Cory Sanin <corysanin@artixlinux.org>
Reviewed-on: #117
2024-03-22 23:03:09 +01:00
fac634cf14 Merge pull request 'artixpkg: add "admin maintainer" to bash completion' (#115) from corysanin/artools:completion-maintainer into master
All checks were successful
Artools shellcheck / lint (push) Successful in 43s
Reviewed-on: #115
Reviewed-by: artoo <artoo@artixlinux.org>
2024-03-22 21:09:03 +01:00
71ed464c33 artixpkg: add "admin maintainer" to bash completion 2024-03-22 14:54:58 -05:00
f7286a0661 artixpkg: remove --manual flag (#110)
All checks were successful
Artools shellcheck / lint (push) Successful in 47s
It is possible to autodetect whether or not a short name is being used.
Remove this flag to avoid breaking the interface.

Co-authored-by: artoo <artoo@artixlinux.org>
Reviewed-on: #110
Co-authored-by: Dudemanguy <dudemanguy@artixlinux.org>
Co-committed-by: Dudemanguy <dudemanguy@artixlinux.org>
2024-03-22 20:45:27 +01:00
aee7c07a04 Artixpkg admin: maintainer (#114)
All checks were successful
Artools shellcheck / lint (push) Successful in 47s
Reviewed-on: #114
Co-authored-by: Artoo <artoo@artixlinux.org>
Co-committed-by: Artoo <artoo@artixlinux.org>
2024-03-22 19:15:12 +01:00
fbcfa79426 artixpkg admin: config archive org (#112)
All checks were successful
Artools shellcheck / lint (push) Successful in 42s
Reviewed-on: #112
2024-03-21 23:31:05 +01:00
87bd203d3e artixpkg: rename completion and update "admin topic" args (#113)
All checks were successful
Artools shellcheck / lint (push) Successful in 51s
bash completion file needs to be the same name as the command it's for

Reviewed-on: #113
Co-authored-by: Cory Sanin <corysanin@artixlinux.org>
Co-committed-by: Cory Sanin <corysanin@artixlinux.org>
2024-03-21 23:29:51 +01:00
ac0472d9ff Merge pull request 'artixpkg admin: add --delete topics' (#111) from rm-all-topics into master
All checks were successful
Artools shellcheck / lint (push) Successful in 45s
Reviewed-on: #111
2024-03-21 02:21:31 +01:00
e80c07d2fc artixpkg admin: add --delete topics
All checks were successful
Artools shellcheck / lint (pull_request) Successful in 46s
2024-03-21 02:04:11 +01:00
7584684bea artixpkg admin: archive repo after landfill transfer (#109)
All checks were successful
Artools shellcheck / lint (push) Successful in 48s
Reviewed-on: #109
Co-authored-by: Artoo <artoo@artixlinux.org>
Co-committed-by: Artoo <artoo@artixlinux.org>
2024-03-21 01:10:34 +01:00
18 changed files with 362 additions and 214 deletions

View File

@@ -115,7 +115,7 @@ install_pkg: binprogs_pkg
for a in $(SETARCH_ALIASES); do install -m0644 $$a -t $(DESTDIR)$(DATADIR)/setarch-aliases.d; done
ln -sf find-libdeps $(DESTDIR)$(PREFIX)/bin/find-libprovides
install -Dm0644 $(BUILDDIR)/contrib/completion/bash/$(TOOLS) $(DESTDIR)$(PREFIX)/share/bash-completion/completions/$(TOOLS)
install -Dm0644 $(BUILDDIR)/contrib/completion/bash/artixpkg $(DESTDIR)$(PREFIX)/share/bash-completion/completions/artixpkg
install_iso: binprogs_iso
install -dm0755 $(DESTDIR)$(SYSCONFDIR)/$(TOOLS)

View File

@@ -32,3 +32,9 @@
# default packaging org
# GIT_ORG='packages'
# default archiving org
# GIT_ORG_ARCHIVE='landfill'
# default jenkins agents
# AGENTS=(orion taurus)

View File

@@ -1,57 +1,20 @@
#/usr/bin/env bash
LIBDIR=${LIBDIR:-'@libdir@'}
_artixpkg_pkgbase() {
local LIBDIR
LIBDIR=${LIBDIR:-'/usr/share/artools/lib'}
source "${LIBDIR}"/pkg/git/config.sh
source "${LIBDIR}"/pkg/util.sh
ls -1 "${TREE_DIR_ARTIX}" | tr '\n' ' '
}
_artixpkg_completion() {
local cur prev comps comps_all repos autorepos teams agents ARTIX_DB ARTIX_TEAMS AGENTS ARTIX_DB_MAP cwords comp_cword_exflag
# TODO: get list, from /src/lib/pkg/db/db.sh?
ARTIX_DB=(
system-goblins
system-gremlins
system
world-goblins
world-gremlins
world
lib32-goblins
lib32-gremlins
lib32
galaxy-goblins
galaxy-gremlins
galaxy
)
# TODO: get from db.sh
ARTIX_TEAMS=(
"${ARTIX_DB[2]}"
"${ARTIX_DB[5]}"
"${ARTIX_DB[8]}"
"${ARTIX_DB[11]}"
)
# TODO: get from db.sh
AGENTS=(
orion
taurus
)
# TODO: get from db.sh
ARTIX_DB_MAP=(
goblins
gremlins
stable
)
local cur prev comps comps_all repos autorepos teams agents cwords comp_cword_exflag
source "${LIBDIR}"/pkg/db/db.sh 2>/dev/null
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
for ((i = COMP_CWORD - 1; i >= 0; i--)); do
if [[ ${COMP_WORDS[i]} != -* ]]; then
last_non_flag_word="${COMP_WORDS[i]}"
@@ -62,9 +25,11 @@ _artixpkg_completion() {
comps=""
comps_all=""
comp_cword_exflag=0
comp_cword_all=0
for ((i = 0; i < ${#COMP_WORDS[@]} - 1; i++)); do
word="${COMP_WORDS[i]}"
comps_all+=" $word"
((comp_cword_all++))
if [[ $word != -* ]]; then
comps+=" $word"
((comp_cword_exflag++))
@@ -111,7 +76,7 @@ _artixpkg_completion() {
2)
case ${prev} in
admin)
COMPREPLY=($(compgen -W "query team topic transfer -h --help" -- ${cur}))
COMPREPLY=($(compgen -W "maintainer query team topic transfer -h --help" -- ${cur}))
;;
ci)
COMPREPLY=($(compgen -W "config -h --help" -- ${cur}))
@@ -133,14 +98,7 @@ _artixpkg_completion() {
local repoAddCommon="-p --push -r --rebuild -n --nocheck -h --help"
case "${comp_cword_exflag}" in
3)
case "${comps_all}" in
*-m*|*--manual*)
COMPREPLY=($(compgen -W "$repoAddCommon $repos" -- ${cur}))
;;
*)
COMPREPLY=($(compgen -W "-m --manual $repoAddCommon $autorepos" -- ${cur}))
;;
esac
COMPREPLY=($(compgen -W "$repoAddCommon $autorepos $repos" -- ${cur}))
;;
*)
COMPREPLY=($(compgen -W "$repoAddCommon $(_artixpkg_pkgbase)" -- ${cur}))
@@ -150,14 +108,7 @@ _artixpkg_completion() {
"artixpkg repo remove"*)
case "${comp_cword_exflag}" in
3)
case "${comps_all}" in
*-m*|*--manual*)
COMPREPLY=($(compgen -W "-p --push -h --help $autorepos" -- ${cur}))
;;
*)
COMPREPLY=($(compgen -W "-m --manual -p --push -h --help $repos" -- ${cur}))
;;
esac
COMPREPLY=($(compgen -W "-p --push -h --help $autorepos $repos" -- ${cur}))
;;
*)
COMPREPLY=($(compgen -W "-p --push -h --help $(_artixpkg_pkgbase)" -- ${cur}))
@@ -167,14 +118,7 @@ _artixpkg_completion() {
"artixpkg repo move"*)
case "${comp_cword_exflag}" in
3|4)
case "${comps_all}" in
*-m*|*--manual*)
COMPREPLY=($(compgen -W "-p --push -h --help $autorepos" -- ${cur}))
;;
*)
COMPREPLY=($(compgen -W "-m --manual -p --push -h --help $repos" -- ${cur}))
;;
esac
COMPREPLY=($(compgen -W "-p --push -h --help $autorepos $repos" -- ${cur}))
;;
*)
COMPREPLY=($(compgen -W "-p --push -h --help $(_artixpkg_pkgbase)" -- ${cur}))
@@ -285,6 +229,16 @@ _artixpkg_completion() {
;;
esac
;;
"artixpkg admin maintainer"*)
case "${comp_cword_all}" in
3)
COMPREPLY=($(compgen -W "-a --adopt --o --orphan -h --help" -- ${cur}))
;;
*)
COMPREPLY=($(compgen -W "-h --help $(_artixpkg_pkgbase)" -- ${cur}))
;;
esac
;;
"artixpkg admin query"*)
case "${prev}" in
"-m"|"--maintainer"|"-t"|"--topic")
@@ -308,12 +262,12 @@ _artixpkg_completion() {
;;
"artixpkg admin topic"*)
case "${prev}" in
"-a"|"--add"|"-d"|"--del"|"-j"|"--jobs")
"-a"|"--add"|"-r"|"--remove"|"-j"|"--jobs")
# this flag expects a parameter
COMPREPLY=()
;;
*)
COMPREPLY=($(compgen -W "-a --add -d --del -j --jobs -h --help $(_artixpkg_pkgbase)" -- ${cur}))
COMPREPLY=($(compgen -W "-a --add -r --remove -d --del -j --jobs -h --help $(_artixpkg_pkgbase)" -- ${cur}))
;;
esac
;;

View File

@@ -17,6 +17,7 @@ artixpkg_admin_usage() {
Usage: ${COMMAND} [COMMAND] [OPTIONS]
COMMANDS
maintainer Manage repo maintainer
query Query maintainers and topics
team Manage repo team
topic Manage topics
@@ -27,8 +28,10 @@ artixpkg_admin_usage() {
EXAMPLES
$ ${COMMAND} transfer libfoo libbar
$ ${COMMAND} query --maintainer tux
$ ${COMMAND} query --topic kf5
$ ${COMMAND} query --topic mytopic
$ ${COMMAND} topic --add mytopic libfoo
$ ${COMMAND} team --add ${ARTIX_TEAMS[3]} libfoo
$ ${COMMAND} maintainer --adopt libfoo libbar
_EOF_
}
@@ -78,6 +81,14 @@ artixpkg_admin() {
artixpkg_admin_transfer "$@"
exit 0
;;
maintainer)
_ARTOOLS_COMMAND+=" $1"
shift
# shellcheck source=src/lib/pkg/admin/maintainer.sh
source "${LIBDIR}"/pkg/admin/maintainer.sh
artixpkg_admin_maintainer "$@"
exit 0
;;
-*)
die "invalid argument: %s" "$1"
;;

View File

@@ -0,0 +1,137 @@
#!/bin/bash
#
# SPDX-License-Identifier: GPL-3.0-or-later
[[ -z ${ARTOOLS_INCLUDE_ADMIN_MAINTAINER_SH:-} ]] || return 0
ARTOOLS_INCLUDE_ADMIN_MAINTAINER_SH=1
# shellcheck source=src/lib/pkg/packager.sh
source "${LIBDIR}"/pkg/packager.sh
set -e
artixpkg_admin_maintainer_usage() {
local -r COMMAND=${_ARTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}}
cat <<- _EOF_
Usage: ${COMMAND} [OPTIONS] [PKGBASE]...
OPTIONS
-a, --adopt Adopt repo
-o, --orphan Orphan repo
-h, --help Show this help text
EXAMPLES
$ ${COMMAND} --adopt libfoo
$ ${COMMAND} --orphan libfoo libbar
_EOF_
}
artixpkg_admin_maintainer() {
if (( $# < 1 )); then
artixpkg_admin_maintainer_usage
exit 0
fi
# options
local pkgbases=()
local pkgbase
local ADOPT=0
local ORPHAN=0
local packager_name
local maintainer
local -r orphan="orphan"
local RUNCMD=${_ARTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}}
while (( $# )); do
case $1 in
-h|--help)
artixpkg_admin_maintainer_usage
exit 0
;;
-a|--adopt)
ADOPT=1
RUNCMD+=" $1"
shift
;;
-o|--orphan)
ORPHAN=1
RUNCMD+=" $1"
shift
;;
--)
shift
break
;;
-*)
die "invalid argument: %s" "$1"
;;
*)
break
;;
esac
done
pkgbases+=("$@")
load_makepkg_config
if [[ -n ${PACKAGER} ]]; then
if ! packager_name=$(get_packager_name "${PACKAGER}") || \
! packager_email=$(get_packager_email "${PACKAGER}"); then
die "invalid PACKAGER format '${PACKAGER}' in makepkg.conf"
fi
if ! is_packager_name_valid "${packager_name}"; then
die "invalid PACKAGER '${PACKAGER}' in makepkg.conf"
fi
fi
maintainer="maintainer-${packager_name}"
if [[ -n ${GIT_TOKEN} ]]; then
# parallelization
if [[ ${jobs} != 1 ]] && (( ${#pkgbases[@]} > 1 )); then
# force colors in parallel if parent process is colorized
if [[ -n ${BOLD} ]]; then
export ARTOOLS_COLOR=always
fi
if ! parallel --bar --jobs "${jobs}" "${RUNCMD}" ::: "${pkgbases[@]}"; then
die 'Failed to manange some packages, please check the output'
exit 1
fi
exit 0
fi
for pkgbase in "${pkgbases[@]}"; do
local gitname
gitname=$(get_compliant_name "${pkgbase}")
if (( ADOPT )); then
if ! add_topic "${gitname}" "$maintainer"; then
warning "failed to add topic: $maintainer"
fi
if ! remove_topic "${gitname}" "$orphan"; then
warning "failed to remove topic: $orphan"
fi
fi
if (( ORPHAN )); then
if ! add_topic "${gitname}" "$orphan"; then
warning "failed to add topic: $orphan"
fi
if ! remove_topic "${gitname}" "$maintainer"; then
warning "failed to remove topic: $maintainer"
fi
fi
done
fi
}

View File

@@ -15,15 +15,17 @@ artixpkg_admin_topic_usage() {
OPTIONS
-a, --add NAME Add a topic to repo
-d, --del NAME Delete a topic from repo
-r, --remove NAME Remove a topic from repo
-d, --delete Delete all topics from repo
-j, --jobs N Run up to N jobs in parallel (default: $(nproc))
-h, --help Show this help text
EXAMPLES
$ ${COMMAND} --add mytopic libfoo
$ ${COMMAND} --del mytopic libbar
$ ${COMMAND} --remove mytopic libbar
$ ${COMMAND} --add mytopic libfoo libbar
$ ${COMMAND} --del mytopic libfoo libbar
$ ${COMMAND} --remove mytopic libfoo libbar
$ ${COMMAND} --delete libfoo
_EOF_
}
@@ -40,8 +42,9 @@ artixpkg_admin_topic() {
local pkgbase
local ADD_TOPIC
local DEL_TOPIC
local RM_TOPIC
local ADD=0
local RM=0
local DEL=0
local jobs=
jobs=$(nproc)
@@ -50,23 +53,28 @@ artixpkg_admin_topic() {
while (( $# )); do
case $1 in
-h|--help)
artixpkg_admin_topic_usage
exit 0
;;
-a|--add)
(( $# <= 1 )) && die "missing argument for %s" "$1"
ADD_TOPIC="$2"
ADD=1
RUNCMD+=" -a ${ADD_TOPIC}"
RUNCMD+=" $1 ${ADD_TOPIC}"
shift 2
;;
-d|--del)
-r|--remove)
(( $# <= 1 )) && die "missing argument for %s" "$1"
DEL_TOPIC="$2"
DEL=1
RUNCMD+=" -d ${DEL_TOPIC}"
RM_TOPIC="$2"
RM=1
RUNCMD+=" $1 ${RM_TOPIC}"
shift 2
;;
-h|--help)
artixpkg_admin_topic_usage
exit 0
-d|--delete)
DEL=1
RUNCMD+=" $1"
shift
;;
-j|--jobs)
(( $# <= 1 )) && die "missing argument for %s" "$1"
@@ -109,13 +117,19 @@ artixpkg_admin_topic() {
# topics meta
if (( ADD )); then
if ! add_topic "${gitname}" "${ADD_TOPIC}"; then
warning "failed to add the topic: ${ADD_TOPIC}"
warning "failed to add topic: ${ADD_TOPIC}"
fi
fi
if (( RM )); then
if ! remove_topic "${gitname}" "${RM_TOPIC}"; then
warning "failed to remove topic: ${RM_TOPIC}"
fi
fi
if (( DEL )); then
if ! remove_topic "${gitname}" "${DEL_TOPIC}"; then
warning "failed to delete the topic: ${DEL_TOPIC}"
if ! remove_all_topics "${gitname}" "${GIT_ORG}"; then
warning "failed to delete all topics: ${gitname}"
fi
fi

View File

@@ -33,7 +33,6 @@ artixpkg_admin_transfer() {
# options
local pkgbases=()
local pkgbase
local waste_org="landfill"
local command=${_ARTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}}
@@ -63,7 +62,9 @@ artixpkg_admin_transfer() {
local gitname
gitname=$(get_compliant_name "${pkgbase}")
transfer_repo "${gitname}" "${waste_org}"
transfer_repo "${gitname}" "${GIT_ORG_ARCHIVE}"
archive_repo "${gitname}" "${GIT_ORG_ARCHIVE}"
remove_all_topics "${gitname}" "${GIT_ORG_ARCHIVE}"
done
fi
}

View File

@@ -78,7 +78,7 @@ transfer_repo() {
local pkgbase="$1"
local new_owner="$2"
local json url
json="{ \"new_owner\": \"$new_owner\", \"team_ids\": [] }"
json="{ \"new_owner\": \"$new_owner\", \"team_ids\": [], \"archived\": \"true\" }"
url="${API_URL}/repos/${GIT_ORG}/$pkgbase/transfer"
stat_busy "Transfer package repo [$pkgbase] in org ($new_owner)"
@@ -164,4 +164,39 @@ check_repo_team() {
stat_done
}
archive_repo() {
local pkgbase="$1"
local org="$2"
local url
local json
url="${API_URL}/repos/$org/$pkgbase"
json="{ \"archived\": true }"
stat_busy "Archive repo [$pkgbase] in org ($org)"
api_patch "$url" \
-H "accept: application/json" \
-H "content-type: application/json" \
-H "Authorization: token ${GIT_TOKEN}" \
-d "$json"
stat_done
}
remove_all_topics() {
local pkgbase="$1"
local org="$2"
local url
local json
url="${API_URL}/repos/$org/$pkgbase/topics"
json="{ \"topics\": [] }"
stat_busy "Delete all topics from [$pkgbase]"
api_put "$url" \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H "Authorization: token ${GIT_TOKEN}" \
-d "$json"
stat_done
}
#}}}

View File

@@ -11,14 +11,6 @@ source "${LIBDIR}"/pkg/db/db.sh
set -e
write_jenkinsfile() {
printf "@Library('artix-ci@%s') import org.artixlinux.RepoPackage\n" "${1}" > "${REPO_CI}"
{
printf '\n'
printf 'PackagePipeline(new RepoPackage(this))\n'
} >> "${REPO_CI}"
}
artixpkg_ci_config_usage() {
local -r COMMAND=${_ARTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}}
cat <<- _EOF_
@@ -49,7 +41,6 @@ artixpkg_ci_config() {
local SWITCH=0
# variables
local RUNCMD=${_ARTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}}
local path realpath pkgbase
while (( $# )); do
@@ -65,7 +56,6 @@ artixpkg_ci_config() {
-a|--agent)
(( $# <= 1 )) && die "missing argument for %s" "$1"
AGENT="$2"
RUNCMD+=" $1 ${AGENT}"
shift 2
;;
-j|--jobs)
@@ -97,18 +87,6 @@ artixpkg_ci_config() {
fi
fi
# parallelization
if [[ ${jobs} != 1 ]] && (( ${#paths[@]} > 1 )); then
if [[ -n ${BOLD} ]]; then
export ARTOOLS_COLOR=always
fi
if ! parallel --bar --jobs "${jobs}" "${RUNCMD}" ::: "${paths[@]}"; then
die 'Failed to configure some packages, please check the output'
exit 1
fi
exit 0
fi
for path in "${paths[@]}"; do
if ! realpath=$(realpath -e "${path}"); then
error "No such directory: ${path}"

View File

@@ -30,11 +30,6 @@ readonly ARTIX_TEAMS=(
"${ARTIX_DB[11]}"
)
readonly AGENTS=(
orion
taurus
)
readonly REPO_DB='.artixlinux/pkgbase.yaml'
readonly REPO_CI='.artixlinux/Jenkinsfile'
@@ -360,3 +355,24 @@ show_srcinfo_base() {
show_srcinfo_pkgs() {
pkg2yaml . | yq '.pkgnames'
}
write_jenkinsfile() {
printf "@Library('artix-ci@%s') import org.artixlinux.RepoPackage\n" "${1}" > "${REPO_CI}"
{
printf '\n'
printf 'PackagePipeline(new RepoPackage(this))\n'
} >> "${REPO_CI}"
}
migrate_agent_branch() {
local branch=${AGENTS[0]}
for a in "${AGENTS[@]}"; do
if grep @"$a" "${REPO_CI}" &>/dev/null; then
branch="$a"
fi
done
if grep @galaxy "${REPO_CI}" &>/dev/null; then
branch=${AGENTS[1]}
fi
write_jenkinsfile "${branch}"
}

View File

@@ -5,6 +5,9 @@
[[ -z ${ARTOOLS_INCLUDE_GIT_CONFIG_SH:-} ]] || return 0
ARTOOLS_INCLUDE_GIT_CONFIG_SH=1
# shellcheck source=src/lib/pkg/packager.sh
source "${LIBDIR}"/pkg/packager.sh
set -e
@@ -23,54 +26,6 @@ artixpkg_git_config_usage() {
_EOF_
}
get_packager_name() {
local packager=$1
local packager_pattern="(.+) <(.+@.+)>"
local name
if [[ ! $packager =~ $packager_pattern ]]; then
return 1
fi
name=$(echo "${packager}"|sed -E "s/${packager_pattern}/\1/")
printf "%s" "${name}"
}
get_packager_email() {
local packager=$1
local packager_pattern="(.+) <(.+@.+)>"
local email
if [[ ! $packager =~ $packager_pattern ]]; then
return 1
fi
email=$(echo "${packager}"|sed -E "s/${packager_pattern}/\2/")
printf "%s" "${email}"
}
is_packager_name_valid() {
local packager_name=$1
if [[ -z ${packager_name} ]]; then
return 1
elif [[ ${packager_name} == "John Tux" ]]; then
return 1
elif [[ ${packager_name} == "Unknown Packager" ]]; then
return 1
fi
return 0
}
is_packager_email_official() {
local packager_email=$1
if [[ -z ${packager_email} ]]; then
return 1
elif [[ $packager_email =~ .+@artixlinux.org ]]; then
return 0
fi
return 1
}
artixpkg_git_config() {
# options
local GIT_REPO_BASE_URL=${GIT_HTTPS}

51
src/lib/pkg/packager.sh Normal file
View File

@@ -0,0 +1,51 @@
#!/bin/bash
#
# SPDX-License-Identifier: GPL-3.0-or-later
get_packager_name() {
local packager=$1
local packager_pattern="(.+) <(.+@.+)>"
local name
if [[ ! $packager =~ $packager_pattern ]]; then
return 1
fi
name=$(echo "${packager}"|sed -E "s/${packager_pattern}/\1/")
printf "%s" "${name}"
}
get_packager_email() {
local packager=$1
local packager_pattern="(.+) <(.+@.+)>"
local email
if [[ ! $packager =~ $packager_pattern ]]; then
return 1
fi
email=$(echo "${packager}"|sed -E "s/${packager_pattern}/\2/")
printf "%s" "${email}"
}
is_packager_name_valid() {
local packager_name=$1
if [[ -z ${packager_name} ]]; then
return 1
elif [[ ${packager_name} == "John Tux" ]]; then
return 1
elif [[ ${packager_name} == "Unknown Packager" ]]; then
return 1
fi
return 0
}
is_packager_email_official() {
local packager_email=$1
if [[ -z ${packager_email} ]]; then
return 1
elif [[ $packager_email =~ .+@artixlinux.org ]]; then
return 0
fi
return 1
}

View File

@@ -38,8 +38,6 @@ artixpkg_repo_add_usage() {
Usage: ${COMMAND} [OPTIONS] [DEST_REPO] [PKGBASE]...
OPTIONS
-m, --manual Disable auto repo
Possible auto values: $(yaml_array ${ARTIX_DB_MAP[@]})
-p, --push Push pkgbase
-r, --rebuild Triggers a rebuild
-n, --nocheck Disable the check function
@@ -48,7 +46,7 @@ artixpkg_repo_add_usage() {
EXAMPLES
$ ${COMMAND} ${ARTIX_DB[4]} libfoo
$ ${COMMAND} --push ${ARTIX_DB[4]} libfoo
$ ${COMMAND} --auto --push ${ARTIX_DB_MAP[2]} libfoo
$ ${COMMAND} --push ${ARTIX_DB_MAP[2]} libfoo
_EOF_
}
@@ -67,7 +65,7 @@ artixpkg_repo_add() {
local REBUILD=0
local NOCHECK=0
local ADD=1
local AUTO=1
local AUTO=0
while (( $# )); do
case $1 in
@@ -75,10 +73,6 @@ artixpkg_repo_add() {
artixpkg_repo_add_usage
exit 0
;;
-m|--manual)
AUTO=0
shift
;;
-p|--push)
PUSH=1
shift
@@ -104,10 +98,8 @@ artixpkg_repo_add() {
shift
pkgbases+=("$@")
if (( AUTO )); then
if ! in_array "${DEST}" "${ARTIX_DB_MAP[@]}"; then
die "${DEST} does not exist!"
fi
if in_array "${DEST}" "${ARTIX_DB_MAP[@]}"; then
AUTO=1
else
if ! in_array "${DEST}" "${ARTIX_DB[@]}"; then
die "${DEST} does not exist!"
@@ -168,6 +160,8 @@ artixpkg_repo_add() {
delete_obsolete_map_keys
migrate_agent_branch
if [[ -n $(git status --porcelain --untracked-files=no) ]]; then
stat_busy 'Staging files'

View File

@@ -14,15 +14,13 @@ artixpkg_repo_move_usage() {
Usage: ${COMMAND} [OPTIONS] [SOURCE_REPO] [DEST_REPO] [PKGBASE]...
OPTIONS
-m, --manual Disable auto repo
Possible auto values: $(yaml_array ${ARTIX_DB_MAP[@]})
-p, --push Push pkgbase
-h, --help Show this help text
EXAMPLES
$ ${COMMAND} ${ARTIX_DB[4]} ${ARTIX_DB[5]} libfoo
$ ${COMMAND} --push ${ARTIX_DB[4]} ${ARTIX_DB[5]} libfoo
$ ${COMMAND} --auto --push ${ARTIX_DB_MAP[1]} ${ARTIX_DB_MAP[2]} libfoo
$ ${COMMAND} --push ${ARTIX_DB_MAP[1]} ${ARTIX_DB_MAP[2]} libfoo
_EOF_
}
@@ -37,7 +35,7 @@ artixpkg_repo_move() {
local pkgbase
local PUSH=0
local AUTO=1
local AUTO=0
local DEST
local SRC
@@ -48,10 +46,6 @@ artixpkg_repo_move() {
artixpkg_repo_move_usage
exit 0
;;
-m|--manual)
AUTO=0
shift
;;
-p|--push)
PUSH=1
shift
@@ -65,17 +59,12 @@ artixpkg_repo_move() {
esac
done
SRC="$1"
SRC="$1"
DEST="$2"
shift 2
if (( AUTO )); then
if ! in_array "${SRC}" "${ARTIX_DB_MAP[@]}"; then
die "${SRC} does not exist!"
fi
if ! in_array "${DEST}" "${ARTIX_DB_MAP[@]}"; then
die "${DEST} does not exist!"
fi
if in_array "${SRC}" "${ARTIX_DB_MAP[@]}" && in_array "${DEST}" "${ARTIX_DB_MAP[@]}"; then
AUTO=1
else
if ! in_array "${SRC}" "${ARTIX_DB[@]}"; then
die "${SRC} does not exist!"
@@ -140,6 +129,8 @@ artixpkg_repo_move() {
delete_obsolete_map_keys
migrate_agent_branch
update_yaml_team "$(auto_detect)"
if [[ -n $(git status --porcelain --untracked-files=no) ]]; then

View File

@@ -14,15 +14,13 @@ artixpkg_repo_remove_usage() {
Usage: ${COMMAND} [OPTIONS] [DEST_REPO] [PKGBASE]...
OPTIONS
-m, --manual Disable auto repo
Possible auto values: $(yaml_array ${ARTIX_DB_MAP[@]})
-p, --push Push pkgbase
-h, --help Show this help text
EXAMPLES
$ ${COMMAND} ${ARTIX_DB[4]} libfoo
$ ${COMMAND} --push ${ARTIX_DB[4]} libfoo
$ ${COMMAND} --auto --push ${ARTIX_DB_MAP[2]} libfoo
$ ${COMMAND} --push ${ARTIX_DB_MAP[2]} libfoo
_EOF_
}
@@ -37,7 +35,7 @@ artixpkg_repo_remove() {
local pkgbase
local PUSH=0
local AUTO=1
local AUTO=0
local DEST=''
while (( $# )); do
@@ -46,10 +44,6 @@ artixpkg_repo_remove() {
artixpkg_repo_remove_usage
exit 0
;;
-m|--manual)
AUTO=0
shift
;;
-p|--push)
PUSH=1
shift
@@ -67,10 +61,8 @@ artixpkg_repo_remove() {
shift
pkgbases=("$@")
if (( AUTO )); then
if ! in_array "${DEST}" "${ARTIX_DB_MAP[@]}"; then
die "${DEST} does not exist!"
fi
if in_array "${DEST}" "${ARTIX_DB_MAP[@]}"; then
AUTO=1
else
if ! in_array "${DEST}" "${ARTIX_DB[@]}"; then
die "${DEST} does not exist!"
@@ -115,6 +107,8 @@ artixpkg_repo_remove() {
delete_obsolete_map_keys
migrate_agent_branch
if [[ -n $(git status --porcelain --untracked-files=no) ]]; then
stat_busy 'Staging files'

View File

@@ -50,6 +50,8 @@ load_pkg_config(){
GIT_UPSTREAM_URL=${GIT_UPSTREAM_URL:-"https://gitlab.archlinux.org/archlinux/packaging/packages"}
GIT_ORG_ARCHIVE=${GIT_ORG_ARCHIVE:-'landfill'}
TREE_DIR_ARTIX=${TREE_DIR_ARTIX:-"${WORKSPACE_DIR}/artixlinux"}
REPOS_ROOT=${REPOS_ROOT:-"${WORKSPACE_DIR}/repos"}
@@ -58,6 +60,10 @@ load_pkg_config(){
DBEXT=${DBEXT:-'gz'}
if [[ -z "${AGENTS[*]}" ]]; then
AGENTS=(orion taurus)
fi
return 0
}

View File

@@ -20,10 +20,11 @@ usage() {
Usage: ${COMMAND} [COMMAND] [OPTIONS]
COMMANDS
repo Pacman database modification for package updates, moves, etc.
git Manage Git packaging repositories and their configuration
agent Manage CI and build agent
admin Manage topics, teams and obsolete repos
ci Manage CI and build agent
git Manage Git packaging repositories and their configuration
repo Pacman database modification for package updates, moves, etc.
version Show artixpkg version information
OPTIONS

View File

@@ -11,6 +11,13 @@ source "${LIBDIR}"/base/chroot.sh
# shellcheck source=src/lib/pkg/deploy.sh
source "${LIBDIR}"/pkg/deploy.sh
# shellcheck source=config/makepkg/x86_64.conf
load_makepkg_config
export PKGDEST
export GPG_KEY
export GPG_PASS
passfiles=("$@")
sign_pkg(){
@@ -23,16 +30,13 @@ sign_pkg(){
if [[ -n "${GPG_KEY}" ]] && [[ -n "${GPG_PASS}" ]]; then
msg "Signing [%s]" "${file_to_sign##*/}"
if ! gpg --homedir /etc/pacman.d/gnupg --no-permission-warning \
--no-default-keyring --default-key "${GPGP_KEY}" --passphrase "${GPGP_PASS}" \
-q --detach-sign "$file_to_sign"; then
return 1
fi
gpg --homedir /etc/pacman.d/gnupg --no-permission-warning \
--no-default-keyring --default-key "${GPG_KEY}" --passphrase "${GPG_PASS}" \
-q --detach-sign "$file_to_sign"
fi
return 0
}
check_root "" "${BASH_SOURCE[0]}" "$@"
check_root PKGDEST,GPG_KEY,GPG_PASS "${BASH_SOURCE[0]}" "$@"
for pkg in "${passfiles[@]}"; do
msg "Searching %s ..." "$pkg"