Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package fyi for openSUSE:Factory checked in at 2024-09-05 15:47:27 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/fyi (Old) and /work/SRC/openSUSE:Factory/.fyi.new.10096 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "fyi" Thu Sep 5 15:47:27 2024 rev:2 rq:1198900 version:1.0.4 Changes: -------- --- /work/SRC/openSUSE:Factory/fyi/fyi.changes 2024-08-05 17:22:07.657219465 +0200 +++ /work/SRC/openSUSE:Factory/.fyi.new.10096/fyi.changes 2024-09-05 15:48:13.850670356 +0200 @@ -1,0 +2,9 @@ +Thu Sep 5 08:18:12 UTC 2024 - llyyr <ll...@yukari.in> + +- Update package to 1.0.4: + * Leading space added to the "body" string +- Update package to 1.0.3: + * Missing include, causing compilation errors. + * Missing fish completions for --image-data and --image-size + +------------------------------------------------------------------- Old: ---- 1.0.2.tar.gz New: ---- 1.0.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ fyi.spec ++++++ --- /var/tmp/diff_new_pack.Kj6DMx/_old 2024-09-05 15:48:14.242686635 +0200 +++ /var/tmp/diff_new_pack.Kj6DMx/_new 2024-09-05 15:48:14.242686635 +0200 @@ -17,7 +17,7 @@ Name: fyi -Version: 1.0.2 +Version: 1.0.4 Release: 0 Summary: notify-send alternative License: MIT ++++++ 1.0.2.tar.gz -> 1.0.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fyi/CHANGELOG.md new/fyi/CHANGELOG.md --- old/fyi/CHANGELOG.md 2024-08-02 12:07:42.000000000 +0200 +++ new/fyi/CHANGELOG.md 2024-09-05 08:39:53.000000000 +0200 @@ -1,10 +1,45 @@ # Changelog +* [1.0.4](#1-0-4) +* [1.0.3](#1-0-3) * [1.0.2](#1-0-2) * [1.0.1](#1-0-1) * [1.0.0](#1-0-0) +## 1.0.4 + +### Added + +* FreeBSD support + + +### Fixed + +* Leading space added to the "body" string ([#5][5]). + +[5]: https://codeberg.org/dnkl/fyi/issues/5 + + +### Contributors + +* antenore +* Baptiste Daroussin + + +## 1.0.3 + +### Fixed + +* Missing include, causing compilation errors. +* Missing fish completions for `--image-data` and `--image-size` + + +### Contributors + +* q66 + + ## 1.0.2 ### Added diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fyi/PKGBUILD new/fyi/PKGBUILD --- old/fyi/PKGBUILD 2024-08-02 12:07:42.000000000 +0200 +++ new/fyi/PKGBUILD 2024-09-05 08:39:53.000000000 +0200 @@ -1,5 +1,5 @@ pkgname=fyi -pkgver=1.0.2 +pkgver=1.0.4 pkgrel=1 pkgdesc="Command line utility to create desktop notifications" arch=('x86_64' 'aarch64') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fyi/README.md new/fyi/README.md --- old/fyi/README.md 2024-08-02 12:07:42.000000000 +0200 +++ new/fyi/README.md 2024-09-05 08:39:53.000000000 +0200 @@ -1,5 +1,7 @@ # FYI +[](https://repology.org/project/fyi/versions) + FYI (for your information) is a command line utility to send desktop notifications to the user via a notification daemon implementing XDG desktop notifications. @@ -17,8 +19,7 @@ * `fyi` can query the notification daemon for its name and version information. * `fyi` can query the notification daemon for its capabilities. -* `fyi` has shell completions (though only - [fish](https://fishshell.com/) for now). +* `fyi` has shell completions (bash and [fish](https://fishshell.com/)). * `fyi` has a single run-time dependency: [dbus](https://www.freedesktop.org/wiki/Software/dbus/) (the original D-Bus implementation). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fyi/completions/fish/fyi.fish new/fyi/completions/fish/fyi.fish --- old/fyi/completions/fish/fyi.fish 2024-08-02 12:07:42.000000000 +0200 +++ new/fyi/completions/fish/fyi.fish 2024-09-05 08:39:53.000000000 +0200 @@ -12,8 +12,8 @@ complete -c fyi -s T -l print-token -d "print the activation token" complete -c fyi -s R -l print-reason -d "print the reason the notification was closed" complete -c fyi -s w -l wait -d "wait for notification to close" -complete -c fyi -l image-data -d "raw RGBA image data, sets the 'image-data' hint" -complete -c fyi -l image-size -d "dimensions of the image loaded by --image-data" +complete -c fyi -x -l image-data -d "raw RGBA image data, sets the 'image-data' hint" +complete -c fyi -x -l image-size -d "dimensions of the image loaded by --image-data" complete -c fyi -l server-info -d "print server name and version" complete -c fyi -l server-capabilities -d "print server capabilities" complete -c fyi -s v -l version -d "show the version number and quit" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fyi/doc/fyi.1.scd new/fyi/doc/fyi.1.scd --- old/fyi/doc/fyi.1.scd 2024-08-02 12:07:42.000000000 +0200 +++ new/fyi/doc/fyi.1.scd 2024-09-05 08:39:53.000000000 +0200 @@ -60,17 +60,19 @@ or a filename. Default: _none_ *-u*,*--urgency*=*low|normal|critical* - Notification urgency. Default: _normal_. + Notification urgency. Shortcut for + *--hint=byte:urgency:0|1|2*. Default: _normal_. *-c*,*--category*=_CATEGORY_ - Notification category. Default: _none_. + Notification category. Shortcut for + *--hint=string:category:CATEGORY*. Default: _none_. *-A*,*--action*=_NAME_:_LABEL_ Defines an action to display (e.g. as a button, or in a list, depending on notification daemon). _LABEL_ is what the notification daemon will display for the user. When the user - triggers an action, *fyi* will display the corresponding _NAME_, - in the format: + triggers an action, *fyi* will print the corresponding _NAME_, in + the format: *action=*_NAME_ @@ -108,7 +110,8 @@ milliseconds. *--transient* - By-pass the server's persistence capability, if any. + By-pass the server's persistence capability, if any. Shortcut for + *--hint=boolean:transient=true*. *-C*,*--close*=_ID_ If there is an existing notification with the specified ID, close @@ -141,7 +144,7 @@ notification is dismissed, regardless of how. The token can be used to focus (activate, raise) a window. It is - not directly useable by *fyi*, but programs using *fyi* is a + not directly useable by *fyi*, but programs using *fyi* as a helper to display notifications can use it. Using this option implies *--wait*. @@ -164,7 +167,7 @@ must also provide the image size, see *--image-size*. *--image-size=WIDTHxHEIGHT* - The dimensions of the image loaded by --image-data. + The dimensions of the image loaded by *--image-data*. *--server-info* Display notification daemon name and version. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fyi/main.c new/fyi/main.c --- old/fyi/main.c 2024-08-02 12:07:42.000000000 +0200 +++ new/fyi/main.c 2024-09-05 08:39:53.000000000 +0200 @@ -10,10 +10,11 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <unistd.h> #include <sys/stat.h> -#include <dbus-1.0/dbus/dbus.h> +#include <dbus/dbus.h> #include "version.h" @@ -115,7 +116,7 @@ /* Mimic notify-send: close the notification */ DBusMessageIter args; dbus_message_iter_init_append(msg, &args); - dbus_message_iter_append_basic(&args, 'u', ¬ification_id); + dbus_message_iter_append_basic(&args, DBUS_TYPE_UINT32, ¬ification_id); dbus_connection_send(conn, msg, 0); dbus_connection_flush(conn); dbus_message_unref(msg); @@ -324,6 +325,124 @@ return ret; } +static void +add_urgency_hint(DBusMessageIter *hints, enum urgency urgency) +{ + static const char *name = "urgency"; + + DBusMessageIter hint; + DBusMessageIter value; + dbus_message_iter_open_container(hints, DBUS_TYPE_DICT_ENTRY, 0, &hint); + + dbus_message_iter_append_basic(&hint, DBUS_TYPE_STRING, &name); + dbus_message_iter_open_container(&hint, DBUS_TYPE_VARIANT, DBUS_TYPE_BYTE_AS_STRING, &value); + dbus_message_iter_append_basic(&value, DBUS_TYPE_BYTE, &(uint8_t){urgency}); + dbus_message_iter_close_container(&hint, &value); + dbus_message_iter_close_container(hints, &hint); +} + +static void +add_category_hint(DBusMessageIter *hints, const char *category) +{ + static const char *name = "category"; + + if (category == NULL || category[0] == '\0') + return; + + DBusMessageIter hint; + DBusMessageIter value; + dbus_message_iter_open_container(hints, DBUS_TYPE_DICT_ENTRY, 0, &hint); + dbus_message_iter_append_basic(&hint, DBUS_TYPE_STRING, &name); + dbus_message_iter_open_container(&hint, DBUS_TYPE_VARIANT, DBUS_TYPE_STRING_AS_STRING, &value); + dbus_message_iter_append_basic(&value, DBUS_TYPE_STRING, &category); + dbus_message_iter_close_container(&hint, &value); + dbus_message_iter_close_container(hints, &hint); +} + +static void +add_transient_hint(DBusMessageIter *hints, bool transient) +{ + static const char *name = "transient"; + + if (!transient) + return; + + DBusMessageIter hint; + DBusMessageIter value; + + dbus_message_iter_open_container(hints, DBUS_TYPE_DICT_ENTRY, 0, &hint); + dbus_message_iter_append_basic(&hint, DBUS_TYPE_STRING, &name); + dbus_message_iter_open_container(&hint, DBUS_TYPE_VARIANT, DBUS_TYPE_BOOLEAN_AS_STRING, &value); + dbus_message_iter_append_basic(&value, DBUS_TYPE_BOOLEAN, &(dbus_bool_t){transient}); + dbus_message_iter_close_container(&hint, &value); + dbus_message_iter_close_container(hints, &hint); +} + +static void +add_image_data_hint(DBusMessageIter *hints, const uint8_t *image, + int32_t width, int32_t height) +{ + static const char *name = "image-data"; + + if (width == 0 || height == 0) + return; + + DBusMessageIter hint; + DBusMessageIter value; + + dbus_message_iter_open_container(hints, DBUS_TYPE_DICT_ENTRY, 0, &hint); + dbus_message_iter_append_basic(&hint, DBUS_TYPE_STRING, &name); + + dbus_message_iter_open_container( + &hint, DBUS_TYPE_VARIANT, + DBUS_STRUCT_BEGIN_CHAR_AS_STRING + DBUS_TYPE_INT32_AS_STRING + DBUS_TYPE_INT32_AS_STRING + DBUS_TYPE_INT32_AS_STRING + DBUS_TYPE_BOOLEAN_AS_STRING + DBUS_TYPE_INT32_AS_STRING + DBUS_TYPE_INT32_AS_STRING + DBUS_TYPE_ARRAY_AS_STRING + DBUS_TYPE_BYTE_AS_STRING + DBUS_STRUCT_END_CHAR_AS_STRING, + &value); + + /* We only support RGBA image data */ + const int32_t stride = width * 4; + + DBusMessageIter data; + dbus_message_iter_open_container(&value, DBUS_TYPE_STRUCT, NULL, &data); + dbus_message_iter_append_basic(&data, DBUS_TYPE_INT32, &width); + dbus_message_iter_append_basic(&data, DBUS_TYPE_INT32, &height); + dbus_message_iter_append_basic(&data, DBUS_TYPE_INT32, &stride); + dbus_message_iter_append_basic(&data, DBUS_TYPE_BOOLEAN, &(dbus_bool_t){true}); + dbus_message_iter_append_basic(&data, DBUS_TYPE_INT32, &(int32_t){8}); + dbus_message_iter_append_basic(&data, DBUS_TYPE_INT32, &(int32_t){4}); + + DBusMessageIter pixels; + dbus_message_iter_open_container(&data, DBUS_TYPE_ARRAY,DBUS_TYPE_BYTE_AS_STRING, &pixels); + for (size_t i = 0; i < height * stride; i++) + dbus_message_iter_append_basic(&pixels, DBUS_TYPE_BYTE, &image[i]); + dbus_message_iter_close_container(&data, &pixels); + dbus_message_iter_close_container(&value, &data); + dbus_message_iter_close_container(&hint, &value); + dbus_message_iter_close_container(hints, &hint); +} + +static void +add_user_hint(DBusMessageIter *hints, const struct hint *h) +{ + DBusMessageIter hint; + DBusMessageIter value; + + dbus_message_iter_open_container(hints, DBUS_TYPE_DICT_ENTRY, 0, &hint); + dbus_message_iter_append_basic(&hint, DBUS_TYPE_STRING, &h->name); + dbus_message_iter_open_container(&hint, DBUS_TYPE_VARIANT, h->type_as_string, &value); + dbus_message_iter_append_basic(&value, h->type, &h->u); + dbus_message_iter_close_container(&hint, &value); + dbus_message_iter_close_container(hints, &hint); +} + int main(int argc, char *const *argv) { @@ -364,7 +483,7 @@ }; const char *progname = argv[0]; - const char *app_id = program_invocation_name; + const char *app_id = progname; const char *icon = NULL; const char *image_data_file = NULL; const char *category = NULL; @@ -390,16 +509,9 @@ char *body = NULL; char *icon_uri = NULL; - char *image_data = NULL; - size_t image_data_sz = 0; + uint8_t *image_data = NULL; int32_t image_width = 0; int32_t image_height = 0; - int32_t image_stride = 0; - - /* We only support RGBA image data */ - const dbus_bool_t image_has_alpha = true; - const int32_t image_bpp = 8; - const int32_t image_channels = 4; DBusError err = DBUS_ERROR_INIT; DBusMessage *msg = NULL; @@ -578,7 +690,6 @@ if (errno == 0 && end != NULL && *end == '\0') { image_width = w; image_height = h; - image_stride = image_width * 4; } else { fprintf(stderr, "error: %s: invalid image size\n", optarg); goto out; @@ -615,18 +726,17 @@ } const char *title = argv[0]; - uint32_t transient_value = transient; /* D-Bus "boolean" */ - uint8_t urgency_value = urgency; /* D-Bus "byte" */ for (size_t i = 1, len = 0; i < argc; i++) { const char *word = argv[i]; size_t word_length = strlen(word); + bool add_space = i > 1; - body = realloc(body, len + 1 + word_length + 1); + body = realloc(body, len + add_space + word_length + 1); body[len] = ' '; - memcpy(&body[len + 1], word, word_length); + memcpy(&body[len + add_space], word, word_length); - len += 1 + word_length; + len += add_space + word_length; body[len] = '\0'; } @@ -683,6 +793,17 @@ goto out; } + /* 4 bytes per pixel (RGBA) */ + size_t expected_size = image_width * image_height * 4; + if (st.st_size != expected_size) { + fprintf( + stderr, + "error: %s: file size (%ld) does not match image dimensions (%dx%d)\n", + image_data_file, (long)st.st_size, image_width, image_height); + close(fd); + goto out; + } + //printf("allocating %lu image data bytes\n", st.st_size); image_data = malloc(st.st_size); @@ -695,7 +816,6 @@ goto out; } - image_data_sz = st.st_size; close(fd); } @@ -706,123 +826,46 @@ const char *icon_arg = icon != NULL ? icon : ""; DBusMessageIter args; dbus_message_iter_init_append(msg, &args); - dbus_message_iter_append_basic(&args, 's', &app_id); - dbus_message_iter_append_basic(&args, 'u', &replaces_id); - dbus_message_iter_append_basic(&args, 's', &icon_arg); - dbus_message_iter_append_basic(&args, 's', &title); - dbus_message_iter_append_basic(&args, 's', &body); + dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &app_id); + dbus_message_iter_append_basic(&args, DBUS_TYPE_UINT32, &replaces_id); + dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &icon_arg); + dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &title); + dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &body); /* Actions: array of strings. Every even item is the action name, every odd item is the action label */ DBusMessageIter args_actions; - dbus_message_iter_open_container(&args, 'a', "s", &args_actions); + dbus_message_iter_open_container( + &args, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING_AS_STRING, &args_actions); for (size_t i = 0; i < action_count; i++) { const struct action *a = &actions[i]; - dbus_message_iter_append_basic(&args_actions, 's', &a->name); - dbus_message_iter_append_basic(&args_actions, 's', &a->label); + dbus_message_iter_append_basic(&args_actions, DBUS_TYPE_STRING, &a->name); + dbus_message_iter_append_basic(&args_actions, DBUS_TYPE_STRING, &a->label); } dbus_message_iter_close_container(&args, &args_actions); - /* Hints: dictionary of "sv" (string + variant) */ DBusMessageIter args_hints; - dbus_message_iter_open_container(&args, 'a', "{sv}", &args_hints); + dbus_message_iter_open_container( + &args, DBUS_TYPE_ARRAY, + DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING + DBUS_TYPE_STRING_AS_STRING + DBUS_TYPE_VARIANT_AS_STRING + DBUS_DICT_ENTRY_END_CHAR_AS_STRING, + &args_hints); { - DBusMessageIter args_hints_hint; - DBusMessageIter args_hints_value; - - dbus_message_iter_open_container(&args_hints, 'e', 0, &args_hints_hint); - { - static const char *hint_name = "urgency"; - dbus_message_iter_append_basic(&args_hints_hint, 's', &hint_name); - dbus_message_iter_open_container(&args_hints_hint, 'v', "y", &args_hints_value); - { - dbus_message_iter_append_basic(&args_hints_value, 'y', &urgency_value); - } - dbus_message_iter_close_container(&args_hints_hint, &args_hints_value); - } - dbus_message_iter_close_container(&args_hints, &args_hints_hint); - - if (category != NULL && category[0] != '\0') { - dbus_message_iter_open_container(&args_hints, 'e', 0, &args_hints_hint); - { - static const char *hint_name = "category"; - dbus_message_iter_append_basic(&args_hints_hint, 's', &hint_name); - dbus_message_iter_open_container(&args_hints_hint, 'v', "s", &args_hints_value); - { - dbus_message_iter_append_basic(&args_hints_value, 's', &category); - } - dbus_message_iter_close_container(&args_hints_hint, &args_hints_value); - } - dbus_message_iter_close_container(&args_hints, &args_hints_hint); - } - - if (transient) { - dbus_message_iter_open_container(&args_hints, 'e', 0, &args_hints_hint); - { - static const char *hint_name = "transient"; - dbus_message_iter_append_basic(&args_hints_hint, 's', &hint_name); - dbus_message_iter_open_container(&args_hints_hint, 'v', "b", &args_hints_value); - { - dbus_message_iter_append_basic(&args_hints_value, 'b', &transient_value); - } - dbus_message_iter_close_container(&args_hints_hint, &args_hints_value); - } - dbus_message_iter_close_container(&args_hints, &args_hints_hint); - } - - if (image_data_sz > 0) { - dbus_message_iter_open_container(&args_hints, 'e', 0, &args_hints_hint); - { - static const char *hint_name = "image-data"; - dbus_message_iter_append_basic(&args_hints_hint, 's', &hint_name); - dbus_message_iter_open_container(&args_hints_hint, 'v', "(iiibiiay)", &args_hints_value); - { - DBusMessageIter args_image_data; - dbus_message_iter_open_container(&args_hints_value, 'r', NULL, &args_image_data); - { - dbus_message_iter_append_basic(&args_image_data, 'i', &image_width); - dbus_message_iter_append_basic(&args_image_data, 'i', &image_height); - dbus_message_iter_append_basic(&args_image_data, 'i', &image_stride); - dbus_message_iter_append_basic(&args_image_data, 'b', &image_has_alpha); - dbus_message_iter_append_basic(&args_image_data, 'i', &image_bpp); - dbus_message_iter_append_basic(&args_image_data, 'i', &image_channels); - - DBusMessageIter args_pixel_array; - dbus_message_iter_open_container(&args_image_data, 'a', "y", &args_pixel_array); - { - for (size_t i = 0; i < image_data_sz; i++) { - dbus_message_iter_append_basic(&args_pixel_array, 'y', &image_data[i]); - } - } - dbus_message_iter_close_container(&args_image_data, &args_pixel_array); - } - dbus_message_iter_close_container(&args_hints_value, &args_image_data); - } - dbus_message_iter_close_container(&args_hints_hint, &args_hints_value); - } - dbus_message_iter_close_container(&args_hints, &args_hints_hint); - - } + add_urgency_hint(&args_hints, urgency); + add_category_hint(&args_hints, category); + add_transient_hint(&args_hints, transient); + add_image_data_hint(&args_hints, image_data, image_width, image_height); /* User specified hints */ - for (size_t i = 0; i < hint_count; i++) { - const struct hint *h = &hints[i]; - dbus_message_iter_open_container(&args_hints, 'e', 0, &args_hints_hint); - { - dbus_message_iter_append_basic(&args_hints_hint, 's', &h->name); - dbus_message_iter_open_container(&args_hints_hint, 'v', h->type_as_string, &args_hints_value); - { - dbus_message_iter_append_basic(&args_hints_value, h->type, &h->u); - } - dbus_message_iter_close_container(&args_hints_hint, &args_hints_value); - } - dbus_message_iter_close_container(&args_hints, &args_hints_hint); - } + for (size_t i = 0; i < hint_count; i++) + add_user_hint(&args_hints, &hints[i]); } dbus_message_iter_close_container(&args, &args_hints); /* Expire timeout */ - dbus_message_iter_append_basic(&args, 'i', &expire_time); + dbus_message_iter_append_basic(&args, DBUS_TYPE_INT32, &expire_time); /* Sign up for signals *before* we send the notification, to avoid race */ if (wait) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fyi/meson.build new/fyi/meson.build --- old/fyi/meson.build 2024-08-02 12:07:42.000000000 +0200 +++ new/fyi/meson.build 2024-09-05 08:39:53.000000000 +0200 @@ -1,5 +1,5 @@ project('fyi', 'c', - version: '1.0.2', + version: '1.0.4', license: 'MIT', default_options: [ 'c_std=c11', @@ -7,6 +7,15 @@ 'werror=true', 'b_ndebug=if-release']) +is_debug_build = get_option('buildtype').startswith('debug') +cc = meson.get_compiler('c') + +add_project_arguments( + (is_debug_build + ? ['-D_DEBUG'] + : [cc.get_supported_arguments('-fno-asynchronous-unwind-tables')]), + language: 'c') + scdoc = dependency('scdoc', native: true, required: get_option('docs')) if scdoc.found() install_data(