Skip to content

Commit 53317a6

Browse files
committed
update and add options:
* update search option - to native search pkg with xbps-query * update-sys - Rebuilds packages in system and updates them
1 parent 7e85b2e commit 53317a6

File tree

1 file changed

+23
-67
lines changed

1 file changed

+23
-67
lines changed

vpsm

Lines changed: 23 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -252,69 +252,6 @@ shift
252252
current_branch=$(git rev-parse --abbrev-ref HEAD)
253253
template_path=$VOID_PKGS/srcpkgs/$@/template
254254

255-
longest_word () {
256-
declare -a pkgs=$@
257-
declare -i longest=0
258-
for pkg in ${pkgs[@]}
259-
do
260-
if [ ${#pkg} -gt $longest ]; then
261-
longest=${#pkg}
262-
fi
263-
done
264-
265-
echo $longest
266-
}
267-
268-
whitespaces() {
269-
i=0
270-
space=" "
271-
qnt_ws=$(($1 - $2))
272-
273-
while [[ "$i" != $qnt_ws ]]
274-
do
275-
space+=" "
276-
((i+=1))
277-
done
278-
echo "$space"
279-
280-
}
281-
282-
show_desc () {
283-
./xbps-src show "$1" | rg short_desc | awk '{$1=""; print $0}'
284-
}
285-
286-
if_instaled () {
287-
[[ "$1" != '' ]] && flag="[$colorgray*$colorreset]" || flag="[-]"
288-
echo -n "$flag"
289-
}
290-
291-
lsgrep_binpkgs () {
292-
[ -d "$VOID_BINPKGS/*" ] && ls $VOID_BINPKGS/* | rg $1 || echo ''
293-
}
294-
295-
check_binpkgs () {
296-
check=$(lsgrep_binpkgs "$1")
297-
resul=$(if_instaled $check)
298-
echo -n "$resul"
299-
}
300-
301-
search_result () {
302-
declare -a res=()
303-
304-
pkgs=$(ls $VOID_SRCPKGS | rg $1)
305-
lword=$(longest_word ${pkgs[@]})
306-
307-
for pkg in ${pkgs[@]}
308-
do
309-
wsnum=$(whitespaces $lword ${#pkg})
310-
desc=$(show_desc $pkg)
311-
inststr=$(check_binpkgs $pkg)
312-
res+=("$inststr $pkg$wsnum-$desc")
313-
done
314-
315-
printf '%s\n' "${res[@]}"
316-
}
317-
318255
build_binary () {
319256
./xbps-src pkg "$@" | \
320257
while read line
@@ -341,6 +278,19 @@ xgensum_config() {
341278
done
342279
}
343280

281+
addrepos() {
282+
check_repos=$(find $VOID_BINPKGS/* -type d)
283+
declare -a repos
284+
for repo in ${check_repos[@]}
285+
do
286+
if ! [[ "$repo" =~ repodata ]];then
287+
repos+="--repository=$repo "
288+
fi
289+
done
290+
291+
echo "${repos[@]}"
292+
}
293+
344294
case "$cmd" in
345295

346296
# clone repo with ssh
@@ -426,8 +376,9 @@ case "$cmd" in
426376
;;
427377

428378
search|s)
379+
repos=$(addrepos)
429380
msg -n "Searching for: $* "
430-
wrapcommand search_result "$@"
381+
wrapcommand xbps-query $repos -Rs "$@"
431382
;;
432383

433384
show|sw)
@@ -445,15 +396,20 @@ case "$cmd" in
445396
shopt -u globstar
446397
;;
447398

448-
update|up)
399+
update-repo|upr)
449400
msg "Update void-packages from void-linux remote master"
450401
git pull void-linux master
451402
msg "Push commits to my own repo"
452403
git push -u origin $current_branch
453404
;;
454405

406+
update-sys|ups)
407+
msg "Rebuilds packages in system and updates them."
408+
wrapcommand ./xbps-src update-sys
409+
;;
410+
455411
xgsum)
456-
msg -n "Generate/Update SHA256 sum in: $*/template "
412+
msg -n "Generate/Update SHA256 sum in: $@/template "
457413
wrapcommand xgensum_config $template_path
458414
;;
459415

@@ -464,7 +420,7 @@ case "$cmd" in
464420
add-commit-new-pkg|anp)
465421
msg "Add new package to repository: branch -> $current_branch"
466422
git add .
467-
wrapcomand git commit -m "New package: $*"
423+
wrapcomand git commit -m "New package: $@"
468424
;;
469425

470426
push-commit|pc)

0 commit comments

Comments
 (0)