FreshPorts / freshports

The website part of FreshPorts
http://www.freshports.org/
BSD 2-Clause "Simplified" License
69 stars 24 forks source link

freshports search for <package name> yields no results for some existing packages #481

Closed EHWV closed 12 months ago

EHWV commented 1 year ago

It seems some packages cannot be found through freshports' own search engine via their package name, although a pkg-search(8) confirms their existance.

At the fresports search page, first selecting "Package Name" from the drop-down and using the default drop-down "containing". Then in the search input field for example: emacs-nox or gpu-firmware-amd-kmod-beige-goby outputs no results[*] ("emacs-nox" used to be a separate package "editors/emacs-nox11"--now deleted).

Using pkg(8):

# pkg search emacs-nox
emacs-nox-29.1,3               GNU editing macros (No X flavor)
# pkg search gpu-firmware-amd-kmod-beige-goby
gpu-firmware-amd-kmod-beige-goby-20230210_1 Firmware modules for beige_goby AMD GPUs

It looks like that packages that have been created from a flavor of a port ("graphics/gpu-firmware-amd-kmod" and "editors/emacs" as mentioned here) cannot be found directly using their package name in freshports' own search engine.


[*] However, using the freshports added google "search bar" does refer to the ports "editors/emacs" and "graphics/gpu-firmware-amd-kmod" where, upon closer inspection and after scrolling down to "Packages (timestamps in pop-ups are UTC):", they are listed.

dlangille commented 1 year ago

What is the output of this command on that server please?

pkg -vv | grep url

dlangille commented 1 year ago

FreshPorts knows the package name based on this command:

[14:39 empty dan /usr/ports/editors/emacs] % make -V PKGNAME
emacs-29.1_1,3

It is not searching for flavors. Good point. Let's check the database....

dlangille commented 1 year ago

Look there, we have that data, we just aren't searching it:

freshports.devgit=# select * from package_flavors where port_id = (select id from ports_active where name = 'emacs');
   id   | port_id | flavor_id |    name     | flavor_number 
--------+---------+-----------+-------------+---------------
 168375 |    1545 |        22 | emacs       |             0
 168376 |    1545 |        23 | emacs-canna |             1
 168377 |    1545 |        24 | emacs-nox   |             2
(3 rows)

freshports.devgit=# 

Based on that, it should be easy enough to accomplish this goal. :)

EHWV commented 1 year ago

What is the output of this command on that server please?

pkg -vv | grep url

# pkg -vv | grep url
    url             : "pkg+http://pkg.FreeBSD.org/FreeBSD:12:amd64/latest",
dlangille commented 1 year ago

Here is the complete list:

freshports.devgit=#   SELECT E.name as port,
         C.name as category,
         PF.name as pkg_name
  FROM ports P LEFT OUTER JOIN ports_vulnerable    PV  ON PV.port_id       = P.id
               LEFT OUTER JOIN commit_log          CL  ON P.last_commit_id = CL.id
               LEFT OUTER JOIN repo                R   ON CL.repo_id       = R.id
               LEFT OUTER JOIN commit_log_branches CLB ON CL.id            = CLB.commit_log_id
                          JOIN system_branch       SB  ON SB.branch_name   = 'head'
                                                      AND SB.id            = CLB.branch_id
 JOIN package_flavors PF on P.id = PF.port_id AND PF.name ILIKE '%emacs%'
  , categories C, element E

    WHERE P.category_id  = C.id
      AND P.element_id   = E.id
      and E.status = 'A'

          order by category, port, pkg_name
freshports.devgit-# ;
         port         | category  |               pkg_name               
