OpenSDE Framework (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
1.9 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: lib/sde-package/package-list.awk
  5. # Copyright (C) 2007 The OpenSDE Project
  6. # Copyright (C) 2004 - 2006 The T2 SDE Project
  7. # Copyright (C) 1998 - 2003 Clifford Wolf
  8. #
  9. # More information can be found in the files COPYING and README.
  10. #
  11. # This program is free software; you can redistribute it and/or modify
  12. # it under the terms of the GNU General Public License as published by
  13. # the Free Software Foundation; version 2 of the License. A copy of the
  14. # GNU General Public License can be found in the file COPYING.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. # Usage: gawk -f lib/sde-package/package-list.awk -v arch=$arch <desc_files>
  17. #
  18. function print_package() {
  19. print defset, stages, pri, pkgtree,
  20. package, ver, "/" categories flags, 0;
  21. }
  22. END {
  23. if ( pkgtree ) print_package();
  24. }
  25. ( FNR == 1 && pkgtree ) {
  26. print_package();
  27. }
  28. FNR == 1 {
  29. split(FILENAME, a, /\//);
  30. pkgtree=a[2]; package=a[3];
  31. defset="X"; pri="999.999";
  32. stages="-----------";
  33. ver="0000"; categories=""
  34. ver_dup=0; flags=""
  35. }
  36. /^\[(P|PRI|PRIORITY)\]/ {
  37. split($0, a, /[ \t]+/);
  38. defset=a[2]; stages=a[3]; pri=a[4];
  39. }
  40. /^\[(V|VER|VERSION)\]/ {
  41. split($0, a, /[ \t]+/);
  42. if ( ver_dup == 0 ) ver=a[2];
  43. ver_dup = 1;
  44. }
  45. /^\[(C|CATEGORY)\]/ {
  46. split($0, a, /[ \t]+/);
  47. for (c=2; a[c]; c++) categories = categories " " a[c];
  48. }
  49. /^\[(F|FLAGS)\]/ {
  50. split($0, a, /[ \t]+/);
  51. for (c=2; a[c]; c++) flags = flags " " a[c];
  52. }
  53. /^\[(R|ARCH|ARCHITECTURE)\]/ {
  54. n=split($0, a, /[ \t]+/);
  55. #if (arch == "")
  56. # next;
  57. # search for an architecture match
  58. if ( a[2] == "-" ) {
  59. for ( i = 3; i<= n; ++i) {
  60. if ( arch == a[i] ) {
  61. pkgtree=""
  62. next;
  63. }
  64. }
  65. # fall thru: keep it
  66. }
  67. else { # intentionally start at index 2: implicit exlusive selection
  68. for ( i = 2; i<= n; ++i) {
  69. if ( arch == a[i] ) {
  70. next;
  71. }
  72. }
  73. # not found: remove it
  74. pkgtree="";
  75. }
  76. }