diff --git a/cook.sh b/cook.sh index 5956919d470cba7bb43cb021461ca12b6ed85ee5..c2b2e25486aa4146d4bd043f006b7202f4804e25 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 2749376673f85033edb2faf85796ce1294fb9b46..c57c71897372f33d47a03c28f1946c1b93547e46 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_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;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_SOURCE" -ge "$TIME_STAGE" ] + if [ "$TIME_BUILD" -gt "$TIME_STAGE" ] then - echo -e "\033[01;38;5;215mrepo - rebuilding $recipe\033[0m" >&2 + 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"