Skip to content

Commit fa669f3

Browse files
committed
remove installing cosmocc from installing build deps
1 parent c7d5160 commit fa669f3

File tree

1 file changed

+28
-35
lines changed

1 file changed

+28
-35
lines changed

lib/Perl/Dist/APPerl.pm

+28-35
Original file line numberDiff line numberDiff line change
@@ -830,45 +830,41 @@ sub _install_cosmocc {
830830
_write_json(SITE_CONFIG_FILE, $SiteConfig);
831831
}
832832

833+
#sub _load_valid_site_config {
834+
# my ($is_cosmo3) = @_;
835+
# my $SiteConfig = _load_json(SITE_CONFIG_FILE);
836+
# $SiteConfig || defined($is_cosmo3) or die "Failed to load SiteConfig";
837+
# $SiteConfig //= {};
838+
# defined $is_cosmo3 or return $SiteConfig;
839+
# if ($is_cosmo3) {
840+
#
841+
# }
842+
#}
843+
833844
sub InstallBuildDeps {
834-
my ($perlrepo, $cosmorepo, $cosmocc) = @_;
845+
my ($perlrepo, $cosmorepo) = @_;
835846
my $SiteConfig = _load_json(SITE_CONFIG_FILE);
847+
$SiteConfig //= {};
848+
836849
# if a repo is not set, set one up by default
837-
if((!$SiteConfig || !exists $SiteConfig->{perl_repo}) && (!$perlrepo)) {
850+
if(!exists $SiteConfig->{perl_repo} && !$perlrepo) {
838851
$perlrepo = SITE_REPO_DIR."/perl5";
839852
_setup_repo($perlrepo, _load_apperl_configs()->{perl_remotes});
840853
print "apperlm install-build-deps: setup perl repo\n";
841854
}
842-
if((!$SiteConfig || !exists $SiteConfig->{cosmo_repo}) && (!$cosmorepo)) {
855+
if(!exists $SiteConfig->{cosmo_repo} && !$cosmorepo) {
843856
$cosmorepo = SITE_REPO_DIR."/cosmopolitan";
844857
_setup_repo( $cosmorepo, _load_apperl_configs()->{cosmo_remotes});
845858
print "apperlm install-build-deps: setup cosmo repo\n";
846859
}
847-
if((!$SiteConfig || !exists $SiteConfig->{cosmocc}) && (!$cosmocc)) {
848-
$cosmocc = SITE_REPO_DIR."/cosmocc";
849-
print "mkdir -p $cosmocc\n";
850-
make_path($cosmocc);
851-
print "cd $cosmocc\n";
852-
my $before = getcwd();
853-
chdir($cosmocc) or die "Failed to chdir $cosmocc";
854-
_command_or_die('wget', 'https://cosmo.zip/pub/cosmocc/cosmocc.zip');
855-
_command_or_die('unzip', 'cosmocc.zip');
856-
print "apperlm install-build-deps: setup cosmocc\n";
857-
chdir($before) or die "error resetting directory";
858-
}
859860

860861
# (re)write site config
861862
$perlrepo //= $SiteConfig->{perl_repo};
862863
$cosmorepo //= $SiteConfig->{cosmo_repo};
863-
$cosmocc //= $SiteConfig->{cosmocc};
864-
my %siteconfig = (
865-
perl_repo => abs_path($perlrepo),
866-
cosmo_repo => abs_path($cosmorepo),
867-
cosmocc => abs_path($cosmocc),
868-
);
869-
$SiteConfig = \%siteconfig;
864+
$SiteConfig->{perl_repo} = abs_path($perlrepo);
865+
$SiteConfig->{cosmo_repo} = abs_path($cosmorepo);
870866
make_path(SITE_CONFIG_DIR);
871-
_write_json(SITE_CONFIG_FILE, \%siteconfig);
867+
_write_json(SITE_CONFIG_FILE, $SiteConfig);
872868
print "apperlm install-build-deps: wrote site config to ".SITE_CONFIG_FILE."\n";
873869
}
874870

@@ -1456,25 +1452,22 @@ END_USAGE
14561452
apperlm install-build-deps [-h|--help] [-c|--cosmo <path>] [-p|--perl <path>]
14571453
-c|--cosmo <path> set path to cosmopolitan repo (skips git initialization)
14581454
-p|--perl <path> set path to perl repo (skips git initialization)
1459-
-C|--cosmocc <path> set path to cosmocc
14601455
-h|--help Show this message
14611456
Install build dependencies for APPerl, use -c or -p to skip initializing
14621457
those repos by providing a path to it.
14631458
END_USAGE
14641459
my $cosmo;
14651460
my $perl;
1466-
my $cosmocc;
14671461
my $help;
14681462
GetOptionsFromArray(\@_, "cosmo|c=s" => \$cosmo,
14691463
"perl|p=s" => \$perl,
1470-
"cosmocc|C=s" => \$cosmocc,
14711464
"help|h" => \$help,
14721465
) or die($usage);
14731466
if($help) {
14741467
print $usage;
14751468
exit 0;
14761469
}
1477-
Perl::Dist::APPerl::InstallBuildDeps($perl, $cosmo, $cosmocc);
1470+
Perl::Dist::APPerl::InstallBuildDeps($perl, $cosmo);
14781471
}
14791472
elsif($command eq 'new-config') {
14801473
my $usage = <<'END_USAGE';
@@ -1539,14 +1532,14 @@ sub _setup_repo {
15391532
my ($repopath, $remotes) = @_;
15401533
print "mkdir -p $repopath\n";
15411534
make_path($repopath);
1542-
#print "cd $repopath\n";
1543-
#chdir($repopath) or die "Failed to chdir $repopath";
1544-
#_command_or_die('git', 'init');
1545-
#_command_or_die('git', 'checkout', '-b', 'placeholder_dont_use');
1546-
#foreach my $remote (keys %{$remotes}) {
1547-
# _command_or_die('git', 'remote', 'add', $remote, $remotes->{$remote});
1548-
# _command_or_die('git', 'fetch', $remote);
1549-
#}
1535+
print "cd $repopath\n";
1536+
chdir($repopath) or die "Failed to chdir $repopath";
1537+
_command_or_die('git', 'init');
1538+
_command_or_die('git', 'checkout', '-b', 'placeholder_dont_use');
1539+
foreach my $remote (keys %{$remotes}) {
1540+
_command_or_die('git', 'remote', 'add', $remote, $remotes->{$remote});
1541+
_command_or_die('git', 'fetch', $remote);
1542+
}
15501543
}
15511544

15521545
sub _write_json {

0 commit comments

Comments
 (0)