public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Yaakov Selkowitz <yselkowi@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/gnome-clocks] rawhide: Avoid vorbis-tools dependency
Date: Mon, 26 Oct 2026 15:38:18 GMT	[thread overview]
Message-ID: <179302909838.1.9524193351184524464.rpms-gnome-clocks-f41ed37e707e@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/gnome-clocks
            Branch : rawhide
            Commit : f41ed37e707ed45c80f916cf353a82ffd3ecb336
            Author : Yaakov Selkowitz <yselkowi@redhat.com>
            Date   : 2026-10-21T15:48:55-04:00
            Stats  : +128/-1 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/gnome-clocks/c/f41ed37e707ed45c80f916cf353a82ffd3ecb336?branch=rawhide

            Log:
            Avoid vorbis-tools dependency

Instead, use GStreamer to convert FLAC to Ogg Vorbis.

https://github.com/fedora-eln/eln/issues/433

---
diff --git a/0001-build-Use-GStreamer-to-convert-FLAC-to-Vorbis.patch b/0001-build-Use-GStreamer-to-convert-FLAC-to-Vorbis.patch
new file mode 100644
index 0000000..61e9d82
--- /dev/null
+++ b/0001-build-Use-GStreamer-to-convert-FLAC-to-Vorbis.patch
@@ -0,0 +1,121 @@
+From 3f22b238835f609ccaac5a3136831636c61867d3 Mon Sep 17 00:00:00 2001
+From: David King <amigadave@amigadave.com>
+Date: Tue, 20 Oct 2026 14:20:21 +0100
+Subject: [PATCH] build: Use GStreamer to convert FLAC to Vorbis
+
+Using oggenc adds a build-time dependency on vorbis-tools, but we can
+use GStreamer instead. However, neither vorbisenc nor oggmux elements
+provide a mechanism to set the serial directly, so this must be patched
+in the Vorbis files themselves, and the CRC regenerated with the new
+serial.
+
+https://github.com/fedora-eln/eln/issues/433
+---
+ data/sounds/alarms/encode-vorbis.py | 64 +++++++++++++++++++++++++++++
+ data/sounds/alarms/meson.build      |  8 ++--
+ 2 files changed, 69 insertions(+), 3 deletions(-)
+ create mode 100644 data/sounds/alarms/encode-vorbis.py
+
+diff --git a/data/sounds/alarms/encode-vorbis.py b/data/sounds/alarms/encode-vorbis.py
+new file mode 100644
+index 0000000..cb7017d
+--- /dev/null
++++ b/data/sounds/alarms/encode-vorbis.py
+@@ -0,0 +1,64 @@
++#!/usr/bin/env python3
++# SPDX-License-Identifier: GPL-2.0-or-later
++
++import struct
++import subprocess
++import sys
++
++CRC_LOOKUP = []
++for _i in range(256):
++    _r = _i << 24
++    for _ in range(8):
++        _r = ((_r << 1) ^ 0x04C11DB7) & 0xFFFFFFFF if _r & 0x80000000 else (_r << 1) & 0xFFFFFFFF
++    CRC_LOOKUP.append(_r)
++
++
++def ogg_crc(data):
++    crc = 0
++    for byte in data:
++        crc = ((crc << 8) ^ CRC_LOOKUP[((crc >> 24) & 0xFF) ^ byte]) & 0xFFFFFFFF
++    return crc
++
++
++def set_ogg_serial(path, serial):
++    with open(path, 'r+b') as f:
++        data = bytearray(f.read())
++
++    pos = 0
++    while pos < len(data) - 27:
++        if data[pos:pos + 4] != b'OggS':
++            break
++        n_segments = data[pos + 26]
++        body_size = sum(data[pos + 27:pos + 27 + n_segments])
++        page_end = pos + 27 + n_segments + body_size
++        struct.pack_into('<I', data, pos + 14, serial)
++        struct.pack_into('<I', data, pos + 22, 0)
++        struct.pack_into('<I', data, pos + 22, ogg_crc(data[pos:page_end]))
++        pos = page_end
++
++    with open(path, 'r+b') as f:
++        f.write(data)
++
++
++def main():
++    gst_launch, input_path, output_path, serial = sys.argv[1:5]
++
++    subprocess.run(
++        [
++            gst_launch,
++            'filesrc', f'location={input_path}',
++            '!', 'flacparse',
++            '!', 'flacdec',
++            '!', 'audioconvert',
++            '!', 'vorbisenc',
++            '!', 'oggmux',
++            '!', 'filesink', f'location={output_path}',
++        ],
++        check=True,
++    )
++
++    set_ogg_serial(output_path, int(serial))
++
++
++if __name__ == '__main__':
++    main()
+diff --git a/data/sounds/alarms/meson.build b/data/sounds/alarms/meson.build
+index 1a344d3..e0a4f4e 100644
+--- a/data/sounds/alarms/meson.build
++++ b/data/sounds/alarms/meson.build
+@@ -1,4 +1,6 @@
+-oggenc = find_program('oggenc')
++python = find_program('python3')
++gst_launch = find_program('gst-launch-1.0')
++encode_vorbis = files('encode-vorbis.py')
+ 
+ alarms_resources = [
+   'beep-beep.flac',
+@@ -11,7 +13,7 @@ foreach alarm: alarms_resources
+     input: alarm,
+     # The default ogg serial numbers are unreproducible
+     # Set the serial number to 0
+-    command: [oggenc, '@INPUT@', '--serial', '0', '-o', '@OUTPUT@' ],
++    command: [python, encode_vorbis, gst_launch, '@INPUT@', '@OUTPUT@', '0'],
+   )
+ endforeach
+ 
+@@ -46,7 +48,7 @@ foreach alarm: alarms_data
+     input: alarm,
+     # The default ogg serial numbers are unreproducible
+     # Set the serial number to 0
+-    command: [oggenc, '@INPUT@', '--serial', '0', '-o', '@OUTPUT@' ],
++    command: [python, encode_vorbis, gst_launch, '@INPUT@', '@OUTPUT@', '0'],
+     install: true,
+     install_dir: get_option('datadir') / 'sounds' / 'gnome' / 'default' / 'alarms',
+   )
+-- 
+2.56.0
+

