desktop.eclass: domenu, fix dying on non-existing files
authorMichał Górny <mgorny@gentoo.org>
Thu, 26 Jul 2018 11:03:37 +0000 (13:03 +0200)
committerMichał Górny <mgorny@gentoo.org>
Thu, 9 Aug 2018 14:08:38 +0000 (16:08 +0200)
The weird logic in domenu had an explicit separate clause
for unsuccessful return on non-existing files.  This worked fine before
EAPI 4 since '|| die' was mandatory.  However, since 'doins' started
dying on its own, developers have assumed the same for 'domenu'
and stopped checking the exit status.  As a result, missing files
are now silently ignored.

Change the logic to explicitly die when the file does not exist.
To provide the best interoperability and avoid code duplication, just
let 'doins' die on its own.

eclass/desktop.eclass

index 91521b85a821ae1b3a208c2b586a70c4bbc998b1..1684a21d21f790c413739969002a3d3fecc49312 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: desktop.eclass
@@ -248,16 +248,14 @@ domenu() {
        insopts -m 0644
        insinto /usr/share/applications
        for i in "$@" ; do
-               if [[ -f ${i} ]] ; then
-                       doins "${i}"
-                       ((ret+=$?))
-               elif [[ -d ${i} ]] ; then
+               if [[ -d ${i} ]] ; then
                        for j in "${i}"/*.desktop ; do
                                doins "${j}"
                                ((ret+=$?))
                        done
                else
-                       ((++ret))
+                       doins "${i}"
+                       ((ret+=$?))
                fi
        done
        exit ${ret}