diff options
| author | Michael Forney <mforney@mforney.org> | 2016-12-29 23:29:07 -0800 |
|---|---|---|
| committer | Michael Forney <mforney@mforney.org> | 2016-12-29 23:29:07 -0800 |
| commit | 36c037effc0ce49beaa5e27caed0343e137013a6 (patch) | |
| tree | 9741abb4eb56e15e2f5b819271b082f7ff9c530b | |
| parent | 4a9f8e3cb82e9b04fc7a63146569b997dc01c1e1 (diff) | |
Allow using /.git as output repository
| -rw-r--r-- | build.ninja | 3 | ||||
| -rw-r--r-- | gen.rc | 12 | ||||
| -rw-r--r-- | ninja.rc | 8 | ||||
| -rw-r--r-- | pkg/man-pages-posix/gen.rc | 2 | ||||
| -rw-r--r-- | pkg/tz/gen.rc | 2 | ||||
| -rw-r--r-- | rules.ninja | 10 | ||||
| -rw-r--r-- | scripts/commit.rc | 12 | ||||
| -rw-r--r-- | scripts/tree.rc | 19 |
8 files changed, 36 insertions, 32 deletions
diff --git a/build.ninja b/build.ninja index 45790701..e4fbfa09 100644 --- a/build.ninja +++ b/build.ninja @@ -16,7 +16,8 @@ python = python yacc = yacc zic = zic -repo = root +repo = $builddir/root.git +repo_flags = --bare repo_tag = tree repo_branch = master @@ -5,10 +5,10 @@ subgen util file .perms '$outdir'/root.perms 644 -build '$builddir/$repo.stamp' gitinit -build '$builddir/$repo.tree' gittree '$outdir/root.index' '|' '$builddir/$repo.stamp' ./scripts/tree.rc -build '$builddir/$repo.tar' gitarchive '|' '$builddir/$repo.tree' -build '$builddir/$repo.commit' gitcommit '|' '$builddir/$repo.tree' -build commit phony '$builddir/$repo.commit' +build '$builddir'/root.stamp gitinit +build '$builddir'/root.tree gittree '$outdir'/root.index '|' ./scripts/tree.rc '||' '$builddir'/root.stamp +build '$builddir'/root.tar gitarchive '|' '$builddir'/root.tree +build '$builddir'/root.commit gitcommit '|' '$builddir'/root.tree +build commit phony '$builddir'/root.commit -echo default '$builddir/$repo.tree' +echo default '$builddir'/root.tree @@ -168,9 +168,9 @@ fn waylandproto { fn file { ~ $#* 3 if(~ $dir . util || fs $pkg $1) { - out='$builddir/$repo.hash'/$1 + out='$builddir'/root.hash/$1 mode=`{printf %4s $3 | tr ' ' 0 | tail -c 4} - build $out githash $2 '|' '$builddir/$repo.stamp' scripts/hash.rc ; with\ + build $out githash $2 '|' scripts/hash.rc '||' '$builddir'/root.stamp ; with\ args 10$mode' '$1 index_inputs=($index_inputs $out) @@ -189,8 +189,8 @@ fn dir { fn sym { ~ $#* 2 if(~ $dir . util || fs $pkg $1) { - out='$builddir/$repo.hash'/$1 - build $out githash '|' '$builddir/$repo.stamp' scripts/hash.rc ; with\ + out='$builddir/root.hash'/$1 + build $out githash '|' scripts/hash.rc '||' '$builddir'/root.stamp ; with\ args 120000' '$1' '$2 index_inputs=($index_inputs $out) } diff --git a/pkg/man-pages-posix/gen.rc b/pkg/man-pages-posix/gen.rc index fe97395a..22a16525 100644 --- a/pkg/man-pages-posix/gen.rc +++ b/pkg/man-pages-posix/gen.rc @@ -1,4 +1,4 @@ -rule manpages 'rc ./$dir/manpages.rc $builddir/$repo.git $out $srcdir $outdir' ; with\ +rule manpages 'rc ./$dir/manpages.rc $repo $out $srcdir $outdir' ; with\ deps gcc\ depfile '$out.d' build '$outdir'/manpages.index manpages '|' '$dir'/manpages.rc config.rc '||' '$outdir'/fetch.stamp diff --git a/pkg/tz/gen.rc b/pkg/tz/gen.rc index b2a9377e..e86c8ef9 100644 --- a/pkg/tz/gen.rc +++ b/pkg/tz/gen.rc @@ -20,7 +20,7 @@ tzdata=(\ factory\ ) build '$outdir'/tzdata.index awk '$srcdir'/$tzdata '|' scripts/hash.rc '$dir/tzdata.awk' ; with\ - expr '-f $dir/tzdata.awk out=$outdir/zoneinfo repo=$builddir/$repo.git' + expr '-f $dir/tzdata.awk out=$outdir/zoneinfo repo=$repo' index_inputs=($index_inputs '$outdir'/tzdata.index) fetch git diff --git a/rules.ninja b/rules.ninja index 41e2cd9c..2627c0c1 100644 --- a/rules.ninja +++ b/rules.ninja @@ -68,20 +68,20 @@ rule waylandproto command = wayland-scanner $type $in $out.tmp && mv $out.tmp $out rule githash - command = rc ./scripts/hash.rc $builddir/$repo.git $args $in >$out.tmp && mv $out.tmp $out + command = rc ./scripts/hash.rc $repo $args $in >$out.tmp && mv $out.tmp $out rule gittree - command = rc ./scripts/tree.rc $builddir/$repo.git $repo_tag $in $out + command = rc ./scripts/tree.rc $repo $repo_tag $in $out restat = 1 rule gitcommit - command = rc ./scripts/commit.rc $builddir/$repo.git $repo_branch $repo_tag $out + command = rc ./scripts/commit.rc $repo $repo_branch $repo_tag $out rule gitarchive - command = git -C $builddir/$repo.git archive -o $$PWD/$out $repo_tag + command = git -C $repo archive -o $$PWD/$out $repo_tag rule gitinit - command = mkdir -p $builddir/$repo.git && git -C $builddir/$repo.git init --bare && touch $out + command = git init $repo_flags $repo && touch $out rule fetchcurl command = rc ./scripts/fetch-curl.rc $dir $args && touch $out diff --git a/scripts/commit.rc b/scripts/commit.rc index e7b5d468..870d7ab3 100644 --- a/scripts/commit.rc +++ b/scripts/commit.rc @@ -9,13 +9,11 @@ out=$4 fn checkstatus {} -wd=`{pwd} -cd $repo - -if([ -f refs/heads/$branch ]) parent=(-p $branch) +if(git -C $repo show-ref -q --verify refs/heads/$branch) + parent=(-p $branch) if not parent=() message='oasis built by '`{id -un} -commit=`{echo $message | git commit-tree $tag $parent} ; checkstatus -git update-ref refs/heads/$branch $commit -ln -f refs/heads/$branch $wd/$out +commit=`{echo $message | git -C $repo commit-tree $tag $parent} ; checkstatus +git -C $repo update-ref refs/heads/$branch $commit +echo $commit > $out.tmp && mv $out.tmp $out diff --git a/scripts/tree.rc b/scripts/tree.rc index 81f641c6..bbc2bd34 100644 --- a/scripts/tree.rc +++ b/scripts/tree.rc @@ -9,11 +9,16 @@ out=$4 fn checkstatus {} -wd=`{pwd} -cd $repo +git -C $repo read-tree --empty +git -C $repo update-index --index-info <$index +tree=`{git -C $repo write-tree} ; checkstatus +git -C $repo update-ref refs/tags/$tag $tree -git read-tree --empty -git update-index --index-info <$wd/$index -tree=`{git write-tree} ; checkstatus -git update-ref refs/tags/$tag $tree -ln -f refs/tags/$tag $wd/$out +if([ -e $out ]) { + oldtree=`{cat $out} ; checkstatus + if(~ $tree $oldtree) + exit 0 +} + +echo $tree >$out.tmp +mv $out.tmp $out |
