9492.1.1
by Karl Fogel
Add utilities/formatdoctest.py and utilities/migrater/, both brought |
1 |
Launchpad Migrater |
2 |
===================
|
|
3 |
||
4 |
This tool moves modules, tests, and configuration from the |
|
5 |
canonical.launchpad tree to the lp tree. The tool uses a configuration |
|
6 |
file that maps files to applications. |
|
7 |
||
8 |
This script does most of the migration work, but it is not intended to do a |
|
9 |
complete migration. The goal of the script is to automate most of the |
|
10 |
mechanical work so that a developer can make the needed manual changes to |
|
11 |
land the branch in 2 days. |
|
12 |
||
13 |
It performs a number of updates for the migration and when a file is moved. |
|
14 |
||
15 |
* Builds a tree with the new directory names. Such as |
|
16 |
database => model |
|
17 |
pagetests => stories |
|
18 |
* Some files are renamed, such as tests that end in '-pages' will be |
|
19 |
named as '-views'. |
|
20 |
* Update imports of the moved module in other modules, tests and zcml. |
|
21 |
* Convert the interface glob imports in the moved module to |
|
22 |
specific imports. |
|
23 |
* Extract all browser zcml instructions to browser/configure.zcml |
|
24 |
* Merge all object zcml into <app>/configure.zcml |
|
25 |
||
14593.2.17
by Curtis Hovey
Removed unneeded test; ./doc is gone. |
26 |
test harnesses are installed to run the tests in doc/ and browser/test. |
9492.1.1
by Karl Fogel
Add utilities/formatdoctest.py and utilities/migrater/, both brought |
27 |
|
28 |
||
29 |
What is missing? |
|
30 |
----------------
|
|
31 |
||
32 |
The tool does not know how to separate the modules, tests and zcml into |
|
33 |
app/ and coop/ directories. You can either add these rules, or do it by hand. |
|
34 |
The registry app has a lot coop/ code in its model and browser modules, though |
|
35 |
it should not have a coop/ directory. The separation of application from |
|
36 |
the pillar models and views must be done after the migration has run, and |
|
37 |
probably in a separate branch. |
|
38 |
||
39 |
||
40 |
Using migrater.py to extract an application |
|
41 |
-------------------------------------------
|
|
42 |
||
43 |
The migration script will probably be run many times over a pristine |
|
44 |
launchpad branch. Each pass you will strive to reconcile warnings, and |
|
45 |
add rules to migrate unhandled files. |
|
46 |
||
47 |
* Update file-ownership.txt |
|
48 |
* Add missing files. |
|
49 |
* Page templates do not need to be marked; their migration list is |
|
50 |
built from the moved zcml and browser modules. |
|
51 |
* Prefix the application code to each file that you want to migrate. |
|
52 |
eg. reg canonical/launchpad/database/distribution.py |
|
53 |
||
54 |
* Run the script (takes about 5 minutes) |
|
55 |
cd pristine-launchpad-branch |
|
56 |
../migrater/migrate.py ../migrater/file-ownership.txt <code|reg|soy> |
|
57 |
||
58 |
* Review the script's output |
|
59 |
* Update file-ownership.txt to reconcile modules that the zcml |
|
60 |
configuration indicates are missing. |
|
61 |
* Examine the templates that are shared by multiple files. Are these |
|
62 |
templates are from a module or zcml that should also be be migrated? |
|
63 |
You may choose to add an exception to migrations rules, or update the |
|
64 |
zcml and module to share a template. |
|
65 |
* Consider the files that were not moved. Do you want to add rules |
|
66 |
to the migration script to handle them? |
|
67 |
||
68 |
* Run lint over lib/lp/<app>/tests/test_doc,py and |
|
69 |
lib/lp/<app>/tests/browser/test_views.py. |
|
70 |
* Update the imports in the migrater/ test_doc.py and test_views.py files |
|
71 |
because you may run the script many times, and you will want to test |
|
72 |
often without the need to make repeated fixes to the test harnesses. |
|
73 |
||
74 |
* Test |
|
75 |
test.py -vv -module=lp.<app> |
|
76 |
* You will probably see circular import issues until the warnings from the |
|
77 |
migration script are resolved. If the problem persists, you may choose |
|
78 |
to make this a manual migration task, or postpone migration of the |
|
79 |
problem module. |
|
80 |
* Examine the failures. Consider making changes to the failing code and |
|
81 |
tests in a tree /before/ the migration script makes its changes. |
|
82 |
||
83 |
* Revert the migration changes. |
|
84 |
* Update code, test, and zcml to work to be compatible with the old and |
|
85 |
new tree. Commit. |
|
86 |
* Update the migration script to handle exceptional moves and unsupported |
|
87 |
files. Commit. |
|
88 |
||
89 |
* Repeat until you believe the remaining migration work can be done my hand |
|
90 |
in a short time. |