Auto-tools/Projects/Mozbase: Difference between revisions

Jump to navigation Jump to search
Line 164: Line 164:
* wlach
* wlach


=== Mirroring to Mozilla-Central ===
=== Mozbase use in Mozilla-Central ===


A copy of [https://github.com/mozilla/mozbase mozbase] is mirrored to [http://hg.mozilla.org/mozilla-central mozilla-central] for use by software there: http://mxr.mozilla.org/mozilla-central/source/testing/mozbase/ .
The mozbase packages are installed into [https://developer.mozilla.org/en-US/docs/Python/Virtualenv#The_Mozilla-Central_Virtualenv the mozilla-central virtualenv] instance via the [http://mxr.mozilla.org/mozilla-central/source/build/virtualenv/populate_virtualenv.py populate_virtualenv.py] script. The Mozbase [http://mxr.mozilla.org/mozilla-central/source/testing/mozbase/packages.txt packages.txt] file is included from the master [http://mxr.mozilla.org/mozilla-central/source/testing/mozbase/packages.txt packages.txt] file and includes all Mozbase packages (really, directories) in mozilla-central via [http://docs.python.org/2/library/site.html .pth files].


All commits should be made against the github mozbase repository first. After a patch lands on github, it may be selectively applied to m-c in the case of urgent, isolated fixes/additions. In general though, we try to keep mozbase in sync between mozilla-central and github through a mirroring process.
The various Mozbase packages are used in mozilla-central python code; see https://developer.mozilla.org/en-US/docs/Python#Python_in_Mozilla-Central . Mozbase is used extensively throughout mozilla-central, including test harnesses, tools and the build system itself.
 
Mozbase packages are mirrored from released versions:
https://wiki.mozilla.org/Auto-tools/Projects/MozBase#Versioning . A
bug should be filed to mirror the appropriate package stating the
reason the package should be mirrored.  When appropriate, mozbase
packages should be mirrored on version bump (see [[#Versioning]]).
 
Since several packages in mozbase are dependent on other mozbase
packages, care must be taken to ensure that the versions of the
packages on m-c are kept compatible with each other.  All packages
dependent on the package to be mirrored should also version-bumped and
mirrored.  Similarly, if any of the packages that the package to be
mirrored depends on have not already been mirrored to m-c, these
should also be mirrored to maintain intra-compatability.
Python | MDN https://developer.mozilla.org/en-US/docs/Python#Python_in_Mozilla-Central
 
Mozbase tests are run during the make check build step (see {{bug|790765}}). In addition, care must be taken not to break existing in-tree test harnesses which make use of Mozbase. In general, the full set of unittests should be run on all platforms on Tryserver to ensure that there is no breakage; however, in cases where the developer knows that only a subset of these will suffice for this end, a full try run is not required.
 
==== Using generate_diff.py ====
 
A script has been written to aid with mozbase package mirrroring:
[http://mxr.mozilla.org/mozilla-central/source/testing/mozbase/generate_diff.py generate_diff.py] .
This script:
 
* ensures that your copy of mozilla-central is clean.  This means no outstanding changes and no untracked files in [http://mxr.mozilla.org/mozilla-central/source/testing/mozbase/ testing/mozbase]. Because `generate_diff.py` manipulates the repository using `hg`, this is necessary.
* clones a fresh copy of the [https://github.com/mozilla/mozbase mozbase repository]
* ensures that the tags associated with the specified packages and associated versions exist
* checks that the versions specified are internally consistent with what is in mozilla-central
 
And if everything looks good...
 
* generates a diff that will upgrade the specified packages to the specified versions. Unless specified with `-o`, the output will be in the current working directory named after the hash tag of the git repo HEAD
* updates http://mxr.mozilla.org/mozilla-central/source/testing/mozbase/packages.txt which is used via [http://mxr.mozilla.org/mozilla-central/source/build/virtualenv/populate_virtualenv.py populate_virtualenv.py] to add the mozbase packages to the mozilla-central [https://developer.mozilla.org/en-US/docs/Python/Virtualenv virtualenv] via [http://docs.python.org/2/install/index.html#modifying-python-s-search-path .pth] files
 
'''--develop''': Often it is the case that one or more packages should have their versions bumped prior to mirroring to mozilla-central. Since, typically, `generate_diff.py` operates only on tags associated with released versions, it is difficult to stage a patch to be mirrored to ensure that no further work is necessary prior to version bump.  To this end, `generate_diff.py` has a flag, `--develop`, that will mirror the packages from the master `HEAD` if a version is not specifically supplied on the command line.  This has the additional advantage in that, following tagging, the command line may be reusable from the `--develop` case since without this flag the latest version of the package is chosen if not specified.
 
'''Usage:'''
 
  generate_diff.py [options] package1[=version1] <package2=version2> <...>
 
''(as displayed with: `generate_diff.py --help`)''
 
'''Example:'''
 
  │./generate_diff.py mozcrash=0.3
  Cloning into 'mozbase'...
  remote: Counting objects: 3883, done.
  remote: Compressing objects: 100% (1746/1746), done.
  remote: Total 3883 (delta 2198), reused 3773 (delta 2105)
  Receiving objects: 100% (3883/3883), 1.16 MiB | 241 KiB/s, done.
  Resolving deltas: 100% (2198/2198), done.
  Note: checking out 'mozcrash-0.3'.
 
  You are in 'detached HEAD' state. You can look around, make experimental
  changes and commit them, and you can discard any commits you make in this
  state without impacting any branches by performing another checkout.
 
  If you want to create a new branch to retain commits you create, you may
  do so (now or later) by using -b with the checkout command again. Example:
 
    git checkout -b new_branch_name
 
  HEAD is now at 1634023... Bug 813132 - support tbpl friendly output from mozcrash and python 2.4
  HEAD is now at 1634023... Bug 813132 - support tbpl friendly output from mozcrash and python 2.4
  removing testing/mozbase/mozcrash/README.md
  undeleting testing/mozbase/mozcrash/README.md
  reverting testing/mozbase/mozcrash/mozcrash/__init__.py
  reverting testing/mozbase/mozcrash/mozcrash/mozcrash.py
  reverting testing/mozbase/mozcrash/setup.py
  Diff at /home/jhammel/mozilla/src/mozilla-central/testing/mozbase/1634023250af1cb9bce9ccbf9dfe620e4a95c970.diff
 
==== Mirroring Non-packaged Resources ====
 
Mozbase has [[#Scripts]] and other files which are mirrored to mozilla-central:
 
* ''README'' : brief overview of the role of mozbase and associated links
* [http://mxr.mozilla.org/mozilla-central/source/testing/mozbase/setup_development.py setup_development.py] : included for development purposes and used by [http://mxr.mozilla.org/mozilla-central/source/testing/mozbase/generate_diff.py generate_diff.py]
* [http://mxr.mozilla.org/mozilla-central/source/testing/mozbase/test-manifest.ini test-manifest.ini] : mozbase test manifest, in the format of https://github.com/mozilla/mozbase/blob/master/manifestdestiny/README.md
* [http://mxr.mozilla.org/mozilla-central/source/testing/mozbase/test.py test.py] : mozbase test runner, see [[#Tests]]
 
Currently the mirroring methodology for non-packaged resources is manual: generate a diff vs mozilla-central by copying files from a clone of the [https://github.com/mozilla/mozbase mozbase tree] of the desired files to a mozilla-central clone and upload it to a bug.
 
==== Mozbase in Mozilla-Central ====
 
The mirrored mozbase packages are installed into [https://developer.mozilla.org/en-US/docs/Python/Virtualenv#The_Mozilla-Central_Virtualenv the mozilla-central virtualenv] instance via the [http://mxr.mozilla.org/mozilla-central/source/build/virtualenv/populate_virtualenv.py populate_virtualenv.py] script. The Mozbase [http://mxr.mozilla.org/mozilla-central/source/testing/mozbase/packages.txt packages.txt] file is included from the master [http://hg.mozilla.org/mozilla-central/file/0c45e6378f1f/build/virtualenv/packages.txt#l15 packages.txt] file and is generated by [http://mxr.mozilla.org/mozilla-central/source/testing/mozbase/generate_diff.py generate_diff.py] to include all Mozbase packages (really, directories) in mozilla-central via [http://docs.python.org/2/library/site.html .pth files].
 
The various Mozbase packages are used in mozilla-central python code; see https://developer.mozilla.org/en-US/docs/Python#Python_in_Mozilla-Central .


=== Uploading to Puppetagain ===
=== Uploading to Puppetagain ===
Confirmed users
656

edits

Navigation menu