Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[Software] exploring grep-dctrl

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
ychaouche
Posts: 87
Joined: 2014-12-11 09:45

[Software] exploring grep-dctrl

#1 Post by ychaouche »

Hello there,

I am exploring the possibilities of grep-dctrl.
My current experiment is to try and show the description of a package that is not necessarily installed.
I have defined a package.describe function in my .bashrc that does the following:

Code: Select all

$ type package.describe
package.describe is a function
package.describe ()
{
    apt-cache show "$1" | grep-dctrl -s Description-en -
}
$
I get desired result

Code: Select all

16:40:35 ~ -1- $ package.describe syslog-summary
Description-en: summarize the contents of a syslog log file
 This program summarizes the contents of a log file written by syslog,
 by displaying each unique (except for the time) line once, and also
 the number of times such a line occurs in the input. The lines are
 displayed in the order they occur in the input.
 .
 It is also possible to define some "ignore rules" using regular
 expressions.
16:42:15 ~ -1- $

I tried to achieve the same w/o using apt-cache, but couldn't.

My failed attempts were :

1/

Code: Select all

16:37:50 ~ -1- $ grep-dctrl -PX syslog-summary /var/lib/apt/lists/*_Packages
Package: syslog-summary
Priority: optional
Section: universe/admin
Installed-Size: 80
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: David Paleino <dapal@debian.org>
Architecture: all
Version: 1.14-2
Depends: python (>= 2.5)
Recommends: python-magic
Filename: pool/universe/s/syslog-summary/syslog-summary_1.14-2_all.deb
Size: 9798
MD5sum: 1694a9b5722f7264f7fb9485c9367f8e
SHA1: c10d8bbf1fc65bcabd2094bd3510fe72925c8d2f
SHA256: 880d6b9b33ea43b137a0c86d8ed88f81674b83c31c4c9924825f7002c834dc9b
Description: summarize the contents of a syslog log file
Description-md5: 3f8fee696c08d1fc790b6611eadfbef1
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu

Package: syslog-summary
Priority: optional
Section: universe/admin
Installed-Size: 80
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: David Paleino <dapal@debian.org>
Architecture: all
Version: 1.14-2
Depends: python (>= 2.5)
Recommends: python-magic
Filename: pool/universe/s/syslog-summary/syslog-summary_1.14-2_all.deb
Size: 9798
MD5sum: 1694a9b5722f7264f7fb9485c9367f8e
SHA1: c10d8bbf1fc65bcabd2094bd3510fe72925c8d2f
SHA256: 880d6b9b33ea43b137a0c86d8ed88f81674b83c31c4c9924825f7002c834dc9b
Description: summarize the contents of a syslog log file
Description-md5: 3f8fee696c08d1fc790b6611eadfbef1
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu

16:39:07 ~ -1- $

Output has only 1-line description field.

2/

Code: Select all

16:40:30 ~ -1- $ grep-aptavail -PX syslog-summary
Package: syslog-summary
Priority: optional
Section: universe/admin
Installed-Size: 80
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: David Paleino <dapal@debian.org>
Architecture: all
Version: 1.14-2
Depends: python (>= 2.5)
Recommends: python-magic
Filename: pool/universe/s/syslog-summary/syslog-summary_1.14-2_all.deb
Size: 9798
MD5sum: 1694a9b5722f7264f7fb9485c9367f8e
SHA1: c10d8bbf1fc65bcabd2094bd3510fe72925c8d2f
SHA256: 880d6b9b33ea43b137a0c86d8ed88f81674b83c31c4c9924825f7002c834dc9b
Description: summarize the contents of a syslog log file
Description-md5: 3f8fee696c08d1fc790b6611eadfbef1
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu

16:40:35 ~ -1- $
Same as with grep-dctrl, description is a one-liner.

Suggestions?

CwF
Global Moderator
Global Moderator
Posts: 2625
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 190 times

Re: [Software] exploring grep-dctrl

#2 Post by CwF »

ychaouche wrote: 2022-11-27 15:43 Suggestions?
What are you after?

Code: Select all

:~$  aptitude show grep-dctrl
No candidate version found for grep-dctrl
Package: grep-dctrl
State: not a real package
Provided by: dctrl-tools (2.24-3+b1)

:~$  aptitude show dctrl-tools
Package: dctrl-tools              
Version: 2.24-3+b1
State: not installed
Multi-Arch: foreign
Priority: optional
Section: utils
Maintainer: Rhonda D'Vine <rhonda@debian.org>
Architecture: amd64
Uncompressed Size: 432 k
Depends: libc6 (>= 2.14)
Suggests: apt, debtags
Conflicts: grep-dctrl
Replaces: grep-dctrl
Provides: grep-dctrl
Description: Command-line tools to process Debian package information
 Debian package information is generally stored in files having a special file
 format, dubbed the Debian control file format (the dctrl format), a special
 case of the record jar file format.  These tools operate on any files
 conforming in a general sense to that format and are therefore widely
 applicable whenever those formats are in play. 
 
 Included are: 
 
  grep-dctrl     - Grep dctrl-format files
  grep-available - Grep the DPKG available database
  grep-status    - Grep the DPKG status database
  grep-aptavail  - Grep the APT available database
  grep-debtags   - Grep the Debtags package database
 
  sort-dctrl     - Sort dctrl-format files
 
  tbl-dctrl      - Tabulate dctrl-format files
 
  sync-available - Sync the dpkg available database with
                   the apt database
Homepage: https://github.com/ajkaijanaho/dctrl-tools
Tags: admin::package-management, devel::debian, implemented-in::c,
      interface::commandline, role::program, scope::utility, suite::debian,
      use::searching, use::synchronizing, works-with::software:package,
      works-with::text

ychaouche
Posts: 87
Joined: 2014-12-11 09:45

Re: [Software] exploring grep-dctrl

#3 Post by ychaouche »

CwF wrote: 2022-11-27 17:53 What are you after?
Using grep-dctrl tools, show the description of a package, whether installed or not.

CwF
Global Moderator
Global Moderator
Posts: 2625
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 190 times

Re: [Software] exploring grep-dctrl

#4 Post by CwF »

Since 'syslog-summary' is not a Debian package I don't know what the description line should be...

Is 'aptitude show' to fat? So you're looking for a minimal footprint for the function?

I thought there were short and long descriptions, but they are not separate, the first line is the short, then a paragraph+ is the long. Not sure why it would drop it.

Check your versions manpage
-d Show only the first line of the Description field from the matching paragraphs. If
no -s option is specified, this option also effects -s Description; if there is a
-s option but it does not include the Description field name, one is appended to
the option. Thus the Description field's location in the output is determined by
the -s option, if any, the last field being the default.

Post Reply