diff --git a/pkg_summary-utils/DESCR b/pkg_summary-utils/DESCR index 959a53f243..d6689b4311 100644 --- a/pkg_summary-utils/DESCR +++ b/pkg_summary-utils/DESCR @@ -17,3 +17,4 @@ pkg_refresh_summary - output an information about latest/newest version pkg_grep_summary - grep the summary using AWK expression pkg_cleanup_distdir - remove old unused distfiles pkg_uniq_summary - filter out repeated package summaries +pkg_summary2build_graph- convert src_summary to build dependency graph diff --git a/pkg_summary-utils/PLIST b/pkg_summary-utils/PLIST index d57425dec1..7f570dede4 100644 --- a/pkg_summary-utils/PLIST +++ b/pkg_summary-utils/PLIST @@ -1,4 +1,4 @@ -@comment $NetBSD: PLIST,v 1.13 2009/03/31 20:31:46 cheusov Exp $ +@comment $NetBSD: PLIST,v 1.14 2009/05/30 14:18:32 cheusov Exp $ bin/cvs_checksum bin/pkg_assignments2pkgpath bin/pkg_cleanup_distdir @@ -10,6 +10,7 @@ bin/pkg_refresh_summary bin/pkg_src_fetch_var bin/pkg_src_summary bin/pkg_summary2bb_pkgs +bin/pkg_summary2build_graph bin/pkg_summary4view bin/pkg_uniq_summary bin/pkg_update_src_summary @@ -22,6 +23,7 @@ man/man1/pkg_list_all_pkgs.1 man/man1/pkg_micro_src_summary.1 man/man1/pkg_refresh_summary.1 man/man1/pkg_src_summary.1 +man/man1/pkg_summary2build_graph.1 man/man1/pkg_summary4view.1 man/man1/pkg_uniq_summary.1 man/man1/pkg_update_src_summary.1 diff --git a/pkg_summary-utils/files/Makefile b/pkg_summary-utils/files/Makefile index 9cf1701350..21aa9521a1 100644 --- a/pkg_summary-utils/files/Makefile +++ b/pkg_summary-utils/files/Makefile @@ -26,7 +26,7 @@ SCRIPTS+= pkg_update_src_summary pkg_summary4view SCRIPTS+= pkg_update_summary pkg_grep_summary SCRIPTS+= cvs_checksum pkg_assignments2pkgpath SCRIPTS+= pkg_uniq_summary pkg_summary2bb_pkgs -SCRIPTS+= pkg_cleanup_distdir +SCRIPTS+= pkg_cleanup_distdir pkg_summary2build_graph MAN= pkg_summary-utils.7 MAN+= pkg_cmp_summary.1 pkg_grep_summary.1 @@ -35,7 +35,7 @@ MAN+= pkg_src_summary.1 pkg_update_src_summary.1 MAN+= pkg_summary4view.1 pkg_update_summary.1 MAN+= pkg_refresh_summary.1 pkg_list_all_pkgs.1 MAN+= cvs_checksum.1 pkg_uniq_summary.1 -MAN+= pkg_cleanup_distdir.1 +MAN+= pkg_cleanup_distdir.1 pkg_summary2build_graph.1 FILES= README NEWS TODO pkg_grep_summary.awk pkg_src_summary.mk diff --git a/pkg_summary-utils/files/Makefile.version b/pkg_summary-utils/files/Makefile.version index db7ded9b11..6d68bb4a5e 100644 --- a/pkg_summary-utils/files/Makefile.version +++ b/pkg_summary-utils/files/Makefile.version @@ -1 +1 @@ -VERSION= 0.29.0 +VERSION= 0.30.0 diff --git a/pkg_summary-utils/files/NEWS b/pkg_summary-utils/files/NEWS index 318f627f60..420ab8588c 100644 --- a/pkg_summary-utils/files/NEWS +++ b/pkg_summary-utils/files/NEWS @@ -1,3 +1,9 @@ +---------------------------------------------------------------------- +Version 0.30.0, by Aleksey Cheusov, Sat, 30 May 2009 17:12:18 +0300 + + - New utility pkg_summary2build_graph that converts src_summary + to build dependency graph. + ---------------------------------------------------------------------- Version 0.29.0, by Aleksey Cheusov, Sun, 10 May 2009 23:00:18 +0300 diff --git a/pkg_summary-utils/files/pkg_summary2build_graph.1 b/pkg_summary-utils/files/pkg_summary2build_graph.1 new file mode 100644 index 0000000000..dc9860a234 --- /dev/null +++ b/pkg_summary-utils/files/pkg_summary2build_graph.1 @@ -0,0 +1,43 @@ +.\" $NetBSD: pkg_summary2build_graph.1,v 1.1 2009/05/30 14:18:32 cheusov Exp $ +.\" +.\" Copyright (c) 2008 by Aleksey Cheusov (cheusov@tut.by) +.\" Absolutely no warranty. +.\" +.\" ------------------------------------------------------------------ +.de VB \" Verbatim Begin +.ft CW +.nf +.ne \\$1 +.. +.de VE \" Verbatim End +.ft R +.fi +.. +.\" ------------------------------------------------------------------ +.TH PKG_SUMMARY2BUILD_GRAPH 1 "Jan 29, 2008" "" "" +.SH NAME +.B pkg_summary2build_graph +converts src_summary to build dependency graph +.SH SYNOPSIS +.BI pkg_summary2build_graph " [files...]" +.SH DESCRIPTION +.B pkg_summary2build_graph +converts src_summary to build dependency graph analysing +{alter,native}:../../dep/endencies entries in DEPENDS and +BUILD_DEPENDS fields. Format of the output: +.VB + package2 package3 + package1 + ... +.VE +Here package1 has no dependencies and package3 depends on package2. +.SH EXAMPLES +.VB +pkg_list_all_pkgs | pkg_src_summary | pkg_summary2build_graph +.VE +.SH SEE ALSO +.BR pkg_summary-utils(7) , +.BR pkg_summary(5) , +.BR pkg_src_summary(1) +.SH AUTHOR +Aleksey Cheusov diff --git a/pkg_summary-utils/files/pkg_summary2build_graph.in b/pkg_summary-utils/files/pkg_summary2build_graph.in new file mode 100644 index 0000000000..13668012a5 --- /dev/null +++ b/pkg_summary-utils/files/pkg_summary2build_graph.in @@ -0,0 +1,122 @@ +#!/usr/bin/env runawk + +# Copyright (c) 2008-2009 Aleksey Cheusov +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +############################################################ + +#env "LC_ALL=C" + +#use "power_getopt.awk" +#use "alt_assert.awk" +#use "braceexpand.awk" + +############################################################ +#.begin-str help +# pkg_summary2build_graph - converts src_summary to build +# dependency graph analysing {alter,native}:../../dep/endencies entries +# in DEPENDS and BUILD_DEPENDS fields. +# Format of the output: +# package1 +# package2 package3 +# ... +# Here package3 depends on package2, package1 has no dependencies. +# usage: pkg_summary2build_graph [OPTIONS] [files...] +# OPTIONS: +# -h|--help display this help +#.end-str +############################################################ + +/^PKGNAME=/ { + pkgname = substr($0, 9) + pkgbase = pkgname + sub(/-[^-]+$/, "", pkgbase) + + pkgpaths [pkgbase] = 1 + + next +} + +/^PKGPATH=/ { + pkgpath = substr($0, 9) + nodep_pkgpaths [pkgpath] = 1 + next +} + +NF == 0 { + assert(pkgbase != "", "Cannot find pkgbase") + assert(pkgpath != "", "Cannot find pkgpath") + + pkgpaths [pkgbase] = pkgpath + + pkgbase = pkgpath = "" + next +} + +/^DEPENDS=/ || /^BUILD_DEPENDS=/ { + sub(/^[^=]+=/, "") + delete deps + for (i=1; i <= NF; ++i){ + if ($i !~ /[{]/){ + sub(/^.*:(..\/..\/)?/, "", $i) + deps [$i " " pkgpath] = 1 + delete nodep_pkgpaths [pkgpath] + delete nodep_pkgpaths [$i] + }else{ + depbase = $i + sub(/:.*$/, "", depbase) + depbase = braceexpand(depbase) + sub(/ .*$/, "", depbase) + sub(/-\[[^\[\]]*\].$|(>|>=|<|<=|=|-)[^><=-]*$/, "", depbase) + + delete nodep_pkgpaths [pkgpath] + hidden_deps [depbase " " pkgpath] = 1 + } + } + for (dep in deps){ + print dep + } +} + +END { + ex = 0 + + for (hdep in hidden_deps){ + base = hdep + sub(/ .*$/, "", base) + + if (! (base in pkgpaths)){ + print "Cannot find PKGPATH for " base > "/dev/stderr" + ex = 1 + }else{ + pkgpath = hdep + sub(/^.* /, "", pkgpath) + + print pkgpaths [base], pkgpath + } + } + + for (pkgpath in nodep_pkgpaths){ + print pkgpath + } + + exit ex +}