Skip to content

Commit

Permalink
feat: add --test flag, set LC_ALL=C (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
vigress8 authored Oct 7, 2024
1 parent 48f18fa commit 631b35a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ MYMETA.json
MYMETA.yml
.tidyall.d/
.vscode/
.direnv/
39 changes: 25 additions & 14 deletions pacup
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package main;
use strict;
use warnings qw(all -experimental::signatures);
use feature qw(say signatures);
our $VERSION = '3.3.6';
our $VERSION = '3.3.7';

#use Data::Dumper;
use open ':std', ':encoding(UTF-8)';
Expand Down Expand Up @@ -33,6 +33,7 @@ my $opt_ship = 0;
my $opt_origin_remote = 'origin';
my $opt_custom_version;
my $opt_push_force = 0;
my $opt_test = 1;

my $srcinfo_script = "pacup-srcinfo";
my @HASHTYPES = qw(b2 md5 sha1 sha224 sha256 sha384 sha512);
Expand Down Expand Up @@ -137,6 +138,7 @@ local $SIG{TERM} = sub {
cleanup();
exit 1;
};
local $ENV{LC_ALL} = 'C';

sub getvar ( $file, $name, $isarr, $base = undef ) {
my $cmd
Expand Down Expand Up @@ -533,21 +535,25 @@ sub main ($pkg) {
unlink $tmp_distrolist;

if ( -x '/usr/bin/pacstall' ) {
info "Installing from $pacscript";
my $payload = join( ';:', @collected_files );
local $ENV{'PACSTALL_PAYLOAD'} = $payload;
if ( scalar @pkgnames == 1 ) {
system 'pacstall', ( '--install', $ppath );
if ($opt_ship) {
return unless ask_wait "Does $pkgname work?";
}
} else {
for my $pkg (@pkgnames) {
system 'pacstall', ( '--install', $ppath . ':' . $pkg );
if ($opt_test) {
info "Installing from $pacscript";
my $payload = join( ';:', @collected_files );
local $ENV{'PACSTALL_PAYLOAD'} = $payload;
if ( scalar @pkgnames == 1 ) {
system 'pacstall', ( '--install', $ppath );
if ($opt_ship) {
return unless ask_wait "Does $pkg work?";
return unless ask_wait "Does $pkgname work?";
}
} else {
for my $pkg (@pkgnames) {
system 'pacstall', ( '--install', $ppath . ':' . $pkg );
if ($opt_ship) {
return unless ask_wait "Does $pkg work?";
}
}
}
} else {
info "Skipping testing of $pacscript";
}
} else {
warner "Pacstall is not installed or not executable!";
Expand Down Expand Up @@ -603,6 +609,7 @@ unless (caller) {
'origin-remote|o=s' => \$opt_origin_remote,
'custom-version|c=s' => \$opt_custom_version,
'push-force|p' => \$opt_push_force,
'test!' => \$opt_test,
) or pod2usage(2);

version_info() if $opt_version;
Expand Down Expand Up @@ -661,6 +668,10 @@ Set a custom version for the package to fetch, instead of querying Repology.
Force push to the branch, overwriting any existing one.
=item B<--[no-]test>
Prompt to install each package for testing. True by default.
=back
=head1 EXAMPLE
Expand All @@ -675,7 +686,7 @@ Vigress - <[email protected]>
=head1 VERSION
Pacup (Perl edition) v3.3.6
Pacup (Perl edition) v3.3.7
=cut
Expand Down
2 changes: 1 addition & 1 deletion shell.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
pkgs ?
import (fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-23.11")
import (fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-24.05")
{
config = {};
overlays = [];
Expand Down

0 comments on commit 631b35a

Please sign in to comment.