Skip to content
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

fix: cleanup on install, repology, download, test, and commit #8

Merged
merged 4 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ WriteMakefile(
VERSION_FROM => 'pacup',
LICENSE => 'gpl_3',
AUTHOR => 'Vigress <[email protected]>',
EXE_FILES => ['pacup'],
EXE_FILES => ['pacup', 'scripts/srcinfo.sh'],
INSTALLDIRS => 'vendor',
dist => { COMPRESS => 'gzip', SUFFIX => 'gz' },
PREREQ_PM => {
Expand Down
12 changes: 6 additions & 6 deletions pacup
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ my $opt_origin_remote = 'origin';
my $opt_custom_version;
my $opt_push_force = 0;

my ( undef, $here ) = fileparse abs_path $0;
my $srcinfo_script = "srcinfo.sh";
my @HASHTYPES = qw(b2 md5 sha1 sha224 sha256 sha384 sha512);
my $REPOLOGY_API_ROOT = 'https://repology.org/api/v1/project';
Expand Down Expand Up @@ -219,7 +218,7 @@ sub repology_get_newestver ( $response, $filters, $oldver, $action ) {
print $json_text;
}
push @filtered, $entry;
if ( $entry->{'status'} ne 'newest' ) {
if ( $entry->{'status'} ne 'newest' && $version_count{ $entry->{'version'} }) {
next
unless ( $filters->{'status'}
&& $filters->{'status'} eq 'devel' )
Expand Down Expand Up @@ -258,7 +257,7 @@ sub fetch_source_entry ( $ua, $url, $outfile ) {
my $location = $response->header('Location');
$response = $ua->head($location);
}
open my $fh, '>', $outfile or throw "Could not open $outfile: $!";
open my $fh, '>:raw', $outfile or throw "Could not open $outfile: $!";
if ( $response->is_success ) {
my $final_url = $response->request->uri;
my $file_size = $ua->head($final_url)->header('Content-Length');
Expand Down Expand Up @@ -350,7 +349,8 @@ sub writelines ( $ref, $infile ) {

sub main ($pkg) {
my $ppath = -f $pkg ? $pkg : "packages/$pkg/$pkg.pacscript";
my ( $pacscript, $dir ) = fileparse $ppath;
my ( $pacscript, $dir ) = fileparse abs_path $ppath;
$ppath = $dir . $pacscript;
my $srcinfo = $dir . ".SRCINFO";

-f $ppath or throw "Not a file: " . colored( $ppath, 'bold' );
Expand Down Expand Up @@ -455,14 +455,14 @@ sub main ($pkg) {
my $payload = join( ';:', @collected_files );
local $ENV{'PACSTALL_PAYLOAD'} = $payload;
system 'pacstall', ( '--install', $ppath );
return unless ask_wait "does $pkgname work?";
} else {
warner "Pacstall is not installed or not executable!";
}

return 1 unless $opt_ship;
return unless ask_wait "does $pkgname work?";

my $commit_msg = qq/upd($pkgname): \\\`$pkgver\\\` -> \\\`$newestver\\\`/;
my $commit_msg = qq/upd($pkgname): \`$pkgver\` -> \`$newestver\`/;

system 'git', ( 'add', $ppath, $srcinfo );
my $ship_branch = "ship-$pkgname";
Expand Down