Compare commits

..

31 Commits

Author SHA1 Message Date
538e5051e5 artixpkg: add custom arch mapping for importing packages
Some checks failed
Artools shellcheck / lint (push) Has been cancelled
There are some packages that track upstream arch but have different
names. This can be handled using a special mapping similar to what is
done in artix-checkupdates.
2024-09-05 14:45:39 -05:00
ba2542c697 artixpkg: remove archlinux to artixlinux sed on import
All checks were successful
Artools shellcheck / lint (pull_request) Successful in 38s
Artools shellcheck / lint (push) Successful in 36s
This is not always desirable. For some packages, the upstream url really
is archlinux.org. This can be taken care of in artix-patches instead.
2024-08-26 10:38:56 -05:00
23c6cecdcc artixpkg: remove unneeded sed condition from import
All checks were successful
Artools shellcheck / lint (pull_request) Successful in 36s
Artools shellcheck / lint (push) Successful in 42s
Changing "(Arch Linux)" to "(Artix Linux)" is not used in practice by
any package and doing such name changes like this is better handled in
artix-patches instead of it being a blunt hammer on all imported
packages.
2024-07-26 20:13:35 -05:00
828844fd9a artixpkg git push: remove parallel
All checks were successful
Artools shellcheck / lint (push) Successful in 35s
2024-05-13 17:03:59 +02:00
760f5e8281 artools/0.34.x (#135)
All checks were successful
Artools shellcheck / lint (push) Successful in 35s
Co-authored-by: Dudemanguy <dudemanguy@artixlinux.org>
Co-authored-by: Cory Sanin <corysanin@artixlinux.org>
Reviewed-on: #135
2024-05-13 15:41:42 +02:00
bb1585ad7b add initial zsh completions (#132)
All checks were successful
Artools shellcheck / lint (push) Successful in 38s
Not as advanced as the bash completions but better than nothing.

Co-authored-by: artoo <artoo@artixlinux.org>
Reviewed-on: #132
Co-authored-by: Dudemanguy <dudemanguy@artixlinux.org>
Co-committed-by: Dudemanguy <dudemanguy@artixlinux.org>
2024-04-27 22:02:55 +02:00
be6506d6ee artixpkg git ci: fix team (#133)
All checks were successful
Artools shellcheck / lint (push) Successful in 39s
Reviewed-on: #133
2024-04-17 23:08:48 +02:00
35a9c2f305 artools/0.34.x (#131)
All checks were successful
Artools shellcheck / lint (push) Successful in 43s
Co-authored-by: Dudemanguy <dudemanguy@artixlinux.org>
Co-authored-by: Cory Sanin <corysanin@artixlinux.org>
Reviewed-on: #131
Co-authored-by: Artoo <artoo@artixlinux.org>
Co-committed-by: Artoo <artoo@artixlinux.org>
2024-04-17 17:05:39 +02:00
5347f45cc5 Merge pull request 'chroot-run: set PATH in chroot' (#129) from env-fix into master
All checks were successful
Artools shellcheck / lint (push) Successful in 46s
Reviewed-on: #129
2024-04-10 23:08:20 +02:00
c7f11a5bd5 chroot-run: set PATH in chroot
All checks were successful
Artools shellcheck / lint (pull_request) Successful in 48s
2024-04-10 23:05:38 +02:00
f3794ff2ad Merge pull request 'artixpkg: use artix-patches on import' (#119) from corysanin/artools:artix-patches into master
All checks were successful
Artools shellcheck / lint (push) Successful in 47s
Reviewed-on: #119
2024-04-03 21:56:40 +02:00
c6811cca48 update repo URL 2024-04-03 14:42:23 -05:00
a1f296ff2b moving patch scripts 2024-04-03 14:41:13 -05:00
ac5e0f4b3d simplify PKGBUILD paths 2024-04-03 14:41:13 -05:00
2ecfb04dc6 artixpkg: use artix-patches on import 2024-04-03 14:41:13 -05:00
e81eac2021 artixpkg: update usage (#124)
All checks were successful
Artools shellcheck / lint (push) Successful in 41s
Reviewed-on: #124
Co-authored-by: Artoo <artoo@artixlinux.org>
Co-committed-by: Artoo <artoo@artixlinux.org>
2024-04-02 14:54:11 +02:00
e612d2c6d2 artixpkg git: fix ci lib source
All checks were successful
Artools shellcheck / lint (push) Successful in 46s
2024-04-01 19:27:32 +02:00
2bed697813 Merge pull request 'repopkg: --include-sigs on add' (#123) from repopkg into master
All checks were successful
Artools shellcheck / lint (push) Successful in 42s
Reviewed-on: #123
2024-04-01 14:47:19 +02:00
ba4ac669e7 repopkg: --include-sigs on add
All checks were successful
Artools shellcheck / lint (pull_request) Successful in 33s
2024-04-01 14:45:20 +02:00
47babd20fd Merge pull request 'artixpkg: refactor ci into git sub cmd' (#122) from refactor-ci into master
All checks were successful
Artools shellcheck / lint (push) Successful in 34s
Reviewed-on: #122
2024-04-01 14:39:38 +02:00
d35422a74e artixpkg: refactor ci into git sub cmd
All checks were successful
Artools shellcheck / lint (pull_request) Successful in 36s
2024-04-01 13:09:37 +02:00
94b8957494 artixpkg ci: remove redundant --switch opt
All checks were successful
Artools shellcheck / lint (push) Successful in 42s
2024-03-31 12:22:06 +02:00
a0a485294c artixpkg ci: remove obsolete jobs opt
All checks were successful
Artools shellcheck / lint (push) Successful in 38s
2024-03-30 21:48:10 +01:00
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
24 changed files with 402 additions and 199 deletions

View File

@@ -116,6 +116,7 @@ install_pkg: binprogs_pkg
ln -sf find-libdeps $(DESTDIR)$(PREFIX)/bin/find-libprovides
install -Dm0644 $(BUILDDIR)/contrib/completion/bash/artixpkg $(DESTDIR)$(PREFIX)/share/bash-completion/completions/artixpkg
install -Dm0644 $(BUILDDIR)/contrib/completion/zsh/_artixpkg $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_artixpkg
install_iso: binprogs_iso
install -dm0755 $(DESTDIR)$(SYSCONFDIR)/$(TOOLS)

View File

@@ -35,3 +35,12 @@
# default archiving org
# GIT_ORG_ARCHIVE='landfill'
# default jenkins agents
# AGENTS=(orion taurus)
# whether to include custom maintainer line when importing from arch
# PATCH_MAINTAINER=false
# override the default git url for patches repo
# PATCH_URL=${GIT_SSH}:artix/artix-patches.git

View File

@@ -8,6 +8,14 @@ _artixpkg_pkgbase() {
ls -1 "${TREE_DIR_ARTIX}" | tr '\n' ' '
}
_artixpkg_remotepkgbase() {
curl -s "https://checkupdates.artixlinux.org/api/1.0/packages?startswith=$1"
}
_artixpkg_maintainers() {
curl -s "https://checkupdates.artixlinux.org/api/1.0/maintainers"
}
_artixpkg_completion() {
local cur prev comps comps_all repos autorepos teams agents cwords comp_cword_exflag
source "${LIBDIR}"/pkg/db/db.sh 2>/dev/null
@@ -70,7 +78,7 @@ _artixpkg_completion() {
case "${comp_cword_exflag}" in
1)
COMPREPLY=($(compgen -W "admin ci git repo version -h --help" -- "${cur}"))
COMPREPLY=($(compgen -W "admin git repo version -h --help" -- "${cur}"))
return 0
;;
2)
@@ -78,11 +86,8 @@ _artixpkg_completion() {
admin)
COMPREPLY=($(compgen -W "maintainer query team topic transfer -h --help" -- ${cur}))
;;
ci)
COMPREPLY=($(compgen -W "config -h --help" -- ${cur}))
;;
git)
COMPREPLY=($(compgen -W "clone config create pull push -h --help" -- ${cur}))
COMPREPLY=($(compgen -W "ci clone config create pull push -h --help" -- ${cur}))
;;
repo)
COMPREPLY=($(compgen -W "add remove move import show -h --help" -- ${cur}))
@@ -150,12 +155,15 @@ _artixpkg_completion() {
"-t"|"--team")
COMPREPLY=($(compgen -W "$teams" -- ${cur}))
;;
"-m"|"--maintainer"|"-s"|"--search"|"-t"|"--team"|"-j"|"--jobs")
"-m"|"--maintainer")
COMPREPLY=($(compgen -W "$(_artixpkg_maintainers)" -- ${cur}))
;;
"-s"|"--search"|"-j"|"--jobs")
# these flags expect a parameter
COMPREPLY=()
;;
*)
COMPREPLY=($(compgen -W "-m --maintainer --protocol -s --search -t --team -a --agent -j --jobs --all -h --help" -- ${cur}))
COMPREPLY=($(compgen -W "-m --maintainer --protocol -s --search -t --team -a --agent -j --jobs --all -h --help $(_artixpkg_remotepkgbase ${cur})" -- ${cur}))
;;
esac
;;
@@ -188,7 +196,10 @@ _artixpkg_completion() {
;;
"artixpkg git pull"*)
case "${prev}" in
"-t"|"--topic"|"-m"|"--maintainer"|"-j"|"--jobs")
"-m"|"--maintainer")
COMPREPLY=($(compgen -W "$(_artixpkg_maintainers)" -- ${cur}))
;;
"-t"|"--topic"|"-j"|"--jobs")
# these flags expect a parameter
COMPREPLY=()
;;
@@ -206,7 +217,10 @@ _artixpkg_completion() {
;;
"artixpkg git push"*)
case "${prev}" in
"-m"|"--maintainer"|"-t"|"--topic"|"-j"|"--jobs")
"-m"|"--maintainer")
COMPREPLY=($(compgen -W "$(_artixpkg_maintainers)" -- ${cur}))
;;
"-t"|"--topic"|"-j"|"--jobs")
# this flag expects a parameter
COMPREPLY=()
;;
@@ -215,17 +229,13 @@ _artixpkg_completion() {
;;
esac
;;
"artixpkg ci config"*)
"artixpkg git ci"*)
case "${prev}" in
"-j"|"--jobs")
# this flag expects a parameter
COMPREPLY=()
;;
"-a"|"--agent")
COMPREPLY=($(compgen -W "$agents" -- ${cur}))
;;
*)
COMPREPLY=($(compgen -W "-a --agent -s --switch -j --jobs -h --help $(_artixpkg_pkgbase)" -- ${cur}))
COMPREPLY=($(compgen -W "-a --agent -h --help $(_artixpkg_pkgbase)" -- ${cur}))
;;
esac
;;
@@ -241,7 +251,10 @@ _artixpkg_completion() {
;;
"artixpkg admin query"*)
case "${prev}" in
"-m"|"--maintainer"|"-t"|"--topic")
"-m"|"--maintainer")
COMPREPLY=($(compgen -W "$(_artixpkg_maintainers)" -- ${cur}))
;;
"-t"|"--topic")
# this flag expects a parameter
COMPREPLY=()
;;

