-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHACKING
214 lines (145 loc) · 7.02 KB
/
HACKING
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
*****************************
How to hack on Simple Backup
*****************************
Style guide
-----------
When writing code for SBackup please follow the style guide for Python code,
PEP 8. See http://www.python.org/dev/peps/pep-0008/.
Tools to ease you writing good style code are:
Eclipse IDE
Pydev
Pylint - checks the code style, imports, unused variables etc.
Commit messages should have the same format as changelog entries
* [FIX] LP Bug #577296: Crash, a number is required, not str
* [Fix] regression: avoid backup of circular symlinks
* [Fix]: implemented a work-around to enable notifications
* [Change]: Logarithmic purge disabled since it still has issues
* [Enhancement]: improvements to the release script
Summary of style guide
----------------------
* Use 4 spaces per indentation level.
* Never mix tabs and spaces.
* Use spaces instead of tabs (set this in your IDE).
* Limit line length to 80-120 characters.
* Modules should have short, all-lowercase names. Underscores can be used
in the module name if it improves readability.
* Function names, method names and instance variables should be lowercase, with
words separated by underscores as necessary to improve readability.
* Top level functions and classes are separated by 2 lines, method definitions
within classes by a single line
Branches and versions
=====================
Development takes place in the trunk version. At a certain point in time, a
version branch is forked and a release is prepared. Fixes and modifications
made to a specific branch are then re-merged into the trunk.
How to run from source code
---------------------------
Attention: For the current version, it is not recommended to install
Simple Backup for productive use and to code on it beside at the same time.
The reason is that there are 2 packages for import in
that case, it might occur name conflicts: in your development environment and
in the Python site-packages directory.
ALTERNATIVE A - recommended
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Use helper scripts shipped with sbackup (based on fresh wheezy installation)
0. Install bazaar and set your Launchpad ID
~$ sudo apt-get install bzr
You have not informed bzr of your Launchpad ID, and you must do this to
write to Launchpad or access private data. See "bzr help launchpad-login".
-> inform bzr of ID
install bzrtools and bzr-gtk (if you want to)
see: bzr help gtk
bzr whoami "Firstname Lastname <[email protected]>"
bzr launchpad-login <username>
see: https://help.launchpad.net/YourAccount/CreatingAnSSHKeyPair
add ssh key (or copy .ssh from another machine)
1. create a directory for your local branch
~$ mkdir Dokumente/sbackup
~$ cd Dokumente/sbackup
2. checkout branch
~/Dokumente/sbackup$ bzr branch lp:sbackup/0.11
Branched 244 revisions.
~/Dokumente/sbackup$ cd 0.11/
~/Dokumente/sbackup/0.11$ ls
AUTHORS COPYING debian HACKING INSTALL METAINFO nssbackup.ChangeLog README setup.py.in tests tools
ChangeLog data doc help Makefile NEWS po scripts src TODO
~/Dokumente/sbackup/0.11$ bzr log -r-2..
------------------------------------------------------------
revno: 244
committer: Jean-Peer Lorenz <[email protected]>
branch nick: 0.11
timestamp: Thu 2012-01-05 18:03:14 +0100
message:
* updated changelog
------------------------------------------------------------
revno: 243
committer: Jean-Peer Lorenz <[email protected]>
branch nick: 0.11
timestamp: Thu 2012-01-05 18:02:50 +0100
message:
* [Fix] LP: #768080 incremental snapshots store more files than needed:
add TAR option '--no-check-device'. Thanks to Rogach (platon7pronko) and
Felix Griewald (tiiunder) for the patch.
3. You have successfully branched sbackup to your local harddrive!
4. Before actually running scripts in order to test modifications, please setup
your development environment by means of following script:
~/Dokumente/sbackup/0.11$ source tools/setup-dev.sh
=SBACKUP DEVELOPMENT= user@host:~/Dokumente/sbackup/0.11/scripts$
5. You are now in a dedicated environment (note the leading
'=SBACKUP DEVELOPMENT= ' in front of your prompt). It is changed into
the 'script' directory of your branch.
Execute scripts as you like,
e.g. run a backup with
./sbackup-run --no-dbus --config-file=<path to your test config file>
or full backups with
./sbackup-run --no-dbus --full --config-file=<path to your test config file>
or restore with
./sbackup-restore --config=<path to your test config file> <name of snapshot>
6. To finish hacking, just exit the development environment by typing 'exit'
7. optional: you can also call './tools/teardown-dev.sh' at any time in order
to clean up your branch and remove temporary files and installed language files.
8. push changes
bzr bind lp:~nssbackup-dev/sbackup/0.11 in case the checkout was done
before bzr launchpad-login call; be sure your SSH keys are in place
bzr push
when getting error "http does not support mkdir()", try:
bzr push --remember bzr+ssh://bazaar.launchpad.net/~nssbackup-dev/sbackup/0.11
ALTERNATIVE B
~~~~~~~~~~~~~
Prepare setup manually. If you know what you are doing you can run development
code for testing as follows:
1. Add your development directory to the Python path. Do this in a shell, so
it does not affect the whole system! You can use the following commands:
declare -x PYTHONPATH="/Path-to-development/sbackup/src:"$PYTHONPATH
2. Manually create a file `resources` with appropriate content based on the
template file `resources.in` and place it in the package's top level
directory (src/sbackup). This file is usually created during installation
and therefore it is required to tweak it by hand for development.
3. Analogous to step 2) create a file `metainfo` with appropriate content based
on the template file `metainfo.in` and place it in the package's top level
directory (src/sbackup).
4. Go to the source directory to run the application you wish
cd /Path-to-development/0.2/sripts
python sbackup-config-gtk
python sbackup-restore-gtk
python sbackup
Limitations
~~~~~~~~~~~
When running solely from a development environment it is currently not
possible to perform/test any D-Bus related actions including the indicator
application. Reason for this is the missing/not installed policy file
in /etc/dbus-1/system.d. When installing sbackup properly from source or
deb this file will be installed and D-Bus communication is possible.
Translations
============
First, some links related to translations using Launchpad/Rosetta:
* http://blog.launchpad.net/general/trying-out-launchpad-translations
* https://help.launchpad.net/Translations/YourProject
* https://help.launchpad.net/Translations/YourProject/ImportingTranslations
* https://help.launchpad.net/Translations/YourProject/ImportPolicy
* https://help.launchpad.net/Translations/YourProject/Exports
Testing
=======
Following test must be executed (automated or manually) before publishing
a new version on each target distribution. Use the spreadsheet to document
your efforts and results.