Public bug reported:

[WHISHLIST]

While investigating how we can integrate snap detection in sosreport as
a packagemanager just like 'rpm' and 'deb' package does when using
"packages = (<PKG_NAME>,) to detect the presence of the package (if
installed) in a sosreport plugin.

I notice there is no easy way to query all installed snaps and have it
into a 'dpkg-query' output equivalent, unless doing a 'snap list' along
with some 'awk', 'grep', 'sed' and family.

That would be helpful to be able to have a 'dpkg-query --showformat'
equivalent for snap if possible.

# man dpkg-query
......
     -f, --showformat=format
              This option is used to specify the format of the output --show 
will produce. The format is a string that will be output for each package 
listed.

              In the format string, “\” introduces escapes:

                  \n  newline
                  \r  carriage return
                  \t  tab
......

According to sosreport official documentation :
https://github.com/sosreport/sos/wiki/How-to-Write-a-Policy

The expected output from sosreport packagemanager is :
package name|major.minor.bugfix version\n....

The output was based on what the following command offers and still in use as 
of today in sosreport :
# dpkg-query -W -f='${Package}|${Version}\\n' # debian
# rpm -qa --queryformat "%{NAME}|%{VERSION}|%{RELEASE}\\n"

** Affects: snapd (Ubuntu)
     Importance: Wishlist
         Status: New

** Changed in: snapd (Ubuntu)
   Importance: Undecided => Wishlist

** Description changed:

  [WHISHLIST]
  
  While investigating how we can integrate snap detection in sosreport as
  a packagemanager just like 'rpm' and 'deb' package does when using
  "packages = (<PKG_NAME>,) to detect the presence of the package (if
  installed) in a sosreport plugin.
  
  I notice there is no easy way to query all installed snaps and have it
  into a 'dpkg-query' output equivalent, unless doing a 'snap list' along
  with some 'awk', 'grep', 'sed' and family.
  
  That would be helpful to be able to have a 'dpkg-query --showformat'
  equivalent for snap if possible.
  
  # man dpkg-query
  ......
-      -f, --showformat=format
-               This option is used to specify the format of the output --show 
will produce. The format is a string that will be output for each package 
listed.
+      -f, --showformat=format
+               This option is used to specify the format of the output --show 
will produce. The format is a string that will be output for each package 
listed.
  
-               In the format string, “\” introduces escapes:
+               In the format string, “\” introduces escapes:
  
-                   \n  newline
-                   \r  carriage return
-                   \t  tab
+                   \n  newline
+                   \r  carriage return
+                   \t  tab
  ......
  
  According to sosreport official documentation :
  https://github.com/sosreport/sos/wiki/How-to-Write-a-Policy
  
  The expected output from sosreport packagemanager is :
  package name|major.minor.bugfix version\n....
  
- The output was based on what the following command offers :
+ The output was based on what the following command offers and still in use as 
of today in sosreport :
  # dpkg-query -W -f='${Package}|${Version}\\n' # debian
  # rpm -qa --queryformat "%{NAME}|%{VERSION}|%{RELEASE}\\n"

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1773842

Title:
  'dpkg-query --showformat' equivalent for snap

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1773842/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to