Windows/Development Workflow: Difference between revisions

From KDE Community Wiki
*>AnneW
(added consistency markup)
(svn sources from external repos are at download/svn-src. More markup.)
Line 23: Line 23:


* git-based sources are in subdirectories of ''%KDEROOT%''/git
* git-based sources are in subdirectories of ''%KDEROOT%''/git
* svn-based sources are in subdirectories of ''%KDEROOT%''/svn
* svn-based sources inside the KDE svn are in ''%KDEROOT%''/svn
* svn-based sources from external repos are in subdirectories of ''%KDEROOT%''/download/svn-src
* archived sources are first downloaded to ''%KDEROOT%''/download. Then, the archives get unpacked to ''%KDEROOT%''/build/''category''/''packagename''/work/ .
* archived sources are first downloaded to ''%KDEROOT%''/download. Then, the archives get unpacked to ''%KDEROOT%''/build/''category''/''packagename''/work/ .


== Debugging and testing ==
== Debugging and testing ==


When developing a fix on the level of a package's source code, first locate the final source tree, as detailed above. You do your work directly in the source tree. For quick testing, you can cd to the build directory (''%KDEROOT%''/build/''category''/''packagename''/work/''compiler_buildtype-version''). Assuming configuration is already complete you can often build directly from there (for MinGW4 use ''mingw32-make'').  
When developing a fix on the level of a package's source code, first locate the final source tree, as detailed above. You do your work directly in the source tree. For quick testing, you can cd to the build directory (''%KDEROOT%''/build/''category''/''packagename''/work/''compiler_buildtype-version''). Assuming configuration is already complete you can often build directly from there (for MinGW4 use <code>mingw32-make</code>).  


You can also use <code>emerge --update</code> to run the build script, without discarding your changes (TODO: Does this apply to all packages, or only svn / git based ones?).
You can also use <code>emerge --update</code> to run the build script, without discarding your changes (TODO: Does this apply to all packages, or only svn / git based ones?).
Line 34: Line 35:
== Creating patches ==
== Creating patches ==


When satisfied with your fix, create a patch with ''emerge --createpatch packagename''. This will automatically diff your changes against an unmodified source tree, and create a suitable diff. It will be stored in ''%KDEROOT%''/build/''category''/''packagename''/.
When satisfied with your fix, create a patch with <code>emerge --createpatch packagename</code>. This will automatically diff your changes against an unmodified source tree, and create a suitable diff. It will be stored in ''%KDEROOT%''/build/''category''/''packagename''/.


Next, you will copy this patch to the directory of the package's emerge build script. Add it to the build script using  
Next, you will copy this patch to the directory of the package's emerge build script. Add it to the build script using  

Revision as of 16:09, 11 December 2012

Development Workflow for KDE on Windows

Basics

Before we start: This page will not tell you how to diagnose and address problems or shortcomings in source code and build files. We assume you know all that already, or are willing to read up on any missing bits, on your own (but for some hints on useful tools and techniques, be sure to visit Development/Tutorials/Debugging/Debugging on MS Windows, and Windows/Tools. The pupose of this page is to give you an outline of the specific steps needed for preparing, testing, and publishing patches in the KDE on Windows project.

Use emerge

You are using emerge to build your KDE on Windows development environment, right? If not, start doing so now. It's mandatory. Some variables to check in your emerge setup:

  • EMERGE_BUILDTYPE: You may want to set this to "Debug"
  • EMERGE_LOG_DIR: Setting this is highly useful, so you can review (long) build logs.
  • GIT_AUTHOR_*/GIT_COMMITTER_*: Useful if you want to be able to make commits directly from your source tree.
  • Be sure you are on the branch you want to be on!

Where are the emerge build files

Often some builds will fail for trivial reasons, like a download failing because the file has moved. This type of error (but also missing or wrong configuration options, and many others) can be corrected in the emerge build files. These are in (subdirectories of) emerge/portage/. Each package has its own subdirectory. In each subdirectory you will find at least one .py-file. I am not aware of any in-depth information on the semantics of these files, but most concepts should be fairly obvious, and if you are unsure, look at other build files for examples.

Where are the sources

If the problem needs fixing somewhere inside the source tree, you may be wondering where to look for the sources.

  • git-based sources are in subdirectories of %KDEROOT%/git
  • svn-based sources inside the KDE svn are in %KDEROOT%/svn
  • svn-based sources from external repos are in subdirectories of %KDEROOT%/download/svn-src
  • archived sources are first downloaded to %KDEROOT%/download. Then, the archives get unpacked to %KDEROOT%/build/category/packagename/work/ .

Debugging and testing

When developing a fix on the level of a package's source code, first locate the final source tree, as detailed above. You do your work directly in the source tree. For quick testing, you can cd to the build directory (%KDEROOT%/build/category/packagename/work/compiler_buildtype-version). Assuming configuration is already complete you can often build directly from there (for MinGW4 use mingw32-make).

You can also use emerge --update to run the build script, without discarding your changes (TODO: Does this apply to all packages, or only svn / git based ones?).

Creating patches

When satisfied with your fix, create a patch with emerge --createpatch packagename. This will automatically diff your changes against an unmodified source tree, and create a suitable diff. It will be stored in %KDEROOT%/build/category/packagename/.

Next, you will copy this patch to the directory of the package's emerge build script. Add it to the build script using

self.patchToApply[ ' package_version ' ] = [(' patch_file_name.diff ', 1 ), optionally further patches]

Don't forget to test your patch for a clean workdir:

emerge --cleanbuild packagename
emerge packagename

TODO: When should build scripts be renamed to reflect newer version? Ever?

Of course in many cases your fix should really become part of the "upstream" package source code. In particular, when patching KDE, you will probably want to commit your fixes to the KDE git repository, directly, in additon (when building an already finalized release of KDE), or instead of creating an emerge patch.

Review and Pushing

If unsure, ask on [email protected], on IRC ([1]), or post your patches to reviewboard before committing.

If you are confident in your patch, here's an extremely reduced overview of the git commands involved in getting it included:

git add all files that you have touched
git commit with a meaningful message, please
git log     # and
git status  # to review your work. git status should typically say "1 commit ahead of origin".
            # Important: If git status shows more than one commit, and you don't know why, ask for help!
git pull --rebase    # To synchronize with the central repository
git push

TODO:

  • Where to do your changes (which branches)
  • Should you merge to / from master?