From: "Ulrich Müller" <ulm@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: "Ulrich Müller" <ulm@gentoo.org>
Subject: [gentoo-dev] [PATCH 1/2] desktop.eclass: Install files as foo.desktop rather than foo-foo.desktop
Date: Sat, 1 Oct 2022 10:39:17 +0200 [thread overview]
Message-ID: <20221001083918.30129-2-ulm@gentoo.org> (raw)
In-Reply-To: <20221001083918.30129-1-ulm@gentoo.org>
Bug: https://bugs.gentoo.org/771708#c14
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
---
eclass/desktop.eclass | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/eclass/desktop.eclass b/eclass/desktop.eclass
index de912bb80932..01de8b61ae1c 100644
--- a/eclass/desktop.eclass
+++ b/eclass/desktop.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: desktop.eclass
@@ -156,19 +156,18 @@ make_desktop_entry() {
;;
esac
fi
- local slot=${SLOT%/*}
- if [[ ${slot} == "0" ]] ; then
- local desktop_name="${PN}"
- else
- local desktop_name="${PN}-${slot}"
- fi
+
local desktop_exec="${exec%%[[:space:]]*}"
desktop_exec="${desktop_exec##*/}"
+ local desktop_suffix="-${PN}"
+ [[ ${SLOT%/*} != 0 ]] && desktop_suffix+="-${SLOT%/*}"
+ # Replace foo-foo.desktop by foo.desktop
+ [[ ${desktop_suffix#-} == "${desktop_exec}" ]] && desktop_suffix=""
# Prevent collisions if a file with the same name already exists #771708
- local desktop="${desktop_exec}-${desktop_name}" count=0
+ local desktop="${desktop_exec}${desktop_suffix}" count=0
while [[ -e ${ED}/usr/share/applications/${desktop}.desktop ]]; do
- desktop="${desktop_exec}-$((++count))-${desktop_name}"
+ desktop="${desktop_exec}-$((++count))${desktop_suffix}"
done
desktop="${T}/${desktop}.desktop"
--
2.37.3
next prev parent reply other threads:[~2022-10-01 8:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-01 8:39 [gentoo-dev] [PATCH 0/2] desktop.eclass: Install files as foo.desktop rather than foo-foo.desktop Ulrich Müller
2022-10-01 8:39 ` Ulrich Müller [this message]
2022-10-01 8:39 ` [gentoo-dev] [PATCH 2/2] desktop.eclass: Add EAPI guard Ulrich Müller
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=20221001083918.30129-2-ulm@gentoo.org \
--to=ulm@gentoo.org \
--cc=gentoo-dev@lists.gentoo.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