Merge lp:~craig.magina/charms/trusty/ilp32-rebase/trunk into lp:~dannf/charms/trusty/ilp32-rebase/trunk

Proposed by Craig Magina
Status: Needs review
Proposed branch: lp:~craig.magina/charms/trusty/ilp32-rebase/trunk
Merge into: lp:~dannf/charms/trusty/ilp32-rebase/trunk
Diff against target: 355 lines (+196/-36)
7 files modified
README (+6/-2)
config.yaml (+16/-0)
files/do-ilp32-rebase (+116/-20)
gen-config (+10/-2)
get-results (+17/-0)
hooks/install (+11/-12)
upload-results (+20/-0)
To merge this branch: bzr merge lp:~craig.magina/charms/trusty/ilp32-rebase/trunk
Reviewer Review Type Date Requested Status
dann frazier Pending
Review via email: mp+251473@code.launchpad.net
To post a comment you must log in.
Revision history for this message
dann frazier (dannf) wrote :

I think it makes sense for you to own this code now. If you agree, I can just mark my branch is abandoned. But, I'm happy to provide review comments - I'll try to add them inline.

One overall comment - in general I find it easier to review things when there is 1 commit per change. I think you've done a good job at splitting out the individual functional changes in the bullets, but with one commit, it isn't always obvious which bullet a specific line change is addressing.

4. By Craig Magina

Fixed an issue with the package versioning that was making the new packages older then the ones they were supposed to replace

Revision history for this message
Craig Magina (craig.magina) wrote :

I'll keep that in mind for all future work, thanks for the tip. I am fine taking ownership of it from here on out. Another set of eyes is always useful with code, so I would appreciate your review.

Revision history for this message
dann frazier (dannf) wrote :

Huh.. I did do an inline review.. but now I'm not seeing those
comments on the MP.. wtf?

Revision history for this message
dann frazier (dannf) wrote :

Ah - ok, your last push hides those review comments since it changes the diff. To see those comments, look under "Preview Diff" below, and select "r3 into r2 on 2015-03-02"

5. By Craig Magina

Added support for specifying the release to use as the base kernel (updates|proposed)

Revision history for this message
Craig Magina (craig.magina) :
6. By Craig Magina

Moved the apt clean back to its original location as suggested by dann

7. By Craig Magina

Revert manual debian changelog entry generation to debain/rules startnewrelease target as suggested by dann

8. By Craig Magina

Single quotes are not expanded in bash, need double quotes to cause $RELEASE to be expanded properly

9. By Craig Magina

Fix for the package version startnewrelease sets, since we want to build on the current package version, not incremement to the next version.

10. By Craig Magina

Removed the script generation from do-ilp32-rebase
Added configuration output to do-ilp32-rebase
Created script to download the results from the juju unit
Created a script to upload the package to the ilp32 ppa

11. By Craig Magina

Removed un-used variable

Unmerged revisions

11. By Craig Magina

Removed un-used variable

10. By Craig Magina

Removed the script generation from do-ilp32-rebase
Added configuration output to do-ilp32-rebase
Created script to download the results from the juju unit
Created a script to upload the package to the ilp32 ppa

9. By Craig Magina

Fix for the package version startnewrelease sets, since we want to build on the current package version, not incremement to the next version.

8. By Craig Magina

Single quotes are not expanded in bash, need double quotes to cause $RELEASE to be expanded properly

7. By Craig Magina

Revert manual debian changelog entry generation to debain/rules startnewrelease target as suggested by dann

6. By Craig Magina

Moved the apt clean back to its original location as suggested by dann

5. By Craig Magina

Added support for specifying the release to use as the base kernel (updates|proposed)

4. By Craig Magina

Fixed an issue with the package versioning that was making the new packages older then the ones they were supposed to replace

3. By Craig Magina

Config changes:
  * The URI for the ILP32 patches git tree is setable
  * The ILP32 start and end pointers are setable
