summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2012-06-29 12:00:42 +0100
committerRichard Maw <richard.maw@codethink.co.uk>2012-06-29 12:00:42 +0100
commit037aadafa59ed46ddac4a9c76d6a1f495cc44a12 (patch)
tree40e7219a08956523be581e636619ac7a8a581ce9
parent0029fee3e447d576cbcde8025fbba91eddc31892 (diff)
parentfee76889e3c5634bc759ed6c9b7056dc10b71a4c (diff)
downloadmorph-037aadafa59ed46ddac4a9c76d6a1f495cc44a12.tar.gz
Merge branch 'liw/remove-implicit-build-depends' of roadtrain.codethink.co.uk:baserock/morph
-rw-r--r--README7
-rwxr-xr-xmorphlib/app.py13
-rw-r--r--morphlib/bins.py16
-rw-r--r--morphlib/bins_tests.py2
-rwxr-xr-xtests.as-root/arm-system-writes-kernel.script6
-rwxr-xr-xtests.as-root/make-patch.script6
-rwxr-xr-xtests.as-root/setup3
-rwxr-xr-xtests.as-root/system-overlap.script12
-rw-r--r--tests.branching/edit-updates-stratum.stdout11
-rwxr-xr-xtests.branching/setup3
-rwxr-xr-xtests/build-stratum-with-submodules.script3
-rwxr-xr-xtests/morphless-chunks.script3
-rwxr-xr-xtests/setup3
-rwxr-xr-xtests/stratum-overlap-warns.setup12
14 files changed, 74 insertions, 26 deletions
diff --git a/README b/README
index 82d7d3cb..06409919 100644
--- a/README
+++ b/README
@@ -119,7 +119,7 @@ For strata, use the following fields:
chunk name), `ref` identifies the commit to use (typically a branch
name, but any tree-ish git accepts is ok), and `morph` is the name
of the morphology to use and is optional. In addition to these keys,
- each of the sources may specify a list of build dependencies using the
+ each of the sources MUST specify a list of build dependencies using the
`build-depends` field. This field may be omitted to make the source
depend on all other chunks that are listed earlier in the `sources`
list. The field may be an empty list to indicate that the chunk does
@@ -161,13 +161,14 @@ Example stratum:
"sources": [
{
"name": "fhs-dirs",
- "ref": "baserock/bootstrap"
+ "ref": "baserock/bootstrap",
+ "build-depends": [],
},
{
"name": "linux-api-headers",
"repo": "linux",
"ref": "baserock/morph",
- "build-depends": []
+ "build-depends": ["fhs-dirs"]
},
{
"name": "eglibc",
diff --git a/morphlib/app.py b/morphlib/app.py
index 851ee058..a8cad8a2 100755
--- a/morphlib/app.py
+++ b/morphlib/app.py
@@ -458,7 +458,20 @@ class Morph(cliapp.Application):
def _create_source_pool(self, lrc, rrc, triplet):
pool = morphlib.sourcepool.SourcePool()
+
+ def check_stratum(filename, morphology):
+ for source in morphology['sources']:
+ if source.get('build-depends', None) is None:
+ name = source.get('name', source.get('repo', 'unknown'))
+ raise morphlib.Error('No build dependencies '
+ 'stratum %s for chunk %s '
+ '(build-depends is a mandatory '
+ 'field)' %
+ (filename, name))
+
def add_to_pool(reponame, ref, filename, absref, morphology):
+ if morphology['kind'] == 'stratum':
+ check_stratum(filename, morphology)
source = morphlib.source.Source(reponame, ref, absref,
morphology, filename)
pool.add(source)
diff --git a/morphlib/bins.py b/morphlib/bins.py
index 0c9ecadf..ce17d0a1 100644
--- a/morphlib/bins.py
+++ b/morphlib/bins.py
@@ -42,6 +42,12 @@ def create_chunk(rootdir, f, regexps, dump_memory_profile=None):
'''
dump_memory_profile = dump_memory_profile or (lambda msg: None )
+
+ # This timestamp is used to normalize the mtime for every file in
+ # chunk artifact. This is useful to avoid problems from smallish
+ # clock skew. It needs to be recent enough, however, that GNU tar
+ # does not complain about an implausibly old timestamp.
+ normalized_timestamp = 683074800
def mkrel(filename):
assert filename.startswith(rootdir)
@@ -82,7 +88,15 @@ def create_chunk(rootdir, f, regexps, dump_memory_profile=None):
include = sorted(include) # get dirs before contents
tar = tarfile.open(fileobj=f, mode='w:gz')
for filename in include:
- tar.add(filename, arcname=mkrel(filename), recursive=False)
+ # Normalize mtime for everything.
+ tarinfo = tar.gettarinfo(filename, arcname=mkrel(filename))
+ tarinfo.ctime = normalized_timestamp
+ tarinfo.mtime = normalized_timestamp
+ if tarinfo.isreg():
+ with open(filename, 'rb') as f:
+ tar.addfile(tarinfo, fileobj=f)
+ else:
+ tar.addfile(tarinfo)
tar.close()
include.remove(rootdir)
diff --git a/morphlib/bins_tests.py b/morphlib/bins_tests.py
index 544e9013..2333bedc 100644
--- a/morphlib/bins_tests.py
+++ b/morphlib/bins_tests.py
@@ -56,7 +56,7 @@ class BinsTest(unittest.TestCase):
if stat.S_ISDIR(st.st_mode):
return (st.st_mode, 0, 0)
else:
- return (st.st_mode, st.st_size, st.st_mtime)
+ return (st.st_mode, st.st_size, 0)
result = []
diff --git a/tests.as-root/arm-system-writes-kernel.script b/tests.as-root/arm-system-writes-kernel.script
index 500cedba..2a837af4 100755
--- a/tests.as-root/arm-system-writes-kernel.script
+++ b/tests.as-root/arm-system-writes-kernel.script
@@ -45,12 +45,14 @@ cat <<EOF >arm-stratum.morph
{
"name": "hello",
"repo": "test:chunk-repo",
- "ref": "farrokh"
+ "ref": "farrokh",
+ "build-depends": []
},
{
"name": "linux",
"repo": "test:kernel-repo",
- "ref": "arm"
+ "ref": "arm",
+ "build-depends": ["hello"]
}
]
}
diff --git a/tests.as-root/make-patch.script b/tests.as-root/make-patch.script
index d312cb55..b5385fc0 100755
--- a/tests.as-root/make-patch.script
+++ b/tests.as-root/make-patch.script
@@ -28,12 +28,14 @@ cat <<EOF > "$DATADIR/morphs-repo/hello-stratum.morph"
{
"name": "hello",
"repo": "test:chunk-repo",
- "ref": "farrokh"
+ "ref": "farrokh",
+ "build-depends": []
},
{
"name": "linux",
"repo": "test:kernel-repo",
- "ref": "master"
+ "ref": "master",
+ "build-depends": ["hello"]
}
]
}
diff --git a/tests.as-root/setup b/tests.as-root/setup
index 1d32b14d..2ee2d7fa 100755
--- a/tests.as-root/setup
+++ b/tests.as-root/setup
@@ -94,7 +94,8 @@ cat <<EOF > hello-stratum.morph
{
"name": "hello",
"repo": "test:chunk-repo",
- "ref": "farrokh"
+ "ref": "farrokh",
+ "build-depends": []
}
]
}
diff --git a/tests.as-root/system-overlap.script b/tests.as-root/system-overlap.script
index 71b55e24..b6e3238e 100755
--- a/tests.as-root/system-overlap.script
+++ b/tests.as-root/system-overlap.script
@@ -45,12 +45,14 @@ cat <<EOF >foo-baz-stratum.morph
{
"name": "overlap-foo-baz",
"repo": "test:chunk-repo",
- "ref": "overlap"
+ "ref": "overlap",
+ "build-depends": []
},
{
"name": "linux",
"repo": "test:kernel-repo",
- "ref": "master"
+ "ref": "master",
+ "build-depends": ["overlap-foo-baz"]
}
]
}
@@ -63,12 +65,14 @@ cat <<EOF >foo-barqux-stratum.morph
{
"name": "overlap-foobar",
"repo": "test:chunk-repo",
- "ref": "overlap"
+ "ref": "overlap",
+ "build-depends": []
},
{
"name": "overlap-fooqux",
"repo": "test:chunk-repo",
- "ref": "overlap"
+ "ref": "overlap",
+ "build-depends": ["overlap-foobar"]
}
]
}
diff --git a/tests.branching/edit-updates-stratum.stdout b/tests.branching/edit-updates-stratum.stdout
index 7dd3a8e2..71038a16 100644
--- a/tests.branching/edit-updates-stratum.stdout
+++ b/tests.branching/edit-updates-stratum.stdout
@@ -1,8 +1,8 @@
diff --git a/hello-stratum.morph b/hello-stratum.morph
-index d7c0afe..af63df7 100644
+index 77fb1d0..c5ed672 100644
--- a/hello-stratum.morph
+++ b/hello-stratum.morph
-@@ -1,10 +1,13 @@
+@@ -1,12 +1,14 @@
{
- "name": "hello-stratum",
- "kind": "stratum",
@@ -13,10 +13,13 @@ index d7c0afe..af63df7 100644
{
- "name": "hello",
- "ref": "master",
-+ "build-depends": null,
+- "repo": "baserock:hello",
+- "build-depends": []
++ "build-depends": [],
+ "morph": "hello",
+ "name": "hello",
+ "ref": "newbranch",
- "repo": "baserock:hello"
++ "repo": "baserock:hello"
}
]
+ }
diff --git a/tests.branching/setup b/tests.branching/setup
index 714be9da..3b9e7e7b 100755
--- a/tests.branching/setup
+++ b/tests.branching/setup
@@ -63,7 +63,8 @@ cat <<EOF > "$DATADIR/morphs/hello-stratum.morph"
{
"name": "hello",
"ref": "master",
- "repo": "baserock:hello"
+ "repo": "baserock:hello",
+ "build-depends": []
}
]
}
diff --git a/tests/build-stratum-with-submodules.script b/tests/build-stratum-with-submodules.script
index 7d44caf6..c2d97817 100755
--- a/tests/build-stratum-with-submodules.script
+++ b/tests/build-stratum-with-submodules.script
@@ -53,7 +53,8 @@ cat <<EOF > "$morphs/submod-stratum.morph"
{
"name": "parent",
"repo": "test:parent-repo",
- "ref": "master"
+ "ref": "master",
+ "build-depends": []
}
]
}
diff --git a/tests/morphless-chunks.script b/tests/morphless-chunks.script
index 584a4e09..956bd7c1 100755
--- a/tests/morphless-chunks.script
+++ b/tests/morphless-chunks.script
@@ -48,7 +48,8 @@ cat << EOF > alfred.morph
{
"name": "morphless",
"repo": "test:morphless",
- "ref": "master"
+ "ref": "master",
+ "build-depends": []
}
]
}
diff --git a/tests/setup b/tests/setup
index 5a6668a3..179502f8 100755
--- a/tests/setup
+++ b/tests/setup
@@ -94,7 +94,8 @@ cat <<EOF > hello-stratum.morph
{
"name": "hello",
"repo": "test:chunk-repo",
- "ref": "farrokh"
+ "ref": "farrokh",
+ "build-depends": []
}
]
}
diff --git a/tests/stratum-overlap-warns.setup b/tests/stratum-overlap-warns.setup
index 94aed05a..4dff3ddb 100755
--- a/tests/stratum-overlap-warns.setup
+++ b/tests/stratum-overlap-warns.setup
@@ -33,22 +33,26 @@ cat <<EOF >overlap-stratum.morph
{
"name": "dirs",
"repo": "test:chunk-repo",
- "ref": "overlap"
+ "ref": "overlap",
+ "build-depends": []
},
{
"name": "overlap-foobar",
"repo": "test:chunk-repo",
- "ref": "overlap"
+ "ref": "overlap",
+ "build-depends": ["dirs"]
},
{
"name": "overlap-fooqux",
"repo": "test:chunk-repo",
- "ref": "overlap"
+ "ref": "overlap",
+ "build-depends": ["overlap-foobar"]
},
{
"name": "overlap-foo-baz",
"repo": "test:chunk-repo",
- "ref": "overlap"
+ "ref": "overlap",
+ "build-depends": ["overlap-fooqux"]
}
]
}