Compare commits

..

5 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
3 changed files with 35 additions and 35 deletions

View File

@@ -8,6 +8,14 @@ _artixpkg_pkgbase() {
ls -1 "${TREE_DIR_ARTIX}" | tr '\n' ' ' 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() { _artixpkg_completion() {
local cur prev comps comps_all repos autorepos teams agents cwords comp_cword_exflag local cur prev comps comps_all repos autorepos teams agents cwords comp_cword_exflag
source "${LIBDIR}"/pkg/db/db.sh 2>/dev/null source "${LIBDIR}"/pkg/db/db.sh 2>/dev/null
@@ -147,12 +155,15 @@ _artixpkg_completion() {
"-t"|"--team") "-t"|"--team")
COMPREPLY=($(compgen -W "$teams" -- ${cur})) 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 # these flags expect a parameter
COMPREPLY=() 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 esac
;; ;;
@@ -185,7 +196,10 @@ _artixpkg_completion() {
;; ;;
"artixpkg git pull"*) "artixpkg git pull"*)
case "${prev}" in 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 # these flags expect a parameter
COMPREPLY=() COMPREPLY=()
;; ;;
@@ -203,7 +217,10 @@ _artixpkg_completion() {
;; ;;
"artixpkg git push"*) "artixpkg git push"*)
case "${prev}" in 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 # this flag expects a parameter
COMPREPLY=() COMPREPLY=()
;; ;;
@@ -234,7 +251,10 @@ _artixpkg_completion() {
;; ;;
"artixpkg admin query"*) "artixpkg admin query"*)
case "${prev}" in case "${prev}" in
"-m"|"--maintainer"|"-t"|"--topic") "-m"|"--maintainer")
COMPREPLY=($(compgen -W "$(_artixpkg_maintainers)" -- ${cur}))
;;
"-t"|"--topic")
# this flag expects a parameter # this flag expects a parameter
COMPREPLY=() COMPREPLY=()
;; ;;

View File

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

View File

@@ -9,6 +9,12 @@ set -e
PATCHDIR=${PATCHDIR:-"${WORKSPACE_DIR}/artix-patches"} 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(){ update_patches(){
if [[ ! -d "${PATCHDIR}" ]]; then if [[ ! -d "${PATCHDIR}" ]]; then
# ${GIT_ORG} # ${GIT_ORG}
@@ -25,10 +31,7 @@ update_patches(){
patch_pkgbase(){ patch_pkgbase(){
local name="$1" local name="$1"
local patches="${PATCHDIR}/patches/${name}" local patches="${PATCHDIR}/patches/${name}"
sed -e 's|https://www.archlinux.org/|https://www.artixlinux.org/|' \ sed -e 's|arch-meson|artix-meson|' -i PKGBUILD
-e 's|(Arch Linux)|(Artix Linux)|' \
-e 's|arch-meson|artix-meson|' \
-i PKGBUILD
if "${PATCH_MAINTAINER}" && [ -n "${PACKAGER}" ]; then if "${PATCH_MAINTAINER}" && [ -n "${PACKAGER}" ]; then
sed -e 's|# Maintainer:|# Contributor:|' -i PKGBUILD sed -e 's|# Maintainer:|# Contributor:|' -i PKGBUILD
@@ -146,9 +149,11 @@ artixpkg_repo_import() {
fi fi
( cd "${pkgbase}" || return ( cd "${pkgbase}" || return
upstream="${arch_map["$pkgbase"]:-$pkgbase}"
stat_busy "Checking for upstream url" stat_busy "Checking for upstream url"
if ! git config --local --get remote.upstream.url &>/dev/null; then 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 fi
stat_done stat_done