82 lines
2.2 KiB
Text
Executable file
82 lines
2.2 KiB
Text
Executable file
#!/usr/bin/env runawk
|
|
|
|
# Copyright (c) 2007-2008 Aleksey Cheusov <vle@gmx.net>
|
|
#
|
|
# 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 "alt_getopt.awk"
|
|
#use "abort.awk"
|
|
#use "power_getopt.awk"
|
|
|
|
############################################################
|
|
#.begin-str help
|
|
# pkg_uniq_summary - filter out repeated summaries.
|
|
# Summaries are compared by (PKGPATH, PKGBASE, ASSIGNMENTS) triple.
|
|
# usage: pkg_uniq_summary -h
|
|
# pkg_uniq_summary [OPTIONS] [files...]
|
|
# OPTIONS:
|
|
# -h|--help display this help
|
|
#.end-str
|
|
############################################################
|
|
|
|
BEGIN {
|
|
skip = 0
|
|
line_count = 0
|
|
}
|
|
|
|
NF == 0 {
|
|
if (!pkgs [pkgbase, pkgpath, assigns]++){
|
|
for (i=0; i < line_count; ++i){
|
|
print lines [i]
|
|
}
|
|
print ""
|
|
}
|
|
assigns = pkgbase = pkgpath = ""
|
|
line_count = 0
|
|
next
|
|
}
|
|
|
|
{
|
|
lines [line_count++] = $0
|
|
}
|
|
|
|
$0 ~ /^PKGNAME=/ {
|
|
pkgbase = substr($0, 9)
|
|
sub(/-[^-]+$/, "", pkgbase)
|
|
next
|
|
}
|
|
|
|
$0 ~ /^PKGPATH=/ {
|
|
pkgpath = substr($0, 9)
|
|
if (sub(/:.*$/, "", pkgpath)){
|
|
assigns = substr($0, 9)
|
|
sub(/^[^:]*:/, "", assigns)
|
|
}
|
|
next
|
|
}
|
|
|
|
$0 ~ /^ASSIGNMENTS=/ {
|
|
assigns = substr($0, 13)
|
|
next
|
|
}
|