8000 apt: Fix updated and issued dates on changelog parsing by ismailof · Pull Request #860 · PackageKit/PackageKit · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

apt: Fix updated and issued dates on changelog parsing #860

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ismailof
Copy link

Fixes the parsing of the changelog dates, which resulted on the issued and updated date parameters never getting filled.

According to deb-changelog specification, the dates in the apt changelog entries do not follow RFC1123 format (which doesn't handle timezones), buut is compatible with RFC2822/RFC5322, that is:
"day-of-week, dd month yyyy hh:mm:ss +zzzz"

Also, rework the conditions to check first for the changelog date line (starts with " --") so it doesn't get shadowed by the general condition (starts with " ")

Some examples of the reported dates on the client side, by adding some debug output to discover:

"kde-cli-tools;4:6.3.4-0ubuntu1;amd64;ubuntu-plucky-universe"
Issued: QDateTime(2025-03-29 15:13:49.000 UTC-05:00 Qt::OffsetFromUTC -18000 s )
Updated: QDateTime(2025-04-02 08:54:06.000 UTC+01:00 Qt::OffsetFromUTC 3600 s )
"### 4:6.3.4-0ubuntu1\n\n * New upstream release (6.3.4)\n\n\n 
-- Rik Mills <rikmills@kde.org>  Wed, 02Apr 2025 08:54:06 +0100\n\n  \n
### 4:6.3.3-0ubuntu2\n\n * No-change rebuild for Qt 6.8.3 ([LP: #2103945](https://bugs.launchpad.net/bugs/2103945)).\n\n\n 
-- Simon Quigley <tsimonq2@ubuntu.com>  Sat, 29 Mar2025 15:13:49 -0500\n"

"ubuntu-release-upgrader-core;1:25.04.15;all;ubuntu-plucky-updates-main"
Issued: QDateTime(2025-04-24 11:20:23.000 UTC-04:00 Qt::OffsetFromUTC -14400 s )
Updated: QDateTime(Invalid)
" == 1:25.04.15 ==\n [ Nick Rosbrook ]\n * DistUpgradeController: exclude pre-write foreign packages from removal\n   (LP: #2107657)\n * data: account for ubuntustudio-desktop-core (LP: #2104859)\n * Run pre-build.sh: updating mirrors.\n [ Julian Andres Klode ]\n * Only upgrade libc6 first if there are no unexpected changes (LP: #2106202)\n\n 
-- Nick Rosbrook <enr0n@ubuntu.com>  Thu, 24 Apr 2025 11:20:23 -0400"

@sidt4
Copy link
Contributor
sidt4 commented May 20, 2025

I think it would be better to add a testcase to https://github.com/PackageKit/PackageKit/blob/main/backends/apt/tests/apt-tests.cpp.

@ismailof ismailof force-pushed the apt-fix-changelog-dates branch from a70bd27 to 2a3bcff Compare May 20, 2025 18:59
Fixes the parsing of the changelog dates, which resulted on the
`issued` and `updated` date parameters never getting filled.

According to `deb-changelog` specification, the dates in the apt
changelog entries do not follow RFC1123 format (which doesn't handle
timezones), but is compatible with RFC2822/RFC5322, that is:
    "day-of-week, dd month yyyy hh:mm:ss +zzzz"

Also, rework the conditions to check first for the changelog date
line (starts with " --") so it doesn't get shadowed by the general
condition (starts with " ")

Adds a test case for the new conversion function
@ismailof ismailof force-pushed the apt-fix-changelog-dates branch from 2a3bcff to e6ec178 Compare May 20, 2025 19:04
@ismailof
Copy link
Author

I think it would be better to add a testcase to https://github.com/PackageKit/PackageKit/blob/main/backends/apt/tests/apt-tests.cpp.

Sure! Added a test case for the conversion function

Testing the whole fetchChangelogData function seems more involved since it also has to fetch the required changelog

@ximion ximion self-requested a review May 21, 2025 00:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0