----------------------+-----------+--------------------------------------
 emms                 | audio     | emms-emacs_canna
 emms                 | audio     | emms-emacs_devel
 emms                 | audio     | emms-emacs_devel_nox
 emms                 | audio     | emms-emacs_nox
 dinotrace            | cad       | dinotrace-emacs_canna
 dinotrace            | cad       | dinotrace-emacs_devel
 dinotrace            | cad       | dinotrace-emacs_devel_nox
 dinotrace            | cad       | dinotrace-emacs_nox
 verilog-mode.el      | cad       | verilog-mode.el-emacs_canna
 verilog-mode.el      | cad       | verilog-mode.el-emacs_devel
 verilog-mode.el      | cad       | verilog-mode.el-emacs_devel_nox
 verilog-mode.el      | cad       | verilog-mode.el-emacs_nox
 bbdb                 | databases | bbdb-emacs_canna
 bbdb                 | databases | bbdb-emacs_devel
 bbdb                 | databases | bbdb-emacs_devel_nox
 bbdb                 | databases | bbdb-emacs_nox
 closql               | databases | closql-emacs_canna
 closql               | databases | closql-emacs_devel
 closql               | databases | closql-emacs_devel_nox
 closql               | databases | closql-emacs_nox
 closql-devel         | databases | closql-devel-emacs_canna
 closql-devel         | databases | closql-devel-emacs_devel
 closql-devel         | databases | closql-devel-emacs_devel_nox
 closql-devel         | databases | closql-devel-emacs_nox
 emacs-sqlite3-api    | databases | emacs-sqlite3-api
 emacs-sqlite3-api    | databases | emacs-sqlite3-api-emacs_canna
 emacs-sqlite3-api    | databases | emacs-sqlite3-api-emacs_devel
 emacs-sqlite3-api    | databases | emacs-sqlite3-api-emacs_devel_nox
 emacs-sqlite3-api    | databases | emacs-sqlite3-api-emacs_nox
 emacsql              | databases | emacsql
 emacsql              | databases | emacsql-emacs_canna
 emacsql              | databases | emacsql-emacs_devel
 emacsql              | databases | emacsql-emacs_devel_nox
 emacsql              | databases | emacsql-emacs_nox
 emacsql-devel        | databases | emacsql-devel
 emacsql-devel        | databases | emacsql-devel-emacs_canna
 emacsql-devel        | databases | emacsql-devel-emacs_devel
 emacsql-devel        | databases | emacsql-devel-emacs_devel_nox
 emacsql-devel        | databases | emacsql-devel-emacs_nox
 pg.el                | databases | pg.el-emacs_canna
 pg.el                | databases | pg.el-emacs_devel
 pg.el                | databases | pg.el-emacs_devel_nox
 pg.el                | databases | pg.el-emacs_nox
 howm                 | deskutils | howm-emacs_canna
 howm                 | deskutils | howm-emacs_devel
 howm                 | deskutils | howm-emacs_devel_nox
 howm                 | deskutils | howm-emacs_nox
 cask                 | devel     | cask-emacs_canna
 cask                 | devel     | cask-emacs_devel
 cask                 | devel     | cask-emacs_devel_nox
 cask                 | devel     | cask-emacs_nox
 clojure-cider        | devel     | clojure-cider-emacs_canna
 clojure-cider        | devel     | clojure-cider-emacs_devel
 clojure-cider        | devel     | clojure-cider-emacs_devel_nox
 clojure-cider        | devel     | clojure-cider-emacs_nox
 dash.el              | devel     | dash.el-emacs_canna
 dash.el              | devel     | dash.el-emacs_devel
 dash.el              | devel     | dash.el-emacs_devel_nox
 dash.el              | devel     | dash.el-emacs_nox
 distel               | devel     | distel-emacs_canna
 distel               | devel     | distel-emacs_devel
 distel               | devel     | distel-emacs_devel_nox
 distel               | devel     | distel-emacs_nox
 epl.el               | devel     | epl.el-emacs_canna
 epl.el               | devel     | epl.el-emacs_devel
 epl.el               | devel     | epl.el-emacs_devel_nox
 epl.el               | devel     | epl.el-emacs_nox
 forge                | devel     | forge-emacs_canna
 forge                | devel     | forge-emacs_devel
 forge                | devel     | forge-emacs_devel_nox
 forge                | devel     | forge-emacs_nox
 forge-devel          | devel     | forge-devel-emacs_canna
 forge-devel          | devel     | forge-devel-emacs_devel
 forge-devel          | devel     | forge-devel-emacs_devel_nox
 forge-devel          | devel     | forge-devel-emacs_nox
 ghub                 | devel     | ghub-emacs_canna
 ghub                 | devel     | ghub-emacs_devel
 ghub                 | devel     | ghub-emacs_devel_nox
 ghub                 | devel     | ghub-emacs_nox
 ghub-devel           | devel     | ghub-devel-emacs_canna
 ghub-devel           | devel     | ghub-devel-emacs_devel
 ghub-devel           | devel     | ghub-devel-emacs_devel_nox
 ghub-devel           | devel     | ghub-devel-emacs_nox
 git-modes            | devel     | git-modes-emacs_canna
 git-modes            | devel     | git-modes-emacs_devel
 git-modes            | devel     | git-modes-emacs_devel_nox
 git-modes            | devel     | git-modes-emacs_nox
 libegit2             | devel     | libegit2-emacs_canna
 libegit2             | devel     | libegit2-emacs_devel
 libegit2             | devel     | libegit2-emacs_devel_nox
 libegit2             | devel     | libegit2-emacs_nox
 lua-mode             | devel     | lua-mode-emacs_canna
 lua-mode             | devel     | lua-mode-emacs_devel
 lua-mode             | devel     | lua-mode-emacs_devel_nox
 lua-mode             | devel     | lua-mode-emacs_nox
 magit                | devel     | magit-emacs_canna
 magit                | devel     | magit-emacs_devel
 magit                | devel     | magit-emacs_devel_nox
 magit                | devel     | magit-emacs_nox
 magit-devel          | devel     | magit-devel-emacs_canna
 magit-devel          | devel     | magit-devel-emacs_devel
 magit-devel          | devel     | magit-devel-emacs_devel_nox
 magit-devel          | devel     | magit-devel-emacs_nox
 p5-Sepia             | devel     | p5-Sepia-emacs_canna
 p5-Sepia             | devel     | p5-Sepia-emacs_devel
 p5-Sepia             | devel     | p5-Sepia-emacs_devel_nox
 p5-Sepia             | devel     | p5-Sepia-emacs_nox
 pkg-info.el          | devel     | pkg-info.el-emacs_canna
 pkg-info.el          | devel     | pkg-info.el-emacs_devel
 pkg-info.el          | devel     | pkg-info.el-emacs_devel_nox
 pkg-info.el          | devel     | pkg-info.el-emacs_nox
 psvn                 | devel     | psvn-emacs_canna
 psvn                 | devel     | psvn-emacs_devel
 psvn                 | devel     | psvn-emacs_devel_nox
 psvn                 | devel     | psvn-emacs_nox
 tablist              | devel     | tablist-emacs_canna
 tablist              | devel     | tablist-emacs_devel
 tablist              | devel     | tablist-emacs_devel_nox
 tablist              | devel     | tablist-emacs_nox
 transient            | devel     | transient-emacs_canna
 transient            | devel     | transient-emacs_devel
 transient            | devel     | transient-emacs_devel_nox
 transient            | devel     | transient-emacs_nox
 transient-devel      | devel     | transient-devel-emacs_canna
 transient-devel      | devel     | transient-devel-emacs_devel
 transient-devel      | devel     | transient-devel-emacs_devel_nox
 transient-devel      | devel     | transient-devel-emacs_nox
 treepy.el            | devel     | treepy.el-emacs_canna
 treepy.el            | devel     | treepy.el-emacs_devel
 treepy.el            | devel     | treepy.el-emacs_devel_nox
 treepy.el            | devel     | treepy.el-emacs_nox
 apel                 | editors   | apel-emacs_canna
 apel                 | editors   | apel-emacs_devel
 apel                 | editors   | apel-emacs_devel_nox
 apel                 | editors   | apel-emacs_nox
 emacs                | editors   | emacs
 emacs                | editors   | emacs-canna
 emacs                | editors   | emacs-nox
 emacs-devel          | editors   | emacs-devel
 emacs-devel          | editors   | emacs-devel-nox
 flim                 | editors   | flim-emacs_canna
 flim                 | editors   | flim-emacs_devel
 flim                 | editors   | flim-emacs_devel_nox
 flim                 | editors   | flim-emacs_nox
 paredit-mode.el      | editors   | paredit-mode.el-emacs_canna
 paredit-mode.el      | editors   | paredit-mode.el-emacs_devel
 paredit-mode.el      | editors   | paredit-mode.el-emacs_devel_nox
 paredit-mode.el      | editors   | paredit-mode.el-emacs_nox
 psgml                | editors   | psgml-emacs_canna
 psgml                | editors   | psgml-emacs_devel
 psgml                | editors   | psgml-emacs_devel_nox
 psgml                | editors   | psgml-emacs_nox
 semi                 | editors   | semi-emacs_canna
 semi                 | editors   | semi-emacs_devel
 semi                 | editors   | semi-emacs_devel_nox
 semi                 | editors   | semi-emacs_nox
 slime                | editors   | slime-emacs_canna
 slime                | editors   | slime-emacs_devel
 slime                | editors   | slime-emacs_devel_nox
 slime                | editors   | slime-emacs_nox
 sly                  | editors   | sly-emacs_canna
 sly                  | editors   | sly-emacs_devel
 sly                  | editors   | sly-emacs_devel_nox
 sly                  | editors   | sly-emacs_nox
 sly-asdf             | editors   | sly-asdf-emacs_canna
 sly-asdf             | editors   | sly-asdf-emacs_devel
 sly-asdf             | editors   | sly-asdf-emacs_devel_nox
 sly-asdf             | editors   | sly-asdf-emacs_nox
 sly-named-readtables | editors   | sly-named-readtables-emacs_canna
 sly-named-readtables | editors   | sly-named-readtables-emacs_devel
 sly-named-readtables | editors   | sly-named-readtables-emacs_devel_nox
 sly-named-readtables | editors   | sly-named-readtables-emacs_nox
 sly-quicklisp        | editors   | sly-quicklisp-emacs_canna
 sly-quicklisp        | editors   | sly-quicklisp-emacs_devel
 sly-quicklisp        | editors   | sly-quicklisp-emacs_devel_nox
 sly-quicklisp        | editors   | sly-quicklisp-emacs_nox
 tamago               | editors   | tamago-emacs_canna
 tamago               | editors   | tamago-emacs_devel
 tamago               | editors   | tamago-emacs_devel_nox
 tamago               | editors   | tamago-emacs_nox
 web-mode             | editors   | web-mode-emacs_canna
 web-mode             | editors   | web-mode-emacs_devel
 web-mode             | editors   | web-mode-emacs_devel_nox
 web-mode             | editors   | web-mode-emacs_nox
 with-editor          | editors   | with-editor-emacs_canna
 with-editor          | editors   | with-editor-emacs_devel
 with-editor          | editors   | with-editor-emacs_devel_nox
 with-editor          | editors   | with-editor-emacs_nox
 with-editor-devel    | editors   | with-editor-devel-emacs_canna
 with-editor-devel    | editors   | with-editor-devel-emacs_devel
 with-editor-devel    | editors   | with-editor-devel-emacs_devel_nox
 with-editor-devel    | editors   | with-editor-devel-emacs_nox
 riece                | irc       | riece-emacs_canna
 riece                | irc       | riece-emacs_devel
 riece                | irc       | riece-emacs_devel_nox
 riece                | irc       | riece-emacs_nox
 boiled-mozc          | japanese  | ja-boiled-mozc-emacs_canna
 boiled-mozc          | japanese  | ja-boiled-mozc-emacs_devel
 boiled-mozc          | japanese  | ja-boiled-mozc-emacs_devel_nox
 boiled-mozc          | japanese  | ja-boiled-mozc-emacs_nox
 cp5022x-el           | japanese  | ja-cp5022x-el-emacs_canna
 cp5022x-el           | japanese  | ja-cp5022x-el-emacs_devel
 cp5022x-el           | japanese  | ja-cp5022x-el-emacs_devel_nox
 cp5022x-el           | japanese  | ja-cp5022x-el-emacs_nox
 ddskk                | japanese  | ja-ddskk-emacs_canna
 ddskk                | japanese  | ja-ddskk-emacs_devel
 ddskk                | japanese  | ja-ddskk-emacs_devel_nox
 ddskk                | japanese  | ja-ddskk-emacs_nox
 lookup               | japanese  | ja-lookup-emacs_canna
 lookup               | japanese  | ja-lookup-emacs_devel
 lookup               | japanese  | ja-lookup-emacs_devel_nox
 lookup               | japanese  | ja-lookup-emacs_nox
 migemo.el            | japanese  | ja-migemo.el-emacs_canna
 migemo.el            | japanese  | ja-migemo.el-emacs_devel
 migemo.el            | japanese  | ja-migemo.el-emacs_devel_nox
 migemo.el            | japanese  | ja-migemo.el-emacs_nox
 mozc-el              | japanese  | ja-mozc-el-emacs_canna
 mozc-el              | japanese  | ja-mozc-el-emacs_devel
 mozc-el              | japanese  | ja-mozc-el-emacs_devel_nox
 mozc-el              | japanese  | ja-mozc-el-emacs_nox
 navi2ch              | japanese  | ja-navi2ch-emacs_canna
 navi2ch              | japanese  | ja-navi2ch-emacs_devel
 navi2ch              | japanese  | ja-navi2ch-emacs_devel_nox
 navi2ch              | japanese  | ja-navi2ch-emacs_nox
 yc.el                | japanese  | ja-yc.el-emacs_canna
 yc.el                | japanese  | ja-yc.el-emacs_nox
 alchemist.el         | lang      | alchemist.el-emacs_canna
 alchemist.el         | lang      | alchemist.el-emacs_devel
 alchemist.el         | lang      | alchemist.el-emacs_devel_nox
 alchemist.el         | lang      | alchemist.el-emacs_nox
 clojure-mode.el      | lang      | clojure-mode.el-emacs_canna
 clojure-mode.el      | lang      | clojure-mode.el-emacs_devel
 clojure-mode.el      | lang      | clojure-mode.el-emacs_devel_nox
 clojure-mode.el      | lang      | clojure-mode.el-emacs_nox
 csharp-mode.el       | lang      | csharp-mode.el-emacs_canna
 csharp-mode.el       | lang      | csharp-mode.el-emacs_devel
 csharp-mode.el       | lang      | csharp-mode.el-emacs_devel_nox
 csharp-mode.el       | lang      | csharp-mode.el-emacs_nox
 elixir-mode.el       | lang      | elixir-mode.el-emacs_canna
 elixir-mode.el       | lang      | elixir-mode.el-emacs_devel
 elixir-mode.el       | lang      | elixir-mode.el-emacs_devel_nox
 elixir-mode.el       | lang      | elixir-mode.el-emacs_nox
 haskell-mode.el      | lang      | haskell-mode-emacs_canna
 haskell-mode.el      | lang      | haskell-mode-emacs_devel
 haskell-mode.el      | lang      | haskell-mode-emacs_devel_nox
 haskell-mode.el      | lang      | haskell-mode-emacs_nox
 php-mode.el          | lang      | php-mode.el-emacs_canna
 php-mode.el          | lang      | php-mode.el-emacs_devel
 php-mode.el          | lang      | php-mode.el-emacs_devel_nox
 php-mode.el          | lang      | php-mode.el-emacs_nox
 tuareg-mode.el       | lang      | tuareg-mode-emacs_canna
 tuareg-mode.el       | lang      | tuareg-mode-emacs_devel
 tuareg-mode.el       | lang      | tuareg-mode-emacs_devel_nox
 tuareg-mode.el       | lang      | tuareg-mode-emacs_nox
 c-sig                | mail      | c-sig-emacs_canna
 c-sig                | mail      | c-sig-emacs_devel
 c-sig                | mail      | c-sig-emacs_devel_nox
 c-sig                | mail      | c-sig-emacs_nox
 mailest              | mail      | mailest-emacs_canna
 mailest              | mail      | mailest-emacs_devel
 mailest              | mail      | mailest-emacs_devel_nox
 mailest              | mail      | mailest-emacs_nox
 mew                  | mail      | mew-emacs_canna
 mew                  | mail      | mew-emacs_devel
 mew                  | mail      | mew-emacs_devel_nox
 mew                  | mail      | mew-emacs_nox
 mew-devel            | mail      | mew-devel-emacs_canna
 mew-devel            | mail      | mew-devel-emacs_devel
 mew-devel            | mail      | mew-devel-emacs_devel_nox
 mew-devel            | mail      | mew-devel-emacs_nox
 mu4e                 | mail      | mu4e-emacs_canna
 mu4e                 | mail      | mu4e-emacs_devel
 mu4e                 | mail      | mu4e-emacs_devel_nox
 mu4e                 | mail      | mu4e-emacs_nox
 mu4e-maildirs        | mail      | mu4e-maildirs-emacs_canna
 mu4e-maildirs        | mail      | mu4e-maildirs-emacs_devel
 mu4e-maildirs        | mail      | mu4e-maildirs-emacs_devel_nox
 mu4e-maildirs        | mail      | mu4e-maildirs-emacs_nox
 notmuch-emacs        | mail      | notmuch-emacs
 notmuch-emacs        | mail      | notmuch-emacs_canna
 notmuch-emacs        | mail      | notmuch-emacs_devel
 notmuch-emacs        | mail      | notmuch-emacs_devel_nox
 notmuch-emacs        | mail      | notmuch-emacs_nox
 wanderlust           | mail      | wanderlust-emacs_canna
 wanderlust           | mail      | wanderlust-emacs_devel
 wanderlust           | mail      | wanderlust-emacs_devel_nox
 wanderlust           | mail      | wanderlust-emacs_nox
 x-face-e21           | mail      | x-face-e21-emacs_canna
 x-face-e21           | mail      | x-face-e21-emacs_devel
 x-face-e21           | mail      | x-face-e21-emacs_devel_nox
 x-face-e21           | mail      | x-face-e21-emacs_nox
 xcite                | mail      | xcite-emacs_canna
 xcite                | mail      | xcite-emacs_devel
 xcite                | mail      | xcite-emacs_devel_nox
 xcite                | mail      | xcite-emacs_nox
 coq                  | math      | coq-emacs_canna
 coq                  | math      | coq-emacs_devel
 coq                  | math      | coq-emacs_devel_nox
 coq                  | math      | coq-emacs_nox
 ess                  | math      | ess-emacs_canna
 ess                  | math      | ess-emacs_devel
 ess                  | math      | ess-emacs_devel_nox
 ess                  | math      | ess-emacs_nox
 compat.el            | misc      | compat.el-emacs_canna
 compat.el            | misc      | compat.el-emacs_devel
 compat.el            | misc      | compat.el-emacs_devel_nox
 compat.el            | misc      | compat.el-emacs_nox
 elscreen             | misc      | elscreen-emacs_canna
 elscreen             | misc      | elscreen-emacs_devel
 elscreen             | misc      | elscreen-emacs_devel_nox
 elscreen             | misc      | elscreen-emacs_nox
 auctex               | print     | auctex-emacs_canna
 auctex               | print     | auctex-emacs_devel
 auctex               | print     | auctex-emacs_devel_nox
 auctex               | print     | auctex-emacs_nox
 hyperlatex           | print     | Hyperlatex-emacs_canna
 hyperlatex           | print     | Hyperlatex-emacs_devel
 hyperlatex           | print     | Hyperlatex-emacs_devel_nox
 hyperlatex           | print     | Hyperlatex-emacs_nox
 pdf-tools            | print     | pdf-tools-emacs_canna
 pdf-tools            | print     | pdf-tools-emacs_devel
 starttls             | security  | starttls-emacs_canna
 starttls             | security  | starttls-emacs_devel
 starttls             | security  | starttls-emacs_devel_nox
 starttls             | security  | starttls-emacs_nox
 puppet-mode.el       | sysutils  | puppet-mode.el-emacs_canna
 puppet-mode.el       | sysutils  | puppet-mode.el-emacs_devel
 puppet-mode.el       | sysutils  | puppet-mode.el-emacs_devel_nox
 puppet-mode.el       | sysutils  | puppet-mode.el-emacs_nox
 adoc-mode.el         | textproc  | adoc-mode.el-emacs_canna
 adoc-mode.el         | textproc  | adoc-mode.el-emacs_devel
 adoc-mode.el         | textproc  | adoc-mode.el-emacs_devel_nox
 adoc-mode.el         | textproc  | adoc-mode.el-emacs_nox
 dictem               | textproc  | dictem-emacs_canna
 dictem               | textproc  | dictem-emacs_devel
 dictem               | textproc  | dictem-emacs_devel_nox
 dictem               | textproc  | dictem-emacs_nox
 dictionary           | textproc  | dictionary-emacs_canna
 dictionary           | textproc  | dictionary-emacs_devel
 dictionary           | textproc  | dictionary-emacs_devel_nox
 dictionary           | textproc  | dictionary-emacs_nox
 doc-mode.el          | textproc  | doc-mode.el-emacs_canna
 doc-mode.el          | textproc  | doc-mode.el-emacs_devel
 doc-mode.el          | textproc  | doc-mode.el-emacs_devel_nox
 doc-mode.el          | textproc  | doc-mode.el-emacs_nox
 markdown-mode.el     | textproc  | markdown-mode.el-emacs_canna
 markdown-mode.el     | textproc  | markdown-mode.el-emacs_devel
 markdown-mode.el     | textproc  | markdown-mode.el-emacs_devel_nox
 markdown-mode.el     | textproc  | markdown-mode.el-emacs_nox
 muse                 | textproc  | muse-emacs
 muse                 | textproc  | muse-emacs_canna
 muse                 | textproc  | muse-emacs_devel
 muse                 | textproc  | muse-emacs_devel_nox
 muse                 | textproc  | muse-emacs_nox
 uim-el               | textproc  | uim-el-emacs_canna
 uim-el               | textproc  | uim-el-emacs_devel
 uim-el               | textproc  | uim-el-emacs_devel_nox
 uim-el               | textproc  | uim-el-emacs_nox
 xml-lite.el          | textproc  | xml-lite.el-emacs_canna
 xml-lite.el          | textproc  | xml-lite.el-emacs_devel
 xml-lite.el          | textproc  | xml-lite.el-emacs_devel_nox
 xml-lite.el          | textproc  | xml-lite.el-emacs_nox
 yaml-mode.el         | textproc  | yaml-mode.el-emacs_canna
 yaml-mode.el         | textproc  | yaml-mode.el-emacs_devel
 yaml-mode.el         | textproc  | yaml-mode.el-emacs_devel_nox
 yaml-mode.el         | textproc  | yaml-mode.el-emacs_nox
 yaml.el              | textproc  | yaml.el-emacs_canna
 yaml.el              | textproc  | yaml.el-emacs_devel
 yaml.el              | textproc  | yaml.el-emacs_devel_nox
 yaml.el              | textproc  | yaml.el-emacs_nox
 emacs-w3m            | www       | emacs-w3m
 emacs-w3m            | www       | emacs-w3m-emacs_canna
 emacs-w3m            | www       | emacs-w3m-emacs_devel
 emacs-w3m            | www       | emacs-w3m-emacs_devel_nox
 emacs-w3m            | www       | emacs-w3m-emacs_nox
