On 13/06/2024 12.42, Ulrich Mueller wrote: >>>>>> On Thu, 13 Jun 2024, Florian Schmaus wrote: >>>> +_GREADME_DOC_DIR="usr/share/doc/${PF}" >>> It is somewhat unusual to call insinto or docompress with a relative >>> path. I'd use "/usr/share/doc/${PF}" here. >>> >>>> +_GREADME_REL_PATH="${_GREADME_DOC_DIR}/${_GREADME_FILENAME}" >>> Why must this be a relative path? AFAICS it could be an absolute >>> path in >>> everywhere it is used. (You even add an explicit slash in places like >>> ${ED}/${_GREADME_REL_PATH}). > >> My idea was to denote relative paths by not including an initial slash >> (/). This allows to write "${ED}/${_GREADME_REL_PATH}" without a >> duplicate slash in the middle. I find > >> ${ED}/${_GREADME_REL_PATH}" > >> more readable when compared to > >> ${ED}${_GREADME_REL_PATH}" > > I think the variable would be renamed in that case, i.e. > ${ED}${_GREADME_PATH} or ${ED}${_GREADME_ABS_PATH}. > >> which seems to be in-line with >> https://mgorny.pl/articles/the-ultimate-guide-to-eapi-7.html#d-ed-root-eroot-no-longer-have-a-trailing-slash > > This has examples like ${D}${EPREFIX}/usr/share/foo: All path variables > start with a slash, _don't_ end with a slash, and no slash between them > when concatenating. > >> But maybe I misunderstand what you are suggesting. You want > >> _GREADME_DOC_DIR="/usr/share/doc/${PF}" > >> instead of > >> _GREADME_DOC_DIR="usr/share/doc/${PF}" > >> right? > > Correct. > >> Then I'd also have to change to ${ED}${_GREADME_REL_PATH}", to avoid >> the double slash. :( > > I see no problem with this. Will change accordingly then. >>>> + while read -r line; do elog "${line}"; done < "${EROOT}/${_GREADME_REL_PATH}" >>> It is not guaranteed that the file exists in ${EROOT} at this point. >>> See FEATURES="nodoc" in make.conf(5). > >> Fair point. Fixed. > > Well, it still won't display anything with FEATURES=nodoc. IIUC > readme.gentoo-r1.eclass works around the problem by saving the file > contents in an environment variable. (However, I see the problem that > even then you couldn't compare old vs new file contents.) I'd assume this is readme.gentoo-r1.eclass working around the readme file being compressed, and by doing so, coincidentally being able to display the readme even if FEATURES=nodoc. It appears we have now two options: A) Just like readme.gentoo-r1, store the content in an environment variable , to be able to show the content (unconditionally) in case of FEATURES=nodoc B) Live with the fact that we will not be able to show the content on FEATURES=nodoc (but document this accordingly). I have no strong opinion, therefore I am happy about hearing peoples thoughts on this. - Flow