WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Proposal: new file dep.db.gz on tc server, having all *.tcz.dep inside  (Read 4682 times)

Online Greg Erskine

  • Sr. Member
  • ****
  • Posts: 404
Re: Proposal: new file dep.db.gz on tc server, having all *.tcz.dep inside
« Reply #30 on: March 01, 2023, 12:30:30 PM »
Hi GNUser
Code: [Select]
EXTN="${EXTN%.tcz}.tcz"
That's exactly how I handled it in my  FetchExt.sh  script.  :)

That's probably where I got it from.  ;D

When I was doing a web GUI interface for extensions in piCorePlayer, I eventually realised that ALL the heavy lifting had already been done in the TC core scripts! That's why I get a little nervous when I see lots of suggested changes to these scripts.

Offline GNUser

  • Hero Member
  • *****
  • Posts: 1377
Re: Proposal: new file dep.db.gz on tc server, having all *.tcz.dep inside
« Reply #31 on: March 01, 2023, 12:34:59 PM »
That's why I get a little nervous when I see lots of suggested changes to these scripts.
Haha. Me, too. Fortunately curaga has a discriminating eye.
I respect the TCL scripts and only dare to suggest minor edits.

Online Greg Erskine

  • Sr. Member
  • ****
  • Posts: 404
Re: Proposal: new file dep.db.gz on tc server, having all *.tcz.dep inside
« Reply #32 on: March 01, 2023, 12:40:02 PM »
On the attached script the indentation is using both spaces and tabs.

Is the capitalisation of the variable $Age OK?

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11267
Re: Proposal: new file dep.db.gz on tc server, having all *.tcz.dep inside
« Reply #33 on: March 01, 2023, 01:07:17 PM »
Hi GNUser
... This is what I mean. Your change only fixes the unexpected results sometimes, so it's not really getting to the actual problem.
Yeah, OK, I see now what you mean. My fix filters out extensions without dependencies. Fuzzy searches
can match on any field and can be a substring of a field.

I dealt with a similar problem in my  LddCheck.sh  script:
https://forum.tinycorelinux.net/index.php/topic,26040.0.html

There I searched  Records  using $0 which is fast. Anytime there is a match, it searchs that  Record  a
second time from  $2  to  NF.

Offline GNUser

  • Hero Member
  • *****
  • Posts: 1377
Re: Proposal: new file dep.db.gz on tc server, having all *.tcz.dep inside
« Reply #34 on: March 01, 2023, 01:18:58 PM »
There I searched  Records  using $0 which is fast. Anytime there is a match, it searchs that  Record  a
second time from  $2  to  NF.
That's brilliant. Yes, this would solve the actual problem without an undue decrease in speed.

It will be a pleasure to think about this further and implement a solution based on this idea.

Offline GNUser

  • Hero Member
  • *****
  • Posts: 1377
Re: Proposal: new file dep.db.gz on tc server, having all *.tcz.dep inside
« Reply #35 on: March 01, 2023, 05:11:13 PM »
Hi Greg. Thanks for catching the clashing indentation styles. I fixed that. Age seems a bit strange but is a valid variable name in shell.

Hi Rich. I changed the search logic using your wonderful idea and example script. I did many test queries and am getting only expected responses now. Please give it a whirl:
https://github.com/tinycorelinux/Core-scripts/blob/master/usr/bin/depends-on.sh



« Last Edit: March 01, 2023, 05:13:56 PM by GNUser »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11267
Re: Proposal: new file dep.db.gz on tc server, having all *.tcz.dep inside
« Reply #36 on: March 01, 2023, 05:23:15 PM »
Hi GNUser
... Age seems a bit strange but is a valid variable name in shell. ...
I'm checking how old the file is. Feel free to pick a more appropriate name.  ;D

The link you provided appears to point to an older version without your changes.

Offline GNUser

  • Hero Member
  • *****
  • Posts: 1377
Re: Proposal: new file dep.db.gz on tc server, having all *.tcz.dep inside
« Reply #37 on: March 01, 2023, 05:29:04 PM »
Oops, link will only update if/when curaga merges the pull request. New version of the script is attached. I think the variable name is just fine  ;D

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11267
Re: Proposal: new file dep.db.gz on tc server, having all *.tcz.dep inside
« Reply #38 on: March 01, 2023, 06:17:59 PM »
Hi GNUser
Looks like it's working correctly. The speed held up well too. Timing
fuzzy searches for gtk2 or gtk3 show identical times to the old search.

Well done GNUser, thank you.  :)

Offline GNUser

  • Hero Member
  • *****
  • Posts: 1377
Re: Proposal: new file dep.db.gz on tc server, having all *.tcz.dep inside
« Reply #39 on: March 01, 2023, 07:37:41 PM »
Hi Rich. You're welcome. The awk technique you shared is very interesting. Thank you for teaching me something new.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11267
Re: Proposal: new file dep.db.gz on tc server, having all *.tcz.dep inside
« Reply #40 on: March 01, 2023, 08:04:37 PM »
Hi GNUser
Glad you like it. I call it "Guess and confirm". It's kind of like speculative execution
or predictive branching but more accurate.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10970
Re: Proposal: new file dep.db.gz on tc server, having all *.tcz.dep inside
« Reply #41 on: March 01, 2023, 11:28:58 PM »
I see a possible issue with the fuzzy search: say acpid.tcz depended on libfoo and libfoo2 both. A fuzzy search for "libfoo" would print acpid twice, no? That is, there needs to be a break after the print so it's only printed once.
The only barriers that can stop you are the ones you create yourself.

Offline GNUser

  • Hero Member
  • *****
  • Posts: 1377
Re: Proposal: new file dep.db.gz on tc server, having all *.tcz.dep inside
« Reply #42 on: March 02, 2023, 01:35:22 AM »
Hi curaga. I think you're right. I'll do some tests later.

Hopefully it's a simple matter of telling awk to continue to next record after it prints. I'll try to fix this.

« Last Edit: March 02, 2023, 01:40:22 AM by GNUser »

Offline GNUser

  • Hero Member
  • *****
  • Posts: 1377
Re: Proposal: new file dep.db.gz on tc server, having all *.tcz.dep inside
« Reply #43 on: March 02, 2023, 05:24:56 AM »
You're right, curaga. For example, depends-on.sh -f gst-plugins causes totem.tcz to be printed three times.

A next statement in the right place fixes this. The GitHub pull request has been updated.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10970
Re: Proposal: new file dep.db.gz on tc server, having all *.tcz.dep inside
« Reply #44 on: March 02, 2023, 08:35:46 AM »
Merged your patches, thanks.
The only barriers that can stop you are the ones you create yourself.