Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include last-modified for cached packages #240

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
Loading