summaryrefslogtreecommitdiff
path: root/HACKING
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2019-07-25 07:20:42 +0100
committerSean Whitton <spwhitton@spwhitton.name>2019-07-25 07:20:42 +0100
commitc3b21df9639ae811a7b8c436a34d558917526b47 (patch)
tree96b68f3392b1a376bf487c53fafd3d215573ea36 /HACKING
parent839b666ac93688e2ef24c3fb7b1fbb0a0024bb33 (diff)
parent97d91ead98b8c771271e1b6878b14db030932560 (diff)
Merge tag 'debian/9.5' into buster-bpo
dgit release 9.5 for unstable (sid) [dgit] [dgit distro=debian no-split] # gpg: Signature made Mon 22 Jul 2019 09:40:00 PM BST # gpg: using RSA key 9B917007AE030E36E4FC248B695B7AE4BF066240 # gpg: Good signature from "Sean Whitton <spwhitton@spwhitton.name>" [ultimate] # Primary key fingerprint: 8DC2 487E 51AB DD90 B5C4 753F 0F56 D055 3B6D 411B # Subkey fingerprint: 9B91 7007 AE03 0E36 E4FC 248B 695B 7AE4 BF06 6240
Diffstat (limited to 'HACKING')
-rw-r--r--HACKING91
1 files changed, 91 insertions, 0 deletions
diff --git a/HACKING b/HACKING
new file mode 100644
index 0000000..2839200
--- /dev/null
+++ b/HACKING
@@ -0,0 +1,91 @@
+Here are some hints and tips or working on src:dgit
+===================================================
+
+Program and source code layout
+------------------------------
+
+Most stuff is in the toplevel.
+Debian/ contains Perl modules, notably Debian/Dgit.pm.
+That module contains much shared code and is used by every package.
+
+The test suite is very useful for ad-hoc work, so see "Tests" below.
+
+Coding style
+------------
+
+I like to use perl "poetry mode" where ( ) are often elided.
+This is often nice and terse but there is a gotcha. This
+ some_function ($a + 2), $b, $c
+is wrong, because the ( ) are treated as function call ( )
+for some_function. When this is a risk, you have to write:
+ some_function +($a + 2), $b, $c
+
+Keep the line length to 75 at most please.
+
+i18n
+----
+
+In the Perl code we use these functions:
+
+ here: meaning: like, in C:
+ __ translate this message _ aka gettext
+ f_ this is a sprintf string to be translated sprintf(_ ...
+ i_ mark for translation but do not translate here gettext_noop
+
+See the info node `(gettext) Sources' for the complete semantics.
+
+The shell scripts are not translated right now.
+
+Running ad-hoc
+--------------
+
+You can run everything right out of the git tree, for ad hoc testing,,
+like this (supposing your dgit tree is in things/Dgit/dgit):
+
+ ~/things/Dgit/dgit/using-these dgit --some-option blah blah
+
+using-these will set PATH and PERLLIB so that programs and modules
+come from its own directory (obtained from $0).
+
+Tests, running and use for hacking
+----------------------------------
+
+The test cases are in bash and are in tests/tests/*. They all use
+shell libraries tests/lib*.
+
+You can run it formally with autopkgtest, but you normally want to run
+tests in one of these two ways [1]:
+
+ tests/using-intree tests/tests/<some-test> 2>&1 |tee ../log
+ tests/run-all [tests/tests/<some shell glob>]
+
+These will leave their working stuff in ./tests/tmp/<name-of-test>.
+
+The test suite is often a nice way to set up situations for ad-hoc
+testing. You can add "xxx" in the middle of one of the test cases to
+get it to crash at the right point. Have an absolute cd like
+ cd ~/things/Dgit/dgit/tests/tmp/<some-test>
+in your shell history, because each time you run the test it will
+blow that directory away again.
+
+There are many env vars settings like
+ DGIT_TEST_DEBUG= DGIT_TEST_DEBUG=-DDD
+ DGIT_TEST_DEBPUSH_DEBUG= DGIT_TEST_DEBPUSH_DEBUG=x
+which can be used to control the level of debug output from
+individual programs run by the test suite.
+
+Editing/adding tests
+--------------------
+
+Things in tests/setup/ generate canned starting points. You can run
+them by hand, but when they are imported by other tests they are not
+automatically regenerated by default. So if you are editing one of
+those, git-clean is your friend.
+
+debian/tests/control is autogenerated by a rule in debia/rules. If
+making actual releases, you must rerun that.
+
+[1] The test suite and libraries, when run without any special
+environment variables, expect to be run via DEP-8 (autopkgtest) - so
+they want an to everything out of PATH and /usr. But there are also
+arrangements to honour environment variables set by using-intree.