This is a helper script for extracting the used pkg-bindings calls from y2log file and building a markdown document with links to the source code at GitHub.
Last active
November 28, 2024 09:51
-
-
Save lslezak/4d59c037afdf7dec3031ee1cff90b3a4 to your computer and use it in GitHub Desktop.
Find used pkg-bindings calls in y2log
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # /bin/bash | |
| # A helper script hich extracts used pkg-bindings calls from y2log files and | |
| # build a markdown list with links to the GitHub sources. | |
| # Usage: | |
| # 1. Copy the y2log files (/var/log/YaST2/y2log*) from an installation | |
| # 2. Run this script in the pkg-bindings Git checkout | |
| # (https://github.com/yast/yast-pkg-bindings/), pass the path to y2log | |
| # files as arguments: | |
| # | |
| # ./pkg-calls.sh <y2log> ... | |
| # | |
| # You can use a shell glob: | |
| # | |
| # ./pkg-calls.sh y2log* | |
| # | |
| # grep the y2log files for the pkg-bindings calls, read the calls into an array, | |
| # use zgrep so it can read also the compressed files (y2log-*.gz) | |
| mapfile -t CALLS < <( zgrep "Pkg Builtin called" "$@" | sed -e "s/^.* Pkg Builtin called: //" | sort -u ) | |
| for C in "${CALLS[@]}"; do | |
| # use the first found occurence | |
| URL=$(grep -r -n "PkgFunctions::$C\\b" . | sed -e "s/\\.cc:\\([0-9]\\+\\):.*/.cc#L\\1/" -e "s@^./@https://github.com/yast/yast-pkg-bindings/blob/master/@" | head -n 1) | |
| echo "[$C]($URL)" | |
| done |
Author
Resolvables - query the selected/available packages/patterns
This call supports a lot of filtering options. Let's see which ones are actually used during the installation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Minimal functionality for installing a system
These are the minimal functions needed to be able to install a system:
Initialize libzypp
Connect - get the libzypp lock
SetTextLocale - set the UI locale for libzypp errors, pattern descriptions, etc...
TargetInitialize, TargetLoad - initialize a temporary target in /tmp/... (for downloading repository metadata, package cache...)
ImportGPGKey - import the base GPG keys so the repository metadata and the installed packages can be verified
Add repositories
RepositoryAdd - add the installation repositories
Select packages to install
SetPackageLocale - install packages for the specified locale (translation packages, spellcheck dictionaries,...)
ResolvableInstall - install the selected package/pattern
Resolvables - query the selected/available packages/patterns
Run the solver
SetSolverFlags - might not be needed, we need to check which flags are set by YaST, maybe using the defaults is fine...
PkgSolve - run the solver
PkgSolveErrors - get details of the solver errors
Start installation
TargetInitialize, TargetLoad - move the installation target to the just created /mnt partition
Commit - start the package installation
Finish the installation
SourceCacheCopyTo - copy the repository caches to the installed system so they do not need to be downloaded again
SourceReleaseAll - free the resources, unmount the disks...
SourceSaveAll - save the *.repo files to the target system
Close libzypp
TargetFinish - free the target resources (the lock as well?)
Optional