(375 rows)

freshports.devgit=# 
dlangille commented 1 year ago

The problem now: how to present this to the user.

dlangille commented 1 year ago

In the above, there are 94 ports. Off hand, perhaps fold the list of different flavors into one column.

          order by category, port;
         port         | category  
----------------------+-----------
 emms                 | audio
 dinotrace            | cad
 verilog-mode.el      | cad
 bbdb                 | databases
 closql               | databases
 closql-devel         | databases
 emacs-sqlite3-api    | databases
 emacsql              | databases
 emacsql-devel        | databases
 pg.el                | databases
 howm                 | deskutils
 cask                 | devel
 clojure-cider        | devel
 dash.el              | devel
 distel               | devel
 epl.el               | devel
 forge                | devel
 forge-devel          | devel
 ghub                 | devel
 ghub-devel           | devel
 git-modes            | devel
 libegit2             | devel
 lua-mode             | devel
 magit                | devel
 magit-devel          | devel
 p5-Sepia             | devel
 pkg-info.el          | devel
 psvn                 | devel
 tablist              | devel
 transient            | devel
 transient-devel      | devel
 treepy.el            | devel
 apel                 | editors
 emacs                | editors
 emacs-devel          | editors
 flim                 | editors
 paredit-mode.el      | editors
 psgml                | editors
 semi                 | editors
 slime                | editors
 sly                  | editors
 sly-asdf             | editors
 sly-named-readtables | editors
 sly-quicklisp        | editors
 tamago               | editors
 web-mode             | editors
 with-editor          | editors
 with-editor-devel    | editors
 riece                | irc
 boiled-mozc          | japanese
 cp5022x-el           | japanese
 ddskk                | japanese
 lookup               | japanese
 migemo.el            | japanese
 mozc-el              | japanese
 navi2ch              | japanese
 yc.el                | japanese
 alchemist.el         | lang
 clojure-mode.el      | lang
 csharp-mode.el       | lang
 elixir-mode.el       | lang
 haskell-mode.el      | lang
 php-mode.el          | lang
 tuareg-mode.el       | lang
 c-sig                | mail
 mailest              | mail
 mew                  | mail
 mew-devel            | mail
 mu4e                 | mail
 mu4e-maildirs        | mail
 notmuch-emacs        | mail
 wanderlust           | mail
 x-face-e21           | mail
 xcite                | mail
 coq                  | math
 ess                  | math
 compat.el            | misc
 elscreen             | misc
 auctex               | print
 hyperlatex           | print
 pdf-tools            | print
 starttls             | security
 puppet-mode.el       | sysutils
 adoc-mode.el         | textproc
 dictem               | textproc
 dictionary           | textproc
 doc-mode.el          | textproc
 markdown-mode.el     | textproc
 muse                 | textproc
 uim-el               | textproc
 xml-lite.el          | textproc
 yaml-mode.el         | textproc
 yaml.el              | textproc
 emacs-w3m            | www
(94 rows)
dlangille commented 1 year ago

Well, would you look at that:


freshports.devgit=#      with pkg_flavors as (
SELECT E.name as port,
         C.name as category,
         PF.name as pkg_name
  FROM ports P LEFT OUTER JOIN ports_vulnerable    PV  ON PV.port_id       = P.id
               LEFT OUTER JOIN commit_log          CL  ON P.last_commit_id = CL.id
               LEFT OUTER JOIN repo                R   ON CL.repo_id       = R.id
               LEFT OUTER JOIN commit_log_branches CLB ON CL.id            = CLB.commit_log_id
                          JOIN system_branch       SB  ON SB.branch_name   = 'head'
                                                      AND SB.id            = CLB.branch_id
JOIN package_flavors PF on P.id = PF.port_id AND PF.name ILIKE '%emacs%'
, categories C, element E

    WHERE P.category_id  = C.id
      AND P.element_id   = E.id
      and E.status = 'A'
)         
          select port, category, array_agg(pkg_name) from (select port, category, pkg_name from pkg_flavors) t
          group by category, port
          order by category, port
freshports.devgit-# ;
         port         | category  |                                                                   array_agg                                                                   
----------------------+-----------+-----------------------------------------------------------------------------------------------------------------------------------------------
 emms                 | audio     | {emms-emacs_nox,emms-emacs_canna,emms-emacs_devel_nox,emms-emacs_devel}
 dinotrace            | cad       | {dinotrace-emacs_devel_nox,dinotrace-emacs_canna,dinotrace-emacs_nox,dinotrace-emacs_devel}
 verilog-mode.el      | cad       | {verilog-mode.el-emacs_canna,verilog-mode.el-emacs_nox,verilog-mode.el-emacs_devel,verilog-mode.el-emacs_devel_nox}
 bbdb                 | databases | {bbdb-emacs_canna,bbdb-emacs_nox,bbdb-emacs_devel,bbdb-emacs_devel_nox}
 closql               | databases | {closql-emacs_canna,closql-emacs_nox,closql-emacs_devel,closql-emacs_devel_nox}
 closql-devel         | databases | {closql-devel-emacs_devel_nox,closql-devel-emacs_devel,closql-devel-emacs_nox,closql-devel-emacs_canna}
 emacs-sqlite3-api    | databases | {emacs-sqlite3-api-emacs_devel_nox,emacs-sqlite3-api,emacs-sqlite3-api-emacs_canna,emacs-sqlite3-api-emacs_nox,emacs-sqlite3-api-emacs_devel}
 emacsql              | databases | {emacsql-emacs_devel,emacsql,emacsql-emacs_canna,emacsql-emacs_nox,emacsql-emacs_devel_nox}
 emacsql-devel        | databases | {emacsql-devel-emacs_nox,emacsql-devel-emacs_canna,emacsql-devel,emacsql-devel-emacs_devel_nox,emacsql-devel-emacs_devel}
 pg.el                | databases | {pg.el-emacs_canna,pg.el-emacs_devel_nox,pg.el-emacs_nox,pg.el-emacs_devel}
 howm                 | deskutils | {howm-emacs_devel,howm-emacs_canna,howm-emacs_nox,howm-emacs_devel_nox}
 cask                 | devel     | {cask-emacs_nox,cask-emacs_canna,cask-emacs_devel_nox,cask-emacs_devel}
 clojure-cider        | devel     | {clojure-cider-emacs_nox,clojure-cider-emacs_devel_nox,clojure-cider-emacs_devel,clojure-cider-emacs_canna}
 dash.el              | devel     | {dash.el-emacs_canna,dash.el-emacs_devel_nox,dash.el-emacs_devel,dash.el-emacs_nox}
 distel               | devel     | {distel-emacs_nox,distel-emacs_canna,distel-emacs_devel_nox,distel-emacs_devel}
 epl.el               | devel     | {epl.el-emacs_devel_nox,epl.el-emacs_nox,epl.el-emacs_canna,epl.el-emacs_devel}
 forge                | devel     | {forge-emacs_canna,forge-emacs_nox,forge-emacs_devel,forge-emacs_devel_nox}
 forge-devel          | devel     | {forge-devel-emacs_canna,forge-devel-emacs_devel_nox,forge-devel-emacs_devel,forge-devel-emacs_nox}
 ghub                 | devel     | {ghub-emacs_canna,ghub-emacs_devel_nox,ghub-emacs_devel,ghub-emacs_nox}
 ghub-devel           | devel     | {ghub-devel-emacs_canna,ghub-devel-emacs_devel_nox,ghub-devel-emacs_devel,ghub-devel-emacs_nox}
 git-modes            | devel     | {git-modes-emacs_nox,git-modes-emacs_canna,git-modes-emacs_devel_nox,git-modes-emacs_devel}
 libegit2             | devel     | {libegit2-emacs_devel_nox,libegit2-emacs_canna,libegit2-emacs_nox,libegit2-emacs_devel}
 lua-mode             | devel     | {lua-mode-emacs_devel_nox,lua-mode-emacs_canna,lua-mode-emacs_nox,lua-mode-emacs_devel}
 magit                | devel     | {magit-emacs_nox,magit-emacs_canna,magit-emacs_devel_nox,magit-emacs_devel}
 magit-devel          | devel     | {magit-devel-emacs_nox,magit-devel-emacs_devel_nox,magit-devel-emacs_canna,magit-devel-emacs_devel}
 p5-Sepia             | devel     | {p5-Sepia-emacs_canna,p5-Sepia-emacs_nox,p5-Sepia-emacs_devel,p5-Sepia-emacs_devel_nox}
 pkg-info.el          | devel     | {pkg-info.el-emacs_devel_nox,pkg-info.el-emacs_nox,pkg-info.el-emacs_devel,pkg-info.el-emacs_canna}
 psvn                 | devel     | {psvn-emacs_devel,psvn-emacs_canna,psvn-emacs_nox,psvn-emacs_devel_nox}
 tablist              | devel     | {tablist-emacs_devel,tablist-emacs_canna,tablist-emacs_nox,tablist-emacs_devel_nox}
 transient            | devel     | {transient-emacs_canna,transient-emacs_devel_nox,transient-emacs_devel,transient-emacs_nox}
 transient-devel      | devel     | {transient-devel-emacs_devel,transient-devel-emacs_devel_nox,transient-devel-emacs_canna,transient-devel-emacs_nox}
 treepy.el            | devel     | {treepy.el-emacs_devel,treepy.el-emacs_nox,treepy.el-emacs_canna,treepy.el-emacs_devel_nox}
 apel                 | editors   | {apel-emacs_devel,apel-emacs_canna,apel-emacs_nox,apel-emacs_devel_nox}
 emacs                | editors   | {emacs-canna,emacs,emacs-nox}
 emacs-devel          | editors   | {emacs-devel,emacs-devel-nox}
 flim                 | editors   | {flim-emacs_canna,flim-emacs_nox,flim-emacs_devel_nox,flim-emacs_devel}
 paredit-mode.el      | editors   | {paredit-mode.el-emacs_canna,paredit-mode.el-emacs_devel_nox,paredit-mode.el-emacs_nox,paredit-mode.el-emacs_devel}
 psgml                | editors   | {psgml-emacs_canna,psgml-emacs_devel,psgml-emacs_devel_nox,psgml-emacs_nox}
 semi                 | editors   | {semi-emacs_nox,semi-emacs_devel_nox,semi-emacs_devel,semi-emacs_canna}
 slime                | editors   | {slime-emacs_nox,slime-emacs_devel,slime-emacs_devel_nox,slime-emacs_canna}
 sly                  | editors   | {sly-emacs_devel,sly-emacs_canna,sly-emacs_devel_nox,sly-emacs_nox}
 sly-asdf             | editors   | {sly-asdf-emacs_devel_nox,sly-asdf-emacs_nox,sly-asdf-emacs_canna,sly-asdf-emacs_devel}
 sly-named-readtables | editors   | {sly-named-readtables-emacs_devel,sly-named-readtables-emacs_canna,sly-named-readtables-emacs_nox,sly-named-readtables-emacs_devel_nox}
 sly-quicklisp        | editors   | {sly-quicklisp-emacs_nox,sly-quicklisp-emacs_canna,sly-quicklisp-emacs_devel_nox,sly-quicklisp-emacs_devel}
 tamago               | editors   | {tamago-emacs_devel,tamago-emacs_canna,tamago-emacs_devel_nox,tamago-emacs_nox}
 web-mode             | editors   | {web-mode-emacs_nox,web-mode-emacs_canna,web-mode-emacs_devel_nox,web-mode-emacs_devel}
 with-editor          | editors   | {with-editor-emacs_devel,with-editor-emacs_canna,with-editor-emacs_devel_nox,with-editor-emacs_nox}
 with-editor-devel    | editors   | {with-editor-devel-emacs_canna,with-editor-devel-emacs_nox,with-editor-devel-emacs_devel,with-editor-devel-emacs_devel_nox}
 riece                | irc       | {riece-emacs_devel,riece-emacs_nox,riece-emacs_canna,riece-emacs_devel_nox}
 boiled-mozc          | japanese  | {ja-boiled-mozc-emacs_devel_nox,ja-boiled-mozc-emacs_canna,ja-boiled-mozc-emacs_devel,ja-boiled-mozc-emacs_nox}
 cp5022x-el           | japanese  | {ja-cp5022x-el-emacs_nox,ja-cp5022x-el-emacs_devel,ja-cp5022x-el-emacs_devel_nox,ja-cp5022x-el-emacs_canna}
 ddskk                | japanese  | {ja-ddskk-emacs_nox,ja-ddskk-emacs_devel_nox,ja-ddskk-emacs_canna,ja-ddskk-emacs_devel}
 lookup               | japanese  | {ja-lookup-emacs_canna,ja-lookup-emacs_devel_nox,ja-lookup-emacs_nox,ja-lookup-emacs_devel}
 migemo.el            | japanese  | {ja-migemo.el-emacs_devel,ja-migemo.el-emacs_nox,ja-migemo.el-emacs_devel_nox,ja-migemo.el-emacs_canna}
 mozc-el              | japanese  | {ja-mozc-el-emacs_devel,ja-mozc-el-emacs_devel_nox,ja-mozc-el-emacs_canna,ja-mozc-el-emacs_nox}
 navi2ch              | japanese  | {ja-navi2ch-emacs_devel,ja-navi2ch-emacs_canna,ja-navi2ch-emacs_nox,ja-navi2ch-emacs_devel_nox}
 yc.el                | japanese  | {ja-yc.el-emacs_canna,ja-yc.el-emacs_nox}
 alchemist.el         | lang      | {alchemist.el-emacs_devel_nox,alchemist.el-emacs_canna,alchemist.el-emacs_nox,alchemist.el-emacs_devel}
 clojure-mode.el      | lang      | {clojure-mode.el-emacs_devel_nox,clojure-mode.el-emacs_devel,clojure-mode.el-emacs_nox,clojure-mode.el-emacs_canna}
 csharp-mode.el       | lang      | {csharp-mode.el-emacs_canna,csharp-mode.el-emacs_devel_nox,csharp-mode.el-emacs_nox,csharp-mode.el-emacs_devel}
 elixir-mode.el       | lang      | {elixir-mode.el-emacs_canna,elixir-mode.el-emacs_devel,elixir-mode.el-emacs_devel_nox,elixir-mode.el-emacs_nox}
 haskell-mode.el      | lang      | {haskell-mode-emacs_devel_nox,haskell-mode-emacs_nox,haskell-mode-emacs_canna,haskell-mode-emacs_devel}
 php-mode.el          | lang      | {php-mode.el-emacs_canna,php-mode.el-emacs_devel_nox,php-mode.el-emacs_devel,php-mode.el-emacs_nox}
 tuareg-mode.el       | lang      | {tuareg-mode-emacs_devel,tuareg-mode-emacs_canna,tuareg-mode-emacs_nox,tuareg-mode-emacs_devel_nox}
 c-sig                | mail      | {c-sig-emacs_devel_nox,c-sig-emacs_canna,c-sig-emacs_nox,c-sig-emacs_devel}
 mailest              | mail      | {mailest-emacs_devel,mailest-emacs_canna,mailest-emacs_devel_nox,mailest-emacs_nox}
 mew                  | mail      | {mew-emacs_devel_nox,mew-emacs_devel,mew-emacs_canna,mew-emacs_nox}
 mew-devel            | mail      | {mew-devel-emacs_devel,mew-devel-emacs_devel_nox,mew-devel-emacs_nox,mew-devel-emacs_canna}
 mu4e                 | mail      | {mu4e-emacs_nox,mu4e-emacs_devel,mu4e-emacs_devel_nox,mu4e-emacs_canna}
 mu4e-maildirs        | mail      | {mu4e-maildirs-emacs_canna,mu4e-maildirs-emacs_nox,mu4e-maildirs-emacs_devel,mu4e-maildirs-emacs_devel_nox}
 notmuch-emacs        | mail      | {notmuch-emacs_devel_nox,notmuch-emacs_canna,notmuch-emacs_nox,notmuch-emacs,notmuch-emacs_devel}
 wanderlust           | mail      | {wanderlust-emacs_devel_nox,wanderlust-emacs_canna,wanderlust-emacs_nox,wanderlust-emacs_devel}
 x-face-e21           | mail      | {x-face-e21-emacs_nox,x-face-e21-emacs_devel_nox,x-face-e21-emacs_canna,x-face-e21-emacs_devel}
 xcite                | mail      | {xcite-emacs_devel_nox,xcite-emacs_devel,xcite-emacs_nox,xcite-emacs_canna}
 coq                  | math      | {coq-emacs_canna,coq-emacs_devel_nox,coq-emacs_nox,coq-emacs_devel}
 ess                  | math      | {ess-emacs_devel_nox,ess-emacs_canna,ess-emacs_nox,ess-emacs_devel}
 compat.el            | misc      | {compat.el-emacs_devel_nox,compat.el-emacs_canna,compat.el-emacs_nox,compat.el-emacs_devel}
 elscreen             | misc      | {elscreen-emacs_canna,elscreen-emacs_devel_nox,elscreen-emacs_devel,elscreen-emacs_nox}
 auctex               | print     | {auctex-emacs_canna,auctex-emacs_nox,auctex-emacs_devel,auctex-emacs_devel_nox}
 hyperlatex           | print     | {Hyperlatex-emacs_nox,Hyperlatex-emacs_canna,Hyperlatex-emacs_devel_nox,Hyperlatex-emacs_devel}
 pdf-tools            | print     | {pdf-tools-emacs_canna,pdf-tools-emacs_devel}
 starttls             | security  | {starttls-emacs_canna,starttls-emacs_devel_nox,starttls-emacs_devel,starttls-emacs_nox}
 puppet-mode.el       | sysutils  | {puppet-mode.el-emacs_canna,puppet-mode.el-emacs_devel,puppet-mode.el-emacs_devel_nox,puppet-mode.el-emacs_nox}
 adoc-mode.el         | textproc  | {adoc-mode.el-emacs_nox,adoc-mode.el-emacs_devel,adoc-mode.el-emacs_devel_nox,adoc-mode.el-emacs_canna}
 dictem               | textproc  | {dictem-emacs_nox,dictem-emacs_canna,dictem-emacs_devel_nox,dictem-emacs_devel}
 dictionary           | textproc  | {dictionary-emacs_devel,dictionary-emacs_devel_nox,dictionary-emacs_canna,dictionary-emacs_nox}
 doc-mode.el          | textproc  | {doc-mode.el-emacs_devel,doc-mode.el-emacs_devel_nox,doc-mode.el-emacs_canna,doc-mode.el-emacs_nox}
 markdown-mode.el     | textproc  | {markdown-mode.el-emacs_nox,markdown-mode.el-emacs_canna,markdown-mode.el-emacs_devel_nox,markdown-mode.el-emacs_devel}
 muse                 | textproc  | {muse-emacs_nox,muse-emacs_canna,muse-emacs,muse-emacs_devel_nox,muse-emacs_devel}
 uim-el               | textproc  | {uim-el-emacs_devel_nox,uim-el-emacs_nox,uim-el-emacs_canna,uim-el-emacs_devel}
 xml-lite.el          | textproc  | {xml-lite.el-emacs_devel_nox,xml-lite.el-emacs_canna,xml-lite.el-emacs_nox,xml-lite.el-emacs_devel}
 yaml-mode.el         | textproc  | {yaml-mode.el-emacs_nox,yaml-mode.el-emacs_devel,yaml-mode.el-emacs_devel_nox,yaml-mode.el-emacs_canna}
 yaml.el              | textproc  | {yaml.el-emacs_nox,yaml.el-emacs_devel,yaml.el-emacs_devel_nox,yaml.el-emacs_canna}
 emacs-w3m            | www       | {emacs-w3m-emacs_nox,emacs-w3m-emacs_devel_nox,emacs-w3m,emacs-w3m-emacs_devel,emacs-w3m-emacs_canna}
