rustybird / corridor

Tor traffic whitelisting gateway
ISC License
68 stars 6 forks source link

debian packaging #10

Open adrelanos opened 8 years ago

adrelanos commented 8 years ago

Since @rustybird does not wish to merge distribution specific stuff of distributions he does not use (https://github.com/rustybird/corridor/pull/2#issuecomment-44758409), I am only opening this as an issue, not as a pull request.

Work in progress:

EDIT:


There is one issue that Debian will complain about.

W: corridor: executable-not-elf-or-script usr/sbin/corridor-load-config

That script if not executable does not belong there.


Would you like to ship a man folder with manuals in ruby-ronn format in rustybird/corridor master?

I guess I could contribute the original, basic man pages.

(The Debian packaging that I am using would convert them during package build to proper man pages compatible with gnu man. Much better than learning and writing the roff format.)

That would help Debian lintian (package checker) no longer complain about missing man pages. The man pages shipped at upstream rustybird/corridor seems more useful than in downstream adrelanos/corridor.

rustybird commented 8 years ago

Alternatively, can we make it executable and useful instead? When manually executed it could work as a config file sanity tester, i.e. just sourcing the config files in verbose -x mode and then exit with an "success" if that did not result in an error.

Sounds good, done.

adrelanos commented 8 years ago

What about the man pages? I think I could also write them in markdown, then convert them roff and eventually send a pull request here.

They are looking quite okay, I think. You can see one created that way in action in Whonix. Example:

man tor-ctrl
rustybird commented 8 years ago

What about the man pages?

What do you think about a combined manpage (i.e. man corridor, symlinked to the individual command names)? It could show how everything fits together, and would probably avoid some redundancy.

I think I could also write them in markdown, then convert them roff and eventually send a pull request here.

Either way would be fine, I'd check in both your source and the generated output anyway. Like it's often done for configure.ac and configure.

They are looking quite okay, I think.

Yeah, even the generated roff code doesn't look terrible. I like it!

adrelanos commented 8 years ago

I don't know if a combined man page would be acceptable by Debian policy or otherwise. I will ask.


Debian request for packaging feature request: RFP: corridor - a Tor traffic whitelisting gateway


Perhaps for getting this into official Debian, I would have to become upstream. I'd be maintaining a Debian friendly fork of corridor. This is because for getting this packages, I patched the makefile and added an additional dependency, genmkfile. Let's see what pkg-privacy-maintainers say and how supportive they are.

adrelanos commented 8 years ago

I am not wiser about the combined manpage yet. Will ask in another place.

What however would work would be having just one corridor binary in /usr/sbin/corridor which would just be a stub calling the others scripts from /usr/share/corridor/{forwarding-init,...}. Then a combined manpage would certainly be possible. Whether this is a good idea is another question.

adrelanos commented 8 years ago

W: corridor: executable-not-elf-or-script usr/sbin/corridor-load-config

Fixed:

I am not wiser about the combined manpage yet. Will ask in another place.

Asked: https://lists.debian.org/debian-mentors/2016/07/threads.html

adrelanos commented 8 years ago

A combined manpage is permissible.

adrelanos commented 8 years ago

As of https://github.com/adrelanos/corridor/commit/e9907c96ffc0264139c48625b6688a160f1d934c:

git diff --stat rustybird/master 
 Makefile                        |  43 ++------
 Makefile_orig                   |  37 +++++++
 README.debian                   |   5 +
 changelog.upstream              | 844 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 debian/changelog                |  12 ++
 debian/compat                   |   1 +
 debian/control                  |  37 +++++++
 debian/copyright                |  31 ++++++
 debian/corridor.links           |  10 ++
 debian/corridor.postinst        |  43 ++++++++
 debian/corridor.postrm          |  36 ++++++                                                                                                                                       
 debian/gain-root-command        |   7 ++                                                                                                                                           
 debian/rules                    |  17 +++                                                                                                                                          
 debian/source/format            |   1 +                                                                                                                                            
 debian/source/lintian-overrides |   2 +                                                                                                                                            
 debian/watch                    |   7 ++                                                                                                                                           
 make-helper-overrides.bsh       |  25 +++++                                                                                                                                        
 17 files changed, 1127 insertions(+), 31 deletions(-)
rustybird commented 8 years ago

Nice! Some things I've noticed:

adrelanos commented 8 years ago

Rusty Bird:

Nice! Some things I've noticed:

  • README.debian can be deleted now

Done.

  • From my cursory understanding of git-based Debian packaging, it sounds like all Debian specific files should go into debian/ and the top level directory be unchanged

Usually yes.

  • Is the custom Makefile and the genmkfile dependency still needed?

Yes.

  • Seems strange to ship almost a thousand lines of upstream.changelog in the same git repository it is generated from. Maybe it could be a line in debian/rules.

If is required for Debian packaging. Not strictly required, but then the package is free of any lintian --pedantic warnings.

Used in debian/rules:

override_dh_installchangelogs:
        dh_installchangelogs changelog.upstream upstream

If upstream does not provide an upstream changelog, this is a legitimate way to generate one.

It could be automatically created during package build in theory, but Debian source packages are spare out the '.git' folder. So the Debian source package already has to include the upstream tarball.

This situation will likely improve when debian/source/format 3.0 (git) GitSrc is ready. Good that I am reminded.

asked on debian-mentors mailing list: What is the status of debian/source/format 3.0 (git) GitSrc?

  • The ruby-ronn dependency might be unnecessary, installation uses the precompiled version

Done.

adrelanos commented 8 years ago

If you are wondering, why I am using genmkfile... genmkfile's make help.

make help
   Show this help.
make dist
   Create package-version.tar.gz from source files in $DISTDIR (default "..").
make undist
   Delete package-version.tar.gz from source files in $DISTDIR (default "..").
make debdist
   Create debian.tar.gz from source files in $DISTDIR (default "..").
make undebdist
   Delete debian.tar.(gz|xz) from source files in $DISTDIR (default "..").
make manpages
   Create man page from man source folder, which will be stored in debian/tmp-man folder.
make uch
   Store upstream changelog from git log in changelog.upstream.
make install
   Copying the files from the source tree to system-wide directories.
make installsim
   Simulate copying the files from the source tree to system-wide directories.
make deb-build-dep
   Install build dependencies listed in debian/control under Build-Depends using apt-get.
   Various environment variables supported.
make deb-pkg
   Create a deb, which will be stored in parent folder.
make deb-pkg-install
   Create a deb, which will be stored in parent folder, and install it.
make deb-install
   Install deb from parent folder.
make deb-icup
   Combination of make deb-pkg, make deb-pkg-install and make deb-pkg-cleanup.
make deb-remove
   apt-get remove make_source_package_name
make deb-purge
   apt-get purge make_source_package_name
make deb-clean
   Delete temporary debhelper files.
make deb-cleanup
   Same as make deb-clean and deletes debuild artifacts from parent folder.
make dput-ubuntu-ppa
   Upload to Ubuntu ppa. Requires functional .dput.cf.
make clean
   Currently same as make deb-clean.
make distclean
   Currently same as make clean.
make checkout
   Fetch from git.
make installcheck
   Check if source files match installed files.
make uninstallcheck
   Check if make uninstall removed all files.
make uninstall
   Delete all installed files.
make uninstallsim
   Simulate what make uninstall would do.
make deb-chl-bumpup-manual
   Manual upstream version number in debian/changelog.
make deb-uachl-bumpup-manual
   Combination of make uch and make deb-chl-bumpup.
make deb-chl-bumpup-major
   Major bump upstream version number in debian/changelog.
make deb-uachl-bumpup-major
   Combination of make uch and make deb-chl-bumpup.
make git-tag-sign
   git tag (-s) sign latest pkg_version_with_revision from debian/changelog. Only a repository sanity check. Not for security purposes!
make git-tag-verify
   git tag (-v) verify latest pkg_version_with_revision from debian/changelog. Only a repository sanity check. Not for security purposes!
make git-tag-check
   Check if current git head is a signed git tag. Only a repository sanity check. Not for security purposes!
make git-commit-verify
   Check if current git head is a signed git commit. Only a repository sanity check. Not for security purposes!
make git-verify
   Combination of tag-check and commit-verify. Only a repository sanity check. Not for security purposes!
make git-tag-push
   git push latest pkg_version_with_revision from debian/changelog. (Environment variable make_git_tag_push_targets, that defaults to 'origin'.)
make git-tag-push-latest
   git push most recent git tag. (Environment variable make_git_tag_push_targets, that defaults to 'origin'.)
make reprepro-add
   Add main deb package using reprepro wrapper (Environment variable make_reprepro_wrapper, that default to 'reprepro'.)
   to repository (Environment variable make_reprepro_codename, that defaults to 'developers'.).

(Some of that is broken for corridor.)

It somewhat standardizes packaging trivially packageable stuff. (I am not saying corridor is trivial! Just sh/bash/scripts that do not require compilation are intrinsically easy to package.) It helps me with questions such as: