From 5c772c18a6f3fbba92244be2d77b462c8e237e98 Mon Sep 17 00:00:00 2001
From: Sergo Beruashvili <sergo.beruashvili@canonical.com>
Date: Sat, 28 Nov 2026 00:15:17 +0100
Subject: [PATCH] Move AppStream metadata into the codeblocks package

The desktop entry and metainfo file were shipped in codeblocks-common,
so appstream-generator assigned the codeblocks.desktop component to
that data-only package (Package: codeblocks-common). Software centers
such as GNOME Software, KDE Discover and Ubuntu App Center install the
package named by the AppStream component, leaving users with the
launcher but without /usr/bin/codeblocks.

AppStream requires desktop metadata to be in a package that also
contains the desktop file and the application itself. Ship both files
in the codeblocks package; the icons and other architecture-independent
data can stay in codeblocks-common, which codeblocks depends on.

Add Breaks/Replaces against older codeblocks-common versions so the
file move is handled correctly during upgrades.

Link: https://bugs.debian.org/892364
Link: https://bugs.launchpad.net/ubuntu/+source/codeblocks/+bug/2024365
---
 debian/codeblocks-common.install | 2 --
 debian/codeblocks.install        | 2 ++
 debian/control                   | 2 ++
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/debian/codeblocks-common.install b/debian/codeblocks-common.install
index a524372..75072f3 100644
--- a/debian/codeblocks-common.install
+++ b/debian/codeblocks-common.install
@@ -1,4 +1,3 @@
-usr/share/applications
 usr/share/codeblocks/Astyle.zip
 usr/share/codeblocks/autosave.zip
 usr/share/codeblocks/classwizard.zip
@@ -24,6 +23,5 @@ usr/share/codeblocks/todo.zip
 usr/share/icons
 usr/share/man/man1/cb_*
 usr/share/man/man1/codeblocks.1
-usr/share/metainfo/codeblocks.appdata.xml	usr/share/metainfo
 usr/share/mime
 usr/share/pixmaps
diff --git a/debian/codeblocks.install b/debian/codeblocks.install
index 7a6fe8b..edd6c6f 100644
--- a/debian/codeblocks.install
+++ b/debian/codeblocks.install
@@ -10,3 +10,5 @@ usr/lib/codeblocks/plugins/libopenfileslist.so
 usr/lib/codeblocks/plugins/libprojectsimporter.so
 usr/lib/codeblocks/plugins/libscriptedwizard.so
 usr/lib/codeblocks/plugins/libtodo.so
+usr/share/applications/codeblocks.desktop
+usr/share/metainfo/codeblocks.appdata.xml	usr/share/metainfo
diff --git a/debian/control b/debian/control
index cdd23ba..91b3bc6 100644
--- a/debian/control
+++ b/debian/control
@@ -30,6 +30,8 @@ Depends: codeblocks-common (= ${source:Version}),
          ${shlibs:Depends}
 Recommends: gcc | g++, gdb, xterm
 Suggests: codeblocks-contrib, libwxgtk3.0-dev
+Breaks: codeblocks-common (<< ${source:Version})
+Replaces: codeblocks-common (<< ${source:Version})
 Description: Code::Blocks integrated development environment (IDE)
  Code::Blocks is a cross-platform Integrated Development Environment (IDE).
  It is based on a self-developed plugin framework allowing unlimited
-- 
2.53.0

