Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
etersoft-build-utils
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
korinf
etersoft-build-utils
Commits
ed7637d3
Commit
ed7637d3
authored
Feb 07, 2026
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rpmgp: add Repology API search for -a option
parent
506cf924
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
2 deletions
+55
-2
rpmgp
bin/rpmgp
+55
-2
No files found.
bin/rpmgp
View file @
ed7637d3
...
...
@@ -54,6 +54,52 @@ list_filter()
sed
-e
"s|.src.rpm
$|
|g"
}
# Search package in Repology API
# Usage: search_repology PKGNAME
search_repology
()
{
local
SPKGNAME
=
"
$1
"
local
REPOLOGY_URL
=
"https://repology.org/api/v1/project/
$SPKGNAME
"
local
TMPJSON
=
"
$OURTMPDIR
/etersoft-build-utils/repology.json"
mkdir
-p
"
$OURTMPDIR
/etersoft-build-utils/"
eget
-q
-O
"
$TMPJSON
"
"
$REPOLOGY_URL
"
2>/dev/null
||
return
1
[
-s
"
$TMPJSON
"
]
||
return
1
# check valid JSON
jq empty
"
$TMPJSON
"
2>/dev/null
||
{
rm
-f
"
$TMPJSON
"
;
return
1
;
}
local
RESULTS
# filter to rpm-based and major distros only
RESULTS
=
$(
jq
-r
'.[] | select(.repo | test("^(alt|fedora|epel|elrepo|rosa|mageia|openmandriva|opensuse|suse|pld|centos|rhel|scientific|oracle|rocky|alma|amazon|pclinuxos)")) | .repo + "\t" + (.srcname // .binname // .name) + "\t" + (.origversion // .version) + "\t" + .status'
"
$TMPJSON
"
|
sort
-u
)
rm
-f
"
$TMPJSON
"
[
-n
"
$RESULTS
"
]
||
return
1
echo
echo
"Repology results for '
$SPKGNAME
':"
echo
"
$RESULTS
"
|
while
IFS
=
' '
read
-r
repo srcname version status
;
do
printf
" %-30s %-30s %s (%s)
\n
"
"
$repo
"
"
$srcname
-
$version
"
"
$version
"
"
$status
"
done
return
0
}
# Try to download src.rpm found via Repology by searching in local cached lists
# Usage: download_repology_pkg PKGNAME
download_repology_pkg
()
{
local
SPKGNAME
=
"
$1
"
local
found
=
for
((
i
=
0
;
i <
${#
SYSNAME
[*]
}
;
i++
))
;
do
local
SYS
=
${
SYSNAME
[
$i
]
}
local
URL
=
${
SYSURL
[
$i
]
}
local
CLIST
=
"
$OURTMPDIR
/etersoft-build-utils/rpmgpall-
$SYS
"
[
-f
"
$CLIST
"
]
||
continue
local
MATCH
=
$(
grep
-i
"
$SPKGNAME
"
"
$CLIST
"
|
head
-1
)
[
-n
"
$MATCH
"
]
||
continue
echo
"Downloading
$MATCH
from
$SYS
..."
download_url
"
$URL
/
$MATCH
"
found
=
1
break
done
[
-n
"
$found
"
]
||
echo
"No cached list has a matching src.rpm for download. Run rpmgp -r first."
}
get_git_list
()
{
local
name
=
$1
...
...
@@ -224,7 +270,7 @@ phelp()
echog
" system - name of system (ALT Linux by default if -a missed)"
echo
echog
"Options:"
echog
" -a search pkgname in all known repositories"
echog
" -a search pkgname in all known repositories
(and Repology)
"
echog
" -b REPONAME binary repository name (4.1, p5, t6 and so on)"
echog
" -c check if this package exists in the ALT Linux repository"
echog
" -d download all matched packages"
...
...
@@ -506,7 +552,7 @@ if [ -n "$ALLSYSTEM" ] ; then
#info "Note: you can use whohas also"
NFLAG
=
load_systems_list
# search thro
w all
systems
# search thro
ugh all cached
systems
for
((
i
=
0
;
i <
${#
SYSNAME
[*]
}
;
i++
))
;
do
check_system
$i
>
/dev/null
[
-n
"
$NLIST
"
]
||
continue
...
...
@@ -515,9 +561,16 @@ if [ -n "$ALLSYSTEM" ] ; then
print_list
$NLIST
NFLAG
=
1
done
# search via Repology API (broader coverage)
if
search_repology
"
$PKGNAME
"
;
then
NFLAG
=
1
fi
if
[
-z
"
$NFLAG
"
]
;
then
echo
"No search result for
$PKGNAME
. Check rpmgp -s for list of all systems."
fi
if
[
-n
"
$DOWNLOADALL
"
]
&&
[
-n
"
$NFLAG
"
]
;
then
download_repology_pkg
"
$PKGNAME
"
fi
exit
0
fi
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment