diff options
author | Andreas Sturmlechner <asturm@gentoo.org> | 2024-08-13 22:39:06 +0200 |
---|---|---|
committer | Andreas Sturmlechner <asturm@gentoo.org> | 2024-08-15 19:46:50 +0200 |
commit | 882d006f2a945587d25fc5e5b8cc520febfe7e9f (patch) | |
tree | 2539a2671f7c7b4c55ea4aa44fa3dcdb93def220 /eclass/ecm.eclass | |
parent | cmake.eclass: If inherited from ecm.eclass, set ECM_DISABLE_GIT (diff) | |
download | gentoo-882d006f2a945587d25fc5e5b8cc520febfe7e9f.tar.gz gentoo-882d006f2a945587d25fc5e5b8cc520febfe7e9f.tar.bz2 gentoo-882d006f2a945587d25fc5e5b8cc520febfe7e9f.zip |
ecm.eclass: For kde.org projects, try to rename metainfo file real hard
- detect if we are inheriting kde.org.eclass
- detect if package name is not the same as upstream name (KDE_ORG_NAME)
- iterate through "${ED}"/usr/share/metainfo/
- if file contains KDE_ORG_NAME or similar, rename that to ${PN}${SLOT/0*/}
- otherwise, prepend "${PN}${SLOT/0*/}-" after ^org.kde.
Notably, this does not (yet?) trigger if a package ${PN} == ${KDE_ORG_NAME}
but different SLOTs. Should we just do that all the time?
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
Diffstat (limited to 'eclass/ecm.eclass')
-rw-r--r-- | eclass/ecm.eclass | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/eclass/ecm.eclass b/eclass/ecm.eclass index 3d3b9328269d..c8731b8c0cff 100644 --- a/eclass/ecm.eclass +++ b/eclass/ecm.eclass @@ -649,6 +649,9 @@ ecm_src_test() { # Wrapper for cmake_src_install. Drops executable bit from .desktop files # installed inside /usr/share/applications. This is set by cmake when install() # is called in PROGRAM form, as seen in many kde.org projects. +# In case kde.org.eclass is detected, in case KDE_ORG_NAME != PN, tries real +# hard to detect, then rename, metainfo.xml appdata files to something unique +# including SLOT if else than "0" (basically KDE_ORG_NAME -> PN+SLOT). ecm_src_install() { debug-print-function ${FUNCNAME} "$@" @@ -664,6 +667,33 @@ ecm_src_install() { fi done fi + + mv_metainfo() { + if [[ -f ${1} ]]; then + mv -v ${1} ${1/${2}/${3}} || die + fi + } + + if [[ -n ${_KDE_ORG_ECLASS} && -d "${ED}"/usr/share/metainfo/ ]]; then + if [[ ${KDE_ORG_NAME} != ${PN} ]]; then + local ecm_metainfo + pushd "${ED}"/usr/share/metainfo/ > /dev/null || die + for ecm_metainfo in find * -type f -iname "*metainfo.xml"; do + case ${ecm_metainfo} in + *${KDE_ORG_NAME}*) + mv_metainfo ${ecm_metainfo} ${KDE_ORG_NAME} ${PN}${SLOT/0*/} + ;; + *${KDE_ORG_NAME/-/_}*) + mv_metainfo ${ecm_metainfo} ${KDE_ORG_NAME/-/_} ${PN}${SLOT/0*/} + ;; + org.kde.*) + mv_metainfo ${ecm_metainfo} "org.kde." "org.kde.${PN}${SLOT/0*/}-" + ;; + esac + done + popd > /dev/null || die + fi + fi } # @FUNCTION: ecm_pkg_preinst |