From 5998a879450a9950b54e1405c152df275af63e96 Mon Sep 17 00:00:00 2001 From: patrick brisbin Date: Tue, 22 Oct 2024 13:30:44 -0400 Subject: [PATCH] Include last-modified for cached packages --- bin/downgrade | 9 ++++++--- test/present_packages/currently-installed.t | 8 ++++---- test/present_packages/installed.t | 8 ++++---- test/present_packages/success.t | 6 +++--- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/bin/downgrade b/bin/downgrade index 74443db9..cfd2ade2 100755 --- a/bin/downgrade +++ b/bin/downgrade @@ -234,7 +234,7 @@ sort_packages() { # output_package() { local number="$1" path="$2" pkgname="$3" - local pkg indicator=" " location version epoch release + local pkg indicator=" " location timestamp version epoch release if [[ -n "$current" ]] && [[ "$path" == *"$current"* ]]; then # Currently installed @@ -253,22 +253,25 @@ output_package() { # Remote or local file if [[ $path =~ ^/ ]]; then location="$(dirname "$path")" + timestamp=$(stat -c '%y' "$path" | cut -d' ' -f1) else location="$(gettext 'remote')" + timestamp= fi IFS=, read -r epoch version release _ < <( extract_version_parts "$pkgname" "$path" ) - printf "%s\t%s)\t%s\t%s\t%s\t%s\t%s\n" \ + printf "%s\t%s)\t%s\t%s\t%s\t%s\t%s\t%s\n" \ "$indicator" \ "$number" \ "$pkgname" \ "$epoch" \ "$version" \ "$release" \ - "$location" + "$location" \ + "$timestamp" } # diff --git a/test/present_packages/currently-installed.t b/test/present_packages/currently-installed.t index e4b4dea1..78b15af7 100644 --- a/test/present_packages/currently-installed.t +++ b/test/present_packages/currently-installed.t @@ -14,7 +14,7 @@ Outputs an indicator next to currently installed packages > current=( $(currently_installed dia) ) > present_packages dia dia-0.1.0 dia-0.1.1 dia-0.2.2 dia-0.3.3 Available packages (community): - | 1) | dia | | 0.1.0 | | remote - - | 2) | dia | | 0.1.1 | | remote - + | 3) | dia | | 0.2.2 | | remote - | 4) | dia | | 0.3.3 | | remote + | 1) | dia | | 0.1.0 | | remote | + - | 2) | dia | | 0.1.1 | | remote | + + | 3) | dia | | 0.2.2 | | remote | + | 4) | dia | | 0.3.3 | | remote | diff --git a/test/present_packages/installed.t b/test/present_packages/installed.t index 5187dfcc..e28b2f14 100644 --- a/test/present_packages/installed.t +++ b/test/present_packages/installed.t @@ -13,7 +13,7 @@ Outputs an indicator next to previously installed packages > installed=( $(previously_installed dia) ) > present_packages dia dia-0.1.0 dia-0.1.1 dia-0.2.2 dia-0.3.3 Available packages (community): - | 1) | dia | | 0.1.0 | | remote - - | 2) | dia | | 0.1.1 | | remote - - | 3) | dia | | 0.2.2 | | remote - | 4) | dia | | 0.3.3 | | remote + | 1) | dia | | 0.1.0 | | remote | + - | 2) | dia | | 0.1.1 | | remote | + - | 3) | dia | | 0.2.2 | | remote | + | 4) | dia | | 0.3.3 | | remote | diff --git a/test/present_packages/success.t b/test/present_packages/success.t index ffcf7980..34a5f52f 100644 --- a/test/present_packages/success.t +++ b/test/present_packages/success.t @@ -4,6 +4,6 @@ Outputs its arguments as a numbered list $ present_packages foo foo foo foo Available packages (foreign/aur): - | 1) | foo | | | | remote - | 2) | foo | | | | remote - | 3) | foo | | | | remote + | 1) | foo | | | | remote | + | 2) | foo | | | | remote | + | 3) | foo | | | | remote |