List packages by repository

14 views
Skip to first unread message

Chris Landa

unread,
May 3, 2022, 2:11:05 PM5/3/22
to opkg-devel
I have an opkg setup with multiple repositories and would like to list packages belonging to a specific repository. Basically 'opkg list' with some extra parameter to limit by repository. I don't thinks this functionality is available, unless I am missing something. I also did not find a way to just parse the information that I want from available output.

What is the best practice to get this information? I was thinking about passing different configs with the -f parameter but this seems rather cumbersome...

Thanks,
Chris

Alex Stewart

unread,
May 3, 2022, 6:53:14 PM5/3/22
to Chris Landa, opkg-...@googlegroups.com
Hey Chris,

On 5/3/22 13:11, Chris Landa wrote:
> I have an opkg setup with multiple repositories and would like to list
> packages belonging to a specific repository. Basically 'opkg list'
> with some extra parameter to limit by repository. I don't thinks this
> functionality is available, unless I am missing something. I also did
> not find a way to just parse the information that I want from
> available output.

You're correct that opkg doesn't have a way to limit the `list` output
to a particular repository.

I can't think of any compelling reasons not to implement that feature.
So, if it is important to you that opkg have that ability, I would be
happy to accept a patchset.

> What is the best practice to get this information? I was thinking
> about passing different configs with the -f parameter but this seems
> rather cumbersome...

Without modifying opkg, you could manually parse the package indexes
stored on disk. After `opkg update`, the index files are stored locally
- usually under `/var/lib/opkg/lists`, or wherever your opkg
variable-store is located. The indexes are simple record-jar formatted
files, and are namespaced by their feed name. I imagine you could simply
parse out the metadata that you're interested in.

eg.
```
# ls -la
total 6860
drwxr-xr-x    2 admin    administ         0 Apr 18 06:11 ./
drwxr-xr-x    4 admin    administ         0 Apr 18 06:12 ../
-rw-r--r--    1 admin    administ     43833 Apr 18 06:11 NI-lv-software
-rw-r--r--    1 admin    administ     43833 Apr 18 06:11 NI-main-software
-rw-r--r--    1 admin    administ    338349 Apr 18 06:11 NIOE-all
-rw-r--r--    1 admin    administ   5784887 Apr 18 06:11 NIOE-core2-64
-rw-r--r--    1 admin    administ    804318 Apr 18 06:11 NIOE-x64
# grep -e '^Package:' NIOE-all NIOE-x64 | cut -d':' -f3 | sort
 adwaita-icon-theme
 adwaita-icon-theme-cursors
 adwaita-icon-theme-hires
 adwaita-icon-theme-lic
 adwaita-icon-theme-symbolic
<snip/>
```

--
Alex Stewart
Software Engineer - NI Real-Time OS
NI (National Instruments)

alex.s...@ni.com

Chris Landa

unread,
May 5, 2022, 11:02:00 AM5/5/22
to opkg-devel
Hey Alex,

On Wednesday, May 4, 2022 at 12:53:14 AM UTC+2 Alex Stewart wrote:
Hey Chris,

On 5/3/22 13:11, Chris Landa wrote:
> I have an opkg setup with multiple repositories and would like to list
> packages belonging to a specific repository. Basically 'opkg list'
> with some extra parameter to limit by repository. I don't thinks this
> functionality is available, unless I am missing something. I also did
> not find a way to just parse the information that I want from
> available output.

You're correct that opkg doesn't have a way to limit the `list` output
to a particular repository.

I can't think of any compelling reasons not to implement that feature.
So, if it is important to you that opkg have that ability, I would be
happy to accept a patchset.

I will evaluate the other option you posted below and if that does not satisfy me needs, I will provide a patchset.
I am a bit hesitant to do so since the opkg I am using is part of a different env (entware) and I am not sure how fast they would pull in the patched version.
Thank you - I will see if this might be a solution for me
Reply all
Reply to author
Forward
0 new messages