View File

@@ -0,0 +1,205 @@
#compdef artixpkg
local -a addcmd admincmd cicmd clonecmd configcmd createcmd gitcmd importcmd \
initialcmd maintainercmd movecmd querycmd pullcmd pushcmd removecmd \
repocmd showcmd teamcmd topiccmd transfercmd versioncmd
_regex_words maintainer '' \
'-a' \
'--adopt' \
'-h' \
'--help' \
'-o' \
'--orphan'
maintainercmd=("$reply[@]")
_regex_words query '' \
'-h' \
'--help' \
'-m' \
'-t'
querycmd=("$reply[@]")
_regex_words team '' \
'-a' \
'--add' \
'-c' \
'--check' \
'-h' \
'--help' \
'-r' \
'--remove'
teamcmd=("$reply[@]")
_regex_words topic '' \
'-a' \
'--add' \
'-d' \
'--delete' \
'-h' \
'--help' \
'-j' \
'--jobs' \
'-r' \
'--remove'
topiccmd=("$reply[@]")
_regex_words transfer '' \
'-h' \
'--help'
transfercmd=("$reply[@]")
_regex_words admin '' \
'-h:Help text' \
'--help:Help text' \
'maintainer:Manage repo maintainer:$maintainercmd' \
'query:Query maintainers and topics:$querycmd' \
'team:Manage repo team:$teamcmd' \
'topic:Manage topics:$topiccmd' \
'transfer:Transfer obsolete repositories to landfill:$transfercmd'
admincmd=("$reply[@]")
_regex_words ci '' \
'-a' \
'--agent' \
'-h' \
'--help'
cicmd=("$reply[@]")
_regex_words clone '' \
'-a' \
'--agent' \
'--all' \
'-h' \
'--help' \
'-j' \
'--jobs' \
'-m' \
'--maintainer' \
'--protocol' \
'-s' \
'--search' \
'-t' \
'--team'
clonecmd=("$reply[@]")
_regex_words config '' \
'-h' \
'--help' \
'-j' \
'--jobs' \
'--protocol'
configcmd=("$reply[@]")
_regex_words create '' \
'-a' \
'--agent' \
'-c' \
'--create' \
'-h' \
'--help' \
'-t' \
'--team'
createcmd=("$reply[@]")
_regex_words pull '' \
'--all' \
'-h' \
'--help' \
'-j' \
'--jobs' \
'-m' \
'--maintainer' \
'-t' \
'--topic'
pullcmd=("$reply[@]")
_regex_words push '' \
'-h' \
'--help' \
'-j' \
'--jobs' \
'-m' \
'--maintainer' \
'-t' \
'--topic'
pushcmd=("$reply[@]")
_regex_words git '' \
'ci:Configure CI agent:$cicmd' \
'clone:Clone a package:$clonecmd' \
'config:Configure a clone:$configcmd' \
'create:Create a new gitea package repository:$createcmd' \
'-h:Help text' \
'--help:Help text' \
'pull:Pull a package repository:$pullcmd' \
'push:Push a package repository:$pushcmd'
gitcmd=("$reply[@]")
_regex_words add '' \
'-h' \
'--help' \
'-n' \
'--nocheck' \
'-p' \
'--push' \
'-r' \
'--rebuild'
addcmd=("$reply[@]")
_regex_words import '' \
'--del' \
'-h' \
'--help' \
'--tag'
importcmd=("$reply[@]")
_regex_words move '' \
'-h' \
'--help' \
'-p' \
'--push'
movecmd=("$reply[@]")
_regex_words remove '' \
'-h' \
'--help' \
'-p' \
'--push'
removecmd=("$reply[@]")
_regex_words show '' \
'-b' \
'--base' \
'-h' \
'--help' \
'-p' \
'--pkgs'
showcmd=("$reply[@]")
_regex_words repo '' \
'add:Add pkgbase to repo:$addcmd' \
'-h:Help text' \
'--help:Help text' \
'import:Import latest tag from arch upstream:$importcmd' \
'move:Move pkgbase between repos:$movecmd' \
'remove:Remove pkgbase from repo:$removecmd' \
'show:Show pkgbase repo db:$showcmd'
repocmd=("$reply[@]")
_regex_words version '' \
'-h' \
'--help'
versioncmd=("$reply[@]")
_regex_words initial '' \
'admin:Manage topics:$admincmd' \
'git:Manage git:$gitcmd' \
'-h:Help text' \
'--help:Help text' \
'repo:Pacman database modification:$repocmd' \
'version:Show artixpkg version:$versioncmd'
initialcmd=("$reply[@]")
_regex_arguments _artixpkg /$'[^\0]##\0'/ "${initialcmd[@]}"
_artixpkg "$@"

View File

@@ -31,7 +31,7 @@ artixpkg_admin_usage() {
$ ${COMMAND} query --topic mytopic
$ ${COMMAND} topic --add mytopic libfoo
$ ${COMMAND} team --add ${ARTIX_TEAMS[3]} libfoo
$ ${COMMAND} --adopt libfoo libbar
$ ${COMMAND} maintainer --adopt libfoo libbar
_EOF_
}

View File

@@ -48,7 +48,7 @@ artixpkg_admin_maintainer() {
local -r orphan="orphan"
local command=${_ARTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}}
local RUNCMD=${_ARTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}}
while (( $# )); do
case $1 in
@@ -58,12 +58,12 @@ artixpkg_admin_maintainer() {
;;
-a|--adopt)
ADOPT=1
RUNCMD+=" $1 $maintainer"
RUNCMD+=" $1"
shift
;;
-o|--orphan)
ORPHAN=1
RUNCMD+=" $1 $orphan"
RUNCMD+=" $1"
shift
;;
--)
@@ -103,7 +103,7 @@ artixpkg_admin_maintainer() {
export ARTOOLS_COLOR=always
fi
if ! parallel --bar --jobs "${jobs}" "${RUNCMD}" ::: "${pkgbases[@]}"; then
die 'Failed to pull some packages, please check the output'
die 'Failed to manange some packages, please check the output'
exit 1
fi
exit 0
@@ -118,7 +118,7 @@ artixpkg_admin_maintainer() {
warning "failed to add topic: $maintainer"
fi
if ! remove_topic "${gitname}" "$orphan"; then
warning "failed to remove topic: $orphan"
warning "failed to remove topic: $orphan"
fi
fi
@@ -127,7 +127,7 @@ artixpkg_admin_maintainer() {
warning "failed to add topic: $orphan"
fi
if ! remove_topic "${gitname}" "$maintainer"; then
warning "failed to remove topic: $maintainer"
warning "failed to remove topic: $maintainer"
fi
fi

View File

@@ -196,7 +196,6 @@ remove_all_topics() {
-H "Authorization: token ${GIT_TOKEN}" \
-d "$json"
stat_done
}
#}}}

View File

@@ -1,55 +0,0 @@
#!/hint/bash
#
# SPDX-License-Identifier: GPL-3.0-or-later
[[ -z ${ARTOOLS_INCLUDE_CI_SH:-} ]] || return 0
ARTOOLS_INCLUDE_CI_SH=1
set -e
artixpkg_ci_usage() {
local -r COMMAND=${_ARTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}}
cat <<- _EOF_
Usage: ${COMMAND} [COMMAND] [OPTIONS]
COMMANDS
config Configure ci and build agent
OPTIONS
-h, --help Show this help text
EXAMPLES
$ ${COMMAND} config libfoo
_EOF_
}
artixpkg_ci() {
if (( $# < 1 )); then
artixpkg_ci_usage
exit 0
fi
# option checking
while (( $# )); do
case $1 in
-h|--help)
artixpkg_ci_usage
exit 0
;;
config)
_ARTOOLS_COMMAND+=" $1"
shift
# shellcheck source=src/lib/pkg/ci/config.sh
source "${LIBDIR}"/pkg/ci/config.sh
artixpkg_ci_config "$@"
exit 0
;;
-*)
die "invalid argument: %s" "$1"
;;
*)
die "invalid command: %s" "$1"
;;
esac
done
}

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

@@ -18,6 +18,7 @@ artixpkg_git_usage() {
create Create a new Gitea package repository
pull Pull a package repository
push Push a package repository
ci Configure CI agent
OPTIONS
-h, --help Show this help text
@@ -25,9 +26,10 @@ artixpkg_git_usage() {
EXAMPLES
$ ${COMMAND} clone libfoo linux libbar
$ ${COMMAND} clone --maintainer tux
$ ${COMMAND} config --topic mytopic
$ ${COMMAND} config --maintainer tux
$ ${COMMAND} clone --search mytopic
$ ${COMMAND} config libfoo
$ ${COMMAND} create -c libfoo
$ ${COMMAND} ci -a ${AGENTS[1]} libfoo
_EOF_
}
@@ -60,6 +62,14 @@ artixpkg_git() {
artixpkg_git_config "$@"
exit 0
;;
ci)
_ARTOOLS_COMMAND+=" $1"
shift
# shellcheck source=src/lib/pkg/git/ci.sh
source "${LIBDIR}"/pkg/git/ci.sh
artixpkg_git_ci "$@"
exit 0
;;
create)
_ARTOOLS_COMMAND+=" $1"
shift

View File

@@ -2,8 +2,8 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
[[ -z ${ARTOOLS_INCLUDE_CI_CONFIG_SH:-} ]] || return 0
ARTOOLS_INCLUDE_CI_CONFIG_SH=1
[[ -z ${ARTOOLS_INCLUDE_GIT_CI_SH:-} ]] || return 0
ARTOOLS_INCLUDE_GIT_CI_SH=1
# shellcheck source=src/lib/pkg/db/db.sh
source "${LIBDIR}"/pkg/db/db.sh
@@ -11,15 +11,7 @@ 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() {
artixpkg_git_ci_usage() {
local -r COMMAND=${_ARTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}}
cat <<- _EOF_
Usage: ${COMMAND} [OPTIONS] [PKGBASE]...
@@ -27,50 +19,35 @@ artixpkg_ci_config_usage() {
OPTIONS
-a, --agent NAME Set the CI agent (default: ${AGENTS[0]})
Possible values: $(yaml_array ${AGENTS[@]})
-s, --switch Switch agent
-j, --jobs N Run up to N jobs in parallel (default: $(nproc))
-h, --help Show this help text
EXAMPLES
$ ${COMMAND} --agent ${AGENTS[1]} libfoo
$ ${COMMAND} --switch --agent ${AGENTS[1]} libfoo
$ ${COMMAND} *
_EOF_
}
artixpkg_ci_config() {
artixpkg_git_ci() {
# options
local jobs=
jobs=$(nproc)
local paths=()
local AGENT=${AGENTS[0]}
local SWITCH=0
local CREATED=0
# variables
local RUNCMD=${_ARTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}}
local path realpath pkgbase
while (( $# )); do
case $1 in
-h|--help)
artixpkg_ci_config_usage
artixpkg_git_ci_usage
exit 0
;;
-s|--switch)
SWITCH=1
shift
;;
-a|--agent)
(( $# <= 1 )) && die "missing argument for %s" "$1"
AGENT="$2"
RUNCMD+=" $1 ${AGENT}"
shift 2
;;
-j|--jobs)
(( $# <= 1 )) && die "missing argument for %s" "$1"
jobs=$2
SWITCH=1
shift 2
;;
--)
@@ -92,23 +69,11 @@ artixpkg_ci_config() {
if [[ -f PKGBUILD ]]; then
paths=(".")
else
artixpkg_ci_config_usage
artixpkg_git_ci_usage
exit 1
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}"
@@ -133,6 +98,8 @@ artixpkg_ci_config() {
git add "${REPO_CI}"
git commit -m "add ci support"
CREATED=1
fi
if [[ ! -f ${REPO_DB} ]]; then
@@ -147,14 +114,17 @@ artixpkg_ci_config() {
fi
git add "${REPO_DB}"
git commit -m "create repo db"
fi
if (( SWITCH )); then
msg "Switching to agent (${AGENT}) ..."
write_jenkinsfile "${AGENT}"
git add "${REPO_CI}"
git commit -m "switch agent"
if (( ! CREATED )); then
git add "${REPO_CI}"
git commit -m "switch agent"
fi
fi
)

View File

@@ -7,8 +7,8 @@ ARTOOLS_INCLUDE_GIT_CLONE_SH=1
# shellcheck source=src/lib/pkg/git/config.sh
source "${LIBDIR}"/pkg/git/config.sh
# shellcheck source=src/lib/pkg/ci/config.sh
source "${LIBDIR}"/pkg/ci/config.sh
# shellcheck source=src/lib/pkg/git/ci.sh
source "${LIBDIR}"/pkg/git/ci.sh
# shellcheck source=src/lib/pkg/admin/team.sh
source "${LIBDIR}"/pkg/admin/team.sh
@@ -169,7 +169,7 @@ artixpkg_git_clone() {
fi
artixpkg_git_config "${CONFIG_OPTS[@]}" "${pkgbase}"
artixpkg_ci_config "${AGENT_OPTS[@]}" "${pkgbase}"
artixpkg_git_ci "${AGENT_OPTS[@]}" "${pkgbase}"
artixpkg_admin_team "${TEAM_OPTS[@]}" "${pkgbase}"
done
}

View File

@@ -9,8 +9,8 @@ ARTOOLS_INCLUDE_GIT_CREATE_SH=1
source "${LIBDIR}"/pkg/git/clone.sh
# shellcheck source=src/lib/pkg/git/config.sh
source "${LIBDIR}"/pkg/git/config.sh
# shellcheck source=src/lib/pkg/ci/config.sh
source "${LIBDIR}"/pkg/ci/config.sh
# shellcheck source=src/lib/pkg/git/ci.sh
source "${LIBDIR}"/pkg/git/ci.sh
# shellcheck source=src/lib/pkg/admin/team.sh
source "${LIBDIR}"/pkg/admin/team.sh
@@ -116,7 +116,7 @@ artixpkg_git_create() {
artixpkg_git_clone "${AGENT_OPTS[@]}" "${TEAM_OPTS[@]}" "${pkgbase}"
elif (( CONFIG )); then
artixpkg_git_config "${pkgbase}"
artixpkg_ci_config "${AGENT_OPTS[@]}" "${pkgbase}"
artixpkg_git_ci "${AGENT_OPTS[@]}" "${pkgbase}"
artixpkg_admin_team "${TEAM_OPTS[@]}" "${pkgbase}"
fi

View File

@@ -16,14 +16,12 @@ artixpkg_git_push_usage() {
OPTIONS
-m, --maintainer NAME Push all packages of the named maintainer
-t, --topic NAME Push all packages of the named topic
-j, --jobs N Run up to N jobs in parallel (default: $(nproc))
-h, --help Show this help text
EXAMPLES
$ ${COMMAND} libfoo linux libbar
$ ${COMMAND} --maintainer tux
$ ${COMMAND} --topic mytopic
$ ${COMMAND} -j 8 --topic mytopic
_EOF_
}
@@ -38,11 +36,6 @@ artixpkg_git_push() {
# options
local MAINTAINER=
local TOPIC=
local CONFIGURE_OPTIONS=()
local jobs=
jobs=$(nproc)
local command=${_ARTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}}
while (( $# )); do
case $1 in
@@ -60,11 +53,6 @@ artixpkg_git_push() {
TOPIC="$2"
shift 2
;;
-j|--jobs)
(( $# <= 1 )) && die "missing argument for %s" "$1"
jobs=$2
shift 2
;;
--)
shift
break
@@ -90,19 +78,6 @@ artixpkg_git_push() {
mapfile -t pkgbases < <(search_topic "${TOPIC}" | yq -P -r '.data | .[].name' | sort)
fi
# 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}" "${command}" ::: "${pkgbases[@]}"; then
die 'Failed to push some packages, please check the output'
exit 1
fi
exit 0
fi
for pkgbase in "${pkgbases[@]}"; do
if [[ -d ${pkgbase} ]]; then
( cd "${pkgbase}" || return

View File

@@ -41,9 +41,12 @@ artixpkg_repo_usage() {
-h, --help Show this help text
EXAMPLES
$ ${COMMAND} add world libfoo
$ ${COMMAND} remove world libfoo
$ ${COMMAND} move world-gremlins world libfoo
$ ${COMMAND} add ${ARTIX_DB_MAP[2]} libfoo
$ ${COMMAND} remove ${ARTIX_DB_MAP[2]} libfoo
$ ${COMMAND} move ${ARTIX_DB_MAP[1]} ${ARTIX_DB_MAP[2]} libfoo
$ ${COMMAND} add ${ARTIX_DB[4]} libfoo
$ ${COMMAND} remove ${ARTIX_DB[4]} libfoo
$ ${COMMAND} move ${ARTIX_DB[3]} ${ARTIX_DB[4]} libfoo
$ ${COMMAND} import libfoo
$ ${COMMAND} show libfoo
_EOF_

View File

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

@@ -7,22 +7,61 @@ ARTOOLS_INCLUDE_REPO_IMPORT_SH=1
set -e
PATCHDIR=${PATCHDIR:-"${WORKSPACE_DIR}/artix-patches"}
declare -A arch_map=(
["archlinux-mirrorlist"]="pacman-mirrorlist"
["artix-rebuild-order"]="arch-rebuild-order"
["virtualbox-host-modules-artix"]="virtualbox-host-modules-arch"
)
update_patches(){
if [[ ! -d "${PATCHDIR}" ]]; then
# ${GIT_ORG}
if ! git clone "${PATCH_URL}" "${PATCHDIR}"; then
error "failed to clone %s" "${PATCHDIR}"
fi
else
if ! git -C "${PATCHDIR}" pull; then
error "Failed to pull artix-patches"
fi
fi
}
patch_pkgbase(){
local name="$1"
case "${name}" in
linux|linux-lts|linux-zen|linux-hardened|linux-rt*)
sed -e 's|KBUILD_BUILD_HOST=.*|KBUILD_BUILD_HOST=artixlinux|' -i PKGBUILD
sed -e 's|CONFIG_DEFAULT_HOSTNAME=.*|CONFIG_DEFAULT_HOSTNAME="artixlinux"|' \
-i config
;;
*)
sed -e 's|https://www.archlinux.org/|https://www.artixlinux.org/|' \
-e 's|(Arch Linux)|(Artix Linux)|' \
-e 's|arch-meson|artix-meson|' \
-i PKGBUILD
;;
esac
local patches="${PATCHDIR}/patches/${name}"
sed -e 's|arch-meson|artix-meson|' -i PKGBUILD
if "${PATCH_MAINTAINER}" && [ -n "${PACKAGER}" ]; then
sed -e 's|# Maintainer:|# Contributor:|' -i PKGBUILD
printf '%s\n%s\n' "# Maintainer: ${PACKAGER}" "$(cat "PKGBUILD")" >"PKGBUILD"
fi
if [ -d "${patches}" ]; then
if [ -f "${patches}/env.txt" ]; then
while read -r line; do
IFS="=" read -r key value <<< "$line"
if [[ -z "${key}" ]] || [[ -z "${value}" ]]; then
die "Invalid key value pair in env.txt"
fi
if declare -p "${key}" &> /dev/null; then
die "Environment variable %s already exists." "${key}"
fi
export "${key}=${value}"
done < "${patches}/env.txt"
fi
for file in "${patches}"/*; do
if [ -x "${file}" ]; then
echo "$> ${name}/$(basename "${file}")"
"${file}" "${TREE_DIR_ARTIX}/${name}"
elif [[ "${file}" == *.diff ]]; then
echo "$> git apply ${name}/$(basename "${file}")"
git -C "${TREE_DIR_ARTIX}/${name}" apply "${file}"
fi
done
fi
git --no-pager diff PKGBUILD
}
@@ -96,6 +135,8 @@ artixpkg_repo_import() {
esac
done
update_patches
pkgbases+=("$@")
for pkgbase in "${pkgbases[@]}"; do
@@ -108,9 +149,11 @@ artixpkg_repo_import() {
fi
( cd "${pkgbase}" || return
upstream="${arch_map["$pkgbase"]:-$pkgbase}"
stat_busy "Checking for upstream url"
if ! git config --local --get remote.upstream.url &>/dev/null; then
git remote add upstream "${GIT_UPSTREAM_URL}/${pkgbase}".git
git remote add upstream "${GIT_UPSTREAM_URL}/${upstream}".git
fi
stat_done

View File

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

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

@@ -60,6 +60,14 @@ load_pkg_config(){
DBEXT=${DBEXT:-'gz'}
PATCH_MAINTAINER=${PATCH_MAINTAINER:-false}
PATCH_URL=${PATCH_URL:-"${GIT_SSH}:artix/artix-patches.git"}
if [[ -z "${AGENTS[*]}" ]]; then
AGENTS=(orion taurus)
fi
return 0
}

View File

@@ -20,10 +20,10 @@ 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
git Manage Git packaging repositories and their configuration
repo Pacman database modification for package updates, moves, etc.
version Show artixpkg version information
OPTIONS
@@ -68,14 +68,6 @@ while (( $# )); do
artixpkg_git "$@"
exit 0
;;
ci)
_ARTOOLS_COMMAND+=" $1"
shift
# shellcheck source=src/lib/pkg/ci.sh
source "${LIBDIR}"/pkg/ci.sh
artixpkg_ci "$@"
exit 0
;;
admin)
_ARTOOLS_COMMAND+=" $1"
shift

View File

@@ -181,7 +181,9 @@ else
set_arch="${CARCH}"
fi
${CARCH:+setarch "${set_arch}"} chroot "${working_dir}" "$@"
chroot_args=(/usr/bin/env PATH=/usr/local/sbin:/usr/local/bin:/usr/bin)
${CARCH:+setarch "${set_arch}"} chroot "${working_dir}" "${chroot_args[@]}" "$@"
ret=$?

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"

View File

@@ -20,6 +20,7 @@ add() {
msg "Found: %s" "${pkgfile}"
packages+=("${pkgname}")
action='add'
action_args+=(--include-sigs)
ln -sfv "${pkgfile}"{,.sig} "${repo_path}"/
fi
}
@@ -41,7 +42,7 @@ repo_action() {
done
( cd "${repo_path}" || return
if [[ -n "${action}" ]]; then
repo-"${action}" -R "${dest_repo}.${db_ext}" "${packages[@]}"
repo-"${action}" "${action_args[@]}" "${dest_repo}.${db_ext}" "${packages[@]}"
fi
)
}
@@ -57,6 +58,7 @@ rm_pkg=false
cmd=${0##*/}
dest_repo=${cmd#*-}
action_args=(-R)
usage() {
printf "Usage: %s [options]\n" "${cmd}"