Gentoo Archives: gentoo-commits

From: Andreas Sturmlechner <asturm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: kde-plasma/plasma-workspace/
Date: Sun, 22 Dec 2019 18:58:26
Message-Id: 1577041068.77aa9069fe3cc4680c446a3d9ecd2f5f695f171d.asturm@gentoo
1 commit: 77aa9069fe3cc4680c446a3d9ecd2f5f695f171d
2 Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
3 AuthorDate: Sun Dec 22 17:06:58 2019 +0000
4 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
5 CommitDate: Sun Dec 22 18:57:48 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=77aa9069
7
8 kde-plasma/plasma-workspace: Improve old script detection/migration
9
10 - Drop mkdir and chmod commands
11 - Add missing || die
12 - No need for subshells to detect constant paths
13 - Use md5sum to detect if existing scripts were modified at all
14 - Clean up pre-5.17.4 scripts, they were owned by plasma-workspace anyway
15
16 Bug: https://bugs.gentoo.org/688366
17 Package-Manager: Portage-2.3.82, Repoman-2.3.20
18 Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
19
20 .../plasma-workspace-5.17.4-r1.ebuild | 82 +++++++++++++---------
21 1 file changed, 48 insertions(+), 34 deletions(-)
22
23 diff --git a/kde-plasma/plasma-workspace/plasma-workspace-5.17.4-r1.ebuild b/kde-plasma/plasma-workspace/plasma-workspace-5.17.4-r1.ebuild
24 index 981850375fc..58f1c7f27b3 100644
25 --- a/kde-plasma/plasma-workspace/plasma-workspace-5.17.4-r1.ebuild
26 +++ b/kde-plasma/plasma-workspace/plasma-workspace-5.17.4-r1.ebuild
27 @@ -130,15 +130,42 @@ PATCHES=(
28
29 RESTRICT+=" test"
30
31 -# used for agent scripts migration
32 -OLDST=/etc/plasma/startup/10-agent-startup.sh
33 -NEWST=/etc/xdg/plasma-workspace/env/10-agent-startup.sh
34 -OLDSH=/etc/plasma/shutdown/10-agent-shutdown.sh
35 -NEWSH=/etc/xdg/plasma-workspace/shutdown/10-agent-shutdown.sh
36 +pkg_setup() {
37 + ecm_pkg_setup
38 +
39 + local md5
40 + local srcfile=/etc/plasma/XX/10-agent-XX.sh
41 + local newdir="${EPREFIX}"/etc/xdg/plasma-workspace
42 +
43 + if [[ -f "${EROOT}"${srcfile//XX/startup} ]]; then
44 + md5=$(md5sum "${EROOT}"${srcfile//XX/startup})
45 + if [[ ${md5%% *} != 90caaabb40b56bfbe65388841a6dd6ca ]]; then
46 + elog "Existing modified ${EPREFIX}${srcfile//XX/startup} detected."
47 + elog "Copying to ${newdir}/env/10-agent-startup.sh..."
48 + cp -v "${EROOT}"${srcfile//XX/startup} "${T}"/ || die
49 + fi
50 + fi
51 +
52 + if [[ -f "${EROOT}"${srcfile//XX/shutdown} ]]; then
53 + md5=$(md5sum "${EROOT}"${srcfile//XX/shutdown})
54 + if [[ ${md5%% *} != d7bffa0273f92abd999c7c3c43dbc23d ]]; then
55 + elog "Existing modified ${EPREFIX}${srcfile//XX/shutdown} detected."
56 + elog "Copying to ${newdir}/shutdown/10-agent-shutdown.sh..."
57 + cp -v "${EROOT}"${srcfile//XX/shutdown} "${T}"/ || die
58 + fi
59 + fi
60 +}
61
62 src_prepare() {
63 ecm_src_prepare
64
65 + if [[ ! -f "${T}"/10-agent-startup.sh ]]; then
66 + cp "${FILESDIR}"/10-agent-startup.sh "${T}"/ || die
67 + fi
68 + if [[ ! -f "${T}"/10-agent-shutdown.sh ]]; then
69 + cp "${FILESDIR}"/10-agent-shutdown.sh "${T}"/ || die
70 + fi
71 +
72 cmake_comment_add_subdirectory libkworkspace
73 # delete colliding libkworkspace translations
74 if [[ ${KDE_BUILD_TYPE} = release ]]; then
75 @@ -166,41 +193,28 @@ src_install() {
76 ecm_src_install
77
78 # default startup and shutdown scripts
79 - insinto "$(dirname ${NEWST})"
80 - doins "${FILESDIR}/$(basename ${NEWST})"
81 + insinto /etc/xdg/plasma-workspace/env
82 + doins "${T}"/10-agent-startup.sh
83
84 - insinto "$(dirname ${NEWSH})"
85 - doins "${FILESDIR}/$(basename ${NEWSH})"
86 - fperms +x "${NEWSH}"
87 -}
88 -
89 -pkg_preinst() {
90 - ecm_pkg_preinst
91 -
92 - # migrate existing agent scripts to new layout if no files there yet
93 - if [[ -r "${EROOT}${OLDST}" && ! -f "${EROOT}${NEWST}" ]]; then
94 - mkdir -p "${EROOT}$(dirname ${NEWST})" && cp "${EROOT}${OLDST}" "${EROOT}${NEWST}" && \
95 - elog "${EROOT}${OLDST} has been migrated to ${EROOT}${NEWST}, please delete old file."
96 - fi
97 - if [[ -r "${EROOT}${OLDSH}" && ! -f "${EROOT}${NEWSH}" ]]; then
98 - mkdir -p "${EROOT}$(dirname ${NEWSH})" && cp "${EROOT}${OLDSH}" "${EROOT}${NEWSH}" && \
99 - chmod +x "${EROOT}${NEWSH}" && \
100 - elog "${EROOT}${OLDSH} has been migrated to ${EROOT}${NEWSH}, please delete old file."
101 - fi
102 + insinto /etc/xdg/plasma-workspace/shutdown
103 + doins "${T}"/10-agent-shutdown.sh
104 + fperms +x /etc/xdg/plasma-workspace/shutdown/10-agent-shutdown.sh
105 }
106
107 pkg_postinst () {
108 ecm_pkg_postinst
109
110 - # warn about any leftover user scripts
111 - if [[ -d "${EROOT}"/etc/plasma/startup && -n "$(ls "${EROOT}"/etc/plasma/startup)" ]] || \
112 - [[ -d "${EROOT}"/etc/plasma/shutdown && -n "$(ls "${EROOT}"/etc/plasma/shutdown)" ]]; then
113 - elog "You appear to have scripts in ${EROOT}/etc/plasma/{startup,shutdown}."
114 - elog "They will no longer work since plasma-workspace-5.17"
115 + # Clean up pre-5.17.4 scripts
116 + if [[ -e "${EROOT}"/etc/plasma/startup/10-agent-startup.sh ]]; then
117 + rm "${EROOT}"/etc/plasma/startup/10-agent-startup.sh || die
118 + elog "Removed obsolete ${EPREFIX}/etc/plasma/startup/10-agent-startup.sh"
119 + fi
120 + if [[ -e "${EROOT}"/etc/plasma/shutdown/10-agent-shutdown.sh ]]; then
121 + rm "${EROOT}"/etc/plasma/shutdown/10-agent-shutdown.sh || die
122 + elog "Removed obsolete ${EPREFIX}/etc/plasma/shutdown/10-agent-shutdown.sh"
123 fi
124
125 - elog " * Edit ${EROOT}${NEWST} and uncomment"
126 - elog " the lines enabling ssh-agent."
127 - elog " * Edit ${EROOT}${NEWSH} uncomment"
128 - elog " the respective lines to properly kill the agent when the session ends."
129 + elog "To enable gpg-agent and/or ssh-agent in Plasma sessions,"
130 + elog "edit ${EPREFIX}/etc/xdg/plasma-workspace/env/10-agent-startup.sh"
131 + elog "and ${EPREFIX}/etc/xdg/plasma-workspace/shutdown/10-agent-shutdown.sh"
132 }