Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package kcalendarcore for openSUSE:Factory 
checked in at 2022-05-16 18:06:37
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/kcalendarcore (Old)
 and      /work/SRC/openSUSE:Factory/.kcalendarcore.new.1538 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "kcalendarcore"

Mon May 16 18:06:37 2022 rev:32 rq:977151 version:5.94.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/kcalendarcore/kcalendarcore.changes      
2022-04-11 23:48:00.775914340 +0200
+++ /work/SRC/openSUSE:Factory/.kcalendarcore.new.1538/kcalendarcore.changes    
2022-05-16 18:08:13.489257462 +0200
@@ -1,0 +2,11 @@
+Tue May 10 08:17:47 UTC 2022 - Christophe Giboudeaux <[email protected]>
+
+- Update to 5.94.0
+  * New feature release
+  * For more details please see:
+  * https://kde.org/announcements/frameworks/5/5.94.0
+- Changes since 5.93.0:
+  * Create UIDs if necessary (kde#339726)
+  * Add windows CI
+
+-------------------------------------------------------------------

Old:
----
  kcalendarcore-5.93.0.tar.xz
  kcalendarcore-5.93.0.tar.xz.sig

New:
----
  kcalendarcore-5.94.0.tar.xz
  kcalendarcore-5.94.0.tar.xz.sig

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ kcalendarcore.spec ++++++
--- /var/tmp/diff_new_pack.qHOahi/_old  2022-05-16 18:08:14.041257984 +0200
+++ /var/tmp/diff_new_pack.qHOahi/_new  2022-05-16 18:08:14.045257988 +0200
@@ -16,14 +16,14 @@
 #
 
 
-%define _tar_path 5.93
+%define _tar_path 5.94
 # Full KF5 version (e.g. 5.33.0)
 %{!?_kf5_version: %global _kf5_version %{version}}
 # Last major and minor KF5 version (e.g. 5.33)
 %{!?_kf5_bugfix_version: %define _kf5_bugfix_version %(echo %{_kf5_version} | 
awk -F. '{print $1"."$2}')}
 %bcond_without released
 Name:           kcalendarcore
-Version:        5.93.0
+Version:        5.94.0
 Release:        0
 Summary:        Library to access and handle calendar data
 License:        LGPL-2.0-or-later


++++++ kcalendarcore-5.93.0.tar.xz -> kcalendarcore-5.94.0.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kcalendarcore-5.93.0/.gitlab-ci.yml 
new/kcalendarcore-5.94.0/.gitlab-ci.yml
--- old/kcalendarcore-5.93.0/.gitlab-ci.yml     2022-04-02 11:55:43.000000000 
+0200
+++ new/kcalendarcore-5.94.0/.gitlab-ci.yml     2022-04-12 00:21:08.000000000 
+0200
@@ -7,3 +7,4 @@
   - 
https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/freebsd.yml
   - 
https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/linux-qt6.yml
   - 
https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/android-qt6.yml
+  - 
https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/windows.yml
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kcalendarcore-5.93.0/CMakeLists.txt 
new/kcalendarcore-5.94.0/CMakeLists.txt
--- old/kcalendarcore-5.93.0/CMakeLists.txt     2022-04-02 11:55:43.000000000 
+0200
+++ new/kcalendarcore-5.94.0/CMakeLists.txt     2022-04-12 00:21:08.000000000 
+0200
@@ -1,5 +1,5 @@
 cmake_minimum_required(VERSION 3.16)
-set(KF_VERSION "5.93.0") # handled by release scripts
+set(KF_VERSION "5.94.0") # handled by release scripts
 
 project(KCalendarCore VERSION ${KF_VERSION})
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kcalendarcore-5.93.0/autotests/testicalformat.cpp 
new/kcalendarcore-5.94.0/autotests/testicalformat.cpp
--- old/kcalendarcore-5.93.0/autotests/testicalformat.cpp       2022-04-02 
11:55:43.000000000 +0200
+++ new/kcalendarcore-5.94.0/autotests/testicalformat.cpp       2022-04-12 
00:21:08.000000000 +0200
@@ -389,3 +389,117 @@
     QCOMPARE(calendar->notebook(reloadedTodo), notebook);
     QCOMPARE(calendar->notebook(reloadedJournal), notebook);
 }
