Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH] eutils.eclass: make_desktop_entry, replace unnecessary extglob
Date: Fri, 14 Apr 2017 17:26:00
Message-Id: 20170414172542.11203-1-mgorny@gentoo.org
1 Replace the unnecessary use of extglob to strip file suffix
2 in make_desktop_entry with a plain ${x%.*}. This is pretty much
3 equivalent since match to one of the pre-defined suffixes is already
4 confirmed via the preceding conditional, and avoiding repeating
5 the suffix list twice makes the code simpler.
6 ---
7 eclass/eutils.eclass | 4 +---
8 1 file changed, 1 insertion(+), 3 deletions(-)
9
10 diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass
11 index ea2a76200f09..e66b40424234 100644
12 --- a/eclass/eutils.eclass
13 +++ b/eclass/eutils.eclass
14 @@ -275,13 +275,11 @@ make_desktop_entry() {
15 # Don't append another ";" when a valid category value is provided.
16 type=${type%;}${type:+;}
17
18 - eshopts_push -s extglob
19 if [[ -n ${icon} && ${icon} != /* ]] && [[ ${icon} == *.xpm || ${icon} == *.png || ${icon} == *.svg ]]; then
20 ewarn "As described in the Icon Theme Specification, icon file extensions are not"
21 ewarn "allowed in .desktop files if the value is not an absolute path."
22 - icon=${icon%.@(xpm|png|svg)}
23 + icon=${icon%.*}
24 fi
25 - eshopts_pop
26
27 cat <<-EOF > "${desktop}"
28 [Desktop Entry]
29 --
30 2.12.2

Replies