From 720a874d6002ecebc3a8159fd5f0d29462ae95e7 Mon Sep 17 00:00:00 2001 From: Willy Sudiarto Raharjo Date: Sat, 15 Oct 2022 19:00:13 +0700 Subject: [PATCH] sqg: Remove duplicate lines in custom queue. Signed-off-by: Willy Sudiarto Raharjo --- src/usr/libexec/sbopkg/sqg/functions | 5 +++++ tools/ChangeLog-latest.txt | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/usr/libexec/sbopkg/sqg/functions b/src/usr/libexec/sbopkg/sqg/functions index 35ff98b..e3708fd 100644 --- a/src/usr/libexec/sbopkg/sqg/functions +++ b/src/usr/libexec/sbopkg/sqg/functions @@ -199,6 +199,11 @@ build_queuefile_custom () { fi done ) + + # Remove all duplicates while preserving the order of lines + # Reference: https://unix.stackexchange.com/questions/194780/remove-duplicate-lines-while-keeping-the-order-of-the-lines + cat -n "$QUEUEDIR/$QUEUENAME.sqf" | sort -k2 | uniq -f1 | sort -k1 | cut -f2- > "$QUEUEDIR/$QUEUENAME.tmp" + mv "$QUEUEDIR/$QUEUENAME.tmp" "$QUEUEDIR/$QUEUENAME.sqf" } # diff --git a/tools/ChangeLog-latest.txt b/tools/ChangeLog-latest.txt index 443ccfb..07bdf8c 100644 --- a/tools/ChangeLog-latest.txt +++ b/tools/ChangeLog-latest.txt @@ -1,10 +1,12 @@ SBOPKG NEWS -sbopkg-devel (2022-03-16 11:56 UTC) +sbopkg-devel (2022-10-15 11:59 UTC) MODIFICATIONS * Update renames * sqg: Fix repo detection when people switch from stable to master or vice versa Patch by Jeremy Hansen (#77) + * sqg: Fix duplicate lines when executing custom queue (partial fix for #83) + Reported by Jeremy Hansen sbopkg 0.38.2 (2022-03-10 16:29 UTC) FEATURES