3
5
Fork
You've already forked xut
3

Create a metadata cache and use it to drive merges, updates and search #66

Merged
mobinmob merged 8 commits from template_list_cache into master 2026年07月05日 16:18:18 +02:00
No description provided.
This is a huge commit (for the script size).
I have not split it up because everything is connected to a change is
design. The center of the script is now a template information cache.
That is a simple text file with lines in the format:
template|version_revision|repo|restricted
This is used by merge_xtra_templates(), search_template(),
discover_updates() and created by build_template_index().
Some related changes use other small caches with similar formats.
awk is used for many of the new functions.
- use xbps-src show-sys-upgrades for upgrade discovery
- use awk to also sort results
- enable system sw upgrades with the -U arguments
mobinmob force-pushed template_list_cache from b05e1ecbf7 to 7a670f565d 2026年01月22日 17:33:06 +01:00 Compare
mobinmob force-pushed template_list_cache from e82edf1c08 to a9eb3a8023 2026年01月22日 18:56:35 +01:00 Compare
AngMits left a comment
Copy link

A lot of heavy lifting is done in awk, and at this point, it would make a bit more sense to move this code elsewhere for clarity.

The rest of the comments are observations; feel free to disregard them. Overall, this feels more powerful.

A lot of heavy lifting is done in awk, and at this point, it would make a bit more sense to move this code elsewhere for clarity. The rest of the comments are observations; feel free to disregard them. Overall, this feels more powerful.
xut Outdated
@ -193,4 +198,3 @@
sum=1ドル
# decimal → hex using POSIX printf
hash=$(printf "%x" "$sum")
Contributor
Copy link

Is this a literal that needs to be single-quoted?

Is this a literal that needs to be single-quoted?
Author
Owner
Copy link

There is certainly a bug in the vicinity, but %x is the printf format specifier/specification. I have to fix this is more ways than one.
Some cksums will disappear as they are overkill.

There is certainly a bug in the vicinity, but %x is the printf format specifier/specification. I have to fix this is more ways than one. Some cksums will disappear as they are overkill.
xut Outdated
@ -218,0 +212,4 @@
msg debug "template_index missing, building it"
build_template_index
else
msg debug "template_index already exists"
Contributor
Copy link

The value could be passed here just for completeness:
msg debug "template_index already exists: $template_index"

The value could be passed here just for completeness: ` msg debug "template_index already exists: $template_index"`
Author
Owner
Copy link

Nice suggestion, thanks 😉

Nice suggestion, thanks 😉
xut Outdated
@ -218,0 +269,4 @@
BEGIN { OFS="|" }
FNR==1 {
v = ""
Contributor
Copy link

Perhaps more descriptive names would help.

Perhaps more descriptive names would help.
Author
Owner
Copy link

These are awk syntax. They are short because they are ancient. They remain powerful though!

These are awk syntax. They are short because they are ancient. They remain powerful though!
Author
Owner
Copy link

@AngMits wrote in #66 (comment):

A lot of heavy lifting is done in awk, and at this point, it would make a bit more sense to move this code elsewhere for clarity.

The rest of the comments are observations; feel free to disregard them. Overall, this feels more powerful.

Thanks for the review and recommendations!
The awk parts should be pulled out of the main script. In fact I believe that most of the sh functions should be in separate files, sourced by the xut script.
Awk is separate though. It can be an executable helper with the awk shebang called with arguments to do whatever is needed. Much cleaner that the current state of affairs.
BTW, I will also need to document a dependency on gawk or rewrite parts of the code. Maybe add local variables in the shell parts (supported by ash, dash, bb ash, bash, zsh, mksh...).

@AngMits wrote in https://codeberg.org/mobinmob/xut/pulls/66#issuecomment-10129758: > A lot of heavy lifting is done in awk, and at this point, it would make a bit more sense to move this code elsewhere for clarity. > > The rest of the comments are observations; feel free to disregard them. Overall, this feels more powerful. > Thanks for the review and recommendations! The awk parts should be pulled out of the main script. In fact I believe that most of the sh functions should be in separate files, sourced by the xut script. Awk is separate though. It can be an executable helper with the awk shebang called with arguments to do whatever is needed. Much cleaner that the current state of affairs. BTW, I will also need to document a dependency on gawk or rewrite parts of the code. Maybe add local variables in the shell parts (supported by ash, dash, bb ash, bash, zsh, mksh...).
mobinmob force-pushed template_list_cache from 8be1b60d64 to f37dc6610a
All checks were successful
xut CI / test (pull_request) Successful in 1m26s
xut CI / test (push) Successful in 1m30s
2026年07月05日 16:17:42 +02:00
Compare
mobinmob changed title from (削除) WIP: Create a metadata cache and use it to drive merges, updates and search (削除ここまで) to Create a metadata cache and use it to drive merges, updates and search 2026年07月05日 16:17:58 +02:00
Sign in to join this conversation.
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
mobinmob/xut!66
Reference in a new issue
mobinmob/xut
No description provided.
Delete branch "template_list_cache"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?