tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

wip/pkg_summary-utils - powerful tools for pkgsrc



As some of you may already know I'm developing wip/pkg_summary-utils,
a collection of tools for manipulating summary files about pkgsrc
packages.

Just a few words about it.

I think these tools be interesting for tech people too.

=================================================================
A collection of utilities for manipulating pkg_summary files,
pkg_summary(5) and pkg_src_summary (the same but for pkgsrc tree).

   pkg_list_all_pkgs      - list (in PKGPATH form) all packages in pkgsrc tree
   pkg_src_summary        - create a full pkg_src_summary
                            for given (in PKGPATH form) packages
   pkg_micro_src_summary  - create a micro pkg_src_summary
                            for given (in PKGPATH form) packages
   pkg_cmp_summary        - compare two summary files, i.e. packages
                            are compared by their versions
   pkg_update_summary     - updates pkg_summary(5) by analysing the modification
                            time of binary packages and pkg_summary(5) file
   pkg_update_src_summary - efficiently updates pkg_src_summary for all
                            packages in pkgsrc tree
   pkg_summary4view       - convert a summary file to human readable format
   pkg_refresh_summary    - output an information about latest/newest version
                            of packages
=================================================================

Samples of usage are below.

All pkgsrc packages (uses SUBDIR variable)

   pkg_list_all_pkgs

Analog for 'lintpkgsrc -i', but MUCH faster:

   pkg_info -Q PKGPATH '*' > packages.txt
   pkg_micro_src_summary < packages.txt 2>/dev/null > micro_summary.txt
   pkg_info -X '*' > inst_pkgs_summary.txt
   pkg_cmp_summary -p inst_pkgs_summary.txt micro_summary.txt

Comparison of binary packages against pkgsrc source tree

   (It is assumed that multiple versions of package may present
   in pkg_summary(5)).

   cd /usr/pkgsrc
   cvs up
   pkg_update_src_summary /usr/pkgsrc/pkg_src_summary.txt # first run is slow
   pkg_update_summary /usr/pkgsrc/pkg_summary.txt
   pkg_refresh_summary /usr/pkgsrc/pkg_summary.txt > newest_pkgs.txt
   pkg_cmp_summary -p newest_pkgs.txt \
                      /usr/pkgsrc/pkg_src_summary.txt

  or (only newest versions are in pkg_summary(5))

   pkg_update_src_summary /usr/pkgsrc/pkg_src_summary.txt # first run is slow
   pkg_update_summary -r /usr/pkgsrc/pkg_summary.txt
   pkg_cmp_summary -p /usr/pkgsrc/pkg_summary.txt \
                      /usr/pkgsrc/pkg_src_summary.txt

The same but with micro summary (much faster!)

   pkg_list_all_pkgs | \
      pkg_micro_src_summary > /usr/pkgsrc/pkg_micro_summary.txt
   pkg_update_summary /usr/pkgsrc/pkg_summary.txt
   pkg_cmp_summary -p /usr/pkgsrc/pkg_micro_summary.txt \
                      /usr/pkgsrc/pkg_src_summary.txt

Summary for humans (looks nice but still easily parsable)

   pkg_summary4view /usr/pkgsrc/pkg_src_summary.txt

  or 

   pkg_summary4view /usr/pkgsrc/pkg_summary.txt

Close to 'pkg_chk -an'

   pkg_info -X '*' > packages.txt
   pkg_cmp_summary -p packages.txt /path/to/simplified_pkgchk.conf

Close to 'pkg_chk -usn'

   pkg_info -X '*' > packages.txt
   pkg_cmp_summary -p packages.txt /usr/pkgsrc/pkg_src_summary.txt |
      awk '$1 !~ /^[+=]$/'

  or 

   pkg_info -X '*' > packages.txt
   pkg_cmp_summary -p packages.txt /usr/pkgsrc/pkg_micro_summary.txt |
      awk '$1 !~ /^[+=]$/'

Close to 'pkg_chk -ubn'

   pkg_info -X '*' > packages.txt
   pkg_cmp_summary -p packages.txt /usr/pkgsrc/pkg_summary.txt |
      awk '$1 !~ /^[+=]$/'

NOTE: To keep pkg_src_summary.txt up-to-date it makes sense to run
pkg_update_src_summary after updating pkgsrc source tree.

P.S.  Does anybody know how to combine pkg_info -a|-u and -X options
without writing a script?  That is I'd like to output pkg_summary
only about user-installed packages.

-- 
Best regards, Aleksey Cheusov.


Home | Main Index | Thread Index | Old Index