Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
af81317aad | |||
79e12f3d10 | |||
917cd188d9 | |||
bfe462432d
|
|||
896e8e195f
|
|||
12d1b784ff | |||
d8129cbb9a
|
|||
950e0604a4
|
2
Makefile
2
Makefile
@@ -1,6 +1,6 @@
|
||||
SHELL=/bin/bash
|
||||
|
||||
V=0.33
|
||||
V=0.36
|
||||
BUILDTOOLVER ?= $(V)
|
||||
|
||||
CHROOTVER=0.12
|
||||
|
@@ -41,3 +41,6 @@
|
||||
|
||||
# override the default git url for patches repo
|
||||
# PATCH_URL=${GIT_SSH}:artix/artix-patches.git
|
||||
|
||||
# override the default debug pool
|
||||
# PKGDEST_DBG=${WORKSPACE_DIR}/packages-debug
|
||||
|
@@ -3,7 +3,6 @@
|
||||
LIBDIR=${LIBDIR:-'@libdir@'}
|
||||
|
||||
_artixpkg_pkgbase() {
|
||||
source "${LIBDIR}"/pkg/git/config.sh
|
||||
source "${LIBDIR}"/pkg/util.sh
|
||||
ls -1 "${TREE_DIR_ARTIX}" | tr '\n' ' '
|
||||
}
|
||||
@@ -17,7 +16,7 @@ _artixpkg_maintainers() {
|
||||
}
|
||||
|
||||
_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 agent_flag_present
|
||||
source "${LIBDIR}"/pkg/db/db.sh 2>/dev/null
|
||||
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
@@ -34,6 +33,7 @@ _artixpkg_completion() {
|
||||
comps_all=""
|
||||
comp_cword_exflag=0
|
||||
comp_cword_all=0
|
||||
agent_flag_present=false
|
||||
for ((i = 0; i < ${#COMP_WORDS[@]} - 1; i++)); do
|
||||
word="${COMP_WORDS[i]}"
|
||||
comps_all+=" $word"
|
||||
@@ -42,6 +42,10 @@ _artixpkg_completion() {
|
||||
comps+=" $word"
|
||||
((comp_cword_exflag++))
|
||||
fi
|
||||
if [[ $word == -a || $word == --agent ]]; then
|
||||
# -a can also refer to --adopt
|
||||
agent_flag_present=true
|
||||
fi
|
||||
done
|
||||
comps="${comps:1}"
|
||||
comps_all="${comps_all:1}"
|
||||
@@ -67,6 +71,13 @@ _artixpkg_completion() {
|
||||
fi
|
||||
done
|
||||
teams="${teams:1}"
|
||||
agents=""
|
||||
for word in "${AGENTS[@]}"; do
|
||||
if [[ $word != -* ]]; then
|
||||
agents+=" $word"
|
||||
fi
|
||||
done
|
||||
agents="${agents:1}"
|
||||
|
||||
case "${comp_cword_exflag}" in
|
||||
1)
|
||||
@@ -79,7 +90,7 @@ _artixpkg_completion() {
|
||||
COMPREPLY=($(compgen -W "maintainer query team topic transfer -h --help" -- ${cur}))
|
||||
;;
|
||||
git)
|
||||
COMPREPLY=($(compgen -W "ci clone config create pull push -h --help" -- ${cur}))
|
||||
COMPREPLY=($(compgen -W "clone config create pull push -h --help" -- ${cur}))
|
||||
;;
|
||||
repo)
|
||||
COMPREPLY=($(compgen -W "add remove move import show -h --help" -- ${cur}))
|
||||
@@ -91,37 +102,6 @@ _artixpkg_completion() {
|
||||
;;
|
||||
*)
|
||||
case "${comps}" in
|
||||
"artixpkg repo add"*)
|
||||
local repoAddCommon="-p --push -r --rebuild -n --nocheck -h --help"
|
||||
case "${comp_cword_exflag}" in
|
||||
3)
|
||||
COMPREPLY=($(compgen -W "$repoAddCommon $autorepos $repos" -- ${cur}))
|
||||
;;
|
||||
*)
|
||||
COMPREPLY=($(compgen -W "$repoAddCommon $(_artixpkg_pkgbase)" -- ${cur}))
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"artixpkg repo remove"*)
|
||||
case "${comp_cword_exflag}" in
|
||||
3)
|
||||
COMPREPLY=($(compgen -W "-p --push -h --help $autorepos $repos" -- ${cur}))
|
||||
;;
|
||||
*)
|
||||
COMPREPLY=($(compgen -W "-p --push -h --help $(_artixpkg_pkgbase)" -- ${cur}))
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"artixpkg repo move"*)
|
||||
case "${comp_cword_exflag}" in
|
||||
3|4)
|
||||
COMPREPLY=($(compgen -W "-p --push -h --help $autorepos $repos" -- ${cur}))
|
||||
;;
|
||||
*)
|
||||
COMPREPLY=($(compgen -W "-p --push -h --help $(_artixpkg_pkgbase)" -- ${cur}))
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"artixpkg repo import"*)
|
||||
case "${prev}" in
|
||||
"--tag")
|
||||
@@ -136,11 +116,53 @@ _artixpkg_completion() {
|
||||
"artixpkg repo show")
|
||||
COMPREPLY=($(compgen -W "-b --base -p --pkgs -h --help" -- ${cur}))
|
||||
;;
|
||||
"artixpkg git clone"*)
|
||||
"artixpkg repo"*)
|
||||
if [ "$agent_flag_present" = true ] ; then
|
||||
((comp_cword_exflag--))
|
||||
fi
|
||||
case "${prev}" in
|
||||
"-a"|"--agent")
|
||||
COMPREPLY=($(compgen -W "$agents" -- ${cur}))
|
||||
;;
|
||||
*)
|
||||
case "${comps}" in
|
||||
"artixpkg repo add"*)
|
||||
local repoAddCommon="-p --push -r --rebuild -n --nocheck -a --agent -h --help"
|
||||
case "${comp_cword_exflag}" in
|
||||
3)
|
||||
COMPREPLY=($(compgen -W "$repoAddCommon $autorepos $repos" -- ${cur}))
|
||||
;;
|
||||
*)
|
||||
COMPREPLY=($(compgen -W "$repoAddCommon $(_artixpkg_pkgbase)" -- ${cur}))
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"artixpkg repo remove"*)
|
||||
case "${comp_cword_exflag}" in
|
||||
3)
|
||||
COMPREPLY=($(compgen -W "-p --push -a --agent -h --help $autorepos $repos" -- ${cur}))
|
||||
;;
|
||||
*)
|
||||
COMPREPLY=($(compgen -W "-p --push -a --agent -h --help $(_artixpkg_pkgbase)" -- ${cur}))
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"artixpkg repo move"*)
|
||||
case "${comp_cword_exflag}" in
|
||||
3|4)
|
||||
COMPREPLY=($(compgen -W "-p --push -a --agent -h --help $autorepos $repos" -- ${cur}))
|
||||
;;
|
||||
*)
|
||||
COMPREPLY=($(compgen -W "-p --push -a --agent -h --help $(_artixpkg_pkgbase)" -- ${cur}))
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"artixpkg git clone"*)
|
||||
case "${prev}" in
|
||||
"--protocol")
|
||||
COMPREPLY=($(compgen -W "https" -- ${cur}))
|
||||
;;
|
||||
@@ -155,7 +177,7 @@ _artixpkg_completion() {
|
||||
COMPREPLY=()
|
||||
;;
|
||||
*)
|
||||
COMPREPLY=($(compgen -W "-m --maintainer --protocol -s --search -t --team -a --agent -j --jobs --all -h --help $(_artixpkg_remotepkgbase ${cur})" -- ${cur}))
|
||||
COMPREPLY=($(compgen -W "-m --maintainer --protocol -s --search -t --team -j --jobs --all -h --help $(_artixpkg_remotepkgbase ${cur})" -- ${cur}))
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
@@ -175,14 +197,11 @@ _artixpkg_completion() {
|
||||
;;
|
||||
"artixpkg git create"*)
|
||||
case "${prev}" in
|
||||
"-a"|"--agent")
|
||||
COMPREPLY=($(compgen -W "$agents" -- ${cur}))
|
||||
;;
|
||||
"-t"|"--team")
|
||||
COMPREPLY=($(compgen -W "$teams" -- ${cur}))
|
||||
;;
|
||||
*)
|
||||
COMPREPLY=($(compgen -W "-c --clone -a --agent -t --team -h --help" -- ${cur}))
|
||||
COMPREPLY=($(compgen -W "-c --clone -t --team -h --help" -- ${cur}))
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
@@ -212,29 +231,19 @@ _artixpkg_completion() {
|
||||
"-m"|"--maintainer")
|
||||
COMPREPLY=($(compgen -W "$(_artixpkg_maintainers)" -- ${cur}))
|
||||
;;
|
||||
"-t"|"--topic"|"-j"|"--jobs")
|
||||
"-t"|"--topic")
|
||||
# this flag expects a parameter
|
||||
COMPREPLY=()
|
||||
;;
|
||||
*)
|
||||
COMPREPLY=($(compgen -W "-m --maintainer -t --topic -j --jobs -h --help $(_artixpkg_pkgbase)" -- ${cur}))
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"artixpkg git ci"*)
|
||||
case "${prev}" in
|
||||
"-a"|"--agent")
|
||||
COMPREPLY=($(compgen -W "$agents" -- ${cur}))
|
||||
;;
|
||||
*)
|
||||
COMPREPLY=($(compgen -W "-a --agent -h --help $(_artixpkg_pkgbase)" -- ${cur}))
|
||||
COMPREPLY=($(compgen -W "-m --maintainer -t --topic -h --help $(_artixpkg_pkgbase)" -- ${cur}))
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"artixpkg admin maintainer"*)
|
||||
case "${comp_cword_all}" in
|
||||
3)
|
||||
COMPREPLY=($(compgen -W "-a --adopt --o --orphan -h --help" -- ${cur}))
|
||||
COMPREPLY=($(compgen -W "-a --adopt -o --orphan -h --help" -- ${cur}))
|
||||
;;
|
||||
*)
|
||||
COMPREPLY=($(compgen -W "-h --help $(_artixpkg_pkgbase)" -- ${cur}))
|
||||
@@ -272,7 +281,7 @@ _artixpkg_completion() {
|
||||
COMPREPLY=()
|
||||
;;
|
||||
*)
|
||||
COMPREPLY=($(compgen -W "-a --add -r --remove -d --del -j --jobs -h --help $(_artixpkg_pkgbase)" -- ${cur}))
|
||||
COMPREPLY=($(compgen -W "-a --add -r --remove -d --delete -j --jobs -h --help $(_artixpkg_pkgbase)" -- ${cur}))
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
@@ -142,7 +142,9 @@ artixpkg_repo_import() {
|
||||
esac
|
||||
done
|
||||
|
||||
update_patches
|
||||
if ! (( NP )); then
|
||||
update_patches
|
||||
fi
|
||||
|
||||
pkgbases+=("$@")
|
||||
|
||||
@@ -159,16 +161,18 @@ artixpkg_repo_import() {
|
||||
upstream="${arch_map["$pkgbase"]:-$pkgbase}"
|
||||
|
||||
stat_busy "Checking for upstream url"
|
||||
if ! git config --local --get remote.upstream.url &>/dev/null; then
|
||||
if ! git config get remote.upstream.url &>/dev/null; then
|
||||
git remote add upstream "${GIT_UPSTREAM_URL}/${upstream}".git
|
||||
fi
|
||||
stat_done
|
||||
|
||||
msg2 "Fetching upstream tags"
|
||||
git fetch --tags upstream main
|
||||
stat_busy "Fetching upstream tags"
|
||||
git fetch -fq --prune --tags upstream main
|
||||
stat_done
|
||||
|
||||
local latest version
|
||||
latest=$(git describe --tags FETCH_HEAD)
|
||||
|
||||
version="${latest}"
|
||||
if [[ -n "${TAG}" ]]; then
|
||||
version="${TAG}"
|
||||
@@ -180,16 +184,16 @@ artixpkg_repo_import() {
|
||||
warning "Could not query ${REPO_DB}"
|
||||
fi
|
||||
|
||||
git checkout "${version}" -b "${version}" &>/dev/null
|
||||
git checkout -q "${version}" -b "${version}"
|
||||
local temp
|
||||
temp=$(mktemp -d --tmpdir "${pkgbase}.XXXXXXXXXX")
|
||||
|
||||
rsync "${rsync_args[@]}" "$(pwd)"/ "${temp}"/ &>/dev/null
|
||||
git checkout master &>/dev/null
|
||||
git branch -D "${version}" &>/dev/null
|
||||
rsync "${rsync_args[@]}" -q "$(pwd)"/ "${temp}"/
|
||||
git checkout -q master
|
||||
git branch -q -D "${version}"
|
||||
|
||||
msg "Importing upstream changeset for ${version}"
|
||||
rsync "${rsync_args[@]}" "${temp}"/ "$(pwd)"/ #&>/dev/null
|
||||
rsync "${rsync_args[@]}" "${temp}"/ "$(pwd)"/
|
||||
|
||||
if ! (( NP )); then
|
||||
msg2 "Patching ${pkgbase} ..."
|
||||
|
@@ -138,6 +138,9 @@ artixpkg_repo_move() {
|
||||
update_yaml_move "${SRC}" "${DEST}"
|
||||
|
||||
team=$(detect_team)
|
||||
if [[ -z "$team" ]]; then
|
||||
team=$(team_from_yaml)
|
||||
fi
|
||||
update_yaml_team "${team}"
|
||||
|
||||
if [[ -z ${AGENT} ]]; then
|
||||
@@ -156,6 +159,9 @@ artixpkg_repo_move() {
|
||||
if [[ "$f" == "${REPO_DB}" ]]; then
|
||||
git add "$f"
|
||||
fi
|
||||
if [[ "$f" == "${REPO_CI}" ]]; then
|
||||
git add "$f"
|
||||
fi
|
||||
done
|
||||
for f in $(git ls-files --others); do
|
||||
if [[ "$f" == "${SRCINFO}" ]]; then
|
||||
|
@@ -112,7 +112,9 @@ artixpkg_repo_remove() {
|
||||
local commit_msg
|
||||
commit_msg=$(get_commit_msg 'remove' "${DEST}")
|
||||
|
||||
# pkg2yaml -o "${SRCINFO}"
|
||||
if ! [[ -f "${SRCINFO}" ]]; then
|
||||
pkg2yaml -o "${SRCINFO}"
|
||||
fi
|
||||
|
||||
upgrade_db
|
||||
|
||||
|
@@ -64,6 +64,8 @@ load_pkg_config(){
|
||||
|
||||
PATCH_URL=${PATCH_URL:-"${GIT_SSH}:artix/artix-patches.git"}
|
||||
|
||||
PKGDEST_DBG=${PKGDEST_DBG:-"${WORKSPACE_DIR}/packages-debug"}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@@ -31,6 +31,18 @@ remove(){
|
||||
# pkg removal will be done by a patched repo-remove honoring -R
|
||||
}
|
||||
|
||||
update_dbg() {
|
||||
local rmp
|
||||
rmp=${pkgname%"${PKGEXT}"}
|
||||
rmp=${rmp%-*}
|
||||
rmp=${rmp%-*}
|
||||
rm -fv "${PKGDEST_DBG}/${rmp}"*
|
||||
if pkgfile=$(find_cached_pkgfile "${pkgname}"); then
|
||||
msg "Found: %s" "${pkgfile}"
|
||||
ln -sfv "${pkgfile}" "${PKGDEST_DBG}"/
|
||||
fi
|
||||
}
|
||||
|
||||
repo_action() {
|
||||
local repo_path
|
||||
# shellcheck disable=SC2153
|
||||
@@ -40,11 +52,13 @@ repo_action() {
|
||||
for pkgname in "${passfiles[@]}"; do
|
||||
"$func"
|
||||
done
|
||||
( cd "${repo_path}" || return
|
||||
if [[ -n "${action}" ]]; then
|
||||
repo-"${action}" "${action_args[@]}" "${dest_repo}.${db_ext}" "${packages[@]}"
|
||||
fi
|
||||
)
|
||||
if ! "${dbg_pkg}"; then
|
||||
( cd "${repo_path}" || return
|
||||
if [[ -n "${action}" ]]; then
|
||||
repo-"${action}" "${action_args[@]}" "${dest_repo}.${db_ext}" "${packages[@]}"
|
||||
fi
|
||||
)
|
||||
fi
|
||||
}
|
||||
|
||||
#}}}
|
||||
@@ -55,9 +69,10 @@ db_ext="db.tar.${DBEXT}"
|
||||
|
||||
add_pkg=false
|
||||
rm_pkg=false
|
||||
dbg_pkg=false
|
||||
|
||||
cmd=${0##*/}
|
||||
dest_repo=${cmd#*-}
|
||||
dest_repo=world #${cmd#*-}
|
||||
action_args=(-R)
|
||||
|
||||
usage() {
|
||||
@@ -65,19 +80,21 @@ usage() {
|
||||
printf ' -d <dest> Destination repository\n'
|
||||
printf ' -a Add package(s) to repository\n'
|
||||
printf ' -r Remove package(s) from repository\n'
|
||||
printf ' -u Update debug repository\n'
|
||||
printf ' -h This help\n'
|
||||
printf '\n'
|
||||
printf '\n'
|
||||
exit "$1"
|
||||
}
|
||||
|
||||
opts='arLRhd:'
|
||||
opts='uarhd:'
|
||||
|
||||
while getopts "${opts}" arg; do
|
||||
case "${arg}" in
|
||||
d) dest_repo="$OPTARG" ;;
|
||||
a) add_pkg=true; rm_pkg=false ;;
|
||||
r) rm_pkg=true; add_pkg=false ;;
|
||||
u) dbg_pkg=true ;;
|
||||
h|?) usage 0 ;;
|
||||
esac
|
||||
done
|
||||
@@ -87,10 +104,14 @@ shift $(( OPTIND - 1 ))
|
||||
passfiles=("$@")
|
||||
|
||||
if [[ -n "${passfiles[*]}" ]]; then
|
||||
if ${add_pkg}; then
|
||||
repo_action add
|
||||
fi
|
||||
if ${rm_pkg}; then
|
||||
repo_action remove
|
||||
if ! "${dbg_pkg}"; then
|
||||
if ${add_pkg}; then
|
||||
repo_action add
|
||||
fi
|
||||
if ${rm_pkg}; then
|
||||
repo_action remove
|
||||
fi
|
||||
else
|
||||
repo_action update_dbg
|
||||
fi
|
||||
fi
|
||||
|
Reference in New Issue
Block a user