Debian Codegraph @

CONTRIBUTING

raw
1 Hacking PackageKit
2
3 Coding Style
4 ------------
5 Please stick to the existing coding style.
6 Tabs should be hard (not expanded to spaces), and set equivalent to
7 8 spaces.
8
9 All documentation and code should be in US English.
10
11 Please consider enabling git's default pre-commit hook:
12
13 $> cd PackageKit
14 $> chmod +x .git/hooks/pre-commit
15
16 This hook will run before every checkin, and check your changes for
17 suspicious use of whitespace.
18
19 In the C files use the following convention.
20 The number of spaces and tabs are very important!
21
22 /* map the roles to policykit rules */
23 if (role == PK_ROLE_ENUM_UPDATE_PACKAGES ||
24 role == PK_ROLE_ENUM_UPDATE_SYSTEM) {
25 policy = "org.freedesktop.packagekit.update";
26 } else if (role == PK_ROLE_ENUM_REMOVE_PACKAGE) {
27 policy = "org.freedesktop.packagekit.remove";
28 }
29
30 and please DO NOT use "!" for a null pointer check.
31
32 Functions are nearly always the same format, gtk-doc is optional:
33
34 /**
35 * pk_engine_search_name:
36 **/
37 gboolean
38 pk_engine_search_name (PkEngine *engine, const gchar *search, GError **error)
39 {
40 gboolean ret;
41 PkTransactionItem *item;
42
43 g_return_val_if_fail (engine != NULL, FALSE);
44 g_return_val_if_fail (PK_IS_ENGINE (engine), FALSE);
45
46 return TRUE;
47 }
48
49 Finally: DO NOT COMMIT TRAILING WHITESPACE.
50
51 Security
52 --------
53 Remember:
54 * The daemon is running as the root user
55 - no FIXME or TODO code please
56 * If the daemon crashes, then that's a DOS
57 * Text from the user (over the dbus interface) is insecure!
58 - even filters and enumerated values can be wrong
59 - users can use dbus-send to do bad stuff as users
60 * Never allocate a buffer on user input
61 * Output from backends is trusted, they are run from standard locations
62
63 Submitting Patches
64 ------------------
65 We prefer patches submitted as pull requests to our GitHub project at
66 https://github.com/PackageKit/PackageKit
67
68 However, if you are unable to use GitHub, you can also submit patches
69 via email.
70
71 To do so, Use 'git format-patch' to generate patches against a checked
72 out copy of the source.
73
74 For example:
75
76 $> cd PackageKit
77 HACK HACK HACK
78 $> git commit -m "My first commit"
79 HACK HACK HACK
80 $> git commit -m "My second commit"
81 $> git format-patch -M HEAD^^
82 0001-My-first-commit.patch
83 0002-My-second-commit.patch
84
85 Send these patches in an introductory email as attachments to
86 [email protected]
87
88 Commit/Patch Style
89 ------------------
90 Commits (and thus patches) should be structured such that each one
91 is a logically distinct change that stands well and can be tested
92 on its own.
93
94 Commit/Patch messages should be wrapped at 72 characters, and the
95 subject line (minus the subsystem prefix) should be less than 50
96 characters.
97
98 What we mean by subsystem prefix is the portion of the codebase
99 that is being modified.
100
101 For example, if you are changing something in the main library,
102 use "lib:" as the prefix of the patch subject. If you are
103 changing something in one of the backends, use the backend name
104 as the prefix in the patch subject.
105
106 There are a number of examples of this already in the revision
107 history, so look at any number of them for good examples.
108
109 Finally, please do not use commit messages as a means for
110 advertising. The revision history is not a place for rent-free
111 permanent advertising. It can be especially problematic as
112 sponsoring entities change, rename, or such. That means that
113 tags like "Sponsored-by" or similar are not allowed.