Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 627170 - devmanual: Provide suggestions against proactive use of variable references
Summary: devmanual: Provide suggestions against proactive use of variable references
Status: RESOLVED FIXED
Alias: None
Product: Documentation
Classification: Unclassified
Component: Devmanual (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Devmanual Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-06 11:23 UTC by Michał Górny
Modified: 2020-01-23 13:23 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2017-08-06 11:23:43 UTC
Give the recent ml discussion [1], I think it'd be worthwhile to provide some variable reference suggestions in the devmanual. Probably around ebuild format.

Something along the lines:

---

You can use variable references to account for data obtained from external sources, frequently changing constants and to reduce repetition. However, variable references for constant values should be used scarcely and with special concern for readability of ebuilds. Avoid using variable references whose values only incidentally match the expected values.

The examples of good variable references are:

1. using PV and derived variables (P, MY_P…) in SRC_URI/S to avoid having to update it frequently (when PV is used to indicate upstream version);

2. using PF in docdir path since this is the canonical Gentoo path that is always required to match PF.

The examples of bad variable references are:

1. using PN in HOMEPAGE, EGIT_REPO_URI, SRC_URI prefix -- since it breaks URL parsing in editors/terminals, makes it hard to copy-paste URLs,

2. using PN proactively in src_install() -- since it impairs readability and requires significant effort if Gentoo package needs to be renamed.

---

[1]:https://archives.gentoo.org/gentoo-dev/message/8f0461d02f4e3971a7b135438780c123
Comment 1 Ulrich Müller gentoo-dev 2020-01-23 13:23:53 UTC
> See Also: https://github.com/gentoo/devmanual.gentoo.org/pull/68

Merged in 2017 already. Closing.