+
+/**
+ * If an instance does not have a UID, one will be created for it.
+ */
+void ICalFormatTest::testUidGeneration()
+{
+    const QString serializedCalendar = QLatin1String(
+        "BEGIN:VCALENDAR\n"
+        "VERSION:2.0\n"
+        "BEGIN:VEVENT\n"
+        "DTSTAMP:20201103T161340Z\n"
+        "SUMMARY:test\n"
+        "END:VEVENT\n"
+        "END:VCALENDAR");
+    auto calendar = MemoryCalendar::Ptr(new MemoryCalendar(QTimeZone::utc()));
+    ICalFormat format;
+    QVERIFY(format.fromString(calendar, serializedCalendar));
+    const auto events = calendar->events();
+    QCOMPARE(events.count(), 1);
+    const auto event = events[0];
+    QVERIFY( ! event->uid().isEmpty());
+}
+
+/**
+ * Generated UIDs do not depend on the order of properties.
+ */
+void ICalFormatTest::testUidGenerationStability()
+{
+    ICalFormat format;
+
+    const QString serializedCalendar1 = QLatin1String(
+        "BEGIN:VCALENDAR\n"
+        "VERSION:2.0\n"
+        "BEGIN:VEVENT\n"
+        "DTSTAMP:20201103T161340Z\n"
+        "SUMMARY:test\n"
+        "END:VEVENT\n"
+        "END:VCALENDAR");
+    auto calendar1 = MemoryCalendar::Ptr(new MemoryCalendar(QTimeZone::utc()));
+    QVERIFY(format.fromString(calendar1, serializedCalendar1));
+    const auto events1 = calendar1->events();
+    QCOMPARE(events1.count(), 1);
+
+    const QString serializedCalendar2 = QLatin1String(
+        "BEGIN:VCALENDAR\n"
+        "VERSION:2.0\n"
+        "BEGIN:VEVENT\n"
+        "SUMMARY:test\n"
+        "DTSTAMP:20201103T161340Z\n"    // Reordered.
+        "END:VEVENT\n"
+        "END:VCALENDAR");
+    auto calendar2 = MemoryCalendar::Ptr(new MemoryCalendar(QTimeZone::utc()));
+    QVERIFY(format.fromString(calendar2, serializedCalendar2));
+    const auto events2 = calendar2->events();
+    QCOMPARE(events2.count(), 1);
+
+    const auto event1 = events1[0];
+    const auto event2 = events2[0];
+    QCOMPARE(event1->uid(), event2->uid());
+}
+
+/**
+ * Generated UIDs depend on property names and values.
+ */
+void ICalFormatTest::testUidGenerationUniqueness()
+{
+    ICalFormat format;
+
+    const QString serializedCalendar1 = QLatin1String(
+        "BEGIN:VCALENDAR\n"
+        "VERSION:2.0\n"
+        "BEGIN:VEVENT\n"
+        "DTSTAMP:20201103T161340Z\n"
+        "SUMMARY:test\n"
+        "END:VEVENT\n"
+        "END:VCALENDAR");
+    auto calendar1 = MemoryCalendar::Ptr(new MemoryCalendar(QTimeZone::utc()));
+    QVERIFY(format.fromString(calendar1, serializedCalendar1));
+    const auto events1 = calendar1->events();
+    QCOMPARE(events1.count(), 1);
+
+    const QString serializedCalendar2 = QLatin1String(
+        "BEGIN:VCALENDAR\n"
+        "VERSION:2.0\n"
+        "BEGIN:VEVENT\n"
+        "DTSTART:20201103T161340Z\n"    // Property name change.
+        "SUMMARY:test\n"
+        "END:VEVENT\n"
+        "END:VCALENDAR");
+    auto calendar2 = MemoryCalendar::Ptr(new MemoryCalendar(QTimeZone::utc()));
+    QVERIFY(format.fromString(calendar2, serializedCalendar2));
+    const auto events2 = calendar2->events();
+    QCOMPARE(events2.count(), 1);
+
+    const QString serializedCalendar3 = QLatin1String(
+        "BEGIN:VCALENDAR\n"
+        "VERSION:2.0\n"
+        "BEGIN:VEVENT\n"
+        "DTSTAMP:20201103T161341Z\n"    // Property value changed.
+        "SUMMARY:test\n"
+        "END:VEVENT\n"
+        "END:VCALENDAR");
+    auto calendar3 = MemoryCalendar::Ptr(new MemoryCalendar(QTimeZone::utc()));
+    QVERIFY(format.fromString(calendar3, serializedCalendar3));
+    const auto events3 = calendar3->events();
+    QCOMPARE(events3.count(), 1);
+
+    const auto event1 = events1[0];
+    const auto event2 = events2[0];
+    const auto event3 = events3[0];
+    QVERIFY(event1->uid() != event2->uid());
+    QVERIFY(event1->uid() != event3->uid());
+    QVERIFY(event2->uid() != event3->uid());
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kcalendarcore-5.93.0/autotests/testicalformat.h 
new/kcalendarcore-5.94.0/autotests/testicalformat.h
--- old/kcalendarcore-5.93.0/autotests/testicalformat.h 2022-04-02 
11:55:43.000000000 +0200
+++ new/kcalendarcore-5.94.0/autotests/testicalformat.h 2022-04-12 
00:21:08.000000000 +0200
@@ -27,6 +27,9 @@
     void testDateTime_data();
     void testDateTime();
     void testNotebook();
+    void testUidGeneration();
+    void testUidGenerationStability();
+    void testUidGenerationUniqueness();
 };
 
 #endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kcalendarcore-5.93.0/src/icalformat_p.cpp 
