View previous topic :: View next topic |
Author |
Message |
PF4Public Tux's lil' helper
Joined: 28 Jan 2019 Posts: 103
|
Posted: Thu Dec 02, 2021 8:48 pm Post subject: Managing ebuild dependencies |
|
|
Hi all
I have two ebuilds, which depend on a third one. Presently I define THIRD_DEP_SLOT variable, which holds a version and which is later used as a slot string in COMMON_DEPEND for the third package string. Unfortunately, I have to use THIRD_DEP_SLOT to construct a path from it and put it into the launcher bash script. Are there any better approaches to this?
Another issue I'm facing is that with that structure as described above, I'd like to use a USE flag to override this third dependency, so that it stays by default for normal users, but for those, who want to tinker with newer versions of the "third" package, dependency and THIRD_DEP_SLOT and the path in launcher and everything be redefined via USE flag. Is it somehow possible? Are there other solutions to providing single ebuild with user-variable dependencies?
Thanks in advance. |
|
Back to top |
|
|
Genone Retired Dev
Joined: 14 Mar 2003 Posts: 9507 Location: beyond the rim
|
Posted: Wed Dec 08, 2021 11:04 am Post subject: |
|
|
Would help to see the actual code involved so we know for sure what you're talking about. |
|
Back to top |
|
|
PF4Public Tux's lil' helper
Joined: 28 Jan 2019 Posts: 103
|
Posted: Wed Dec 08, 2021 8:14 pm Post subject: |
|
|
Of course!
I have electron ebuilds, which are slotted like this: "SLOT="$(ver_cut 1)/$(ver_cut 2-)"". Apart from that I have eselect for electron, which is based on Postgresql's one IIRC, it operates on major versions, as major electron versions are compatible.
Now, I have vscode ebuilds, which depend on electron. In it at the very beginning I set "ELECTRON_SLOT="13"", which goes here: "dev-util/electron:${ELECTRON_SLOT}",
here:
Code: | export PATH="/usr/$(get_libdir)/electron-${ELECTRON_SLOT}:/usr/$(get_libdir)/electron-${ELECTRON_SLOT}/npm/bin/node-gyp-bin:$PATH"
export CFLAGS="${CFLAGS} -I/usr/include/electron-${ELECTRON_SLOT}/node"
export CPPFLAGS="${CPPFLAGS} -I/usr/include/electron-${ELECTRON_SLOT}/node"
yarn config set nodedir /usr/include/electron-${ELECTRON_SLOT}/node || die |
and here:
Code: | sed -i '/^ELECTRON/,+3d' "${WORKDIR}"/V*/bin/code-oss || die
echo "VSCODE_PATH=\"/usr/$(get_libdir)/vscode\"
ELECTRON_PATH=\"/usr/$(get_libdir)/electron-${ELECTRON_SLOT}\"
CLI=\"\${VSCODE_PATH}/out/cli.js\"
exec /usr/bin/env ELECTRON_RUN_AS_NODE=1 \
NPM_CONFIG_NODEDIR=\"\${ELECTRON_PATH}/node/\" \
\"\${ELECTRON_PATH}/electron\" \"\${CLI}\" --app=\"\${VSCODE_PATH}\" \"\$@\"" >> "${WORKDIR}"/V*/bin/code-oss |
First snippet is used to build native dependencies by the correct electron version, which is 13 in this case. The second one is mangling the launcher to [again] use proper electron. So that electron version belongs to the ebuild and does not depend on its version: whenever they want, they update electron.
Same thing with element-desktop
Questions are:
1. Is there any better approach to accomplish the same?
2. Is it possible to vary this dependency based on USE flags (say USE="electron-16") for example?
Sorry for not providing these from the start. |
|
Back to top |
|
|
Genone Retired Dev
Joined: 14 Mar 2003 Posts: 9507 Location: beyond the rim
|
Posted: Tue Dec 21, 2021 4:25 pm Post subject: |
|
|
PF4Public wrote: | 2. Is it possible to vary this dependency based on USE flags (say USE="electron-16") for example? |
That is possible using use-conditionals like this:
Code: | COMMON_DEPEND="electron-13? ( dev-util/electron:13 ) electron-14? ( dev-util/electron:14 )" |
and so on. Of course you then have to take care to adjust ELECTRON_SLOT as well (if use electron-13; then ....; fi), and you need some rule how to handle the case when multiple such use-flags are handled (when there is more than one). |
|
Back to top |
|
|
PF4Public Tux's lil' helper
Joined: 28 Jan 2019 Posts: 103
|
Posted: Tue Dec 21, 2021 5:43 pm Post subject: |
|
|
Thanks for your answer, looks promising.
Would ELECTRON_SLOT be preserved into ebuild's environment for the entire duration of the build if I "export ELECTRON_SLOT" using conditionals based on USE flags in "src_prepare()"?
EDIT: Everything seems to work. Thanks. |
|
Back to top |
|
|
|