Talk:Basic guide to write Gentoo Ebuilds

From Gentoo Wiki
Jump to:navigation Jump to:search
Before creating a discussion or leaving a comment, please read about using talk pages. To create a new discussion, click here. Comments on an existing discussion should be signed using ~~~~:
A comment [[User:Larry|Larry]] 13:52, 13 May 2024 (UTC)
: A reply [[User:Sally|Sally]] 10:36, 21 July 2024 (UTC)
:: Your reply ~~~~

Issue with the steps

Talk status
This discussion is done as of 2019-12-27.

Question: There is a problem in that following the cited steps fails as shown below. — Donahue 20:27, 16 January 2014‎ (UTC)

fx8150 ~ # mkdir -p /usr/local/portage/app-misc/hello-world
fx8150 ~ # cd $_                                           
fx8150 hello-world # cp /usr/portage/header.txt ./hello-world-1.0.ebuild
fx8150 hello-world # SLOT="0"
fx8150 hello-world # ebuild hello-world-1.0.ebuild manifest clean merge
Appending /usr/local/portage to PORTDIR_OVERLAY...
!!! Repository 'x-portage' is missing masters attribute in '/usr/local/portage/metadata/layout.conf'
!!! Set 'masters = gentoo' in this file for future compatibility
Error(s) in metadata for 'app-misc/hello-world-1.0':
  SLOT: invalid value: ''

Answer: You need to put SLOT="0" inside the ebuild. — Tom Wijsman 21:07, 16 January 2014 (UTC)

Hi all, please remember to sign your contributions to discussion pages. Kind regards, --Maffblaster (talk) 04:19, 25 December 2016 (UTC)
I think there are two issues here; even if you include 'SLOT="0"' in your ebuild, you still get the "!!! Repository 'x-portage'" error. See this forum thread and this exchange. Separately, the hello-world instructions should probably specify what name to save your ebuild file under; currently only the path is explicitly specified. Kergu (talk) 23:06, 3 June 2019 (UTC)
My mistake, have amended instructions accordingly. Proofreading welcome; I just wrote what worked for me. Kergu (talk) 23:19, 3 June 2019 (UTC)
One more problem; there appears to be no file at The "ebuild hello-world-1.0.ebuild manifest clean merge" command hangs at "PASV ... ". Kergu (talk) 00:07, 4 June 2019 (UTC)
Just removed those "Hello World" stuff as it was a confusing mixture of creating source code and writing ebuild. Creating source code (programming) might go to its own dedicated article.--Charles17 (talk) 07:51, 27 December 2019 (UTC)

Error 404

Talk status
This discussion is done as of 3 August 2020.

The following link doesn't work anymore: Fturco (talk) 16:35, 20 August 2018 (UTC)

I reviewed the article, and the errant link has been expunged. --Davidbryant (talk) 16:16, 3 August 2020 (UTC)

Add examples from portage tree

Talk status
This discussion is done as of 3 August 2020.

I think a nice addition to this page would be to list real ebuilds from the portage tree that show good ebuild practices. Many real ebuilds look complicated showing examples for libraries and executibles for different languages would be helpful. Garbanzo (talk) 04:47, 4 June 2019 (UTC)

Well, the article is not write-protected. So if you really want another example, why not add it yourself? --Davidbryant (talk) 16:20, 3 August 2020 (UTC)

Remove section on variables in SRC_URI

Talk status
This discussion is done.

I think it would be useful to remove the note about not using ${PN} style variables in SRC_URI, the page it links to only talks about the HOMEPAGE variable, and the rationale within HOMEPAGE variable is that it does not contain dynamic parts, whereas SRC_URI does (specifically, the package version). The current text can be easily interpreted as not including ${PV} which is a really useful variable to include within SRC_URI. — The preceding unsigned comment was added by Chriscpritchard (talkcontribs) 2022-05-12

Seems to depend. In case the ebuild is for a PR assigned to @gentoo/proxy-maint the proxy maintainer style guide seems to apply.
--Vaukai (talk) 09:23, 13 May 2022 (UTC)
That section only talks about ${PN} which is static, perhaps the section could be changed to highlight that ${PV} is an acceptable variable given it is variable, not static, as it's based on the package version.
Chriscpritchard (talk) 09:14, 15 May 2022 (UTC)
Done. Original insertion was only PN, but further edits increased the scope. Tried to changed it back some. --Grknight (talk) 14:33, 16 May 2022 (UTC)

Add Instructions to allow the first ebuild to succeed

Talk status
This discussion is done.

I attempted test fetching and unpacking and failed using the instructions ebuild ./scrub-2.6.1.ebuild manifest clean unpack. The attempt tried to download the package from another repo,, which is a official Gentoo source. I needed to install pkgdev and then run pkgdev manifest. After this the command executed correctly. I also changed priorities in repos.conf, but I believe that didn't move towards a solution. I believe this should be added as it took me some time to figure this out as a beginner. If this is the correct way of fixing this issue I can update the wiki. I hesitated since there could be a correct way of doing this and my method is functional, but undesirable. I question the solution since the error is not repeatable and the command ebuild ./scrub-2.6.1.ebuild manifest clean unpack runs as intended. The Manifest file in the folder pkgdev created can be deleted with no change in behaviour.

Nels Larsen 21:27, 3 March 2023 (UTC)

Unfortunately this article got messed by too many changes and insertions making it almost unreadable. Have a look at the older version with uninterrupted reading where the words »It can be tested« clearly refer to the SRC_URI shown in the codebox and filebox above.
--Vaukai (talk) 22:21, 3 March 2023 (UTC)
That does make more sense. Given the different context I assume the reader should know how to resolve the issue with the repository not being referenced by the ebuild command. Thanks for the wiki update!
-- Nels Larsen