WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: tree of tcz which depends of one chosen tcz  (Read 2477 times)

Offline nick65go

  • Hero Member
  • *****
  • Posts: 839
tree of tcz which depends of one chosen tcz
« on: March 01, 2023, 03:09:12 PM »
I saw in https://en.wikipedia.org/wiki/Graphviz some tree dependency, build by
Code: [Select]
Title:          graphviz.tcz
Version:        2.38.0
Size: 5.9MB
Extension_by:   juanito
Comments:       graph drawing programs and libraries
Change-log:     first version
Current:        2016/01/28
I do not know how o use it; and even if I will know, I think we do not need a 6 MB apps to draw an ASCII tree, when we have a tcz.dep.db.gz on the server.

The idea is to have a A.tcz as root, and then list (optionally to a specific level, let say LEV=4 branches), the hierarchical tcz which ask for this A.tcz, aside of their size. Something like:
Code: [Select]
A.tcz
- B1.tcz [x1 kb]
  -- C1.tcz [x2 kb]
  -- D1.tcz [x3 kb]
- B2.tcz [x1 kb]
  -- C2.tcz [x2 kb]
     -- E1.tcz [x1 kb ]
        -- F1.tcz [x2 kb] 
     -- D3.tcz [x3 kb]
        -- E1.tcz [x1 kb]
- B3.tcz [x1 kb]
I think having these 2 files on the server: size.gz (kb for each tcz) and the new tcz.dep.db.gz, some skilled programmer could build a script using just busybox tools, like awk.
The logic i think is similar with the engine of tce-load, using an array of variable number of fields in awk.
I do not have the skills, but maybe someone could take the challenge, for fun, or as an exercise.

 
« Last Edit: March 01, 2023, 03:18:21 PM by nick65go »

Offline nick65go

  • Hero Member
  • *****
  • Posts: 839
Re: tree of tcz which depends of one chosen tcz
« Reply #1 on: March 01, 2023, 03:53:51 PM »
as a sample, for what other package-manager could do, I chroot into Alpine-Linux:
Code: [Select]
root@box:/# apk --help  info
apk-tools 2.12.11, compiled for x86_64.
Info options:
  -r, --rdepends        List reverse dependencies of the package (all other
                        packages which depend on the package)
  -R, --depends         List the dependencies of the package
root@box:/#

Code: [Select]
root@box:/# time apk info -R goffice
goffice-0.10.55-r0 depends on:
so:libatk-1.0.so.0
so:libc.musl-x86_64.so.1
so:libcairo.so.2
so:libgdk-3.so.0
so:libgdk_pixbuf-2.0.so.0
so:libgio-2.0.so.0
so:libglib-2.0.so.0
so:libgmodule-2.0.so.0
so:libgobject-2.0.so.0
so:libgsf-1.so.114
so:libgtk-3.so.0
so:libintl.so.8
so:libpango-1.0.so.0
so:libpangocairo-1.0.so.0
so:librsvg-2.so.2
so:libxml2.so.2
so:libxslt.so.1

real    0m 2.43s
user    0m 1.80s
sys     0m 0.63s

Code: [Select]
root@box:/# time apk info -r goffice
goffice-0.10.55-r0 is required by:
gnumeric-1.12.55-r0
abiword-3.0.5-r6

real    0m 1.21s
user    0m 0.90s
sys     0m 0.30s
« Last Edit: March 01, 2023, 03:59:05 PM by nick65go »

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11049
Re: tree of tcz which depends of one chosen tcz
« Reply #2 on: March 02, 2023, 02:18:08 AM »
We already have tree files, and the depends-on script was just added?
The only barriers that can stop you are the ones you create yourself.

Offline nick65go

  • Hero Member
  • *****
  • Posts: 839
Re: tree of tcz which depends of one chosen tcz
« Reply #3 on: March 02, 2023, 02:49:11 AM »
I was thinking about a tree plus BRANCHES, plus SIZE, plus optionally trim at a chosen deep LEVEL.
You replay that (see my first post here) we will have something like a short list.
Code: [Select]
A.tcz is required by:
B1.tcz
B2.tcz
B3.tcz

But not lets say, branches at level =2, like:
Code: [Select]
A.tcz is required by:
- B1.tcz [x1 kb] ->
-- C1.tcz [x2 kb]   LEV=2
- B2.tcz [x1 kb]
  -- C2.tcz [x2 kb]   LEV=2
- B3.tcz [x1 kb]

If this is already the plan for depends-on.sh then I miss-interpreted.
« Last Edit: March 02, 2023, 02:55:23 AM by nick65go »

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11049
Re: tree of tcz which depends of one chosen tcz
« Reply #4 on: March 02, 2023, 11:33:55 AM »
Ah, you want a reverse tree. No, that is not planned, it's not very commonly needed. I can't really think of any use case for it.

You can write it for yourself, call depends-on.sh recursively and indent to create a tree.
The only barriers that can stop you are the ones you create yourself.

Offline mocore

  • Hero Member
  • *****
  • Posts: 666
  • ~.~
Re: tree of tcz which depends of one chosen tcz
« Reply #5 on: March 19, 2023, 04:13:58 AM »
I do not know how o use it; and even if I will know,
I think we do not need a 6 MB apps to draw an ASCII tree, when we have a tcz.dep.db.gz on the server.

i have in the past found (&lost)  awk scripts

eg 
https://github.com/pouriya/grawk - Simple Awk script for generating ASCII graphs in terminal
the one i had in mind but now cant find was to create graphs git branch/history (like git hub)

Offline mocore

  • Hero Member
  • *****
  • Posts: 666
  • ~.~
Re: tree of tcz which depends of one chosen tcz
« Reply #6 on: March 19, 2023, 09:08:06 AM »
ftr this was the project i had in mind

"Grawkit is a tool that helps build SVG graphs from git command-line descriptions, and is built in Awk."
https://github.com/deuill/grawkit - The Awksome Git Graph Generator

perhaps it can provide some inspiration , all though mabe it is less relevant than pouriya/grawk  which (apparently) outputs ascii graphs

Ah, you want a reverse tree. No, that is not planned, it's not very commonly needed. I can't really think of any use case for it.

You can write it for yourself, call depends-on.sh recursively and indent to create a tree.

presumably a 'reverse tree' would be like one of the methods
mentioned hear https://en.wikipedia.org/wiki/Tree_traversal
ftr the wiki links to rosettacode
 8) https://rosettacode.org/wiki/Tree_traversal
which conveniently has a section on tree traversal
and  various examples in awk!
https://rosettacode.org/wiki/Tree_traversal#AWK