Skip to content

Conversation

classabbyamp
Copy link
Member

@classabbyamp classabbyamp commented Jun 24, 2025

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 classabbyamp force-pushed the priority-flash-traffic branch 4 times, most recently from 833f6f2 to fe865e6 Compare June 24, 2025 23:05
@classabbyamp classabbyamp marked this pull request as ready for review June 24, 2025 23:07
@classabbyamp classabbyamp force-pushed the priority-flash-traffic branch 2 times, most recently from 967027d to ed25ebe Compare June 24, 2025 23:17
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.
@classabbyamp classabbyamp force-pushed the priority-flash-traffic branch from ed25ebe to c874c15 Compare June 24, 2025 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant