# --- SDE-COPYRIGHT-NOTE-BEGIN --- # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # Filename: lib/sde-package/package-list.awk # Copyright (C) 2007 The OpenSDE Project # Copyright (C) 2004 - 2006 The T2 SDE Project # Copyright (C) 1998 - 2003 Clifford Wolf # # More information can be found in the files COPYING and README. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 of the License. A copy of the # GNU General Public License can be found in the file COPYING. # --- SDE-COPYRIGHT-NOTE-END --- # Usage: gawk -f lib/sde-package/package-list.awk -v arch=$arch # function print_package() { print defset, stages, pri, pkgtree, package, ver, "/" categories flags, 0; } END { if ( pkgtree ) print_package(); } ( FNR == 1 && pkgtree ) { print_package(); } FNR == 1 { split(FILENAME, a, /\//); pkgtree=a[2]; package=a[3]; defset="X"; pri="999.999"; stages="-----------"; ver="0000"; categories="" ver_dup=0; flags="" } /^\[(P|PRI|PRIORITY)\]/ { split($0, a, /[ \t]+/); defset=a[2]; stages=a[3]; pri=a[4]; } /^\[(V|VER|VERSION)\]/ { split($0, a, /[ \t]+/); if ( ver_dup == 0 ) ver=a[2]; ver_dup = 1; } /^\[(C|CATEGORY)\]/ { split($0, a, /[ \t]+/); for (c=2; a[c]; c++) categories = categories " " a[c]; } /^\[(F|FLAGS)\]/ { split($0, a, /[ \t]+/); for (c=2; a[c]; c++) flags = flags " " a[c]; } /^\[(R|ARCH|ARCHITECTURE)\]/ { n=split($0, a, /[ \t]+/); #if (arch == "") # next; # search for an architecture match if ( a[2] == "-" ) { for ( i = 3; i<= n; ++i) { if ( arch == a[i] ) { pkgtree="" next; } } # fall thru: keep it } else { # intentionally start at index 2: implicit exlusive selection for ( i = 2; i<= n; ++i) { if ( arch == a[i] ) { next; } } # not found: remove it pkgtree=""; } }