Skip to content

Commit

Permalink
Merge pull request #213 from jrmarino/clean-environment
Browse files Browse the repository at this point in the history
Clean environment
  • Loading branch information
jrmarino committed Jan 31, 2023
2 parents 28cb64d + 48b3af3 commit cc05e2d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
2 changes: 1 addition & 1 deletion License.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2015-2021, John R. Marino <[email protected]>
Copyright (c) 2015-2023, John R. Marino <[email protected]>

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
Expand Down
4 changes: 2 additions & 2 deletions src/definitions.ads
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ package Definitions is
pragma Pure;

synth_version_major : constant String := "2";
synth_version_minor : constant String := "12";
copyright_years : constant String := "2015-2021";
synth_version_minor : constant String := "13";
copyright_years : constant String := "2015-2023";
host_localbase : constant String := "/usr/local";
host_make : constant String := "/usr/bin/make";
host_pkg8 : constant String := host_localbase & "/sbin/pkg";
Expand Down
24 changes: 21 additions & 3 deletions src/portscan.adb
Original file line number Diff line number Diff line change
Expand Up @@ -511,9 +511,10 @@ package body PortScan is
end if;
end get_fullport;

scanenv : constant String := scan_environment;
fullport : constant String := get_fullport;
ssroot : constant String := chroot & JT.USS (PM.configuration.dir_buildbase) & ss_base;
command : constant String := ssroot & " " & chroot_make_program &
command : constant String := scanenv & ssroot & " " & chroot_make_program &
" .MAKE.EXPAND_VARIABLES=yes -C " & fullport & " -VPKGFILE:T";
content : JT.Text;
topline : JT.Text;
Expand Down Expand Up @@ -766,10 +767,11 @@ package body PortScan is
end if;
end get_fullport;

scanenv : constant String := scan_environment;
fullport : constant String := get_fullport;
ssroot : constant String := chroot & JT.USS (PM.configuration.dir_buildbase) & ss_base;
command : constant String :=
ssroot & " " & chroot_make_program & " -C " & fullport &
scanenv & ssroot & " " & chroot_make_program & " -C " & fullport &
" -VPKGVERSION -VPKGFILE:T -VMAKE_JOBS_NUMBER -VIGNORE" &
" -VFETCH_DEPENDS -VEXTRACT_DEPENDS -VPATCH_DEPENDS" &
" -VBUILD_DEPENDS -VLIB_DEPENDS -VRUN_DEPENDS" &
Expand Down Expand Up @@ -841,10 +843,11 @@ package body PortScan is
is
catport : String := get_catport (all_ports (target));
fullport : constant String := dir_ports & "/" & catport;
scanenv : constant String := scan_environment;
ssroot : constant String := chroot &
JT.USS (PM.configuration.dir_buildbase) & ss_base;
command : constant String :=
ssroot & " " & chroot_make_program & " -C " & fullport &
scanenv & ssroot & " " & chroot_make_program & " -C " & fullport &
" .MAKE.EXPAND_VARIABLES=yes " &
" -VPKGVERSION -VPKGFILE:T -V_MAKE_JOBS:C/^-j//" &
" -V_CBBH_MSGS -VTOOL_DEPENDS -VBUILD_DEPENDS -VDEPENDS" &
Expand Down Expand Up @@ -1733,4 +1736,19 @@ package body PortScan is
so_serial.Iterate (suggest'Access);
end suggest_flavor_for_bad_origin;


--------------------------------------
-- scan_environment --
--------------------------------------
function scan_environment return String
is
PATH : constant String := "PATH=/sbin:/bin:/usr/sbin:/usr/bin ";
TERM : constant String := "TERM=dumb ";
USER : constant String := "USER=root ";
HOME : constant String := "HOME=/root ";
LANG : constant String := "LANG=C ";
begin
return " /usr/bin/env -i " & PATH & TERM & USER & HOME & LANG;
end scan_environment;

end PortScan;
1 change: 1 addition & 0 deletions src/portscan.ads
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ private
show_progress : Boolean);

-- some helper routines
function scan_environment return String;
function find_colon (Source : String) return Natural;
function scrub_phase (Source : String) return JT.Text;
function get_catport (PR : port_record) return String;
Expand Down

0 comments on commit cc05e2d

Please sign in to comment.