bin/xbps-create: add support for recording provides priority information
The provides-priority property is specified as a space-separated array of comma-separated keys and values that record the priority which xbps should give to a virtual package a package provides. Keys are pkgvers, and values are positive integers. Higher values will be given a higher priority, and missing entries will be given a priority of 0 by default.
This is implemented as a generic function with validation and parsing callbacks so it can be used for other properties that are dictionaries.
The alternatives property handling is genericised too.
example:
xbps-create -A noarch -n foo-1.0_1 -s "foo pkg" \
-P "cmd:foo-1.0_1 foo-0_1 awk-0_1" \
--provides-priority "foo-0_1,100 awk-0_1,25" \
--alternatives "vi:vi:/usr/bin/nvim vi:vi.1:/usr/share/man/man1/nvim.1 vi:view:/usr/bin/nvim vi:view.1:/usr/share/man/man1/nvim.1 vim:vim:/usr/bin/nvim vim:vim.1:/usr/share/man/man1/nvim.1" \
/tmp/pkg
creates this props.plist (only diff between this branch and master is the new property):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>alternatives</key>
<dict>
<key>vi</key>
<array>
<string>vi:/usr/bin/nvim</string>
<string>vi.1:/usr/share/man/man1/nvim.1</string>
<string>view:/usr/bin/nvim</string>
<string>view.1:/usr/share/man/man1/nvim.1</string>
</array>
<key>vim</key>
<array>
<string>vim:/usr/bin/nvim</string>
<string>vim.1:/usr/share/man/man1/nvim.1</string>
</array>
</dict>
<key>architecture</key>
<string>noarch</string>
<key>installed_size</key>
<integer>0</integer>
<key>pkgname</key>
<string>foo</string>
<key>pkgver</key>
<string>foo-1.0_1</string>
<key>provides</key>
<array>
<string>cmd:foo-1.0_1</string>
<string>foo-0_1</string>
<string>awk-0_1</string>
</array>
<key>provides-priority</key>
<dict>
<key>awk-0_1</key>
<integer>25</integer>
<key>foo-0_1</key>
<integer>100</integer>
</dict>
<key>short_desc</key>
<string>foo pkg</string>
<key>version</key>
<string>1.0_1</string>
</dict>
</plist>
@classabbyamp did you use any AI/LLM tools to make this PR?