App::D...::Dist(3pm)

πŸ“¦
version 8.0.1 Β· 4 versions
, in ubuntu resolute, ubuntu stonking

πŸ’– App::DocKnot::Dist(3pm) β€” aka Dist πŸ’–

okay so bestie, this is the App::DocKnot::Dist page from the User Contributed Perl Documentation, and it's literally all about making a distribution tarball. it's giving "packaging fairy godmother" and honestly? we're obsessed. let's get into it ✨


πŸŽ€ NAME πŸŽ€

App::DocKnot::Dist β€” Prepare a distribution tarball 🫢


✨ SYNOPSIS ✨

use App::DocKnot::Dist;
my $docknot = App::DocKnot::Dist->new({ distdir => '/path/to/dist' });
$docknot->make_distribution();

that's it. two lines and a dream, no cap πŸ’…


🌸 REQUIREMENTS 🌸

ngl there's a lil shopping list here. you need Git, Perl 5.24 or later, and these modules:

  • File::BaseDir
  • File::ShareDir
  • Git::Repository
  • IO::Compress::Xz (part of IO-Compress-Lzma)
  • IO::Uncompress::Gunzip (part of IO-Compress)
  • IPC::Run
  • IPC::System::Simple
  • Kwalify
  • List::SomeUtils
  • Path::Tiny
  • YAML::XS

all of which are available from CPAN, so like, go get 'em 🧚

you also need whatever tools build the type of software distribution you're preparing, because the distribution gets built and tested as part of preparing the tarball. no shortcuts, babe β€” it's a whole vibe check on your own code πŸ”₯

and to sign distribution tarballs, you need the GnuPG command-line program gpg. (any version works β€” GnuPG v1 or GnuPG v2, both fine, we don't discriminate πŸ’œ)


πŸ¦‹ DESCRIPTION πŸ¦‹

so this component of DocKnot generates distribution tarballs for a package. and yes, it's a little bit of an odd inclusion in the DocKnot suite, because bestie… it's not about generating documentation at all 😭 but it uses the same configuration and metadata as the rest of DocKnot, so it still fits the friend group.

specifically: App::DocKnot::Dist exports the current branch from Git into a separate working directory, runs the commands appropriate to create a distribution (based on the build system configured in the package metadata), and cleans up the working directory. in, out, immaculate. main character behavior, honestly πŸ‘‘


πŸ‘‘ CLASS METHODS πŸ‘‘

🌈 new(ARGS)

creates a brand new App::DocKnot::Dist object. use this for all your subsequent actions, bestie β€” it's the moment everything begins. ARGS should be a hash reference with one or more of these keys:

  • distdir β€” the path to the directory where the distribution tarball goes. this should point to a trusted directory, not one where an attacker could have written files (see make_distribution() below, it'll make sense i promise). required if it's not already set in the global configuration file.
  • gpg β€” the path to the gpg binary, used to sign generated tarballs if "pgp_key" is present in the global configuration or handed to us as a constructor argument. default: the binary named "gpg" on the user's PATH.
  • metadata β€” the path to the metadata for the package we're operating on. default: docs/docknot.yaml relative to the current directory.
  • perl β€” the path to the Perl executable to use for build steps that require it. mostly used in the test suite. default: the binary named "perl" on the user's PATH.
  • pgp_key β€” sign generated tarballs with the provided PGP key. the key can be named in any way that the -u option of GnuPG understands. this can also be set in the global configuration file. there is no default β€” if this option isn't set, neither as a constructor parameter nor in the global configuration file, the generated tarballs just won't be signed. no signature, no problem πŸ’…

πŸ’€ INSTANCE METHODS πŸ’€

⭐ check_dist(SOURCE, TARBALL)

you hand it the path to a source directory and the path to a gzip-compressed distribution tarball made from that directory, and it returns the list of files that should be in the tarball but aren't. an empty list means everything in the source tree that's expected to be in the distribution is present. periodt. βœ…

this method exists primarily for testing convenience, and it's normally just an implementation detail of make_distribution().

⭐ commands()

returns the commands that should be run to generate a distribution tarball, as a reference to an array of arrays. each included array is a single command.

also provided primarily for testing convenience, and also normally just an implementation detail of make_distribution().

⭐ make_distribution()

generates distribution tarballs in the "destdir" directory you gave to new(). the distribution will be generated from the first branch found named either "main" or "master". 🌿

⚠️ careful bestie: if "destdir" already contains a subdirectory whose name matches the "tarname" of the distribution, it will be forcibly removed. and to successfully remove trees that result from Automake's make distcheck failing partway through, App::DocKnot::Dist will change permissions as needed to remove an existing directory. for security reasons, the "distdir" parameter of this module should therefore only be pointed to a trusted directory, not one where an attacker could have written files. like. fr fr. πŸ”₯

okay continuing ✨

  • if the native distribution tarball generation commands for the package generate a gzip-compressed tarball but not an xz-compressed tarball, an xz-compressed tarball will be created. we're thorough like that.
  • after the distribution is created, check_dist() will be run on it. if any files are missing from the distribution, they'll be reported to standard output and then an exception will be thrown. dramatic? yes. necessary? also yes 😭
  • if the "pgp_key" constructor parameter or global configuration option is set, the generated tarballs will then be signed with that key, using gpg. the generated signature will be armored and stored in a file named by appending .asc to the name of the tarball. iconic πŸŽ€

🌈 AUTHOR 🌈

Russ Allbery <rra@cpan.org> β€” legend behavior πŸ’œ


Copyright 2019-2022 Russ Allbery <rra@cpan.org>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


🌈 SEE ALSO 🌈

this module is part of the App-DocKnot distribution. the current version of DocKnot is available from CPAN, or directly from its web site at <https://www.eyrie.org/~eagle/software/docknot/>.


and that's the whole page bestie!! πŸ¦‹ it's perl v5.40.1, dated 2026-01-16, from App::D...::Dist(3pm) β€” so yeah, go make some tarballs, sign them if you want, and stay hydrated πŸ’–βœ¨πŸ’…

πŸ“¦ where this page comes from