-
-
Notifications
You must be signed in to change notification settings - Fork 60
Add gentoo #2006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Lucretia
wants to merge
21
commits into
alire-project:master
Choose a base branch
from
Lucretia:add-gentoo
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add gentoo #2006
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
6acdf9b
Add Gentoo and Portage into the platforms and package managers.
Lucretia 00d0492
Add a new package to support portage on Gentoo.
Lucretia 24357e3
Hook in Gentoo/Portage into the Deployers
Lucretia ba4154d
dev: check templates are up to date (#1995)
mosteo 9f400ff
dev: guidelines for automatic Copilot reviews (#1998)
mosteo 949aa16
fix: pass GH token in Docker tests too (#1999)
mosteo 4ae0f4e
dev: placeholder for ignoring known future properties (#2000)
mosteo 4c31954
fix: typos in `catalog-format-spec.md` (#2002)
mgrojo c021b26
fix: workflow on aarch64 linux, macOS 14 instead of latest (#2003)
AldanTanneo e1fe270
feat: prevent incidental output breaking structured output (#2005)
Seb-MCaw ff77496
Add documentation for Gentoo.
Lucretia 89697c6
Merge branch 'master' into add-gentoo
Lucretia 7345f7a
Simplify the expression.
Lucretia bdea4b0
Fix indexing error.
Lucretia c0bf7b9
feat: validation of GH PATs (#1994)
mosteo 6b3e60a
Merge branch 'master' into add-gentoo
Lucretia 8dd254d
Merge remote-tracking branch 'upstream/master' into add-gentoo
Lucretia 60705e7
Correct the package manager's name to emerge.
Lucretia 395b759
Change the log level to Detail.
Lucretia 7a54348
Change Info -> Debug.
Lucretia 25737fb
Add the comment box.
Lucretia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Submodule den
updated
14 files
| +0 −17 | .github/workflows/publish.yml | |
| +10 −6 | .github/workflows/selftest.yml | |
| +2 −4 | alire.toml | |
| +2 −2 | config/den_config.ads | |
| +2 −9 | config/den_config.gpr | |
| +2 −2 | config/den_config.h | |
| +36 −9 | src/den-filesystem.adb | |
| +3 −3 | src/den-filesystem.ads | |
| +0 −22 | src/den-os.adb | |
| +0 −3 | src/den-os.ads | |
| +9 −10 | src/den.adb | |
| +4 −7 | src/den.ads | |
| +1 −0 | tests/alire.toml | |
| +0 −30 | tests/src/den_tests-scrub.adb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,148 @@ | ||
| with Ada.Characters.Latin_1; | ||
| with AAA.Strings; use AAA.Strings; | ||
|
|
||
| with Alire.Errors; | ||
| with Alire.OS_Lib.Subprocess; | ||
| -- with Alire.Utils.Regex; | ||
|
|
||
| package body Alire.Origins.Deployers.System.Portage is | ||
|
|
||
| package L1 renames Ada.Characters.Latin_1; | ||
| package Subprocess renames Alire.OS_Lib.Subprocess; | ||
|
|
||
| ----------------------- | ||
| -- Already_Installed -- | ||
| ----------------------- | ||
|
|
||
| overriding function Already_Installed (This : Deployer) return Boolean | ||
| is | ||
| -- The following call is faster than using emerge. | ||
| Output : constant AAA.Strings.Vector := | ||
| Subprocess.Checked_Spawn_And_Capture | ||
| ("eix", | ||
| Empty_Vector & "-ce" & This.Base.Package_Name, | ||
| -- Check the category (A), | ||
| -- whether it is installed (I) and | ||
| -- match against the exact string (e). | ||
| -- i.e. "app-editors/zed" | ||
| Valid_Exit_Codes => (1, 0), -- returns 1 when not found | ||
| Err_To_Out => True); | ||
|
|
||
| Indicator : constant String := "[I]"; | ||
| Line : constant String := AAA.Strings.First_Element (Output); | ||
| begin | ||
| Trace.Detail ("Already_Installed: " & This.Base.Package_Name); | ||
|
|
||
| if Line'Length >= Indicator'Length then | ||
| return | ||
| Line (Line'First .. Line'First + Indicator'Length - 1) = Indicator; | ||
| end if; | ||
|
|
||
| return False; | ||
| end Already_Installed; | ||
|
|
||
| ------------------------- | ||
| -- To_Semantic_Version -- | ||
| ------------------------- | ||
|
|
||
| function To_Semantic_Version (Gentoo_Version : String) return String is | ||
| Tmp : String := Gentoo_Version; | ||
| begin | ||
| for C in Tmp'Range loop | ||
| -- Format: 0.0.0_release-rc9 | ||
| if Tmp (C) = L1.Low_Line then | ||
| Tmp (C) := L1.Hyphen; | ||
|
|
||
| Trace.Debug ("To_Semantic_Version: " & Tmp); | ||
|
|
||
| return Tmp; | ||
| end if; | ||
| end loop; | ||
|
|
||
| Trace.Debug ("To_Semantic_Version: " & Tmp); | ||
|
|
||
| return Tmp; | ||
| end To_Semantic_Version; | ||
|
|
||
| ------------ | ||
| -- Detect -- | ||
| ------------ | ||
|
|
||
| overriding | ||
| function Detect (This : Deployer) return Version_Outcomes.Outcome | ||
| is | ||
| function Split_Version (Gentoo_Package_Version : String) return String is | ||
| begin | ||
| for Index in Gentoo_Package_Version'Range loop | ||
| if Gentoo_Package_Version (Index) = L1.Hyphen then | ||
| return Gentoo_Package_Version | ||
| (Index + 1 .. Gentoo_Package_Version'Last); | ||
| end if; | ||
| end loop; | ||
|
|
||
| return ""; | ||
| end Split_Version; | ||
| pragma Unreferenced (Split_Version); | ||
|
|
||
| PortageQ_Output : constant AAA.Strings.Vector := | ||
| Subprocess.Checked_Spawn_And_Capture | ||
| ("portageq", | ||
| Empty_Vector & "best_visible" & "/" & | ||
| This.Base.Package_Name, | ||
| Valid_Exit_Codes => (0, 1), -- Returned when not found | ||
| Err_To_Out => True); | ||
| -- portageq should *always* produce zero or one line result. | ||
|
|
||
| Output : constant AAA.Strings.Vector := | ||
| Subprocess.Checked_Spawn_And_Capture | ||
| ("qatom", | ||
| Empty_Vector & "-F%{PVR}" & | ||
| First_Element (PortageQ_Output), | ||
| Valid_Exit_Codes => (0, 1), -- Returned when not found | ||
| Err_To_Out => True); | ||
| Gentoo_Version : constant String := First_Element (Output); | ||
|
|
||
| -- Regexp : constant String := | ||
| -- "[0-9]+(\.[0-9]+)*[a-z](_[a-z]+[0-9]?)*(-r[0-9]*)*"; | ||
| -- From the pms.pdf. | ||
| begin | ||
| if Gentoo_Version /= "" then | ||
| Trace.Info ("Detect: " & This.Base.Package_Name & " - " & | ||
| Gentoo_Version & " - " & To_Semantic_Version (Gentoo_Version) & | ||
| " => " & Semantic_Versioning.Parse | ||
| (To_Semantic_Version (Gentoo_Version), | ||
| Relaxed => True).Image); | ||
|
|
||
| return | ||
| Version_Outcomes.New_Result | ||
| (Semantic_Versioning.Parse | ||
| (To_Semantic_Version (Gentoo_Version), Relaxed => True)); | ||
| end if; | ||
|
|
||
| Trace.Debug ("System deployer could not detect: " & This.Base.Image); | ||
| return Version_Outcomes.Outcome_Failure ("could not be detected", | ||
| Report => False); | ||
| end Detect; | ||
|
|
||
| ------------- | ||
| -- Install -- | ||
| ------------- | ||
|
|
||
| overriding | ||
| function Install (This : Deployer) return Outcome is | ||
| begin | ||
| Trace.Info ("Install: " & This.Base.Package_Name); | ||
|
|
||
| Subprocess.Checked_Spawn | ||
| ("sudo", Empty_Vector & | ||
| "emerge" & | ||
| "-av" & | ||
| This.Base.Package_Name); | ||
|
|
||
| return Outcome_Success; | ||
| exception | ||
| when E : others => | ||
| return Alire.Errors.Get (E); | ||
| end Install; | ||
|
|
||
| end Alire.Origins.Deployers.System.Portage; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| package Alire.Origins.Deployers.System.Portage is | ||
|
|
||
| type Deployer is new Deployers.System.Deployer with null record; | ||
|
|
||
| overriding | ||
| function Already_Installed (This : Deployer) return Boolean; | ||
|
|
||
| overriding | ||
| function Detect (This : Deployer) | ||
| return Version_Outcomes.Outcome; | ||
|
|
||
| overriding | ||
| function Install (This : Deployer) return Outcome; | ||
|
|
||
| overriding | ||
| function Executable_Name (This : Deployer) return String is ("emerge"); | ||
|
|
||
| end Alire.Origins.Deployers.System.Portage; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing subprogram box here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean "box?"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A comment with the name of the function inside a "box":
GNAT Studio has a command to automate this process. Look in the shortcut settings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm in vscode.