Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

www-apps/cgit: Create cache directory at runtime #30724

Closed
wants to merge 1 commit into from

Conversation

cjmayo
Copy link
Contributor

@cjmayo cjmayo commented Apr 23, 2023

Closes: https://bugs.gentoo.org/516388


Add a systemd USE flag because this does not fix the problem for non-systemd systems.

@gentoo-bot
Copy link

Pull Request assignment

Submitter: @cjmayo
Areas affected: ebuilds
Packages affected: www-apps/cgit

www-apps/cgit: @gentoo/web-apps

Linked bugs

Bugs linked: 516388


In order to force reassignment and/or bug reference scan, please append [please reassign] to the pull request title.

Docs: Code of ConductCopyright policy (expl.) ● DevmanualGitHub PRsProxy-maint guide

@gentoo-bot gentoo-bot added assigned PR successfully assigned to the package maintainer(s). bug linked Bug/Closes found in footer, and cross-linked with the PR. labels Apr 23, 2023
@thesamesam
Copy link
Member

Why doesn't this fix the issue for non-systemd systems? (What am I missing?)

@cjmayo
Copy link
Contributor Author

cjmayo commented Apr 23, 2023

I assumed tmpfiles wasn't supported by openrc.

Looking into it there is: sys-apps/opentmpfiles-0.2-r1, but:

# No longer maintained upstream; please see the 2021-07-15-opentmpfiles-deprecation
# news item.

@gentoo-repo-qa-bot
Copy link
Collaborator

Pull request CI report

Report generated at: 2023-04-23 19:28 UTC
Newest commit scanned: e32508c
Status: ✅ good

There are existing issues already. Please look into the report to make sure none of them affect the packages in question:
https://qa-reports.gentoo.org/output/gentoo-ci/7a490fcab1/output.html

@cjmayo
Copy link
Contributor Author

cjmayo commented Apr 23, 2023

OK sys-apps/systemd-tmpfiles is the replacement which doesn't need systemd. I will update this PR.

Closes: https://bugs.gentoo.org/516388
Signed-off-by: Chris Mayo <aklhfex@gmail.com>
@cjmayo cjmayo changed the title www-apps/cgit: Create cache directory at runtime using systemd www-apps/cgit: Create cache directory at runtime Apr 24, 2023
@cjmayo
Copy link
Contributor Author

cjmayo commented Apr 24, 2023

Updated to use tmpfiles for everyone:

  • Create cgit.conf in src_install(), using CGIT_CACHEDIR
  • Expand the pkg_postinst() ewarn to explain about the path
--- cgit-1.2.3-r201.ebuild
+++ cgit-1.2.3-r202.ebuild
@@ -9,7 +9,7 @@
 
 WEBAPP_MANUAL_SLOT="yes"
 
-inherit lua-single python-single-r1 toolchain-funcs webapp
+inherit lua-single python-single-r1 tmpfiles toolchain-funcs webapp
 
 [[ -z "${CGIT_CACHEDIR}" ]] && CGIT_CACHEDIR="/var/cache/${PN}/"
 
@@ -22,7 +22,7 @@
 
 LICENSE="GPL-2"
 SLOT="0"
-KEYWORDS="amd64 arm ~riscv x86"
+KEYWORDS="~amd64 ~arm ~riscv ~x86"
 IUSE="doc +highlight +lua test"
 REQUIRED_USE="lua? ( ${LUA_REQUIRED_USE} ) ${PYTHON_REQUIRED_USE}"
 RESTRICT="!test? ( test )"
@@ -91,9 +91,11 @@
 	webapp_postinst_txt en "${FILESDIR}"/postinstall-en.txt
 	webapp_src_install
 
-	keepdir "${CGIT_CACHEDIR}"
-	fowners ${PN}:${PN} "${CGIT_CACHEDIR}"
-	fperms 700 "${CGIT_CACHEDIR}"
+	cat > cgit.conf <<-EOT || die
+		d ${CGIT_CACHEDIR} 0700 cgit cgit -
+	EOT
+	dotmpfiles cgit.conf
+
 	python_fix_shebang .
 }
 
@@ -103,6 +105,11 @@
 
 pkg_postinst() {
 	webapp_pkg_postinst
-	ewarn "If you intend to run cgit using web server's user"
-	ewarn "you should change ${CGIT_CACHEDIR} permissions."
+	tmpfiles_process cgit.conf
+	ewarn "The cgit cache is enabled using the cache-size setting in cgitrc."
+	ewarn "If enabling the cache and running cgit using the web server's user"
+	ewarn "you should copy /usr/lib/tmpfiles.d/cgit.conf"
+	ewarn "to /etc/tmpfiles.d/ and edit, changing the ownership fields."
+	ewarn "If you use the cache-root setting in cgitrc to specify a cache directory"
+	ewarn "other than ${CGIT_CACHEDIR} edit the path in cgit.conf."
 }

@gentoo-repo-qa-bot
Copy link
Collaborator

Pull request CI report

Report generated at: 2023-04-24 18:38 UTC
Newest commit scanned: 204b8db
Status: ✅ good

There are existing issues already. Please look into the report to make sure none of them affect the packages in question:
https://qa-reports.gentoo.org/output/gentoo-ci/a4c79c9656/output.html

@cjmayo cjmayo deleted the cgit_tmpfiles branch April 26, 2023 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assigned PR successfully assigned to the package maintainer(s). bug linked Bug/Closes found in footer, and cross-linked with the PR.
Projects
None yet
4 participants