How does Drupal.org's packaging script works?
The projects on drupal.org are managed by the Project project, which also contains the scripts for this. Some drupal.org specific code (for example the zip. and tar.gz packaging implementations) are also in the Drupal.org customizations project.