File: HACKING

package info (click to toggle)
packagekit 1.1.5-2%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 15,464 kB
  • sloc: ansic: 56,926; cpp: 8,658; python: 7,641; xml: 6,388; sh: 4,517; perl: 1,738; makefile: 1,437; ruby: 1,341
file content (81 lines) | stat: -rw-r--r-- 2,122 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
Hacking PackageKit

Coding Style
------------
Please stick to the existing coding style.
Tabs should be hard (not expanded to spaces), and set equivalent to
8 spaces.

All documentation and code should be in US English.

Please consider enabling git's default pre-commit hook:

	$> cd PackageKit
	$> chmod +x .git/hooks/pre-commit

This hook will run before every checkin, and check your changes for
suspicious use of whitespace.

In the C files use the following convention.
The number of spaces and tabs are very important!

	/* map the roles to policykit rules */
	if (role == PK_ROLE_ENUM_UPDATE_PACKAGES ||
	    role == PK_ROLE_ENUM_UPDATE_SYSTEM) {
		policy = "org.freedesktop.packagekit.update";
	} else if (role == PK_ROLE_ENUM_REMOVE_PACKAGE) {
		policy = "org.freedesktop.packagekit.remove";
	}

and please DO NOT use "!" for a null pointer check.

Functions are nearly always the same format, gtk-doc is optional:

/**
 * pk_engine_search_name:
 **/
gboolean
pk_engine_search_name (PkEngine *engine, const gchar *search, GError **error)
{
	gboolean ret;
	PkTransactionItem *item;

	g_return_val_if_fail (engine != NULL, FALSE);
	g_return_val_if_fail (PK_IS_ENGINE (engine), FALSE);

	return TRUE;
}

Finally: DO NOT COMMIT TRAILING WHITESPACE.

Security
--------
Remember:
* The daemon is running as the root user
 - no FIXME or TODO code please
* If the daemon crashes, then that's a DOS
* Text from the user (over the dbus interface) is insecure!
 - even filters and enumerated values can be wrong
 - users can use dbus-send to do bad stuff as users
* Never allocate a buffer on user input
* Output from backends is trusted, they are run from standard locations

Submitting Patches
------------------
Use 'git format-patch' to generate patches against a checked out copy
of the source.

For Example:

	$> cd PackageKit
	HACK HACK HACK
	$> git commit -m "My first commit"
	HACK HACK HACK
	$> git commit -m "My second commit"
	$> git format-patch -M HEAD^^
	0001-My-first-commit.patch
	0002-My-second-commit.patch

Send these patches in an introductory email as attachments to
packagekit@lists.freedesktop.org