diff options
Diffstat (limited to '')
-rw-r--r-- | paku.lock | 158 | ||||
-rwxr-xr-x | src/bin/paku | 382 |
2 files changed, 259 insertions, 281 deletions
@@ -13,103 +13,87 @@ "packages": [ { "name": "git-permalink", - "versions": [ - { - "native-inputs": [], - "inputs": [], - "name": "v0.1.0", - "sha256": "1jb0rgcj5b4bkm5gds3l0dymf3gd644r2njmirs9345vf54if45y", - "sha256FIXME": "07waci3y0xdlbr8gl1lzdbsiz0csnrshcm6f18cdzn7y97irhb15", - "url": "https://euandre.org/git/git-permalink/snapshot/git-permalink-v0.1.0.tar.xz", - "fname": "git-permalink-v0.1.0.tar.xz", - "maintainer": "EuAndreh <eu@euandre.org>", - "architectures": "any", - "type": "tag", - "description": "Git extension to generate web permalinks of files in a repository", - "long-description": "It knows about many of the existing code forges, but allows for URL\ntemplate overrides to be used on custom domains or deployments via git\nconfig." - }, - { - "native-inputs": [], - "inputs": [], - "name": "v0.2.0", - "sha256": "1bzx4gdfc87jfshaqifxpc3llp2j98wkzjjslzwbrqn59jzakxc9", - "sha256FIXME": "10qiigp29jamb23mdrf1yp0gqmihlsg931ibpiqpf4pn28l5d9ly", - "url": "https://euandre.org/git/git-permalink/snapshot/git-permalink-v0.2.0.tar.xz", - "fname": "git-permalink-v0.2.0.tar.xz", - "maintainer": "EuAndreh <eu@euandre.org>", - "architectures": "any", - "type": "tag", - "description": "Git extension to generate web permalinks of files in a repository", - "long-description": "It knows about many of the existing code forges, but allows for URL\ntemplate overrides to be used on custom domains or deployments via git\nconfig." - } - ] + "native-inputs": [], + "inputs": [], + "version": "v0.1.0", + "sha256": "1jb0rgcj5b4bkm5gds3l0dymf3gd644r2njmirs9345vf54if45y", + "sha256FIXME": "07waci3y0xdlbr8gl1lzdbsiz0csnrshcm6f18cdzn7y97irhb15", + "url": "https://euandre.org/git/git-permalink/snapshot/git-permalink-v0.1.0.tar.xz", + "fname": "git-permalink-v0.1.0.tar.xz", + "maintainer": "EuAndreh <eu@euandre.org>", + "architectures": "any", + "type": "tag", + "description": "Git extension to generate web permalinks of files in a repository", + "long-description": "It knows about many of the existing code forges, but allows for URL\ntemplate overrides to be used on custom domains or deployments via git\nconfig." + }, + { + "name": "git-permalink", + "native-inputs": [], + "inputs": [], + "version": "v0.2.0", + "sha256": "1bzx4gdfc87jfshaqifxpc3llp2j98wkzjjslzwbrqn59jzakxc9", + "sha256FIXME": "10qiigp29jamb23mdrf1yp0gqmihlsg931ibpiqpf4pn28l5d9ly", + "url": "https://euandre.org/git/git-permalink/snapshot/git-permalink-v0.2.0.tar.xz", + "fname": "git-permalink-v0.2.0.tar.xz", + "maintainer": "EuAndreh <eu@euandre.org>", + "architectures": "any", + "type": "tag", + "description": "Git extension to generate web permalinks of files in a repository", + "long-description": "It knows about many of the existing code forges, but allows for URL\ntemplate overrides to be used on custom domains or deployments via git\nconfig." }, { "name": "remembering", - "versions": [ - { - "native-inputs": [], - "inputs": [], - "name": "v0.1.2", - "sha256": "1mrkyfcgz77hw7mpgqrnsaws9qng2awf8flslzf1s1gikk3zljns", - "sha256FIXME": "1syzn41w4f754ihblwxcv3wn653lh92cgg6g06db1qrx3m2zvw5v", - "url": "https://euandre.org/git/remembering/snapshot/remembering-v0.1.2.tar.xz", - "fname": "remembering-v0.1.2.tar.xz", - "maintainer": "EuAndreh <eu@euandre.org>", - "architectures": "any", - "type": "tag", - "description": "Add memory to dmenu, fzf and similar tools", - "long-description": "It can wrap such tools to accumulate preferences over time, and\nre-arrange the input according to common picks." - } - ] + "native-inputs": [], + "inputs": [], + "version": "v0.1.2", + "sha256": "1mrkyfcgz77hw7mpgqrnsaws9qng2awf8flslzf1s1gikk3zljns", + "sha256FIXME": "1syzn41w4f754ihblwxcv3wn653lh92cgg6g06db1qrx3m2zvw5v", + "url": "https://euandre.org/git/remembering/snapshot/remembering-v0.1.2.tar.xz", + "fname": "remembering-v0.1.2.tar.xz", + "maintainer": "EuAndreh <eu@euandre.org>", + "architectures": "any", + "type": "tag", + "description": "Add memory to dmenu, fzf and similar tools", + "long-description": "It can wrap such tools to accumulate preferences over time, and\nre-arrange the input according to common picks." }, { "name": "td", + "native-inputs": [], + "inputs": [], + "version": "4a8a7a2662c94b2581f587e9a4b81feba4f5e7d8", + "sha256": "1xqr2vc270jydk508pbkhcchmbg74w4bf83ch2d85nqja14r64n9", + "sha256FIXME": "01g1vnlz1kch8j9zzaxyixih04azdvrfabfzg7xqny32h2p62md2", + "url": "https://euandre.org/git/td/snapshot/td-4a8a7a2662c94b2581f587e9a4b81feba4f5e7d8.tar.xz", + "fname": "td-4a8a7a2662c94b2581f587e9a4b81feba4f5e7d8.tar.xz", + "maintainer": "EuAndreh <eu@euandre.org>", "architectures": "any", - "versions": [ - { - "native-inputs": [], - "inputs": [], - "name": "4a8a7a2662c94b2581f587e9a4b81feba4f5e7d8", - "sha256": "1xqr2vc270jydk508pbkhcchmbg74w4bf83ch2d85nqja14r64n9", - "sha256FIXME": "01g1vnlz1kch8j9zzaxyixih04azdvrfabfzg7xqny32h2p62md2", - "url": "https://euandre.org/git/td/snapshot/td-4a8a7a2662c94b2581f587e9a4b81feba4f5e7d8.tar.xz", - "fname": "td-4a8a7a2662c94b2581f587e9a4b81feba4f5e7d8.tar.xz", - "maintainer": "EuAndreh <eu@euandre.org>", - "architectures": "any", - "type": "latest", - "description": "Minimalistic bug tracker CLI", - "long-description": "Create and maintain a TODOs.md files as a bug database.\n\nIt is a tool for distributed, offline issue tracking, reified as a simple text\nfile in the repository." - } - ] + "type": "latest", + "description": "Minimalistic bug tracker CLI", + "long-description": "Create and maintain a TODOs.md files as a bug database.\n\nIt is a tool for distributed, offline issue tracking, reified as a simple text\nfile in the repository." }, { "name": "guile-heredoc", - "versions": [ - { - "architectures": [ - "i386", - "x86_64", - "arm", - "aarch64" - ], - "native-inputs": [ - "texinfo" - ], - "inputs": [ - "guile" - ], - "type": "latest", - "name": "065435cdce609604e33b879b9be3e81ab89f3e7b", - "sha256": "179qq17mgi4kakhj9w1dk26afljh5yad4j9ih9d8wms70x6h211m", - "sha256FIXME": "1y1110bg4ki0dvn8hggxy34wg7ig4r3377nc84isnj3dydqm2vjd", - "url": "https://euandre.org/git/guile-heredoc/snapshot/guile-heredoc-065435cdce609604e33b879b9be3e81ab89f3e7b.tar.xz", - "fname": "guile-heredoc-065435cdce609604e33b879b9be3e81ab89f3e7b.tar.xz", - "maintainer": "EuAndreh <eu@euandre.org>", - "description": "Guile heredoc syntax", - "long-description": "Guile heredoc syntax long." - } - ] + "architectures": [ + "i386", + "x86_64", + "arm", + "aarch64" + ], + "native-inputs": [ + "texinfo" + ], + "inputs": [ + "guile" + ], + "type": "latest", + "version": "065435cdce609604e33b879b9be3e81ab89f3e7b", + "sha256": "179qq17mgi4kakhj9w1dk26afljh5yad4j9ih9d8wms70x6h211m", + "sha256FIXME": "1y1110bg4ki0dvn8hggxy34wg7ig4r3377nc84isnj3dydqm2vjd", + "url": "https://euandre.org/git/guile-heredoc/snapshot/guile-heredoc-065435cdce609604e33b879b9be3e81ab89f3e7b.tar.xz", + "fname": "guile-heredoc-065435cdce609604e33b879b9be3e81ab89f3e7b.tar.xz", + "maintainer": "EuAndreh <eu@euandre.org>", + "description": "Guile heredoc syntax", + "long-description": "Guile heredoc syntax long." } ] } diff --git a/src/bin/paku b/src/bin/paku index e4f0b83..d73107a 100755 --- a/src/bin/paku +++ b/src/bin/paku @@ -132,76 +132,74 @@ if ($action eq 'nix') { self: super: { $ns = rec { EOF - for my $package (@{$json->{packages}}) { - for my $version (@{$package->{versions}}) { - my $ver = $version->{name}; - $ver =~ s/^v//; - $ver =~ s/\./-/g; - if ($version->{type} eq 'latest') { - $ver = 'latest'; - print <<~EOF; - $package->{name} = $package->{name}-latest; - EOF - } - - my $long = $version->{'long-description'}; - $long =~ s/^(.)/ $1/gm; - - my $base_url = $base_url_prefix . '/' . $package->{name}; - + for my $pkg (@{$json->{packages}}) { + my $ver = $pkg->{version}; + $ver =~ s/^v//; + $ver =~ s/\./-/g; + if ($pkg->{type} eq 'latest') { + $ver = 'latest'; print <<~EOF; - $package->{name}-$ver = pkgs.stdenv.mkDerivation rec { - name = "$package->{name}"; - version = "$version->{name}"; + $pkg->{name} = $pkg->{name}-latest; + EOF + } - src = fetchTarball { - url = - "$version->{url}"; - sha256 = "$version->{sha256}"; - }; + my $long = $pkg->{'long-description'}; + $long =~ s/^(.)/ $1/gm; - nativeBuildInputs = with pkgs; [ - EOF + my $base_url = $base_url_prefix . '/' . $pkg->{name}; - for my $input (@{$version->{'native-inputs'}}) { - print <<~EOF; - $input - EOF - } - print <<~EOF; - ]; + print <<~EOF; + $pkg->{name}-$ver = pkgs.stdenv.mkDerivation rec { + name = "$pkg->{name}"; + version = "$pkg->{version}"; + + src = fetchTarball { + url = + "$pkg->{url}"; + sha256 = "$pkg->{sha256}"; + }; + + nativeBuildInputs = with pkgs; [ + EOF - buildInputs = with pkgs; [ + for my $input (@{$pkg->{'native-inputs'}}) { + print <<~EOF; + $input EOF - for my $input (@{$version->{inputs}}) { - print <<~EOF; - $input - EOF - } + } + print <<~EOF; + ]; + + buildInputs = with pkgs; [ + EOF + for my $input (@{$pkg->{inputs}}) { print <<~EOF; - ]; - - makeFlags = [ "PREFIX=\$(out)" ]; - - doCheck = true; - enableParallelBuilding = true; - - meta = with pkgs.lib; { - description = "$version->{description}"; - longDescription = '' - $long - ''; - homepage = "$base_url/"; - changelog = "$base_url/CHANGELOG.html"; - downloadPage = "$base_url/#releases"; - license = licenses.agpl3; - platforms = platforms.unix; - }; - }; + $input EOF - # FIXME: escape quotes in description - # FIXME: parameterize license } + print <<~EOF; + ]; + + makeFlags = [ "PREFIX=\$(out)" ]; + + doCheck = true; + enableParallelBuilding = true; + + meta = with pkgs.lib; { + description = "$pkg->{description}"; + longDescription = '' + $long + ''; + homepage = "$base_url/"; + changelog = "$base_url/CHANGELOG.html"; + downloadPage = "$base_url/#releases"; + license = licenses.agpl3; + platforms = platforms.unix; + }; + }; + EOF + # FIXME: escape quotes in description + # FIXME: parameterize license } print <<~EOF; }; @@ -232,78 +230,76 @@ if ($action eq 'guix') { EOF - for my $package (@{$json->{packages}}) { - for my $version (@{$package->{versions}}) { - my $ver = $version->{name}; - $ver =~ s/^v//; - $ver =~ s/\./-/g; - if ($version->{type} eq 'latest') { - push @pkgs, "$package->{name}"; - $ver = 'latest'; - } + for my $pkg (@{$json->{packages}}) { + my $ver = $pkg->{version}; + $ver =~ s/^v//; + $ver =~ s/\./-/g; + if ($pkg->{type} eq 'latest') { + push @pkgs, "$pkg->{name}"; + $ver = 'latest'; + } - my $long = $version->{'long-description'}; - $long =~ s/^(.)/ $1/gm; + my $long = $pkg->{'long-description'}; + $long =~ s/^(.)/ $1/gm; - my $base_url = $base_url_prefix . '/' . $package->{name}; + my $base_url = $base_url_prefix . '/' . $pkg->{name}; - push @pkgs, "$package->{name}-$ver"; - # FIXME: indentation of (source ...) - print <<~EOF; - (define-public $package->{name}-$ver - (package - (name "$package->{name}-$ver") - (version "$version->{name}") - (source (origin - (method url-fetch) - (uri "$version->{url}") - (sha256 - (base32 "$version->{sha256FIXME}")))) - (build-system gnu-build-system) - (native-inputs - EOF + push @pkgs, "$pkg->{name}-$ver"; + # FIXME: indentation of (source ...) + print <<~EOF; + (define-public $pkg->{name}-$ver + (package + (name "$pkg->{name}-$ver") + (version "$pkg->{version}") + (source (origin + (method url-fetch) + (uri "$pkg->{url}") + (sha256 + (base32 "$pkg->{sha256FIXME}")))) + (build-system gnu-build-system) + (native-inputs + EOF + + print ' (list'; + for my $input (@{$pkg->{'native-inputs'}}) { + my $name = $json->{mappings}{$input}{guix} || $input; + print "\n $name"; + } + print "))\n"; - print ' (list'; - for my $input (@{$version->{'native-inputs'}}) { - my $name = $json->{mappings}{$input}{guix} || $input; - print "\n $name"; - } - print "))\n"; - - print " (inputs\n"; - print ' (list'; - for my $input (@{$version->{inputs}}) { - my $name = $json->{mappings}{$input}{guix} || $input; - print "\n $name"; - } - print "))\n"; + print " (inputs\n"; + print ' (list'; + for my $input (@{$pkg->{inputs}}) { + my $name = $json->{mappings}{$input}{guix} || $input; + print "\n $name"; + } + print "))\n"; + print <<~EOF; + (arguments + (list + #:make-flags '(list (string-append "PREFIX=" %output)) + #:phases + #~(modify-phases %standard-phases + (delete 'configure)))) + (synopsis "$pkg->{description}") + (description + "$pkg->{'long-description'}") + (home-page "$base_url/") + (license license:agpl3+))) + + EOF + # FIXME: escape quotes in description + # FIXME: parameterize license + if ($pkg->{type} eq 'latest') { print <<~EOF; - (arguments - (list - #:make-flags '(list (string-append "PREFIX=" %output)) - #:phases - #~(modify-phases %standard-phases - (delete 'configure)))) - (synopsis "$version->{description}") - (description - "$version->{'long-description'}") - (home-page "$base_url/") - (license license:agpl3+))) + (define-public $pkg->{name} + (package + (inherit $pkg->{name}-latest) + (name "$pkg->{name}"))) + EOF - # FIXME: escape quotes in description - # FIXME: parameterize license - if ($version->{type} eq 'latest') { - print <<~EOF; - (define-public $package->{name} - (package - (inherit $package->{name}-latest) - (name "$package->{name}"))) - - - EOF - } } } print '(list'; @@ -326,82 +322,80 @@ my %vars = ( my @targets = (); -for my $package (@{$json->{packages}}) { - for my $version (@{$package->{versions}}) { - push @{$vars{tarballs}}, "\t$dir/tarballs/$version->{fname} \\\n"; - push @{$vars{checkouts}}, "\t$dir/checkouts/$package->{name}-$version->{name} \\\n"; - - push @targets, <<~EOF; - $dir/tarballs/$version->{fname}: - mkdir -p \$(\@D) - wget -O \$\@ \\ - '$version->{url}' +for my $pkg (@{$json->{packages}}) { + push @{$vars{tarballs}}, "\t$dir/tarballs/$pkg->{fname} \\\n"; + push @{$vars{checkouts}}, "\t$dir/checkouts/$pkg->{name}-$pkg->{version} \\\n"; - $dir/checkouts/$package->{name}-$version->{name}: $dir/tarballs/$version->{fname} - mkdir -p \$(\@D) - tar -C $dir/checkouts/ -xf $dir/tarballs/$version->{fname} - touch \$\@ - - EOF + 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 $dir/checkouts/ -xf $dir/tarballs/$pkg->{fname} + touch \$\@ - next if $version->{architectures} ne 'any'; + EOF - push @{$vars{destdirs}}, "\t$dir/debian-destdir/$package->{name}-$version->{name}/DEBIAN \\\n"; - push @{$vars{ctrlfiles}}, "\t$dir/debian-destdir/$package->{name}-$version->{name}/DEBIAN/control \\\n"; - push @{$vars{destdebs}}, "\t$dir/debian-destdir/$package->{name}-$version->{name}.deb \\\n"; - push @{$vars{debs}}, "\t$dir/debian/$package->{name}_$version->{name}_all.deb \\\n"; - my $ver = $version->{type} eq 'latest' ? '0.' . $version->{name} . '.latest' : $version->{name}; - $ver =~ s/^v//; - my $maintainer_b64 = MIME::Base64::encode_base64 $version->{maintainer}, ''; - my $desc_b64 = MIME::Base64::encode_base64 $version->{description}, ''; - my $long_desc_b64 = MIME::Base64::encode_base64 $version->{'long-description'}, ''; - - push @targets, <<~EOF; - $dir/debian-destdir/$package->{name}-$version->{name}/DEBIAN: $dir/checkouts/$package->{name}-$version->{name} - \$(MAKE) \\ - -C $dir/checkouts/$package->{name}-$version->{name} \\ - install \\ - PREFIX=/usr \\ - DESTDIR="\$\$PWD"/$dir/debian-destdir/$package->{name}-$version->{name} - mkdir -p \$\@ - touch \$\@ - - $dir/debian-destdir/$package->{name}-$version->{name}/DEBIAN/control: $dir/debian-destdir/$package->{name}-$version->{name}/DEBIAN - printf '' > \$\@ - printf 'Package: $package->{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 '$maintainer_b64' | base64 -d >> \$\@ - printf '\\n' >> \$\@ - - printf 'Description: ' >> \$\@ - printf '$desc_b64' | base64 -d >> \$\@ - printf '\\n' >> \$\@ - - printf '$long_desc_b64' | \\ - base64 -d | \\ - sed 's|^\$\$|.|' | \\ - sed 's|^| |' >> \$\@ - printf '\\n' >> \$\@ - - $dir/debian-destdir/$package->{name}-$version->{name}.deb: $dir/debian-destdir/$package->{name}-$version->{name}/DEBIAN/control - dpkg-deb --build $dir/debian-destdir/$package->{name}-$version->{name} - - $dir/debian/$package->{name}_$version->{name}_all.deb: $dir/debian-destdir/$package->{name}-$version->{name}.deb - mkdir -p \$(\@D) - cp $dir/debian-destdir/$package->{name}-$version->{name}.deb \$\@ + next if $pkg->{architectures} ne 'any'; + + push @{$vars{destdirs}}, "\t$dir/debian-destdir/$pkg->{name}-$pkg->{version}/DEBIAN \\\n"; + push @{$vars{ctrlfiles}}, "\t$dir/debian-destdir/$pkg->{name}-$pkg->{version}/DEBIAN/control \\\n"; + push @{$vars{destdebs}}, "\t$dir/debian-destdir/$pkg->{name}-$pkg->{version}.deb \\\n"; + push @{$vars{debs}}, "\t$dir/debian/$pkg->{name}_$pkg->{version}_all.deb \\\n"; + + my $ver = $pkg->{type} eq 'latest' ? '0.' . $pkg->{version} . '.latest' : $pkg->{version}; + $ver =~ s/^v//; + my $maintainer_b64 = MIME::Base64::encode_base64 $pkg->{maintainer}, ''; + my $desc_b64 = MIME::Base64::encode_base64 $pkg->{description}, ''; + my $long_desc_b64 = MIME::Base64::encode_base64 $pkg->{'long-description'}, ''; + + push @targets, <<~EOF; + $dir/debian-destdir/$pkg->{name}-$pkg->{version}/DEBIAN: $dir/checkouts/$pkg->{name}-$pkg->{version} + \$(MAKE) \\ + -C $dir/checkouts/$pkg->{name}-$pkg->{version} \\ + install \\ + PREFIX=/usr \\ + DESTDIR="\$\$PWD"/$dir/debian-destdir/$pkg->{name}-$pkg->{version} + mkdir -p \$\@ + touch \$\@ + + $dir/debian-destdir/$pkg->{name}-$pkg->{version}/DEBIAN/control: $dir/debian-destdir/$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 '$maintainer_b64' | base64 -d >> \$\@ + printf '\\n' >> \$\@ + + printf 'Description: ' >> \$\@ + printf '$desc_b64' | base64 -d >> \$\@ + printf '\\n' >> \$\@ + + printf '$long_desc_b64' | \\ + base64 -d | \\ + sed 's|^\$\$|.|' | \\ + sed 's|^| |' >> \$\@ + printf '\\n' >> \$\@ + + $dir/debian-destdir/$pkg->{name}-$pkg->{version}.deb: $dir/debian-destdir/$pkg->{name}-$pkg->{version}/DEBIAN/control + dpkg-deb --build $dir/debian-destdir/$pkg->{name}-$pkg->{version} + + $dir/debian/$pkg->{name}_$pkg->{version}_all.deb: $dir/debian-destdir/$pkg->{name}-$pkg->{version}.deb + mkdir -p \$(\@D) + cp $dir/debian-destdir/$pkg->{name}-$pkg->{version}.deb \$\@ - EOF - } + EOF } |