The linux-meta package is now built to match the kernel abi
do-ilp32-rebase no longer needs to be run under root, running it as root will actually break on the linux-meta package build
Scripts are generate at the end of each build phase (linux and linux-meta):
  * Downloads all parts required for upload
  * Signs package sources for upload
  * Uploads package sources to the ilp32-proposed ppa
  * Suggests an optimized means of downloading the git trees to be saved for history

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'README'
--- README 2014-12-17 01:14:12 +0000
+++ README 2015-04-15 13:14:49 +0000
@@ -1,19 +1,23 @@
1# Overview1# Overview
22
3This charm is used to help maintain the ilp32-enabled arm64 kernel in ppa:ce-hyperscale/ilp32. As the Ubuntu 14.04 kernel is updated, the ilp32 patches need to be rebased and packaged. On deployment, this charm will install all the necessary packages to do the job and seed content from various git locations. A user can then login and run a single command that will:3This charm is used to help maintain the ilp32-enabled arm64 kernel in ppa:ce-hyperscale/ilp32-proposed. As the Ubuntu 14.04 kernel is updated, the ilp32 patches need to be rebased and packaged. On deployment, this charm will install all the necessary packages to do the job and seed content from various git locations. A user can then login and run a single command that will:
4 1. Query launchpad to find the version of the current kernel package in trusty-proposed4 1. Query launchpad to find the version of the current kernel package in trusty-proposed
5 2. Pull updates for all relevant git branches5 2. Pull updates for all relevant git branches
6 3. Create a new git branch based on the tag of the kernel currently in trusty-proposed6 3. Create a new git branch based on the tag of the kernel currently in trusty-proposed
7 4. Rebase ILP32 patches from a reference tree onto this tag7 4. Rebase ILP32 patches from a reference tree onto this tag
8 5. Prepare a source package suitable for upload to a test PPA8 5. Prepare a source package suitable for upload to a test PPA
9 6. Repeat for the linux-meta package
910
10# Usage11# Usage
1112
12Step by step instructions on using the charm:13Step by step instructions on using the charm:
1314
14 juju deploy ilp32-rebase15 juju deploy ilp32-rebase
16 juju set user-email="user@example.org" user-fullname="Example User"
15 juju ssh ilp32-rebase/017 juju ssh ilp32-rebase/0
16 sudo /usr/bin/do-ilp32-rebase18 /usr/bin/do-ilp32-rebase
19
20The config allows a user to set the URI where the ILP32 patches are located and pointers to the start and end of the patch set.
17 21
18## Scale out Usage22## Scale out Usage
1923
2024
=== modified file 'config.yaml'
--- config.yaml 2014-12-17 01:14:12 +0000
+++ config.yaml 2015-04-15 13:14:49 +0000
@@ -7,3 +7,19 @@
7 type: string7 type: string
8 default: "Example User"8 default: "Example User"
9 description: "Full name to use in commits and changelogs"9 description: "Full name to use in commits and changelogs"
10 release:
11 type: string
12 default: "proposed"
13 description: "The trusty release to use as the base for the ilp32 kernel"
14 ilp32-ref-tree:
15 type: string
16 default: "git://kernel.ubuntu.com/dannf/trusty-xgene.git"
17 description: "GIT reference tree containing the ilp32 support patches"
18 ilp32-start-ref:
19 type: string
20 default: "ilp32/ilp32-start"
21 description: "GIT reference to the first ilp32 support commit"
22 ilp32-end-ref:
23 type: string
24 default: "ilp32/ilp32"
25 description: "GIT reference to the end ilp32 support commit"
1026
=== added directory 'files'
=== renamed file 'do-ilp32-rebase' => 'files/do-ilp32-rebase'
--- do-ilp32-rebase 2014-12-17 01:14:12 +0000
+++ files/do-ilp32-rebase 2015-04-15 13:14:49 +0000
@@ -12,15 +12,25 @@
12export GIT_COMMITTER_EMAIL="$USER_EMAIL"12export GIT_COMMITTER_EMAIL="$USER_EMAIL"
13export GIT_COMMITTER_NAME="$USER_FULLNAME"13export GIT_COMMITTER_NAME="$USER_FULLNAME"
1414
15cd $GIT_TREE15ILP32_REBASE_DIR=`mktemp -d /tmp/ilp32-rebase-XXXX`
16
17cd $ILP32_REBASE_DIR
18
19# Build linux
20# Fetch the ubuntu and reference trees.
21git clone /usr/src/ilp32-rebase/linux
22cd linux
23
24git remote add ilp32 $ILP32_REF_TREE
25git fetch ilp32
26git remote add trusty git://kernel.ubuntu.com/ubuntu/ubuntu-trusty.git
16git fetch trusty27git fetch trusty
17git fetch ilp32
1828
19prover=$(get-src-package-version \29prover=$(get-src-package-version \
20 --archive 'http://ports.ubuntu.com/ubuntu-ports' \30 --archive "http://ports.ubuntu.com/ubuntu-ports" \
21 --release 'trusty-proposed' \31 --release "trusty-$RELEASE" \
22 --section 'main' \32 --section "main" \
23 linux)33 linux)
2434
25tag="Ubuntu-${prover}"35tag="Ubuntu-${prover}"
26ilp32_branch="${prover}+ilp32"36ilp32_branch="${prover}+ilp32"
@@ -29,7 +39,7 @@
29git reset --hard HEAD39git reset --hard HEAD
30# get off of ilp32 branch if we are on it40# get off of ilp32 branch if we are on it
31# (git won't let us delete the branch we're sitting on)41# (git won't let us delete the branch we're sitting on)
32git checkout origin/master42git checkout master
33git branch -D "$ilp32_branch" || /bin/true43git branch -D "$ilp32_branch" || /bin/true
34git branch "$ilp32_branch" "$tag"44git branch "$ilp32_branch" "$tag"
35git checkout "$ilp32_branch"45git checkout "$ilp32_branch"
@@ -40,30 +50,116 @@
40./debian/scripts/misc/getabis ${upstream_ver} ${old_package_rev}50./debian/scripts/misc/getabis ${upstream_ver} ${old_package_rev}
4151
42# clean causes debian/control to be generated, needed by startnewrelease52# clean causes debian/control to be generated, needed by startnewrelease
43make -f debian/rules clean53fakeroot make -f debian/rules clean
44make -f debian/rules startnewrelease54fakeroot make -f debian/rules startnewrelease
55
45# This adds a middle ABI number and appends '+ilp32.1'56# This adds a middle ABI number and appends '+ilp32.1'
46sed -i -r '0,/(.*\(.+)-(.+)\.(.+)\)(.*)/s//\1\-\2\.\2\.\3\+ilp32\.1\)\4/' \57sed -i -r "0,/(.*\(.+)-(.+)\.(.+)\)(.*)/s//\1\-${old_package_rev%.*}\.${old_package_rev#*.}\.${old_package_rev#*.}\+ilp32\.1\)\4/" \
47 debian.master/changelog58 debian.master/changelog
48git add debian.master/changelog59git add debian.master/changelog
49git commit -s -m 'UBUNTU: Start new release60git commit -s -F debian/commit-templates/newrelease
5061
51Ignore: yes'62git log --reverse $ILP32_START_REF..$ILP32_END_REF | grep ^commit | cut -d' ' -f2 | \
52
53# FIXME: the start/end references should be user configurable
54git log --reverse ilp32/ilp32-start..ilp32/ilp32 | grep ^commit | cut -d' ' -f2 | \
55 while read c; do63 while read c; do
56 git cherry-pick $c64 git cherry-pick $c
57 done65done
5866
59make -f debian/rules insertchanges67fakeroot make -f debian/rules insertchanges
60dch -c debian.master/changelog -r ""68dch -c debian.master/changelog -r ""
61git add debian.master/changelog69git add debian.master/changelog
62newver="$(dpkg-parsechangelog --show-field Version -ldebian.master/changelog)"70newver="$(dpkg-parsechangelog --show-field Version -ldebian.master/changelog)"
63git commit -s -m "UBUNTU: Ubuntu-$newver"71git commit -s -m "UBUNTU: Ubuntu-$newver"
72
73cp /usr/src/ilp32-rebase/linux_${upstream_ver}.orig.tar.gz $ILP32_REBASE_DIR
64rm -rf ../linux-${upstream_ver}74rm -rf ../linux-${upstream_ver}
65git clone . ../linux-${upstream_ver}75git clone . ../linux-${upstream_ver}
66cd ../linux-${upstream_ver}76cd ../linux-${upstream_ver}
67rm -rf .git77rm -rf .git
68make -f debian/rules clean78fakeroot make -f debian/rules clean
69dpkg-buildpackage -rfakeroot -uc -us -S79dpkg-buildpackage -rfakeroot -uc -us -S
80
81# Generate ilp32-rebase-results file
82cd $ILP32_REBASE_DIR
83changes=`ls -1 linux_${upstream_ver}-*+ilp32.1_source.changes`
84dsc=`ls -1 linux_${upstream_ver}-*+ilp32.1.dsc`
85diff=`ls -1 linux_${upstream_ver}-*+ilp32.1.diff.gz`
86
87cat > $HOME/ilp32-rebase-results <<EOF
88JUJU_UNIT_NAME=$JUJU_UNIT_NAME
89ILP32_REBASE_DIR=$ILP32_REBASE_DIR
90LINUX_CHANGES=$changes
91LINUX_DSC=$dsc
92LINUX_DIFF=$diff
93LINUX_GIT=$ILP32_REBASE_DIR/linux
94EOF
95# End of linux build
96
97# Build linux-meta
98cd $ILP32_REBASE_DIR
99
100git clone /usr/src/ilp32-rebase/linux-meta
101cd linux-meta
102
103prover=$(get-src-package-version \
104 --archive "http://ports.ubuntu.com/ubuntu-ports" \
105 --release "trusty-$RELEASE" \
106 --section "main" \
107 linux-meta)
108
109tag="Ubuntu-${prover}"
110ilp32_branch="${prover}+ilp32"
111
112git clean -x -f -d .
113git reset --hard HEAD
114# get off of ilp32 branch if we are on it
115# (git won't let us delete the branch we're sitting on)
116git checkout master
117git branch -D "$ilp32_branch" || /bin/true
118git branch "$ilp32_branch" "$tag"
119git checkout "$ilp32_branch"
120
121linux_upstream_ver="${upstream_ver}"
122linux_package_rev="${old_package_rev}"
123
124oldver="$(dpkg-parsechangelog --show-field Version -lmeta-source/debian/changelog)"
125upstream_ver="${oldver%.*.*}"
126old_package_rev="${oldver#${upstream_ver}.}"
127
128now="$(date -R)"
129cat > meta-source/debian/changelog.new <<EOF
130linux-meta (${upstream_ver}.${linux_package_rev}.${old_package_rev#*.}+ilp32.1) UNRELEASED; urgency=low
131
132 * linux ABI ${upstream_ver}-${linux_package_rev}
133
134 -- $DEBFULLNAME <$DEBEMAIL> $now
135EOF
136cat meta-source/debian/changelog >> meta-source/debian/changelog.new
137mv meta-source/debian/changelog.new meta-source/debian/changelog
138dch -c meta-source/debian/changelog -r ""
139git add meta-source/debian/changelog
140
141# Update the KERNEL_VERSION and KERNEL_ABI in the debian/rules file
142sed "/KERNEL_ABI_VERSION=.*/i \
143KERNEL_VERSION=${linux_upstream_ver}\n\
144KERNEL_ABI=${linux_package_rev}" -i meta-source/debian/rules
145git add meta-source/debian/rules
146git commit -s -m "UBUNTU: Ubuntu-${upstream_ver}.${linux_package_rev}.${old_package_rev#*.}+ilp32.1"
147
148make
149
150# Append linux-meta to il32-rebase-results config
151changes=`ls -1 linux-meta_*source.changes`
152dsc=`ls -1 linux-meta_*.dsc`
153tarball=`ls -1 linux-meta_*.tar.gz`
154
155echo >> $HOME/ilp32-rebase-results <<EOF
156LINUX_META_CHANGES=$changes
157LINUX_META_DSC=$dsc
158LINUX_META_TARBALL=$tarball
159LINUX_META_GIT=$ILP32_REBASE_DIR/linux-meta
160EOF
161# End of linux-meta build
162
163echo "To retrieve results, download the ilp32-rebase-results file and run the get-results script"
164echo "juju scp $JUJU_UNIT_NAME:$HOME/ilp32-rebase-results ."
165echo "get-results"
70166
=== renamed file 'get-src-package-version' => 'files/get-src-package-version'
=== modified file 'gen-config'
--- gen-config 2014-12-17 01:14:12 +0000
+++ gen-config 2015-04-15 13:14:49 +0000
@@ -3,15 +3,23 @@
3set -e3set -e
4set -x4set -x
55
6git_tree="$CHARM_DIR/linux"6juju_unit_name="$JUJU_UNIT_NAME"
7user_email="$(config-get user-email)"7user_email="$(config-get user-email)"
8user_fullname="$(config-get user-fullname)"8user_fullname="$(config-get user-fullname)"
9release="$(config-get release)"
10ilp32_ref_tree="$(config-get ilp32-ref-tree)"
11ilp32_start_ref="$(config-get ilp32-start-ref)"
12ilp32_end_ref="$(config-get ilp32-end-ref)"
913
10mkdir -p /etc/ilp32-rebase14mkdir -p /etc/ilp32-rebase
11cat > /etc/ilp32-rebase/config.new <<EOF15cat > /etc/ilp32-rebase/config.new <<EOF
12GIT_TREE="$git_tree"16JUJU_UNIT_NAME="$juju_unit_name"
13USER_EMAIL="$user_email"17USER_EMAIL="$user_email"
14USER_FULLNAME="$user_fullname"18USER_FULLNAME="$user_fullname"
19RELEASE="$release"
20ILP32_REF_TREE="$ilp32_ref_tree"
21ILP32_START_REF="$ilp32_start_ref"
22ILP32_END_REF="$ilp32_end_ref"
15EOF23EOF
1624
17# Atomically replace to avoid using half-written configs25# Atomically replace to avoid using half-written configs
1826
=== added file 'get-results'
--- get-results 1970-01-01 00:00:00 +0000
+++ get-results 2015-04-15 13:14:49 +0000
@@ -0,0 +1,17 @@
1#!/bin/sh
2#
3# Downloads the results generated by the do-ilp32-rebase script from the juju unit.
4#
5
6source ilp32-rebase-results
7
8ILP32_REBASE_IP=$(juju-deployer -f ilp32-rebase)
9
10juju scp $JUJU_UNIT_NAME:$ILP32_REBASE_DIR/$LINUX_CHANGES
11juju scp $JUJU_UNIT_NAME:$ILP32_REBASE_DIR/$LINUX_DSC
12juju scp $JUJU_UNIT_NAME:$ILP32_REBASE_DIR/$LINUX_DIFF
13juju scp $JUJU_UNIT_NAME:$ILP32_REBASE_DIR/$LINUX_META_CHANGES
14juju scp $JUJU_UNIT_NAME:$ILP32_REBASE_DIR/$LINUX_DSC
15
16git clone --single-branch ssh://$ILP32_REBASE_IP/$LINUX_GIT linux
17git clone --single-branch ssh://$ILP32_REBASE_IP/$LINUX_META_GIT linux-meta
018
=== modified file 'hooks/install'
--- hooks/install 2014-12-17 01:14:12 +0000
+++ hooks/install 2015-04-15 13:14:49 +0000
@@ -5,12 +5,17 @@
55
6apt-get update6apt-get update
7apt-get build-dep -y linux7apt-get build-dep -y linux
8apt-get install -y devscripts dpkg-dev fakeroot git python3-debian
9
10mkdir -m 0755 -p /usr/src/ilp32-rebase
11cd /usr/src/ilp32-rebase
12
8# For the upstream tarball, since this is a non-native package13# For the upstream tarball, since this is a non-native package
9apt-get source --download-only linux14apt-get source --download-only linux
10apt-get install -y devscripts dpkg-dev fakeroot git python3-debian
11apt-get clean15apt-get clean
1216
13rm -rf linux # for indempotency (are install hooks retriable?)17# for indempotency (are install hooks retriable?)
18rm -rf linux
1419
15#20#
16# HACK21# HACK
@@ -25,19 +30,13 @@
25#git clone git://kernel.ubuntu.com/ubuntu/ubuntu-trusty.git linux30#git clone git://kernel.ubuntu.com/ubuntu/ubuntu-trusty.git linux
26git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git31git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
2732
28# Fetch the ubuntu and reference trees. The do-ilp32-rebase script will33# Clone the linux-meta sources
29# fetch new changes, this is just to seed it.34git clone git://kernel.ubuntu.com/ubuntu/ubuntu-trusty-meta.git linux-meta
30cd linux
31git remote add ilp32 git://kernel.ubuntu.com/dannf/trusty-xgene.git
32git fetch ilp32
33git remote add trusty git://kernel.ubuntu.com/ubuntu/ubuntu-trusty.git
34git fetch trusty
35cd -
3635
37# do-ilp32-rebase currently runs outside of juju context, so it can't36# do-ilp32-rebase currently runs outside of juju context, so it can't
38# get-config charm settings itself. Use gen-config to pass those on.37# get-config charm settings itself. Use gen-config to pass those on.
39$CHARM_DIR/gen-config38$CHARM_DIR/gen-config
4039
41# These should be replaced by juju actions when they exist40# These should be replaced by juju actions when they exist
42install -m 755 get-src-package-version /usr/bin41install -m 755 $CHARM_DIR/files/get-src-package-version /usr/bin
43install -m 755 do-ilp32-rebase /usr/bin42install -m 755 $CHARM_DIR/files/do-ilp32-rebase /usr/bin
4443
=== added file 'upload-results'
--- upload-results 1970-01-01 00:00:00 +0000
+++ upload-results 2015-04-15 13:14:49 +0000
@@ -0,0 +1,20 @@
1#!/bin/sh
2#
3# Sign and upload linux and linux-meta to the ilp32 ppa
4# By default, it will upload to the proposed ppa unless
5# "updates" is passed in as the first argument.
6#
7
8source ilp32-rebase-results
9
10debsign $LINUX_CHANGES
11debsign $LINUX_META_CHANGES
12
13if [ "$1" = "updates" ]; then
14 ppa="ppa:ce-hyperscale/ilp32"
15else
16 ppa="ppa:ce-hyperscale/ilp32-proposed"
17fi
18
19dput $ppa $LINUX_CHANGES
20dput $ppa $LINUX_META_CHANGES

Subscribers

People subscribed via source and target branches

to all changes: