Skip to content

Commit

Permalink
Refactor duplicated code
Browse files Browse the repository at this point in the history
  • Loading branch information
mosteo committed Jun 3, 2022
1 parent 9248fbe commit 72ad199
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/alire/alire-origins-deployers-system-rpm_wrappers.adb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ package body Alire.Origins.Deployers.System.RPM_Wrappers is
when Dnf => "dnf",
when Yum => "yum");

------------------------------
-- Package_Name_With_Archit --
------------------------------

function Package_Name_With_Archit (Name : String) return String
is (if Contains (Name, ".")
then Name
else Name
& "."
& To_Lower_Case
(Platforms.Current.Host_Architecture'Image));

-----------------------
-- Already_Installed --
-----------------------
Expand All @@ -29,13 +41,7 @@ package body Alire.Origins.Deployers.System.RPM_Wrappers is
-- Name of the package narrowed down by architecture, to avoid being
-- confused by i386 packages
Full_Pkg_Name : constant String :=
(if Contains (This.Base.Package_Name, ".")
then This.Base.Package_Name
else
This.Base.Package_Name
& "."
& To_Lower_Case
(Platforms.Current.Host_Architecture'Image));
Package_Name_With_Archit (This.Base.Package_Name);

Wrapper : constant String := Wrapper_Command (This);

Expand Down Expand Up @@ -71,13 +77,7 @@ package body Alire.Origins.Deployers.System.RPM_Wrappers is
-- Name of the package narrowed down by architecture, to avoid being
-- confused by i386 packages
Full_Pkg_Name : constant String :=
(if Contains (This.Base.Package_Name, ".")
then This.Base.Package_Name
else
This.Base.Package_Name
& "."
& To_Lower_Case
(Platforms.Current.Host_Architecture'Image));
Package_Name_With_Archit (This.Base.Package_Name);

--------------------------
-- Detect_Not_Installed --
Expand Down

0 comments on commit 72ad199

Please sign in to comment.