Skip to content

Commit

Permalink
Include last-modified for cached packages
Browse files Browse the repository at this point in the history
  • Loading branch information
pbrisbin committed Oct 22, 2024
1 parent 1110821 commit 2417318
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
9 changes: 6 additions & 3 deletions bin/downgrade
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ sort_packages() {
# <number> <path> <package name>
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
Expand All @@ -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"
}

# <package name> <package path>
Expand Down
8 changes: 4 additions & 4 deletions test/present_packages/currently-installed.t
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
8 changes: 4 additions & 4 deletions test/present_packages/installed.t
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
6 changes: 3 additions & 3 deletions test/present_packages/success.t
Original file line number Diff line number Diff line change
Expand Up @@ -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 |

0 comments on commit 2417318

Please sign in to comment.