Add SUMMARY.txt generator
This commit is contained in:
parent
452391b55e
commit
e738e4092b
1 changed files with 24 additions and 4 deletions
|
@ -48,6 +48,7 @@ if [[ "$#" -lt 1 ]]; then
|
|||
echo -e " ${CACTION}update${RS} - Scan for new packages and add them to the repository";
|
||||
echo -e " ${CACTION}update-cron${RS} - Like ${CACTION}update${RS}, but silent unless something goes wrong";
|
||||
echo -e " ${CACTION}metafiles${RS} - Rebuild the repository metafiles only (useful if you've manually fiddled with the repo packages)";
|
||||
echo -e " ${CACTION}generate-summary${RS} - Generate a SUMMARY.txt file in the repo root";
|
||||
echo -e "";
|
||||
|
||||
exit 1;
|
||||
|
@ -159,6 +160,25 @@ task_metafiles() {
|
|||
task_end $?;
|
||||
}
|
||||
|
||||
# Spits out a TSV record with 3 columns:
|
||||
# 1. Package name
|
||||
# 2. Package version
|
||||
# 3. Package description
|
||||
__analyse_package() { dpkg --info "$1" | awk '/^\s*Package:/ { gsub("\\s*Package:\\s*", ""); printf($0 "\t"); } /^\s*Version:/ { gsub("\\s*Version:\\s*", ""); printf($0 "\t"); } /^\s*Description:/ { gsub("\\s*Description:\\s*", ""); print($0); }'; };
|
||||
|
||||
_generate_summary() {
|
||||
export -f __analyse_package;
|
||||
find "${dir_sources}" -type f -name "*.deb" -print0 | \
|
||||
xargs -0 -n1 -p "$(nproc)" -I{} bash -c 'do_work "{}"' | \ # Generate the TSV records in parallel
|
||||
sort -k1,2V | \ # Sort on the package name, then version (note the 2V does a *version sort* on column 2)
|
||||
uniq | \ # Remove duplicates (e.g. due to multiple architectures)
|
||||
column -t -s "$(printf '\t')"; # Align all the columns nicely - ref https://unix.stackexchange.com/a/468048/64687
|
||||
}
|
||||
|
||||
task_generate-summary() {
|
||||
_generate_summary >"${dir_repo}/SUMMARY.txt";
|
||||
}
|
||||
|
||||
task_update-cron() {
|
||||
tmpfile="$(mktemp --suffix ".aptosaurus.log")";
|
||||
|
||||
|
|
Loading…
Reference in a new issue