pkgcore / pkgcheck

pkgcore-based QA utility for ebuild repos
https://pkgcore.github.io/pkgcheck
BSD 3-Clause "New" or "Revised" License
34 stars 29 forks source link

[New Check]: SYSROOT, ESYSROOT and BROOT in global scope #606

Closed ulm closed 11 months ago

ulm commented 11 months ago

Is there an existing such new check request for this?

Explain

Some ebuilds use SYSROOT, ESYSROOT or BROOT outside src_* and pkg_setup phases. Especially they use it in global scope.

Valid scope of these variables is defined by PMS, table 11.1: https://projects.gentoo.org/pms/8/pms.html#x1-109001r1

Examples

https://github.com/gentoo/gentoo/blob/0cfac423f478d94763f544b1c88b88ed71b1de46/dev-util/diffstat/diffstat-1.65.ebuild#L6

Output message

Variable <variable> used in ( global scope | <phase function name> )

Documentation

Variables SYSROOT, ESYSROOT and BROOT are valid only in src_* and pkg_setup phases. Their value can change between phases.

Result level

warning

arthurzam commented 11 months ago

Just FYI, for all usages except inside VERIFY_SIG_OPENPGP_KEY_PATH we remain with those (I'm giving this diff just because I wanted to remove the common noise)

Note that I've collected all the variables in your link that have Consistent set to No.

app-admin/conky
  VariableScope: version 1.17.0-r1: variable 'ROOT' used in 'global scope' on line: 110
  VariableScope: version 1.19.2-r1: variable 'ROOT' used in 'global scope' on line: 110

app-mobilephone/adebar
  VariableScope: version 2.4.1: variable 'ROOT' used in 'global scope' on line: 26

app-text/highlight
  VariableScope: version 4.1: variable 'D' used in 'global scope' on line: 46
  VariableScope: version 4.6: variable 'D' used in 'global scope' on line: 47

dev-perl/Crypt-OpenSSL-Random
  VariableScope: version 0.150.0-r1: variable 'ESYSROOT' used in 'global scope' on line: 36

dev-perl/Crypt-OpenSSL-RSA
  VariableScope: version 0.330.0: variable 'ESYSROOT' used in 'global scope' on line: 41

dev-util/buildbot-worker
  VariableScope: version 3.6.1-r2: variable 'ROOT' used in 'global scope' on line: 44
  VariableScope: version 9999: variable 'ROOT' used in 'global scope' on line: 44

games-action/descent3
  VariableScope: version 1.4.0b-r3: variable 'ED' used in 'global scope' on line: 30

games-action/fakk2
  VariableScope: version 1.02-r1: variable 'D' used in 'global scope' on line: 22

games-fps/soldieroffortune
  VariableScope: version 1.06a-r2: variable 'ED' used in 'global scope' on line: 32

games-fps/tribes2
  VariableScope: version 25034: variable 'ED' used in 'global scope' on line: 31

games-fps/transfusion-bin
  VariableScope: version 1.01-r1: variable 'D' used in 'global scope' on line: 35

games-fps/ut2003-bonuspack-epic
  VariableScope: version 1-r1: variable 'ED' used in 'global scope' on line: 23

games-fps/ut2003-demo
  VariableScope: version 2206-r5: variable 'ED' used in 'global scope' on line: 31

games-fps/ut2003-data
  VariableScope: version 2107-r2: variable 'ED' used in 'global scope' on line: 25

games-fps/ut2004-demo
  VariableScope: version 3334-r3: variable 'ED' used in 'global scope' on line: 28

games-strategy/dominions2
  VariableScope: version 2.16-r1: variable 'ED' used in 'global scope' on line: 45

games-strategy/majesty-demo
  VariableScope: version 1.0.0-r1: variable 'D' used in 'global scope' on line: 28

media-radio/direwolf
  VariableScope: version 1.5-r1: variable 'D' used in 'global scope' on line: 28

media-tv/plex-media-server
  VariableScope: version 1.31.1.6733: variable 'ED' used in 'global scope' on lines: 43, 44
  VariableScope: version 1.32.0.6973: variable 'ED' used in 'global scope' on lines: 44, 45
  VariableScope: version 1.32.1.6999: variable 'ED' used in 'global scope' on lines: 44, 45
  VariableScope: version 1.32.2.7100: variable 'ED' used in 'global scope' on lines: 44, 45
  VariableScope: version 1.32.3.7162: variable 'ED' used in 'global scope' on lines: 44, 45

net-misc/asterisk
  VariableScope: version 16.29.1: variable 'D' used in 'global scope' on line: 117
  VariableScope: version 16.30.0: variable 'D' used in 'global scope' on line: 117
  VariableScope: version 18.15.1: variable 'D' used in 'global scope' on line: 115
  VariableScope: version 18.17.0: variable 'D' used in 'global scope' on line: 114
  VariableScope: version 18.17.1: variable 'D' used in 'global scope' on line: 115
  VariableScope: version 18.18.0: variable 'D' used in 'global scope' on line: 115
  VariableScope: version 20.3.0: variable 'D' used in 'global scope' on line: 114

net-misc/radvd
  VariableScope: version 2.19-r2: variable 'ROOT' used in 'global scope' on lines: 60, 61
  VariableScope: version 2.19-r4: variable 'ROOT' used in 'global scope' on lines: 61, 62

x11-misc/compose-tables
  VariableScope: version 1.8.6: variable 'ESYSROOT' used in 'global scope' on line: 30