(94 rows)

freshports.devgit=# 
EHWV commented 1 year ago

Here is the complete list:

Quite a list. Hmm, unless I am mistaken, the package "gpu-firmware-amd-kmod-beige-goby" (on my system happened to have been pulled in by "graphics/gpu-firmware-amd-kmod") is not in the output of your queries.

dlangille commented 1 year ago

The queries above are emacs specific.

Let's run the same query for gpu-firmware-amd-kmod-beige-goby.

You need to scroll way to the right to see the actual search term.

freshports.devgit=# with pkg_flavors as (
SELECT E.name as port,
         C.name as category,
         PF.name as pkg_name
  FROM ports P LEFT OUTER JOIN ports_vulnerable    PV  ON PV.port_id       = P.id
               LEFT OUTER JOIN commit_log          CL  ON P.last_commit_id = CL.id
               LEFT OUTER JOIN repo                R   ON CL.repo_id       = R.id
               LEFT OUTER JOIN commit_log_branches CLB ON CL.id            = CLB.commit_log_id
                          JOIN system_branch       SB  ON SB.branch_name   = 'head'
                                                      AND SB.id            = CLB.branch_id
JOIN package_flavors PF on P.id = PF.port_id AND PF.name ILIKE '%gpu-firmware-amd-kmod-beige-goby%'
, categories C, element E

    WHERE P.category_id  = C.id
      AND P.element_id   = E.id
      and E.status = 'A'
)         
          select port, category, array_agg(pkg_name) from (select port, category, pkg_name from pkg_flavors) t
          group by category, port
          order by category, port
freshports.devgit-# ;
         port          | category |             array_agg              
-----------------------+----------+------------------------------------
 gpu-firmware-amd-kmod | graphics | {gpu-firmware-amd-kmod-beige-goby}
(1 row)

freshports.devgit=# 
EHWV commented 1 year ago

Thanks, I missed that "logical shift" :) My suspicion is that these are not the only two categories though.

dlangille commented 1 year ago

The solution above will work for all packages.

dlangille commented 1 year ago

It uses this data shown at https://dev.freshports.org/graphics/gpu-firmware-amd-kmod/#flavors

dlangille commented 1 year ago

I should have a first draft ready by the end of the weekend.

dlangille commented 1 year ago

This search must be combined with the regular search of ports.package_name - not all ports have flavors. Most ports do not.

If the search finds 30 matching ports, with 94 flavors, what counts do we show? I say 30.

dlangille commented 1 year ago

Here is my early morning idea which may be a good approach to searching both ports.package_name and package_flavors.name:

with package_names as
(select P.id as port_id, P.package_name as package_name
  FROM ports P where P.package_name ilike '%emacs%'
UNION
select PV.port_id as port_id, PV.name as package_name
  FROM package_flavors PV where  name ilike '%emacs%'
 )
 select distinct port_id, array_agg(package_name) from package_names
 group by port_id;
dlangille commented 1 year ago

Getting the count for emacs

with packages as
(with package_names as
(select P.id as port_id, P.package_name as package_name
  FROM ports P where P.package_name ilike '%emacs%'
UNION
select PV.port_id as port_id, PV.name as package_name
  FROM package_flavors PV where  name ilike '%emacs%'
 )
 select distinct port_id, array_agg(package_name) from package_names
 group by port_id
 ) 
  SELECT count(*)
  FROM packages P2 join ports P ON p2.port_id = P.id
               LEFT OUTER JOIN ports_vulnerable    PV  ON PV.port_id       = P.id
               LEFT OUTER JOIN commit_log          CL  ON P.last_commit_id = CL.id
               LEFT OUTER JOIN repo                R   ON CL.repo_id       = R.id
               LEFT OUTER JOIN commit_log_branches CLB ON CL.id            = CLB.commit_log_id
                          JOIN system_branch       SB  ON SB.branch_name   = 'head'
                                                      AND SB.id            = CLB.branch_id,
          categories C, element E
    WHERE P.category_id  = C.id
      AND P.element_id   = E.id
      AND E.status = 'A';
dlangille commented 1 year ago

The actual ports.

Notice this is 4 more than found by seaching port_flavors only.

That difference corresponds with the 4 entries below which have only a single entry for package_names.

with packages as
(with package_names as
(select P.id as port_id, P.package_name as package_name
  FROM ports P where P.package_name ilike '%emacs%'
UNION
select PV.port_id as port_id, PV.name as package_name
  FROM package_flavors PV where  name ilike '%emacs%'
 )
 select distinct port_id, array_agg(package_name) as package_names from package_names
 group by port_id
 ) 
  select P.id as port_id,
         C.name || '/' || E.name as port_name,
         P.version as version,
         P.revision as revision,
         P2.package_names
  FROM packages P2 join ports P ON p2.port_id = P.id
               LEFT OUTER JOIN ports_vulnerable    PV  ON PV.port_id       = P.id
               LEFT OUTER JOIN commit_log          CL  ON P.last_commit_id = CL.id
               LEFT OUTER JOIN repo                R   ON CL.repo_id       = R.id
               LEFT OUTER JOIN commit_log_branches CLB ON CL.id            = CLB.commit_log_id
                          JOIN system_branch       SB  ON SB.branch_name   = 'head'
                                                      AND SB.id            = CLB.branch_id,
          categories C, element E
    WHERE P.category_id  = C.id
      AND P.element_id   = E.id
      AND E.status = 'A'
 ORDER BY port_name
LIMIT 100;

 port_id |          port_name           |        version         | revision |                                                                 package_names                                                                 
