Hi GNUser
...
3. Running any depends-on.sh foo or depends-on.sh foo.tcz
- Expected matches: Should not include foo.tcz because it seems silly to say that an extension depends on itself
- Actual matches always include foo.tcz ...
The .db files contain Records like this:
aalib-dev.tcz
aalib.tcz
libX11-dev.tcz
A Record consists of Fields , 4 in this case. Field1 is the extension , Field2 and
Field3 are the dependencies, and Field4 is a blank line which marks the end of
a Record.
In awk, $0 is the entire Record. $1 is Field1, $2 is Field2, etc. The search is
performed on $0. For extensions which have no dependencies, $0 and $1 are
the same.
... I attached a little patch that fixes these issues.
awk 'BEGIN {FS="\n";RS=""} /\n'${TARGET_WITH_EXTENSION}'/{print $1}' "$TCEDIR"/"$DB" | grep -v "^${TARGET_WITH_EXTENSION}"
This will filter out avahi-ui-gtk3, gtk3-dev, gtk3-gir, vte-gtk3-dev, wxwidgetsgtk3-dev, etc
from the results when you do a fuzzy search for gtk3.
This should handle that correctly:
awk 'BEGIN {FS="\n";RS=""} /\n'${TARGET_WITH_EXTENSION}'/{if($1 != $0) print $1}' "$TCEDIR"/"$DB"
Nice trick placing \n in front of TARGET. I'll have to make a note of that. If I recall
correctly, the internet is littered with statements that line breaks are ignored when
doing a search of $0.