new/kcalendarcore-5.94.0/src/icalformat_p.cpp
--- old/kcalendarcore-5.93.0/src/icalformat_p.cpp       2022-04-02 
11:55:43.000000000 +0200
+++ new/kcalendarcore-5.94.0/src/icalformat_p.cpp       2022-04-12 
00:21:08.000000000 +0200
@@ -32,6 +32,7 @@
 #include "kcalendarcore_debug.h"
 
 #include <QFile>
+#include <QCryptographicHash>
 
 using namespace KCalendarCore;
 
@@ -1925,11 +1926,24 @@
                                 << "to the application that generated this 
file.";
 
         // Our in-memory incidence has a random uid generated in Event's ctor.
-        // Make it empty so it matches what's in the file:
-        incidenceBase->setUid(QString());
-
+        // Generate a deterministic UID from its properties.
         // Otherwise, next time we read the file, this function will return
         // an event with another random uid and we will have two events in the 
calendar.
+        std::vector<const char *> 
properties(icalcomponent_count_properties(parent, ICAL_ANY_PROPERTY));
+        icalproperty *p = icalcomponent_get_first_property(parent, 
ICAL_ANY_PROPERTY);
+        for (const char *&str : properties) {
+            str = icalproperty_as_ical_string(p);
+            p = icalcomponent_get_next_property(parent, ICAL_ANY_PROPERTY);
+        }
+        std::sort(properties.begin(), properties.end(),
+                [](const char *str1, const char *str2) {
+                    return strcmp(str1, str2) < 0;
+                });
+        QCryptographicHash hasher(QCryptographicHash::Md5);
+        for (const char *str : properties) {
+            hasher.addData(str);
+        }
+        incidenceBase->setUid(QString::fromLatin1(hasher.result().toHex()));
     }
 
     // custom properties

Reply via email to