---------+------------------------------+------------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------------
   17735 | audio/emms                   | 5.0                    | 13       | {emms-emacs_canna,emms-emacs_devel,emms-emacs_devel_nox,emms-emacs_nox}
     190 | audio/timidity++-emacs       | 2.15.0                 | 0        | {timidity++-emacs}
   13005 | cad/dinotrace                | 9.4f                   | 5        | {dinotrace-emacs_canna,dinotrace-emacs_devel,dinotrace-emacs_devel_nox,dinotrace-emacs_nox}
   24068 | cad/verilog-mode.el          | 801                    | 18       | {verilog-mode.el-emacs_devel,verilog-mode.el-emacs_nox,verilog-mode.el-emacs_canna,verilog-mode.el-emacs_devel_nox}
    6458 | databases/bbdb               | 3.2.2.a                | 6        | {bbdb-emacs_devel,bbdb-emacs_devel_nox,bbdb-emacs_nox,bbdb-emacs_canna}
   94097 | databases/closql             | 1.2.1                  | 6        | {closql-emacs_nox,closql-emacs_devel_nox,closql-emacs_canna,closql-emacs_devel}
  112171 | databases/closql-devel       | 1.2.1.28               | 0        | {closql-devel-emacs_devel,closql-devel-emacs_devel_nox,closql-devel-emacs_nox,closql-devel-emacs_canna}
  112169 | databases/emacs-sqlite3-api  | 0.17                   | 1        | {emacs-sqlite3-api-emacs_nox,emacs-sqlite3-api,emacs-sqlite3-api-emacs_devel_nox,emacs-sqlite3-api-emacs_canna,emacs-sqlite3-api-emacs_devel}
   94096 | databases/emacsql            | 3.1.1                  | 5        | {emacsql-emacs_devel,emacsql-emacs_canna,emacsql-emacs_devel_nox,emacsql-emacs_nox,emacsql}
  112170 | databases/emacsql-devel      | 3.1.1.43               | 0        | {emacsql-devel-emacs_canna,emacsql-devel,emacsql-devel-emacs_devel,emacsql-devel-emacs_devel_nox,emacsql-devel-emacs_nox}
   94089 | databases/pg.el              | 0.24                   | 0        | {pg.el-emacs_nox,pg.el-emacs_devel,pg.el-emacs_canna,pg.el-emacs_devel_nox}
   11316 | deskutils/howm               | 1.4.8                  | 6        | {howm-emacs_nox,howm-emacs_devel_nox,howm-emacs_devel,howm-emacs_canna}
   34920 | devel/cask                   | 0.8.3                  | 12       | {cask-emacs_canna,cask-emacs_devel,cask-emacs_devel_nox,cask-emacs_nox}
   34661 | devel/clojure-cider          | 1.10.0                 | 0        | {clojure-cider-emacs_devel_nox,clojure-cider-emacs_devel,clojure-cider-emacs_nox,clojure-cider-emacs_canna}
   34658 | devel/dash.el                | 2.19.1                 | 8        | {dash.el-emacs_canna,dash.el-emacs_nox,dash.el-emacs_devel_nox,dash.el-emacs_devel}
    8448 | devel/distel                 | 4.1.1                  | 14       | {distel-emacs_devel,distel-emacs_canna,distel-emacs_devel_nox,distel-emacs_nox}
   34659 | devel/epl.el                 | 0.8                    | 14       | {epl.el-emacs_devel_nox,epl.el-emacs_nox,epl.el-emacs_canna,epl.el-emacs_devel}
   94099 | devel/forge                  | 0.3.2                  | 1        | {forge-emacs_devel_nox,forge-emacs_canna,forge-emacs_devel,forge-emacs_nox}
   95196 | devel/forge-devel            | 0.3.2.236              | 0        | {forge-devel-emacs_canna,forge-devel-emacs_devel,forge-devel-emacs_devel_nox,forge-devel-emacs_nox}
   47697 | devel/ghub                   | 3.6.0                  | 1        | {ghub-emacs_nox,ghub-emacs_devel_nox,ghub-emacs_canna,ghub-emacs_devel}
  101682 | devel/ghub-devel             | 3.6.0.8                | 0        | {ghub-devel-emacs_nox,ghub-devel-emacs_devel,ghub-devel-emacs_canna,ghub-devel-emacs_devel_nox}
   34570 | devel/git-modes              | 1.4.2                  | 0        | {git-modes-emacs_canna,git-modes-emacs_nox,git-modes-emacs_devel,git-modes-emacs_devel_nox}
   62325 | devel/libegit2               | g20200515              | 13       | {libegit2-emacs_devel,libegit2-emacs_canna,libegit2-emacs_devel_nox,libegit2-emacs_nox}
  101146 | devel/lua-mode               | 20210802               | 5        | {lua-mode-emacs_devel,lua-mode-emacs_devel_nox,lua-mode-emacs_nox,lua-mode-emacs_canna}
   27454 | devel/magit                  | 3.3.0                  | 11       | {magit-emacs_nox,magit-emacs_canna,magit-emacs_devel_nox,magit-emacs_devel}
   62324 | devel/magit-devel            | 3.3.0.822              | 0        | {magit-devel-emacs_devel_nox,magit-devel-emacs_nox,magit-devel-emacs_canna,magit-devel-emacs_devel}
   30002 | devel/p5-Sepia               | 0.992                  | 24       | {p5-Sepia-emacs_devel,p5-Sepia-emacs_nox,p5-Sepia-emacs_canna,p5-Sepia-emacs_devel_nox}
   34660 | devel/pkg-info.el            | 0.6                    | 13       | {pkg-info.el-emacs_nox,pkg-info.el-emacs_devel_nox,pkg-info.el-emacs_canna,pkg-info.el-emacs_devel}
   12673 | devel/psvn                   | 20150720.214200        | 11       | {psvn-emacs_devel_nox,psvn-emacs_canna,psvn-emacs_devel,psvn-emacs_nox}
   46861 | devel/tablist                | 1.0.13                 | 5        | {tablist-emacs_devel,tablist-emacs_canna,tablist-emacs_nox,tablist-emacs_devel_nox}
   62323 | devel/transient              | 0.4.3                  | 0        | {transient-emacs_canna,transient-emacs_devel_nox,transient-emacs_nox,transient-emacs_devel}
  101680 | devel/transient-devel        | 0.4.3.45               | 0        | {transient-devel-emacs_nox,transient-devel-emacs_devel_nox,transient-devel-emacs_canna,transient-devel-emacs_devel}
   50812 | devel/treepy.el              | 0.1.2                  | 9        | {treepy.el-emacs_devel_nox,treepy.el-emacs_canna,treepy.el-emacs_devel,treepy.el-emacs_nox}
    6368 | editors/apel                 | 10.8.20220720          | 5        | {apel-emacs_devel,apel-emacs_nox,apel-emacs_canna,apel-emacs_devel_nox}
    1545 | editors/emacs                | 29.1                   | 1        | {emacs-canna,emacs,emacs-nox}
   17212 | editors/emacs-devel          | 30.0.50.20231030       | 0        | {emacs-devel,emacs-devel-nox}
    6369 | editors/flim                 | 1.14.9.20230205        | 1        | {flim-emacs_devel_nox,flim-emacs_devel,flim-emacs_nox,flim-emacs_canna}
   27263 | editors/paredit-mode.el      | 24                     | 15       | {paredit-mode.el-emacs_devel_nox,paredit-mode.el-emacs_nox,paredit-mode.el-emacs_canna,paredit-mode.el-emacs_devel}
    6388 | editors/psgml                | 1.4.0                  | 19       | {psgml-emacs_devel_nox,psgml-emacs_nox,psgml-emacs_devel,psgml-emacs_canna}
    6393 | editors/semi                 | 1.14.7.20230104        | 1        | {semi-emacs_nox,semi-emacs_canna,semi-emacs_devel,semi-emacs_devel_nox}
   13892 | editors/slime                | 2.26.1.9               | 9        | {slime-emacs_devel,slime-emacs_devel_nox,slime-emacs_canna,slime-emacs_nox}
   63407 | editors/sly                  | 1.0.43.20230624        | 0        | {sly-emacs_devel_nox,sly-emacs_nox,sly-emacs_canna,sly-emacs_devel}
   63410 | editors/sly-asdf             | 0.2.0.20221119         | 1        | {sly-asdf-emacs_devel_nox,sly-asdf-emacs_canna,sly-asdf-emacs_devel,sly-asdf-emacs_nox}
   63408 | editors/sly-named-readtables | 20191013               | 12       | {sly-named-readtables-emacs_canna,sly-named-readtables-emacs_nox,sly-named-readtables-emacs_devel_nox,sly-named-readtables-emacs_devel}
   63409 | editors/sly-quicklisp        | 20211206               | 1        | {sly-quicklisp-emacs_canna,sly-quicklisp-emacs_nox,sly-quicklisp-emacs_devel,sly-quicklisp-emacs_devel_nox}
    1629 | editors/tamago               | 4.0.6.0.20041122.19.15 | 5        | {tamago-emacs_nox,tamago-emacs_devel,tamago-emacs_devel_nox,tamago-emacs_canna}
    3036 | editors/uemacs               | 4.0                    | 1        | {uemacs}
   40193 | editors/web-mode             | 15.1                   | 16       | {web-mode-emacs_canna,web-mode-emacs_devel,web-mode-emacs_nox,web-mode-emacs_devel_nox}
   38008 | editors/with-editor          | 3.3.2                  | 0        | {with-editor-emacs_canna,with-editor-emacs_devel_nox,with-editor-emacs_devel,with-editor-emacs_nox}
  101681 | editors/with-editor-devel    | 3.3.2.1                | 0        | {with-editor-devel-emacs_devel_nox,with-editor-devel-emacs_canna,with-editor-devel-emacs_nox,with-editor-devel-emacs_devel}
   13793 | irc/riece                    | 9.0.0                  | 22       | {riece-emacs_nox,riece-emacs_canna,riece-emacs_devel_nox,riece-emacs_devel}
   39132 | japanese/boiled-mozc         | 0.7                    | 19       | {ja-boiled-mozc-emacs_canna,ja-boiled-mozc-emacs_nox,ja-boiled-mozc-emacs_devel,ja-boiled-mozc-emacs_devel_nox}
   52476 | japanese/cp5022x-el          | 0.0.20120324           | 11       | {ja-cp5022x-el-emacs_devel,ja-cp5022x-el-emacs_devel_nox,ja-cp5022x-el-emacs_canna,ja-cp5022x-el-emacs_nox}
    6949 | japanese/ddskk               | 16.2                   | 15       | {ja-ddskk-emacs_nox,ja-ddskk-emacs_devel,ja-ddskk-emacs_devel_nox,ja-ddskk-emacs_canna}
    6540 | japanese/lookup              | 1.99.96.20180209       | 15       | {ja-lookup-emacs_nox,ja-lookup-emacs_devel,ja-lookup-emacs_devel_nox,ja-lookup-emacs_canna}
   34808 | japanese/migemo.el           | 1.9.2                  | 11       | {ja-migemo.el-emacs_nox,ja-migemo.el-emacs_canna,ja-migemo.el-emacs_devel,ja-migemo.el-emacs_devel_nox}
   28968 | japanese/mozc-el             | 2.23.2815.102.01       | 14       | {ja-mozc-el-emacs_devel,ja-mozc-el-emacs_nox,ja-mozc-el-emacs_devel_nox,ja-mozc-el-emacs_canna}
   23350 | japanese/navi2ch             | 2.0.0.d                | 20       | {ja-navi2ch-emacs_devel,ja-navi2ch-emacs_devel_nox,ja-navi2ch-emacs_nox,ja-navi2ch-emacs_canna}
    3276 | japanese/yc.el               | 5.2.1                  | 23       | {ja-yc.el-emacs_nox,ja-yc.el-emacs_canna}
   36740 | lang/alchemist.el            | 1.8.2                  | 14       | {alchemist.el-emacs_canna,alchemist.el-emacs_nox,alchemist.el-emacs_devel,alchemist.el-emacs_devel_nox}
   23974 | lang/clojure-mode.el         | 5.11.0                 | 11       | {clojure-mode.el-emacs_nox,clojure-mode.el-emacs_devel,clojure-mode.el-emacs_devel_nox,clojure-mode.el-emacs_canna}
   18054 | lang/csharp-mode.el          | 0.9.2                  | 11       | {csharp-mode.el-emacs_nox,csharp-mode.el-emacs_devel_nox,csharp-mode.el-emacs_devel,csharp-mode.el-emacs_canna}
   36739 | lang/elixir-mode.el          | 2.3.1                  | 14       | {elixir-mode.el-emacs_devel_nox,elixir-mode.el-emacs_devel,elixir-mode.el-emacs_nox,elixir-mode.el-emacs_canna}
      29 | lang/emacs-lisp-intro        | 2.04                   | 1        | {emacs-lisp-intro}
   12098 | lang/haskell-mode.el         | 17.2                   | 8        | {haskell-mode-emacs_canna,haskell-mode-emacs_nox,haskell-mode-emacs_devel_nox,haskell-mode-emacs_devel}
    7636 | lang/php-mode.el             | 1.25.0                 | 1        | {php-mode.el-emacs_canna,php-mode.el-emacs_devel,php-mode.el-emacs_devel_nox,php-mode.el-emacs_nox}
   13778 | lang/tuareg-mode.el          | 2.0.8                  | 16       | {tuareg-mode-emacs_devel,tuareg-mode-emacs_nox,tuareg-mode-emacs_devel_nox,tuareg-mode-emacs_canna}
   13759 | mail/c-sig                   | 3.8.0.1                | 13       | {c-sig-emacs_devel_nox,c-sig-emacs_canna,c-sig-emacs_devel,c-sig-emacs_nox}
   36897 | mail/mailest                 | 0.9.24                 | 15       | {mailest-emacs_canna,mailest-emacs_devel,mailest-emacs_nox,mailest-emacs_devel_nox}
     707 | mail/mew                     | 6.9                    | 3        | {mew-emacs_devel_nox,mew-emacs_canna,mew-emacs_devel,mew-emacs_nox}
   96329 | mail/mew-devel               | 6.9.48                 | 1        | {mew-devel-emacs_canna,mew-devel-emacs_devel_nox,mew-devel-emacs_devel,mew-devel-emacs_nox}
   38549 | mail/mu4e                    | 1.8.13                 | 6        | {mu4e-emacs_canna,mu4e-emacs_devel_nox,mu4e-emacs_nox,mu4e-emacs_devel}
   38550 | mail/mu4e-maildirs           | 0.8.20201028           | 12       | {mu4e-maildirs-emacs_devel,mu4e-maildirs-emacs_canna,mu4e-maildirs-emacs_nox,mu4e-maildirs-emacs_devel_nox}
   47315 | mail/notmuch-emacs           | 0.38                   | 0        | {notmuch-emacs,notmuch-emacs_nox,notmuch-emacs_devel_nox,notmuch-emacs_canna,notmuch-emacs_devel}
    6413 | mail/wanderlust              | 2.15.9.b.20230623      | 1        | {wanderlust-emacs_nox,wanderlust-emacs_devel_nox,wanderlust-emacs_canna,wanderlust-emacs_devel}
   25592 | mail/x-face-e21              | 20070306               | 28       | {x-face-e21-emacs_devel_nox,x-face-e21-emacs_devel,x-face-e21-emacs_canna,x-face-e21-emacs_nox}
   23730 | mail/xcite                   | 1.60                   | 23       | {xcite-emacs_canna,xcite-emacs_nox,xcite-emacs_devel_nox,xcite-emacs_devel}
   13711 | math/coq                     | 8.6                    | 19       | {coq-emacs_devel,coq-emacs_canna,coq-emacs_devel_nox,coq-emacs_nox}
   28907 | math/ess                     | 18.10.2                | 17       | {ess-emacs_canna,ess-emacs_devel,ess-emacs_devel_nox,ess-emacs_nox}
  100813 | misc/compat.el               | 29.1.4.2               | 1        | {compat.el-emacs_nox,compat.el-emacs_devel_nox,compat.el-emacs_devel,compat.el-emacs_canna}
    7447 | misc/elscreen                | 1.4.6.20180320         | 12       | {elscreen-emacs_devel,elscreen-emacs_canna,elscreen-emacs_devel_nox,elscreen-emacs_nox}
    3682 | print/auctex                 | 13.2                   | 1        | {auctex-emacs_devel,auctex-emacs_nox,auctex-emacs_canna,auctex-emacs_devel_nox}
    3676 | print/hyperlatex             | 2.9.a                  | 20       | {Hyperlatex-emacs_devel_nox,Hyperlatex-emacs_devel,Hyperlatex-emacs_canna,Hyperlatex-emacs_nox}
   46862 | print/pdf-tools              | 1.1.0                  | 2        | {pdf-tools-emacs_devel,pdf-tools-emacs_canna}
   11250 | security/starttls            | 0.10                   | 30       | {starttls-emacs_nox,starttls-emacs_devel,starttls-emacs_canna,starttls-emacs_devel_nox}
   33809 | sysutils/puppet-mode.el      | 0.2                    | 16       | {puppet-mode.el-emacs_nox,puppet-mode.el-emacs_devel_nox,puppet-mode.el-emacs_canna,puppet-mode.el-emacs_devel}
  112648 | textproc/adoc-mode.el        | 0.7.0                  | 1        | {adoc-mode.el-emacs_canna,adoc-mode.el-emacs_devel_nox,adoc-mode.el-emacs_devel,adoc-mode.el-emacs_nox}
   17558 | textproc/dictem              | 1.0.4                  | 18       | {dictem-emacs_devel_nox,dictem-emacs_devel,dictem-emacs_nox,dictem-emacs_canna}
    7071 | textproc/dictionary          | 1.8.7                  | 34       | {dictionary-emacs_devel_nox,dictionary-emacs_canna,dictionary-emacs_devel,dictionary-emacs_nox}
   23005 | textproc/doc-mode.el         | 1.1                    | 27       | {doc-mode.el-emacs_devel_nox,doc-mode.el-emacs_devel,doc-mode.el-emacs_nox,doc-mode.el-emacs_canna}
   29401 | textproc/markdown-mode.el    | 2.6                    | 0        | {markdown-mode.el-emacs_canna,markdown-mode.el-emacs_devel_nox,markdown-mode.el-emacs_devel,markdown-mode.el-emacs_nox}
   17117 | textproc/muse                | 3.20                   | 25       | {muse-emacs_nox,muse-emacs_canna,muse-emacs_devel,muse-emacs_devel_nox,muse-emacs}
   16599 | textproc/uim-el              | 1.9.0.b.20220927       | 5        | {uim-el-emacs_devel_nox,uim-el-emacs_canna,uim-el-emacs_nox,uim-el-emacs_devel}
    6878 | textproc/xml-lite.el         | 1.1                    | 22       | {xml-lite.el-emacs_canna,xml-lite.el-emacs_devel_nox,xml-lite.el-emacs_nox,xml-lite.el-emacs_devel}
   21524 | textproc/yaml-mode.el        | 0.0.16                 | 0        | {yaml-mode.el-emacs_devel_nox,yaml-mode.el-emacs_canna,yaml-mode.el-emacs_nox,yaml-mode.el-emacs_devel}
   95160 | textproc/yaml.el             | 0.5.4                  | 0        | {yaml.el-emacs_devel,yaml.el-emacs_devel_nox,yaml.el-emacs_canna,yaml.el-emacs_nox}
   16501 | ukrainian/emacs-koi8u        | 1.0                    | 1        | {emacs-koi8u}
    6396 | www/emacs-w3m                | 1.4.632.b.20230630     | 1        | {emacs-w3m-emacs_canna,emacs-w3m-emacs_devel,emacs-w3m-emacs_nox,emacs-w3m,emacs-w3m-emacs_devel_nox}
