Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
cookbook
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Wildan Mubarok
cookbook
Commits
a48475e4
Commit
a48475e4
authored
7 years ago
by
Jeremy Soller
Browse files
Options
Downloads
Patches
Plain Diff
Improve rebuild logic
parent
b3ad568e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cook.sh
+12
-10
12 additions, 10 deletions
cook.sh
repo.sh
+22
-8
22 additions, 8 deletions
repo.sh
with
34 additions
and
18 deletions
cook.sh
+
12
−
10
View file @
a48475e4
...
@@ -14,6 +14,8 @@ function usage {
...
@@ -14,6 +14,8 @@ function usage {
echo
" clean"
>
&2
echo
" clean"
>
&2
echo
" fetch"
>
&2
echo
" fetch"
>
&2
echo
" unfetch"
>
&2
echo
" unfetch"
>
&2
echo
" prepare"
>
&2
echo
" unprepare"
>
&2
echo
" publish"
>
&2
echo
" publish"
>
&2
echo
" unpublish"
>
&2
echo
" unpublish"
>
&2
echo
" stage"
>
&2
echo
" stage"
>
&2
...
@@ -32,7 +34,7 @@ function op {
...
@@ -32,7 +34,7 @@ function op {
case
"
$2
"
in
case
"
$2
"
in
dist
)
dist
)
op
$1
fetch
op
$1
prepare
op
$1
update
op
$1
update
op
$1
build
op
$1
build
op
$1
stage
op
$1
stage
...
@@ -41,7 +43,7 @@ function op {
...
@@ -41,7 +43,7 @@ function op {
distclean
)
distclean
)
op
$1
untar
op
$1
untar
op
$1
unstage
op
$1
unstage
op
$1
un
fetch
op
$1
un
prepare
;;
;;
fetch
)
fetch
)
if
[
-n
"
$TAR
"
]
if
[
-n
"
$TAR
"
]
...
@@ -56,9 +58,6 @@ function op {
...
@@ -56,9 +58,6 @@ function op {
mkdir source
mkdir source
tar
xvf source.tar
-C
source
--strip-components
1
tar
xvf source.tar
-C
source
--strip-components
1
fi
fi
rm
-rf
build
cp
-r
source
build
elif
[
-n
"
$GIT
"
]
elif
[
-n
"
$GIT
"
]
then
then
if
[
!
-d
source
]
if
[
!
-d
source
]
...
@@ -71,19 +70,22 @@ function op {
...
@@ -71,19 +70,22 @@ function op {
git submodule
sync
git submodule
sync
git submodule update
--init
--recursive
git submodule update
--init
--recursive
popd
>
/dev/null
popd
>
/dev/null
rm
-rf
build
cp
-r
source
build
fi
fi
;;
;;
unfetch
)
unfetch
)
rm
-rfv
build
source
rm
-rfv
source
if
[
-n
"
$TAR
"
]
if
[
-n
"
$TAR
"
]
then
then
rm
-f
source.tar
rm
-f
source.tar
fi
fi
;;
;;
prepare
)
rm
-rf
build
cp
-r
source
build
;;
unprepare
)
rm
-rf
build
;;
version
)
version
)
pushd
build
>
/dev/null
pushd
build
>
/dev/null
skip
=
"0"
skip
=
"0"
...
...
This diff is collapsed.
Click to expand it.
repo.sh
+
22
−
8
View file @
a48475e4
...
@@ -17,19 +17,33 @@ do
...
@@ -17,19 +17,33 @@ do
./cook.sh
"
$recipe
"
fetch
./cook.sh
"
$recipe
"
fetch
fi
fi
if
[
!
-
f
"recipes/
$recipe
/
stage.tar
"
]
if
[
!
-
d
"recipes/
$recipe
/
build
"
]
then
then
echo
-e
"
\0
33[01;38;5;
2
15mrepo -
build
ing
$recipe
\0
33[0m"
>
&2
echo
-e
"
\0
33[01;38;5;1
5
5mrepo -
prepar
ing
$recipe
\0
33[0m"
>
&2
./cook.sh
$recipe
update build stage
tar
./cook.sh
"
$recipe
"
prepare
else
else
TIME_SOURCE
=
"
$(
find recipes/
$recipe
/source
-type
f
-not
-path
'*/.git*'
-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_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
"
\0
33[01;38;5;155mrepo - repreparing
$recipe
\0
33[0m"
>
&2
./cook.sh
"
$recipe
"
unprepare prepare
fi
fi
if
[
!
-f
"recipes/
$recipe
/stage.tar"
]
then
echo
-e
"
\0
33[01;38;5;155mrepo - building
$recipe
\0
33[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
)
"
TIME_STAGE
=
"
$(
stat
-c
"%Y"
recipes/
$recipe
/stage.tar
)
"
if
[
"
$TIME_
SOURCE
"
-g
e
"
$TIME_STAGE
"
]
if
[
"
$TIME_
BUILD
"
-g
t
"
$TIME_STAGE
"
]
then
then
echo
-e
"
\0
33[01;38;5;
2
15mrepo - rebuilding
$recipe
\0
33[0m"
>
&2
echo
-e
"
\0
33[01;38;5;1
5
5mrepo - rebuilding
$recipe
\0
33[0m"
>
&2
./cook.sh
"
$recipe
"
untar unstage update build stage
tar
./cook.sh
"
$recipe
"
untar unstage update build stage
tar
else
else
echo
-e
"
\0
33[01;38;5;
2
15mrepo -
$recipe
up to date
\0
33[0m"
>
&2
echo
-e
"
\0
33[01;38;5;1
5
5mrepo -
$recipe
up to date
\0
33[0m"
>
&2
fi
fi
fi
fi
done
done
...
@@ -38,12 +52,12 @@ for recipe in $recipes
...
@@ -38,12 +52,12 @@ for recipe in $recipes
do
do
if
[
"recipes/
$recipe
/stage.tar"
-nt
"
$REPO
/
$recipe
.tar"
]
if
[
"recipes/
$recipe
/stage.tar"
-nt
"
$REPO
/
$recipe
.tar"
]
then
then
echo
-e
"
\0
33[01;38;5;
2
15mrepo - publishing
$recipe
\0
33[0m"
>
&2
echo
-e
"
\0
33[01;38;5;1
5
5mrepo - publishing
$recipe
\0
33[0m"
>
&2
./cook.sh
$recipe
publish
./cook.sh
$recipe
publish
fi
fi
done
done
echo
-e
"
\0
33[01;38;5;
2
15mrepo - generating repo.toml
\0
33[0m"
>
&2
echo
-e
"
\0
33[01;38;5;1
5
5mrepo - generating repo.toml
\0
33[0m"
>
&2
echo
"[packages]"
>
"
$REPO
/repo.toml"
echo
"[packages]"
>
"
$REPO
/repo.toml"
for
toml
in
"
$REPO
/"
*
".toml"
for
toml
in
"
$REPO
/"
*
".toml"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment