Changes between Version 1 and Version 2 of WorkingWithTheRepository

07/01/15 09:47:43 (8 years ago)



  • WorkingWithTheRepository

    v1 v2  
    1 == For Core Developers == 
     1= Working With The Repository = 
     3== Background == 
     5The "central" Athena repository is located on `` (aka `drugstore`), accessible via git+ssh.  You must be on the `athena-commiters` [yes, the typo is deliberate] list in order to read or write to any of the Athena repositories on this server.  
     7Our git repository is automatically mirrored to the `mit-athena` organization on Github, and anyone without `drugstore` access should clone from there. 
     9*Note*: This document will use the canonical paths.  In general, you can replace `git+ssh://` with `` in a repository URL. 
     11=== Submodules === 
     13Because of the vast number of repositories, we use submodules.  The `debathena` repository is the parent repository, and its `.gitmodules` file contains all the submodule information.  If you're not familiar with submodules, please check out [[]] 
     15Submodule configuration is stored in the `.gitmodules` file, which is itself under version control.  Submodules know both their path, and the last SHA1 they were updated with.  In theory, we would update the central repository every time we make a change to a submodule, so it always points to the submodule's `HEAD`, or at least a reasonable tag.  However, we don't.  It is therefore vital that you ensure your submodule is up to date and that you're on `master` before working on it, lest you find yourself attempt to commit to a detached `HEAD`. 
     17=== Repository Layout === 
     19At the top level of the repository are 4 sub-directories: 
     21* `athena` - This typically contains software we write.  These are "non-native" packages (i.e. packages that consist of more than just a `debian/` directory and some configuration files).  Basically, if something is of value on distributions other than Ubuntu and Debian, it should go in here. 
     22* `debathena` - This typically contains "native" packages (i.e. packages which are "native" to Ubuntu and Debian, and which would not make sense on other distributions) 
     23* `misc` - Things needed as part of the Debathena build infrastructure. 
     24 * `build-system` - The "new" build system components 
     25 * `debathena-common` - Along with manual-config (below), used for manual-config packages 
     26 * `installer` - The installer, both the PXE versions and the script 
     27 * `manual-config` - The "manual-config" packages.  These have the same names as debathena-config packages, but only provide dependencies, and are otherwise empty.  Used by a few users so that, for example, they can install something that depends on `debathena-printing-config` without actually configuring printing. 
     28 * `scripts` - Various scripts, and the "old" build system components 
     29* `third` - A few packages that we build, but for which we are not the upstream source.  These count as "non-native" packages. 
     31== Initial Repository Cloning == 
     33If you're only working on a single project, you can of course clone that project as you would any other Git repository.  However, core developers should clone all the submodules at once for simplicity.  This is about 150MB or so. 
    3 $ git clone git+ssh:// athena 
    4 $ cd athena 
     36$ git clone git+ssh:// athena-source-tree 
     37$ cd athena-source-tree 
    538$ git submodule init 
    639$ git submodule update 
    9 This will checkout specific SHA1s for each submodule, but will not switch to the master branch.  Checkout the master branch in a submodule _before_ working on it. 
     42(You can of course replace `athena-source-tree` with whatever you'd like your local clone to be called.) 
     44This will checkout specific SHA1s for each submodule (specifically, whatever the SHA1 was when it was first added as a submodule), but *will not switch to the master branch*. 
     46== Working on a Package == 
     48In the example below, we will prepare to work on the `getcluster` package: 
     51jdreed@infinite-loop:~/src/athena-source-tree$ cd athena/getcluster 
     52jdreed@infinite-loop:~/src/athena-source-tree/athena/getcluster$ git status 
     53HEAD detached at 3f5c288 
     54nothing to commit, working directory clean 
     57As you can see, this is a deatched HEAD, because the `getcluster` submodule was at `3f5c288` when initially added to the parent repository.  So to work on it, we should ensure we're up to date: 
     60jdreed@infinite-loop:~/src/athena-source-tree/athena/getcluster$ git checkout master 
     61Previous HEAD position was 3f5c288... Revert unintended changelog changes from r25887 
     62Switched to branch 'master' 
     63Your branch is up-to-date with 'origin/master'. 
     64jdreed@infinite-loop:~/src/athena-source-tree/athena/getcluster$ git pull 
     65remote: Counting objects: 6, done. 
     66remote: Compressing objects: 100% (4/4), done. 
     67remote: Total 5 (delta 0), reused 0 (delta 0) 
     68Unpacking objects: 100% (5/5), done. 
     69From git+ssh:// 
     70   db5520e..772d62f  pristine-tar -> origin/pristine-tar 
     71 * [new tag]         10.2.2-0debathena2 -> 10.2.2-0debathena2 
     72Already up-to-date. 
     75We checked out the master branch, and then did a `git pull`.  There were no changes to fetch, but there was a new branch (`pristine-tar`) and a new tag. 
     77== Branches == 
     79Non-native packages have two branches: `debian` and `master`.  The `master` branch contains the software itself, but no `debian` directory.  The `debian` branch contains the software plus a `debian/` directory. 
     81There is also a `pristine-tar` branch, where "pristine" upstream tarballs are stored as part of the build process.  You can check it out remotely, but you basically never want to be working on it.  Continuing from the `getcluster` example above: 
     84jdreed@infinite-loop:~/src/athena-source-tree/athena/getcluster$ ls 
     85getcluster  getcluster.1 
     86jdreed@infinite-loop:~/src/athena-source-tree/athena/getcluster$ git branch 
     87  debian 
     88* master 
     89jdreed@infinite-loop:~/src/athena-source-tree/athena/getcluster$ git checkout origin/pristine-tar  
     90Note: checking out 'origin/pristine-tar'. 
     92You are in 'detached HEAD' state. You can look around, make experimental 
     93changes and commit them, and you can discard any commits you make in this 
     94state without impacting any branches by performing another checkout. 
     96If you want to create a new branch to retain commits you create, you may 
     97do so (now or later) by using -b with the checkout command again. Example: 
     99  git checkout -b <new-branch-name> 
     101HEAD is now at 772d62f... pristine-tar data for getcluster-10.2.2.tar.gz 
     102jdreed@infinite-loop:~/src/athena-source-tree/athena/getcluster$ ls 
     104jdreed@infinite-loop:~/src/athena-source-tree/athena/getcluster$ git checkout master 
     105Previous HEAD position was 772d62f... pristine-tar data for getcluster-10.2.2.tar.gz 
     106Switched to branch 'master' 
     107Your branch is up-to-date with 'origin/master'. 
     108jdreed@infinite-loop:~/src/athena-source-tree/athena/getcluster$ ls 
     109getcluster  getcluster.1 
     112Native packages only have a `master` branch -- no pristine-tar or debian branches.