From 70170d29142a539d6579c68d2363027f686ca3c5 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Tue, 9 May 2017 21:16:02 -0600 Subject: [PATCH 01/12] Add version to drivers, remove /sbin staging --- pkgutils | 2 +- recipes/drivers/recipe.sh | 6 +++++- recipes/orbital/recipe.sh | 1 - 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pkgutils b/pkgutils index 4cf2e9d21..b9c10c980 160000 --- a/pkgutils +++ b/pkgutils @@ -1 +1 @@ -Subproject commit 4cf2e9d216721282a8f2bb82c031ee90ede878f4 +Subproject commit b9c10c980e1724270b7e90d3c2d4999c398814b8 diff --git a/recipes/drivers/recipe.sh b/recipes/drivers/recipe.sh index c4648ebad..1a6400064 100644 --- a/recipes/drivers/recipe.sh +++ b/recipes/drivers/recipe.sh @@ -1,6 +1,10 @@ GIT=https://github.com/redox-os/drivers CARGOFLAGS=--all -BINDIR="/sbin" + +function recipe_version { + echo "0.1.0" + return 1 +} function recipe_update { cp ../Cargo.toml ./ diff --git a/recipes/orbital/recipe.sh b/recipes/orbital/recipe.sh index d823bef79..be4992a37 100644 --- a/recipes/orbital/recipe.sh +++ b/recipes/orbital/recipe.sh @@ -1,2 +1 @@ GIT=https://github.com/redox-os/orbital.git -BINDIR="/sbin" From bacdbc0f304a53aecd149c430b6753d19ab1873a Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Tue, 9 May 2017 21:45:03 -0600 Subject: [PATCH 02/12] Add more recipes --- recipes/drivers/recipe.sh | 2 +- recipes/netstack/recipe.sh | 1 + recipes/ptyd/recipe.sh | 1 + recipes/randd/recipe.sh | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 recipes/netstack/recipe.sh create mode 100644 recipes/ptyd/recipe.sh create mode 100644 recipes/randd/recipe.sh diff --git a/recipes/drivers/recipe.sh b/recipes/drivers/recipe.sh index 1a6400064..b43142765 100644 --- a/recipes/drivers/recipe.sh +++ b/recipes/drivers/recipe.sh @@ -1,4 +1,4 @@ -GIT=https://github.com/redox-os/drivers +GIT=https://github.com/redox-os/drivers.git CARGOFLAGS=--all function recipe_version { diff --git a/recipes/netstack/recipe.sh b/recipes/netstack/recipe.sh new file mode 100644 index 000000000..190f9487c --- /dev/null +++ b/recipes/netstack/recipe.sh @@ -0,0 +1 @@ +GIT=https://github.com/redox-os/netstack.git diff --git a/recipes/ptyd/recipe.sh b/recipes/ptyd/recipe.sh new file mode 100644 index 000000000..a3c336ef1 --- /dev/null +++ b/recipes/ptyd/recipe.sh @@ -0,0 +1 @@ +GIT=https://github.com/redox-os/ptyd.git diff --git a/recipes/randd/recipe.sh b/recipes/randd/recipe.sh new file mode 100644 index 000000000..29f1ef75b --- /dev/null +++ b/recipes/randd/recipe.sh @@ -0,0 +1 @@ +GIT=https://github.com/redox-os/randd.git From b3c50f1aa138827a75118d5531dd549314637ede Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Wed, 10 May 2017 19:34:16 -0600 Subject: [PATCH 03/12] Add contain --- recipes/contain/recipe.sh | 1 + 1 file changed, 1 insertion(+) create mode 100644 recipes/contain/recipe.sh diff --git a/recipes/contain/recipe.sh b/recipes/contain/recipe.sh new file mode 100644 index 000000000..60d7e75df --- /dev/null +++ b/recipes/contain/recipe.sh @@ -0,0 +1 @@ +GIT=https://github.com/redox-os/contain.git From 06b260967e1af61ad4b1336d4b5090618d2dea1b Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Wed, 10 May 2017 19:41:30 -0600 Subject: [PATCH 04/12] Add RedoxFS --- recipes/redoxfs/recipe.sh | 1 + 1 file changed, 1 insertion(+) create mode 100644 recipes/redoxfs/recipe.sh diff --git a/recipes/redoxfs/recipe.sh b/recipes/redoxfs/recipe.sh new file mode 100644 index 000000000..9b8b0406e --- /dev/null +++ b/recipes/redoxfs/recipe.sh @@ -0,0 +1 @@ +GIT=https://github.com/redox-os/redoxfs.git From 0506e3602e7e59de94a0e6c200d9aef82fe8e82c Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Wed, 10 May 2017 19:48:00 -0600 Subject: [PATCH 05/12] Add installer --- recipes/installer/recipe.sh | 1 + 1 file changed, 1 insertion(+) create mode 100644 recipes/installer/recipe.sh diff --git a/recipes/installer/recipe.sh b/recipes/installer/recipe.sh new file mode 100644 index 000000000..398e4f022 --- /dev/null +++ b/recipes/installer/recipe.sh @@ -0,0 +1 @@ +GIT=https://github.com/redox-os/installer.git From 1fb6beca6361c2642b8829b9ddf922299c1984d6 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Wed, 10 May 2017 21:50:41 -0600 Subject: [PATCH 06/12] Stage pcid.toml --- recipes/drivers/Cargo.toml | 14 -------------- recipes/drivers/recipe.sh | 7 ++++--- 2 files changed, 4 insertions(+), 17 deletions(-) delete mode 100644 recipes/drivers/Cargo.toml diff --git a/recipes/drivers/Cargo.toml b/recipes/drivers/Cargo.toml deleted file mode 100644 index 4b13eaf78..000000000 --- a/recipes/drivers/Cargo.toml +++ /dev/null @@ -1,14 +0,0 @@ -[workspace] -members = [ - "ahcid", - "alxd", - "bgad", - "e1000d", - "nvmed", - "pcid", - "ps2d", - "rtl8168d", - "vboxd", - "vesad", - "xhcid" -] diff --git a/recipes/drivers/recipe.sh b/recipes/drivers/recipe.sh index b43142765..cdbba51c3 100644 --- a/recipes/drivers/recipe.sh +++ b/recipes/drivers/recipe.sh @@ -2,10 +2,11 @@ GIT=https://github.com/redox-os/drivers.git CARGOFLAGS=--all function recipe_version { - echo "0.1.0" + echo "0.1.1" return 1 } -function recipe_update { - cp ../Cargo.toml ./ +function recipe_stage { + mkdir -pv "$1/etc" + cp -v pcid.toml "$1/etc/pcid.toml" } From 714bc32f1712c31a840aba4ceed30d37dc1e8eea Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Wed, 10 May 2017 21:20:13 -0700 Subject: [PATCH 07/12] Do not copy .cargo and libc-artifacts Cargo searches parent directories for .cargo, so this is unnecessary. --- cook.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cook.sh b/cook.sh index ddc4fbaae..0c45d336c 100755 --- a/cook.sh +++ b/cook.sh @@ -135,7 +135,7 @@ function op { fi if [ "$skip" -eq "0" ] then - cp -r "$ROOT/Xargo.toml" "$ROOT/.cargo" "$ROOT/libc-artifacts" . + cp -r "$ROOT/Xargo.toml" . xargo build --target "$TARGET" --release $CARGOFLAGS fi popd > /dev/null @@ -149,7 +149,7 @@ function op { fi if [ "$skip" -eq "0" ] then - cp -r "$ROOT/Xargo.toml" "$ROOT/.cargo" "$ROOT/libc-artifacts" . + cp -r "$ROOT/Xargo.toml" . xargo test --no-run --target "$TARGET" --release $CARGOFLAGS fi popd > /dev/null From 925eaba3a042a9d04817bbb0af31612c7b0f3d3b Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Thu, 11 May 2017 20:29:07 -0600 Subject: [PATCH 08/12] Move update-packages into repo command, use source timestamps --- config.sh | 9 ++++++++ cook.sh | 31 +++---------------------- repo.sh | 57 ++++++++++++++++++++++++++++++++++++++++++++++ update-packages.sh | 40 -------------------------------- 4 files changed, 69 insertions(+), 68 deletions(-) create mode 100755 config.sh create mode 100755 repo.sh delete mode 100755 update-packages.sh diff --git a/config.sh b/config.sh new file mode 100755 index 000000000..bab886f90 --- /dev/null +++ b/config.sh @@ -0,0 +1,9 @@ +#!/bin/bash -e + +# Configuration +export TARGET=x86_64-unknown-redox + +# Automatic variables +ROOT="$(cd `dirname "$0"` && pwd)" +REPO="$ROOT/repo/$TARGET" +export CC="$ROOT/libc-artifacts/gcc.sh" diff --git a/cook.sh b/cook.sh index ddc4fbaae..f6d5f80bf 100755 --- a/cook.sh +++ b/cook.sh @@ -1,19 +1,11 @@ -#!/bin/bash +#!/bin/bash -e -# Configuration -export TARGET=x86_64-unknown-redox - -# Automatic variables -ROOT="$(cd `dirname "$0"` && pwd)" -REPO="$ROOT/repo/$TARGET" -export CC="$ROOT/libc-artifacts/gcc.sh" +source config.sh # Variables to be overriden by recipes export BINDIR=bin export CARGOFLAGS= -set -e - function usage { echo "cook.sh $1 " >&2 echo " dist" >&2 @@ -222,24 +214,7 @@ function op { if [ -n "$1" ] then - if [ "$1" = "repo" ] - then - if [ ! "$COOK_QUIET" = "1" ] - then - echo -e "\033[01;38;5;215mcook - repo\033[0m" >&2 - fi - - echo "[packages]" > "$REPO/repo.toml" - for toml in "$REPO/"*".toml" - do - package="$(basename "$toml" .toml)" - if [ "$package" != "repo" ] - then - version="$(grep version "$toml" | cut -d '=' -f2-)" - echo "$package =$version" >> "$REPO/repo.toml" - fi - done - elif [ -d "$ROOT/recipes/$1" ] + if [ -d "$ROOT/recipes/$1" ] then cd "$ROOT/recipes/$1" source recipe.sh diff --git a/repo.sh b/repo.sh new file mode 100755 index 000000000..0c94fd7b0 --- /dev/null +++ b/repo.sh @@ -0,0 +1,57 @@ +#!/bin/bash -e + +source config.sh + +if [ $# = 0 ] +then + recipes="$(ls -1 recipes)" +else + recipes="$@" +fi + +for recipe in $recipes +do + if [ ! -d "recipes/$recipe/source" ] + then + echo -e "\033[01;38;5;215mrepo - fetching and updating $recipe\033[0m" >&2 + ./cook.sh "$recipe" fetch + fi + + if [ ! -f "recipes/$recipe/stage.tar" ] + then + echo -e "\033[01;38;5;215mrepo - building $recipe\033[0m" >&2 + ./cook.sh $recipe update build stage tar + else + TIME_SOURCE="$(find recipes/$recipe/source -printf "%Ts\n" | sort -nr | head -n 1)" + TIME_STAGE="$(stat -c "%Y" recipes/$recipe/stage.tar)" + if [ "$TIME_SOURCE" -ge "$TIME_STAGE" ] + then + echo -e "\033[01;38;5;215mrepo - rebuilding $recipe\033[0m" >&2 + ./cook.sh "$recipe" untar unstage update build stage tar + else + echo -e "\033[01;38;5;215mrepo - $recipe up to date\033[0m" >&2 + fi + fi +done + +for recipe in $recipes +do + if [ "recipes/$recipe/stage.tar" -nt "$REPO/$recipe.tar" ] + then + echo -e "\033[01;38;5;215mrepo - publishing $recipe\033[0m" >&2 + ./cook.sh $recipe publish + fi +done + +echo -e "\033[01;38;5;215mrepo - generating repo.toml\033[0m" >&2 + +echo "[packages]" > "$REPO/repo.toml" +for toml in "$REPO/"*".toml" +do + package="$(basename "$toml" .toml)" + if [ "$package" != "repo" ] + then + version="$(grep version "$toml" | cut -d '=' -f2-)" + echo "$package =$version" >> "$REPO/repo.toml" + fi +done diff --git a/update-packages.sh b/update-packages.sh deleted file mode 100755 index 0109dd234..000000000 --- a/update-packages.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -set -e - -if [ $# = 0 ] -then - recipes=$(ls -1 recipes) -else - recipes=$@ -fi - -publish="" -for recipe in $recipes -do - if [ ! -f "recipes/$recipe/stage.tar" ] - then - echo "$recipe: building..." - ./cook.sh $recipe dist - publish="${publish} $recipe" - else - oldver=$(COOK_QUIET=1 ./cook.sh $recipe gitversion) - ./cook.sh $recipe fetch - newver=$(COOK_QUIET=1 ./cook.sh $recipe gitversion) - if [ "$oldver" = "$newver" ] - then - echo "$recipe: up to date (version $newver)." - else - echo "$recipe: updating $oldver -> $newver..." - ./cook.sh $recipe unstage untar dist - publish="${publish} $recipe" - fi - fi -done - -for recipe in $publish -do - ./cook.sh $recipe publish -done - -./cook.sh repo From 362af48613c370ec10cedda4bf97df0b9323ad95 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Thu, 11 May 2017 20:53:21 -0600 Subject: [PATCH 09/12] Ignore git directory, move fetch logic into seperate file --- fetch.sh | 16 ++++++++++++++++ repo.sh | 8 +------- 2 files changed, 17 insertions(+), 7 deletions(-) create mode 100755 fetch.sh diff --git a/fetch.sh b/fetch.sh new file mode 100755 index 000000000..a1f111092 --- /dev/null +++ b/fetch.sh @@ -0,0 +1,16 @@ +#!/bin/bash -e + +source config.sh + +if [ $# = 0 ] +then + recipes="$(ls -1 recipes)" +else + recipes="$@" +fi + +for recipe in $recipes +do + echo -e "\033[01;38;5;215mfetch - fetching $recipe\033[0m" >&2 + ./cook.sh "$recipe" fetch +done diff --git a/repo.sh b/repo.sh index 0c94fd7b0..5c042fdf3 100755 --- a/repo.sh +++ b/repo.sh @@ -11,18 +11,12 @@ fi for recipe in $recipes do - if [ ! -d "recipes/$recipe/source" ] - then - echo -e "\033[01;38;5;215mrepo - fetching and updating $recipe\033[0m" >&2 - ./cook.sh "$recipe" fetch - fi - if [ ! -f "recipes/$recipe/stage.tar" ] then echo -e "\033[01;38;5;215mrepo - building $recipe\033[0m" >&2 ./cook.sh $recipe update build stage tar else - TIME_SOURCE="$(find recipes/$recipe/source -printf "%Ts\n" | sort -nr | head -n 1)" + TIME_SOURCE="$(find recipes/$recipe/source -type f -not -path '*/.git*' -printf "%Ts\n" | sort -nr | head -n 1)" TIME_STAGE="$(stat -c "%Y" recipes/$recipe/stage.tar)" if [ "$TIME_SOURCE" -ge "$TIME_STAGE" ] then From b3ad568eda0530ae94964d9e3210236478334414 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Thu, 11 May 2017 20:54:12 -0600 Subject: [PATCH 10/12] Keep fetch logic if source does not exist --- repo.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/repo.sh b/repo.sh index 5c042fdf3..274937667 100755 --- a/repo.sh +++ b/repo.sh @@ -11,6 +11,12 @@ fi for recipe in $recipes do + if [ ! -d "recipes/$recipe/source" ] + then + echo -e "\033[01;38;5;215mrepo - fetching $recipe\033[0m" >&2 + ./cook.sh "$recipe" fetch + fi + if [ ! -f "recipes/$recipe/stage.tar" ] then echo -e "\033[01;38;5;215mrepo - building $recipe\033[0m" >&2 From a48475e408eb5d291bbd358379d5903214b55a06 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Fri, 12 May 2017 20:26:09 -0600 Subject: [PATCH 11/12] Improve rebuild logic --- cook.sh | 22 ++++++++++++---------- repo.sh | 32 +++++++++++++++++++++++--------- 2 files changed, 35 insertions(+), 19 deletions(-) diff --git a/cook.sh b/cook.sh index 5956919d4..c2b2e2548 100755 --- a/cook.sh +++ b/cook.sh @@ -14,6 +14,8 @@ function usage { echo " clean" >&2 echo " fetch" >&2 echo " unfetch" >&2 + echo " prepare" >&2 + echo " unprepare" >&2 echo " publish" >&2 echo " unpublish" >&2 echo " stage" >&2 @@ -32,7 +34,7 @@ function op { case "$2" in dist) - op $1 fetch + op $1 prepare op $1 update op $1 build op $1 stage @@ -41,7 +43,7 @@ function op { distclean) op $1 untar op $1 unstage - op $1 unfetch + op $1 unprepare ;; fetch) if [ -n "$TAR" ] @@ -56,9 +58,6 @@ function op { mkdir source tar xvf source.tar -C source --strip-components 1 fi - - rm -rf build - cp -r source build elif [ -n "$GIT" ] then if [ ! -d source ] @@ -71,19 +70,22 @@ function op { git submodule sync git submodule update --init --recursive popd > /dev/null - - rm -rf build - cp -r source build fi - ;; unfetch) - rm -rfv build source + rm -rfv source if [ -n "$TAR" ] then rm -f source.tar fi ;; + prepare) + rm -rf build + cp -r source build + ;; + unprepare) + rm -rf build + ;; version) pushd build > /dev/null skip="0" diff --git a/repo.sh b/repo.sh index 274937667..c57c71897 100755 --- a/repo.sh +++ b/repo.sh @@ -17,19 +17,33 @@ do ./cook.sh "$recipe" fetch fi - if [ ! -f "recipes/$recipe/stage.tar" ] + if [ ! -d "recipes/$recipe/build" ] then - echo -e "\033[01;38;5;215mrepo - building $recipe\033[0m" >&2 - ./cook.sh $recipe update build stage tar + echo -e "\033[01;38;5;155mrepo - preparing $recipe\033[0m" >&2 + ./cook.sh "$recipe" prepare else TIME_SOURCE="$(find recipes/$recipe/source -type f -not -path '*/.git*' -printf "%Ts\n" | sort -nr | head -n 1)" - TIME_STAGE="$(stat -c "%Y" recipes/$recipe/stage.tar)" - if [ "$TIME_SOURCE" -ge "$TIME_STAGE" ] + TIME_BUILD="$(find recipes/$recipe/build -type f -not -path '*/.git*' -printf "%Ts\n" | sort -nr | head -n 1)" + if [ "$TIME_SOURCE" -gt "$TIME_BUILD" ] then - echo -e "\033[01;38;5;215mrepo - rebuilding $recipe\033[0m" >&2 + echo -e "\033[01;38;5;155mrepo - repreparing $recipe\033[0m" >&2 + ./cook.sh "$recipe" unprepare prepare + fi + fi + + if [ ! -f "recipes/$recipe/stage.tar" ] + then + echo -e "\033[01;38;5;155mrepo - building $recipe\033[0m" >&2 + ./cook.sh "$recipe" update build stage tar + else + TIME_BUILD="$(find recipes/$recipe/build -type f -not -path '*/.git*' -printf "%Ts\n" | sort -nr | head -n 1)" + TIME_STAGE="$(stat -c "%Y" recipes/$recipe/stage.tar)" + if [ "$TIME_BUILD" -gt "$TIME_STAGE" ] + then + echo -e "\033[01;38;5;155mrepo - rebuilding $recipe\033[0m" >&2 ./cook.sh "$recipe" untar unstage update build stage tar else - echo -e "\033[01;38;5;215mrepo - $recipe up to date\033[0m" >&2 + echo -e "\033[01;38;5;155mrepo - $recipe up to date\033[0m" >&2 fi fi done @@ -38,12 +52,12 @@ for recipe in $recipes do if [ "recipes/$recipe/stage.tar" -nt "$REPO/$recipe.tar" ] then - echo -e "\033[01;38;5;215mrepo - publishing $recipe\033[0m" >&2 + echo -e "\033[01;38;5;155mrepo - publishing $recipe\033[0m" >&2 ./cook.sh $recipe publish fi done -echo -e "\033[01;38;5;215mrepo - generating repo.toml\033[0m" >&2 +echo -e "\033[01;38;5;155mrepo - generating repo.toml\033[0m" >&2 echo "[packages]" > "$REPO/repo.toml" for toml in "$REPO/"*".toml" From b91b2762d6360da65703631f4b733ea38c5b47e5 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Fri, 12 May 2017 20:28:43 -0600 Subject: [PATCH 12/12] Update pkgutils, remove print from fetch.sh --- fetch.sh | 1 - pkgutils | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/fetch.sh b/fetch.sh index a1f111092..ca8906787 100755 --- a/fetch.sh +++ b/fetch.sh @@ -11,6 +11,5 @@ fi for recipe in $recipes do - echo -e "\033[01;38;5;215mfetch - fetching $recipe\033[0m" >&2 ./cook.sh "$recipe" fetch done diff --git a/pkgutils b/pkgutils index b9c10c980..e8b316a8d 160000 --- a/pkgutils +++ b/pkgutils @@ -1 +1 @@ -Subproject commit b9c10c980e1724270b7e90d3c2d4999c398814b8 +Subproject commit e8b316a8d52437b6f28cb3c68c61895403337018