diff --git a/gnome-clocks.spec b/gnome-clocks.spec
index acf61d7..7a7eccf 100644
--- a/gnome-clocks.spec
+++ b/gnome-clocks.spec
@@ -12,6 +12,9 @@ Summary:        Clock application designed for GNOME 3
 License:        GPL-2.0-or-later AND CC-BY-SA-3.0 AND CC0-1.0
 URL:            https://wiki.gnome.org/Apps/Clocks
 Source0:        https://download.gnome.org/sources/%{name}/%{gnome_major_version}/%{name}-%{gnome_tarball_version}.tar.xz
+# avoid vorbis-tools dependency
+# https://github.com/fedora-eln/eln/issues/433
+Patch0:         0001-build-Use-GStreamer-to-convert-FLAC-to-Vorbis.patch
 
 %gnome_check_version
 
@@ -31,7 +34,10 @@ BuildRequires:  pkgconfig(gtk4) >= %{gtk4_version}
 BuildRequires:  pkgconfig(gweather4)
 BuildRequires:  pkgconfig(libgeoclue-2.0) >= %{geoclue2_version}
 BuildRequires:  pkgconfig(libadwaita-1) >= %{libadwaita_version}
-BuildRequires:  vorbis-tools
+# audioconvert, oggmux, vorbisenc
+BuildRequires:  gstreamer1-plugins-base
+# flacdec, flacparse
+BuildRequires:  gstreamer1-plugins-good
 
 Requires:       geoclue2-libs%{?_isa} >= %{geoclue2_version}
 Requires:       gtk4%{?_isa} >= %{gtk4_version}

                 reply	other threads:[~2026-10-26 15:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179302909838.1.9524193351184524464.rpms-gnome-clocks-f41ed37e707e@fedoraproject.org \
    --to=yselkowi@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox