Skip to content

Instantly share code, notes, and snippets.

@lslezak
Last active November 28, 2024 09:51
Show Gist options
  • Select an option

  • Save lslezak/4d59c037afdf7dec3031ee1cff90b3a4 to your computer and use it in GitHub Desktop.

Select an option

Save lslezak/4d59c037afdf7dec3031ee1cff90b3a4 to your computer and use it in GitHub Desktop.
Find used pkg-bindings calls in y2log

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.

# /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
@mvidner
Copy link

mvidner commented Nov 28, 2024

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