Skip to content

Commit

Permalink
fix: cleanup on install, repology, download, test, and commit (#8)
Browse files Browse the repository at this point in the history
* some fixes

* fix repology probably

* include srcinfo correctly

* patch

---------

Co-authored-by: ook37 <[email protected]>
  • Loading branch information
oklopfer and ook37 authored May 6, 2024
1 parent 40d0267 commit 0985b2a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
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

0 comments on commit 0985b2a

Please sign in to comment.