Summary: | doman should support foo.lang.N filenames | ||
---|---|---|---|
Product: | Portage Development | Reporter: | Yuri Vasilevski (RETIRED) <yvasilev> |
Component: | Enhancement/Feature Requests | Assignee: | Portage team <dev-portage> |
Status: | RESOLVED FIXED | ||
Severity: | enhancement | CC: | pms |
Priority: | High | Keywords: | InVCS |
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 233213 | ||
Attachments: |
doman-langsufix.patch
doman-langsufix.patch |
Description
Yuri Vasilevski (RETIRED)
2008-05-16 21:16:26 UTC
Created attachment 153375 [details, diff]
doman-langsufix.patch
A patch for doman that will handle the following cases (the same ones dh_installman can handle):
foo.1 -> man/man1/foo.1
foo.lang.1 -> man/lang/man1/foo.1
where ${lang} can be a two letter language code (ej: 'es') or a two letter language code followed by a variant (ej: 'es_MX').
please do not use string replacements like that ... too much of a possibility of hitting false positives add a case to trim the lang from the end of the name only (In reply to comment #2) > please do not use string replacements like that ... too much of a possibility > of hitting false positives I think in this case the string replacement is reasonably safe, as I match for \.xx(_XX)?\. and man pages are not allowed to have dots in their names. But You are right, ${x/.${manlang}./.} or maybe ${x/.${manlang}.${suffix}/.${suffix}} is a lot safer (Note: bash's string substitution '.' matches only '.'), so I'll update the patch to that. > add a case to trim the lang from the end of the name only Sorry I don't get what do you mean by that case, could you please elaborate some more or give me an example? PS: I'll update the patch once the second part of the request is clear to avoid spamming bugzilla. what i meant was to use the % operator so that you only trim from the end of the string ... i think some of the code there is already doing similar stuff Created attachment 154375 [details, diff]
doman-langsufix.patch
Updated patch as requested by SpanKY.
Thanks, I've just committed a version of your patch which makes use of bash's =~ operator and corresponding $BASH_REMATCH array: - mandir=${i18n}man${suffix:0:1} + if [[ $x =~ (.*)\.([a-z][a-z](_[A-Z][A-Z])?)\.(.*) ]] ; then + name=${BASH_REMATCH[1]##*/}.${BASH_REMATCH[4]} + mandir=${BASH_REMATCH[2]}/man${suffix:0:1} + else + name=${x##*/} + mandir=${i18n}man${suffix:0:1} + fi i'd suggest we avoid the =~ operator as it historically breaks during bash upgrades ... but hopefully most of that has finished now that =~ has been out for a while ... That crossed my mind too. However, that's not the only thing that can break with a bash upgrade. Something like bug 190128 could also happen again. It's not the end of the world if something breaks like that (hopefully it won't though). If any kind of severe breakage occurs, we'll have to do like we did for bug 190128 and use blockers to prevent bad combinations of portage & bash. Blockers like those aren't nearly as annoying as they used to be, since current versions of portage can solve them automatically by adjusting merge order (upgrade portage first, then bash). Fixed in or before 2.2_pre8 |