Merge lp:~harlowja/cloud-init/cloud-init-git-tarball-make into lp:~cloud-init-dev/cloud-init/trunk

Proposed by Joshua Harlow on 2015-09-16
Status: Rejected
Rejected by: Scott Moser on 2017-06-06
Proposed branch: lp:~harlowja/cloud-init/cloud-init-git-tarball-make
Merge into: lp:~cloud-init-dev/cloud-init/trunk
Diff against target: 56 lines (+25/-13)
1 file modified
tools/make-tarball (+25/-13)
To merge this branch: bzr merge lp:~harlowja/cloud-init/cloud-init-git-tarball-make
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Needs Fixing on 2016-07-22
cloud-init commiters 2015-09-16 Pending
Review via email: mp+271394@code.launchpad.net

Description of the Change

Make tools/make-tarball work under existence of a .git directory (or a .bzr one).

To post a comment you must log in.
review: Needs Fixing (continuous-integration)
Scott Moser (smoser) wrote :

Hello,
Thank you for taking the time to contribute to cloud-init. Cloud-init has moved its revision control system to git. As a result, we are marking all bzr merge proposals as 'rejected'. If you would like to re-submit this proposal for review, please do so by following the current HACKING documentation at http://cloudinit.readthedocs.io/en/latest/topics/hacking.html .

Note, I think the general intent of this patch is already in trunk.

Unmerged revisions

1146. By Joshua Harlow on 2015-09-16

Allow make-tarball to function under git usage

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tools/make-tarball'
2--- tools/make-tarball 2014-02-28 21:19:19 +0000
3+++ tools/make-tarball 2015-09-16 22:03:26 +0000
4@@ -1,4 +1,5 @@
5 #!/bin/sh
6+
7 set -e
8
9 find_root() {
10@@ -18,22 +19,33 @@
11 exit 1;
12 fi
13
14-REVNO=$(bzr revno "$ROOT_DIR")
15+if [ -d "$ROOT_DIR/.git" ]; then
16+ VERSION=$(cd $ROOT_DIR && python setup.py --version)
17+ REVPOSTFIX=""
18+else
19+ REVNO=$(bzr revno "$ROOT_DIR")
20+ REVPOSTFIX="~bzr$REVNO"
21+ VERSION=$("$ROOT_DIR/tools/read-version")
22+fi
23
24 if [ ! -z "$1" ]; then
25 ARCHIVE_FN="$1"
26 else
27- VERSION=$("$ROOT_DIR/tools/read-version")
28- ARCHIVE_FN="$PWD/cloud-init-$VERSION~bzr$REVNO.tar.gz"
29-fi
30-
31-export_uncommitted=""
32-if [ "${UNCOMMITTED:-0}" != "0" ]; then
33- export_uncommitted="--uncommitted"
34-fi
35-
36-bzr export ${export_uncommitted} \
37- --format=tgz --root="cloud-init-$VERSION~bzr$REVNO" \
38- "--revision=${REVNO}" "${ARCHIVE_FN}" "$ROOT_DIR"
39+ ARCHIVE_FN="$PWD/cloud-init-${VERSION}${REVPOSTFIX}.tar.gz"
40+fi
41+
42+if [ -d "$ROOT_DIR/.git" ]; then
43+ git_hash=$(cd $ROOT_DIR && git log --pretty=format:'%h' -n 1)
44+ cd $ROOT_DIR && git archive -o "$ARCHIVE_FN" \
45+ --prefix="cloud-init-${VERSION}${REVPOSTFIX}/" "$git_hash"
46+else
47+ export_uncommitted=""
48+ if [ "${UNCOMMITTED:-0}" != "0" ]; then
49+ export_uncommitted="--uncommitted"
50+ fi
51+ bzr export ${export_uncommitted} \
52+ --format=tgz --root="cloud-init-${VERSION}${REVPOSTFIX}" \
53+ "--revision=${REVNO}" "${ARCHIVE_FN}" "$ROOT_DIR"
54+fi
55
56 echo "$ARCHIVE_FN"