(98 rows)
dlangille commented 1 year ago

I have a working draft. It looks like this. @EHWV please test.

Screen Shot 2023-11-04 at 7 33 01 PM

dlangille commented 1 year ago

This is now in production, please test.

EHWV commented 1 year ago

Thanks, apologies for the delayed response.

I've looked into this further and have some remarks/issues.

Would you prefer that I append it here or open a new issue?

dlangille commented 1 year ago

If it is related to package search, here.

EHWV commented 1 year ago

I don't have output from the old version anymore, but if I oberserve correctly, you have added a subsection Package flavors (<flavor>: <package>) So, in the normal list output for a match (and in the detailed port view) the user can find there the packages (possibly from flavored ports) with a architecture dependance notice.

I have three remarks about "flavor":

  1. HTML and Plain Text list outputs
  2. Search semantics for "Package Name"
  3. How about flavors?

HTML and Plain Text list outputs

Regarding the checkbox Minimal Output used for "HTML" and "Plain Text" output. When that option is checked, the list output shows the same ports, however, the user has now lost the direct visual match or relation of the search string (for a package name) with the list output when a package search is done that happens not to be a port name sec.

Perhaps you could consider a slightly extended version of the minimal list output that reveals matching package name(s).

Search semantics for "Package Name"

Using "Package Name", it seems that, when targeting a "packaged flavor", a relaxed search is executed when compared to using "Port Name". This leads to false positives.

Using "Package Name" also differs from a comparable pkg-search(8).

E-1a At the Fresports search page:

yields 2 results: the ports editors/emacs and editors/emacs-nox11

E-1b Now using the previous settings of E-1a, but now:

yields the same 2 results. Comparing with the previous example: no results dropped, not expected.

E-2a However, a comparable search for ports shows a different scheme: At the fresports search page:

yields 1 result.

E-2b Now using the previous settings of E-2a, but now:

yields no result.

E-3 Using pkg search:

[1] # pkg search ^emacs-nox
emacs-nox-29.1,3               GNU editing macros (No X flavor)
[2] # pkg search --exact emacs-nox-29.1,3
emacs-nox-29.1,3               GNU editing macros (No X flavor)
[3] # pkg search --exact emacs-nox
[4] # echo $?
1

Although the semantics of --exact are not identical to the "equal" drop-down of Freshports, the pkg search command [3] can compared to E-1b.

How about flavors?

Freshports has an extended functionality beyond mere ports and has also included packages and "flavored packages". As flavors are a unique concept of FreeBSD ports (AFAIK) it seems that flavor names also form a seperate category where the "Flavor Name" is not the same as the flavored Package Name. For example, the port emulators/qemu has the following entries of Flavor Name - Package Name: Package flavors (<flavor>: <package>)

    default: qemu
    nox11: qemu-nox11
    tools: qemu-tools
    guestagent: qemu-guest-agent

"Flavor Name" could be a useful category to add to the items of the first drop-down after the "The FreshPorts Search" heading. Of course such a flavor addition would not only apply to flavored packages but also to flavors of ports in general.


[*] I only used this checkbox in search of a contrasting example.

dlangille commented 1 year ago

FYI, I'll be responding as I go through the points. :)

I don't have output from the old version anymore, but if I oberserve correctly, you have added a subsection Package flavors (<flavor>: <package>) So, in the normal list output for a match (and in the detailed port view) the user can find there the packages (possibly from flavored ports) with a architecture dependance notice.

FYI: Package flavors is not recently added - it is five years old: https://github.com/FreshPorts/freshports/commit/4e873ee8c9e0eae672f5e4030b4d9afe840ff52a

dlangille commented 1 year ago

HTML and Plain Text list outputs

Regarding the checkbox Minimal Output used for "HTML" and "Plain Text" output. When that option is checked, the list output shows the same ports, however, the user has now lost the direct visual match or relation of the search string (for a package name) with the list output when a package search is done that happens not to be a port name sec.

Perhaps you could consider a slightly extended version of the minimal list output that reveals matching package name(s).

The main purpose of Plain Text is to get a list of category/port values for later use (e.g. you're researching for later work on changing something).

When searching by package name with Minimal output, we could include the list of flavors - that would expand the list slightly - if you want to follow up on that, please create a new issue for tracking purposes. It will get lost in here.

dlangille commented 1 year ago

How about flavors?

Freshports has an extended functionality beyond mere ports and has also included packages and "flavored packages". As flavors are a unique concept of FreeBSD ports (AFAIK) it seems that flavor names also form a seperate category where the "Flavor Name" is not the same as the flavored Package Name. For example, the port emulators/qemu has the following entries of Flavor Name - Package Name: Package flavors (<flavor>: <package>)

    default: qemu
    nox11: qemu-nox11
    tools: qemu-tools
    guestagent: qemu-guest-agent

"Flavor Name" could be a useful category to add to the items of the first drop-down after the "The FreshPorts Search" heading. Of course such a flavor addition would not only apply to flavored packages but also to flavors of ports in general.

[*] I only used this checkbox in search of a contrasting example.

The current implementation for searching by package name searches both the make -V PKGNAME name for a port and the output of make -V FLAVORS:

[13:00 empty dan /usr/ports/emulators/qemu] % make -V PKGNAME  
qemu-8.1.2

[13:00 empty dan /usr/ports/emulators/qemu] % make -V FLAVORS
default nox11 tools guestagent

We could rename the dropdown value Package Name to Package/Flavor Name - or do that and also create a Flavor/Package Name option. Both options would invoke the same code and yield the same results.

I hope I'm following what you're getting at.

dlangille commented 1 year ago

Search semantics for "Package Name"

Using "Package Name", it seems that, when targeting a "packaged flavor", a relaxed search is executed when compared to using "Port Name". This leads to false positives.

Using "Package Name" also differs from a comparable pkg-search(8).

E-1a At the Fresports search page:

  • selecting "Package Name" from the drop-down
  • using the drop-down "starting with"
  • check the checkbox "Include deleted ports"[*]
  • search input field: emacs-nox

yields 2 results: the ports editors/emacs and editors/emacs-nox11

E-1b Now using the previous settings of E-1a, but now:

  • using the drop-down "equal to"

yields the same 2 results. Comparing with the previous example: no results dropped, not expected.

This is expected, given that search by package name was implemented only for containing. The only indication of that is in the fine print under Notes: Searching for Package is always 'containing' and case sensitive - if you figure we need something better, please open an issue - the current implementation was a first draft of searching package flavor names.

I think that can be expanded so that all the comparisons can be implemented.

I can think of two ways to resolve that:

1 - create a ticket to get the other search comparisons done 2 - create javascript to disable the other options which are not valid for search by package name

dlangille commented 1 year ago

E-2a However, a comparable search for ports shows a different scheme: At the fresports search page:

  • selecting "Port Name" from the drop-down
  • using the drop-down "starting with"
  • check the checkbox "Include deleted ports"[*]
  • search input field: emacs-nox

yields 1 result.

E-2b Now using the previous settings of E-2a, but now:

  • using the drop-down "equal to"

yields no result.

That makes sense to me. That seems to be the expected results.

E-3 Using pkg search:


[1] # pkg search ^emacs-nox
emacs-nox-29.1,3               GNU editing macros (No X flavor)

That matches FreshPorts.

[2] # pkg search --exact emacs-nox-29.1,3 emacs-nox-29.1,3 GNU editing macros (No X flavor)

That matches FreshPorts.

[3] # pkg search --exact emacs-nox [4] # echo $? 1

That also matches FreshPorts, although it seems pkg-search includes PORTREVISION etc when doing an --exact match.

Although the semantics of --exact are not identical to te "equal" drop-down of Freshports, the pkg search command [3] can compared to E-1b.

If there are points I have missed, please highlight them.

Thank you for great feedback. I hope my replies help.

EHWV commented 12 months ago

Thank you for the clarification about the Plain Text output; I had that in the back of my mind as well. Especially when considering that the searches are port searches, I'm fine with the current status.

My intention with the examples was to show the deviation in behaviour when using the Package Name drop-down compared to the Freshports behaviour for Port Name and comparable pkg-search(8). The behaviour for Package Name was the only one was behaving unexpectedly, as mentioned.

Regarding the flavor names.

I hope I'm following what you're getting at.

Given:

    default: qemu
    nox11: qemu-nox11
    tools: qemu-tools
    guestagent: qemu-guest-agent

the package name qemu-nox11 & qemu-tools are derived from their respective flavor name in a straight forward manner. The package name qemu is different because its derived from the default flavor name, not all that interesting. The flavor name guestagent however is spelled differently and has gained a dash. Perhaps such differences happen more often, though I admit I have not looked further then this example.

Request regarding Package Name

This is expected, given that search by package name was implemented only for containing. The only indication of that is in the fine print under Notes: Searching for Package is always 'containing' and case sensitive - if you figure we need something better, please open an issue - the current implementation was a first draft of searching package flavor names.

I think that can be expanded so that all the comparisons can be implemented.

I can think of two ways to resolve that:

1 - create a ticket to get the other search comparisons done 2 - create javascript to disable the other options which are not valid for search by package name

I failed to notice the "fine print" as you aptly named it.[*]

When I look at the Freshports search web page, I see basically two sections:

When I select a drop-down equal to or any other one for that matter I generally expect that that would be a valid & meaningful selection; I don't expect that it will default to containing.

Ideally the drop-down item list for Package Name could be expanded when the matching search facilities are in place, but I have no immediate desire for that.

I'm very much in favour of a drop-down item list that functionally represents the search parameters being used; that would reflect better UI design. I'd like to request:

2 - create javascript to disable the other options which are not valid for search by package name


[*] compared to the obvious expected behaviour of the drop-down equal to (when using Package Name) I did investigate the meaning of Maximum Effort that appeared quite elusive and happens to not even be present in the fine print but here: https://news.freshports.org/2019/09/03/things-you-didnt-know-freshports-can-do/

The Maximum Effort checkbox on the search page does nothing.

dlangille commented 12 months ago

Regarding the flavor names.

I hope I'm following what you're getting at.

Given:

    default: qemu
    nox11: qemu-nox11
    tools: qemu-tools
    guestagent: qemu-guest-agent

the package name qemu-nox11 & qemu-tools are derived from their respective flavor name in a straight forward manner. The package name qemu is different because its derived from the default flavor name, not all that interesting. The flavor name guestagent however is spelled differently and has gained a dash. Perhaps such differences happen more often, though I admit I have not looked further then this example.

Thanks. I had not noticed that deviation between flavor and package_name.

However, look what we have here:

freshports.devgit=# select distinct package_name from packages
 where package_set = 'latest' and port_id = (select id from ports_active where name = 'qemu') order by package_name;
   package_name   
------------------
 qemu
 qemu-guest-agent
 qemu-nox11
 qemu-tools
(4 rows)

freshports.devgit=# 

That is exactly what we need and all in one table, for every port.

This data is obtained from the build servers via packagesite.yaml - https://news.freshports.org/2020/04/10/what-packages-are-now-available-for-this-port/

dlangille commented 12 months ago

Expanding that search, from show me the packages for this port to show me the ports with packages which match, we get:


freshports.devgit=# select distinct port_id, getport(port_id), package_name 
from packages 
where package_set = 'latest' and package_name ilike '%qemu%' order by 1;
 port_id |                   getport                    |      package_name      
---------+----------------------------------------------+------------------------
   12786 | /ports/head/emulators/qemu                   | qemu
   12786 | /ports/head/emulators/qemu                   | qemu-guest-agent
   12786 | /ports/head/emulators/qemu                   | qemu-nox11
   12786 | /ports/head/emulators/qemu                   | qemu-tools
   20242 | /ports/head/emulators/qemu-devel             | qemu-devel
   23419 | /ports/head/emulators/aqemu                  | aqemu
   34671 | /ports/head/emulators/qemu-user-static       | qemu-user-static
   37974 | /ports/head/emulators/qemu-cheri             | qemu-cheri
   51007 | /ports/head/emulators/qemu-powernv           | qemu-powernv
   55902 | /ports/head/emulators/qemu-user-static-devel | qemu-user-static-devel
   57881 | /ports/head/sysutils/u-boot-qemu-arm         | u-boot-qemu-arm
   58512 | /ports/head/sysutils/u-boot-qemu-arm64       | u-boot-qemu-arm64
   59673 | /ports/head/sysutils/u-boot-qemu-riscv64     | u-boot-qemu-riscv64
   59733 | /ports/head/sysutils/edk2                    | edk2-qemu-i386
   59733 | /ports/head/sysutils/edk2                    | edk2-qemu-x64
  100728 | /ports/head/emulators/qemu6                  | qemu6
  100728 | /ports/head/emulators/qemu6                  | qemu6-nox11
  100728 | /ports/head/emulators/qemu6                  | qemu6-tools
  112113 | /ports/head/emulators/qemu7                  | qemu7
  112113 | /ports/head/emulators/qemu7                  | qemu7-nox11
  112113 | /ports/head/emulators/qemu7                  | qemu7-tools
(21 rows)

freshports.devgit=# 
dlangille commented 12 months ago

Changing the above to get a list of ports, we have:

freshports.devgit=# select distinct port_id, getport(port_id) from packages where package_set = 'latest' and package_name ilike '%qemu%' order by 1;
 port_id |                   getport                    
---------+----------------------------------------------
   12786 | /ports/head/emulators/qemu
   20242 | /ports/head/emulators/qemu-devel
   23419 | /ports/head/emulators/aqemu
   34671 | /ports/head/emulators/qemu-user-static
   37974 | /ports/head/emulators/qemu-cheri
   51007 | /ports/head/emulators/qemu-powernv
   55902 | /ports/head/emulators/qemu-user-static-devel
   57881 | /ports/head/sysutils/u-boot-qemu-arm
   58512 | /ports/head/sysutils/u-boot-qemu-arm64
   59673 | /ports/head/sysutils/u-boot-qemu-riscv64
   59733 | /ports/head/sysutils/edk2
  100728 | /ports/head/emulators/qemu6
  112113 | /ports/head/emulators/qemu7
(13 rows)

NOTE: the above contains 1 deleted port: emulators/qemu6 - that result gets filtered in/out depending on the search criteria.

dlangille commented 12 months ago

Now, when searching by package-name for qemu-guest-agent, emulators/qemu is found. :)

dlangille commented 12 months ago

I'm very much in favour of a drop-down item list that functionally represents the search parameters being used; that would reflect better UI design. I'd like to request:

2 - create javascript to disable the other options which are not valid for search by package name

Yes, let's do that under another ticket. I have opened #500

[*] compared to the obvious expected behaviour of the drop-down equal to (when using Package Name) I did investigate the meaning of Maximum Effort that appeared quite elusive and happens to not even be present in the fine print but here: https://news.freshports.org/2019/09/03/things-you-didnt-know-freshports-can-do/

The Maximum Effort checkbox on the search page does nothing.

I recall this during BSDCan, I don't recall what year, but I know it related to Minimal Output - a bunch of us were sitting around when I coding that and someone mentioned adding Maximum Effort - and we were joking. And in it went.

Does that cover all the points you raised?

EHWV commented 12 months ago

I recall this during BSDCan, I don't recall what year, but I know it related to Minimal Output - a bunch of us were sitting around when I coding that and someone mentioned adding Maximum Effort - and we were joking. And in it went.

Ha, I guessed as much, all in good fun!

Thanks for covering my issues; good to have created #500 addressing drop-down options.

Let me conclude by expressing my thanks for all your FreeBSD contributions, and of course for creating Freshports.

dlangille commented 12 months ago

Thank you. FreshPorts is a very personally rewarding project. I enjoy working with databases.

Oddly enough, when I studied SQL at university, I did not enough/understand it. A few years later, when working with a tool called SQLAnywhere, I took a keen liking to it.

dlangille commented 11 months ago

I read [this article](Ryan Reynolds' Mint Mobile sale to T-Mobile earns actor over $300m https://www.bbc.co.uk/news/world-us-canada-64984291) where it mentions Maximum Effort.

image