aboutsummaryrefslogtreecommitdiff
path: root/src/bin/paku
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/paku')
-rwxr-xr-xsrc/bin/paku57
1 files changed, 49 insertions, 8 deletions
diff --git a/src/bin/paku b/src/bin/paku
index cbc8df0..41b420f 100755
--- a/src/bin/paku
+++ b/src/bin/paku
@@ -79,16 +79,52 @@ if ($opts{h}) {
my $dir = $opts{d} || '.paku';
my $fname = $opts{f} || 'paku.lock';
-my $json_str = do {
- open my $fh, $fname or die "Failed opening \"$fname\"";
- local $/;
- <$fh>;
-};
-my $json = JSON::decode_json($json_str);
+
my $action = $ARGV[0] or die "Missing ACTION";
+shift;
+
+sub load_json() {
+ my $json_str = do {
+ open my $fh, $fname or die "Failed opening \"$fname\"";
+ local $/;
+ <$fh>;
+ };
+ return JSON::decode_json($json_str);
+}
+
+sub emit_packages() {
+ for (@ARGV) {
+ my $fh;
+ my $size = (stat($_))[7];
+
+ open ($fh, '<', $_) or die "Can't open \"$_\": $!";
+ my $md5 = Digest::MD5->new->addfile($fh)->hexdigest;
+ close $fh;
+
+ open ($fh, '<', $_) or die "Can't open \"$_\": $!";
+ my $sha1 = Digest::SHA->new(1)->addfile($fh)->hexdigest;
+ close $fh;
+
+ open ($fh, '<', $_) or die "Can't open \"$_\": $!";
+ my $sha256 = Digest::SHA->new(256)->addfile($fh)->hexdigest;
+ close $fh;
+
+ open ($fh, '<', $_) or die "Can't open \"$_\": $!";
+ my $sha512 = Digest::SHA->new(512)->addfile($fh)->hexdigest;
+ close $fh;
+
+ print `ar -p $_ control.tar.xz | tar -xJO ./control`;
+ say "Filename: ./$_";
+ say "Size: $size";
+ say "MD5sum: $md5";
+ say "SHA1: $sha1";
+ say "SHA256: $sha256";
+ print "\n";
+ }
+}
sub emit_release() {
- my $f = $ARGV[1];
+ my $f = $ARGV[0];
my $name = File::Basename::basename $f;
my $size = (stat($f))[7];
@@ -128,6 +164,7 @@ sub emit_release() {
}
sub emit_nix() {
+ my $json = load_json();
my $ns = $json->{namespace};
$ns =~ s/\./-/g;
print <<~EOF;
@@ -203,6 +240,7 @@ sub emit_nix() {
}
sub emit_guix() {
+ my $json = load_json();
my $ns = $json->{namespace};
$ns =~ s/\./ /g;
print <<~EOF;
@@ -295,6 +333,7 @@ sub emit_guix() {
}
sub emit_debian() {
+ my $json = load_json();
my %vars = (
tarballs => ["tarballs = \\\n"],
checkouts => ["checkouts = \\\n"],
@@ -404,7 +443,7 @@ sub emit_debian() {
\$(DIR)/debian/Packages: \$(debs)
- cd \$(\@D) && dpkg-scanpackages -m . > \$(\@F)
+ cd \$(\@D) && perl \$\$OLDPWD/src/bin/paku debian-packages *.deb > \$(\@F)
\$(DIR)/debian/Release: \$(DIR)/debian/Packages
perl src/bin/paku debian-release \$(DIR)/debian/Packages > \$\@
@@ -425,6 +464,7 @@ sub emit_debian() {
}
sub emit_html() {
+ my $json = load_json();
print <<~EOF;
<!DOCTYPE html>
<html lang="en">
@@ -590,6 +630,7 @@ sub emit_html() {
my %actions = (
+ 'debian-packages' => \&emit_packages,
'debian-release' => \&emit_release,
nix => \&emit_nix,
guix => \&emit_guix,