aboutsummaryrefslogtreecommitdiff
path: root/src/bin/paku.in
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xsrc/bin/paku.in159
1 files changed, 72 insertions, 87 deletions
diff --git a/src/bin/paku.in b/src/bin/paku.in
index e7c43f3..b7b06d7 100755
--- a/src/bin/paku.in
+++ b/src/bin/paku.in
@@ -477,7 +477,7 @@ sub emit_debian() {
\$(DIR)/debian/public-key.asc debian.out.txt
debian.out.txt:
- \@printf '\$(DIR)/debian/\\n' > \$\@
+ \@printf '\$(DIR)/debian/*\\n' > \$\@
\$(DIR)/debian/Packages: \$(debs)
@@ -501,79 +501,74 @@ sub emit_debian() {
}
sub emit_alpine() {
+ my $d = $ARGV[0] or die 'Missing "src/alpine/" directory';
my $json = load_json();
+ for my $pkg (@{$json->{packages}}) {
+ my $date = $pkg->{date} =~ s/-//gr;
+ my $ver = $pkg->{label} eq 'latest' ? "0.0.1_git$date" : $pkg->{version};
+ my $dir = "$d/$pkg->{name}" . (
+ $pkg->{label} eq 'latest' ? '' : "-$pkg->{label}"
+ );
+ mkdir "$dir";
+ open(my $fh, '>', "$dir/APKBUILD");
+ print $fh <<~EOF;
+ # Maintainer: $pkg->{maintainer}
+ pkgname='$pkg->{name}'
+ pkgver='$ver'
+ pkgrel='0'
+ pkgdesc='$pkg->{description}'
+ url='$pkg->{homepage}'
+ arch='noarch'
+ license='$pkg->{license}'
+ depends=''
+ makedepends=''
+ checkdepends=''
+ install=''
+ subpackages='$pkg->{name}-doc'
+ source='$pkg->{url}'
+ builddir="\$srcdir/$pkg->{name}-$pkg->{version}"
+
+ build() {
+ make PREFIX=/usr
+ }
+
+ check() {
+ make check
+ }
+
+ package() {
+ make install DESTDIR="\$pkgdir" PREFIX=/usr
+ }
+
+ sha512sums='
+ $pkg->{sha512} $pkg->{fname}
+ '
+ EOF
+ close $fh;
+ }
my @apks = ();
my @targets = ();
for my $pkg (@{$json->{packages}}) {
- push @targets, <<~EOF;
- \$(DIR)/tarballs/$pkg->{fname}:
- mkdir -p \$(\@D)
- wget -O \$\@ \\
- '$pkg->{url}'
-
- \$(DIR)/checkouts/$pkg->{name}-$pkg->{version}: \$(DIR)/tarballs/$pkg->{fname}
- mkdir -p \$(\@D)
- tar -C \$(\@D) -xf \$(DIR)/tarballs/$pkg->{fname}
- touch \$\@
-
- EOF
-
-
next if $pkg->{architectures} ne 'any';
+ my $date = $pkg->{date} =~ s/-//gr;
+ my $ver = $pkg->{label} eq 'latest' ? "0.0.1_git$date" : $pkg->{version};
- my $deb_name = "$pkg->{name}_" . (
- $pkg->{label} eq 'latest' ? 'latest' : $pkg->{version}
- ) . "_all.deb";
- my $deb_path = "\$(DIR)/debian/$deb_name";
-
- push @apks, "\t$deb_path \\\n";
+ my $recipe_dir = "src/alpine/$pkg->{name}" . (
+ $pkg->{label} eq 'latest' ? '' : "-$pkg->{label}"
+ ) . '/';
+ my $apk_name = "$pkg->{name}-$ver-r0.apk";
+ my $apk_path = "\$(DIR)/alpine/REPODEST/alpine/x86_64/$apk_name";
- my $ver = $pkg->{label} eq 'latest' ? '0.' . $pkg->{version} . '.latest' : $pkg->{version};
- $ver =~ s/^v//;
+ push @apks, "\t$apk_path \\\n";
push @targets, <<~EOF;
- \$(DIR)/builddirs/$pkg->{name}-$pkg->{version}/DEBIAN: \$(DIR)/checkouts/$pkg->{name}-$pkg->{version}
- \$(MAKE) \\
- -C \$(DIR)/checkouts/$pkg->{name}-$pkg->{version} \\
- install \\
- PREFIX=/usr \\
- DESTDIR="\$\$PWD"/\$(\@D)
- mkdir -p \$\@
- touch \$\@
-
- \$(DIR)/builddirs/$pkg->{name}-$pkg->{version}/DEBIAN/control: \$(DIR)/builddirs/$pkg->{name}-$pkg->{version}/DEBIAN
- printf '' > \$\@
- printf 'Package: $pkg->{name}\\n' >> \$\@
- printf 'Version: $ver\\n' >> \$\@
- printf 'Section: custom\\n' >> \$\@
- printf 'Depends:\\n' >> \$\@
- printf 'Priority: optional\\n' >> \$\@
- printf 'Architecture: all\\n' >> \$\@
- printf 'Essential: no\\n' >> \$\@
-
- printf 'Maintainer: ' >> \$\@
- printf '$pkg->{"maintainer-b64"}' | base64 -d >> \$\@
- printf '\\n' >> \$\@
-
- printf 'Description: ' >> \$\@
- printf '$pkg->{"description-b64"}' | base64 -d >> \$\@
- printf '\\n' >> \$\@
-
- printf '$pkg->{'long-description-b64'}' | \\
- base64 -d | \\
- sed 's|^\$\$|.|' | \\
- sed 's|^| |' >> \$\@
- printf '\\n' >> \$\@
-
- \$(DIR)/builddirs/$pkg->{name}-$pkg->{version}.deb: \$(DIR)/builddirs/$pkg->{name}-$pkg->{version}/DEBIAN/control
- dpkg-deb --build \$(DIR)/builddirs/$pkg->{name}-$pkg->{version}
-
- $deb_path: \$(DIR)/builddirs/$pkg->{name}-$pkg->{version}.deb
- mkdir -p \$(\@D)
- cp \$(DIR)/builddirs/$pkg->{name}-$pkg->{version}.deb \$\@
-
+ $apk_path: $recipe_dir/APKBUILD
+ cd $recipe_dir && abuild \\
+ -s \$\$OLDPWD/\$(DIR)/alpine/SRCDEST \\
+ -P \$\$OLDPWD/\$(DIR)/alpine/REPODEST \\
+ sanitycheck clean fetch verify unpack build check rootpkg index clean
EOF
}
@@ -583,42 +578,32 @@ sub emit_alpine() {
.POSIX:
DIR = $json->{datadir}
+ RSAKEY = $json->{maintainer}{email}
+
apks = \\
EOF
- # print @apks, "\n";
+ print @apks, "\n";
print "\n\n";
print <<~EOF;
- RSAKEY = '$json->{maintainer}{email}'
-
-
- all: \$(DIR)/alpine/public/x86_64/APKINDEX.tar.gz \$(DIR)/alpine/public/\$(RSAKEY).rsa.pub
-
- public-dir:
- \@printf '\$(DIR)/alpine/public'
+ all: \$(apks) \$(DIR)/alpine/REPODEST/alpine/\$(RSAKEY).rsa.pub alpine.out.txt
+ alpine.out.txt:
+ \@printf '\$(DIR)/alpine/REPODEST/alpine/*\\n' > \$\@
- \$(DIR)/alpine/x86_64/APKINDEX: \$(apks)
- mkdir -p \$(\@D) # FIXME
- touch \$\@
+ \$(apks): src/secrets/\$(RSAKEY).rsa
- \$(DIR)/alpine/x86_64/DESCRIPTION: \$(DIR)/alpine/x86_64/APKINDEX
- echo xablau > \$\@
-
- \$(DIR)/alpine/public/x86_64/APKINDEX.tar.gz: \$(DIR)/alpine/x86_64/APKINDEX \\
- \$(DIR)/alpine/x86_64/DESCRIPTION
- mkdir -p \$(\@D) # FIXME
- tar -C \$(DIR)/alpine/x86_64 -cvf \$\@ APKINDEX DESCRIPTION
-
-
- \$(DIR)/alpine/public/\$(RSAKEY).rsa.pub: \$(apks)
- mkdir -p \$(\@D) # FIXME
- gpg --export-ssh-key \$(RSAKEY) | ssh-keygen -f/dev/stdin -e -m pem > \$\@
+ \$(DIR)/alpine/REPODEST/alpine/\$(RSAKEY).rsa.pub: src/secrets/\$(RSAKEY).rsa
+ mkdir -p \$(\@D)
+ cp src/secrets/\$(RSAKEY).rsa.pub \$\@
+ src/secrets/\$(RSAKEY).rsa: src/secrets/\$(RSAKEY).rsa.gpg
+ gpg -d -o \$\@ \$\@.gpg
+ chmod 400 \$\@
EOF
- # print @targets;
+ print @targets;
}
sub pascal_case($s) {