Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.recipe.build
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Eric Zheng
slapos.recipe.build
Commits
d27df419
Commit
d27df419
authored
Jul 02, 2013
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not upload to cache by default, nor cache working copy
parent
62416e88
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
15 deletions
+23
-15
CHANGES.txt
CHANGES.txt
+7
-0
README.rst
README.rst
+3
-1
setup.py
setup.py
+1
-1
slapos/recipe/gitclone.py
slapos/recipe/gitclone.py
+12
-13
No files found.
CHANGES.txt
View file @
d27df419
Changes
=======
0.12 (Unreleased)
-----------------
* Do not upload to cache by default. 'use-cache' option replaces
'forbid-download-cache' and must be explicitely set in order to use cache.
* Do not cache working copy, which just duplicate `.git` folder.
0.11.6 (2013-02-25)
-------------------
...
...
README.rst
View file @
d27df419
...
...
@@ -57,7 +57,8 @@ slapos.recipe.build:gitclone
****************************
Checkout a git repository.
Supports slapos.libnetworkcache if present.
Supports slapos.libnetworkcache if present, and if boolean 'use-cache' option
is true.
Examples
********
...
...
@@ -78,6 +79,7 @@ the recipe will pick up the latest commit on the remote master branch::
... [git-clone]
... recipe = slapos.recipe.build:gitclone
... repository = http://git.erp5.org/repos/slapos.recipe.build.git
... use-cache = true
... """)
This will clone the git repository in `parts/git-clone` directory.
...
...
setup.py
View file @
d27df419
from
setuptools
import
setup
,
find_packages
version
=
'0.1
1.6
'
version
=
'0.1
2-dev
'
name
=
'slapos.recipe.build'
long_description
=
open
(
"README.rst"
).
read
()
+
"
\
n
"
+
\
open
(
"CHANGES.txt"
).
read
()
+
"
\
n
"
...
...
slapos/recipe/gitclone.py
View file @
d27df419
...
...
@@ -51,7 +51,7 @@ except:
GIT_DEFAULT_REMOTE_NAME
=
'origin'
GIT_DEFAULT_BRANCH_NAME
=
'master'
TRUE_VALUES
=
[
'y'
,
'yes'
,
'1'
,
'true'
]
TRUE_VALUES
=
(
'y'
,
'yes'
,
'1'
,
'true'
)
GIT_CLONE_ERROR_MESSAGE
=
'Impossible to clone repository.'
GIT_CLONE_CACHE_ERROR_MESSAGE
=
'Impossible to clone repository and '
\
...
...
@@ -62,7 +62,7 @@ def upload_network_cached(path, name, revision, networkcache_options):
Creates uploads repository to cache.
"""
if
not
(
LIBNETWORKCACHE_ENABLED
and
networkcache_options
.
get
(
'
shacache-cert-file
'
)):
'
upload-dir-url
'
)):
return
False
try
:
print
'Uploading git repository to cache...'
...
...
@@ -132,12 +132,8 @@ class Recipe(object):
self
.
name
=
name
self
.
location
=
options
.
get
(
'location'
)
# Set boolean values
for
key
in
[
'develop'
,
'forbid-download-cache'
]:
attribute
=
key
.
replace
(
'-'
,
'_'
)
if
options
.
get
(
key
)
in
TRUE_VALUES
:
setattr
(
self
,
attribute
,
True
)
else
:
setattr
(
self
,
attribute
,
False
)
for
key
in
(
'develop'
,
'use-cache'
):
setattr
(
self
,
key
.
replace
(
'-'
,
'_'
),
options
.
get
(
key
)
in
TRUE_VALUES
)
self
.
networkcache
=
buildout
.
get
(
'networkcache'
,
{})
...
...
@@ -182,18 +178,21 @@ class Recipe(object):
raise
UserError
(
"Unknown error while cloning repository."
)
if
self
.
revision
:
self
.
gitReset
(
self
.
revision
)
upload_network_cached
(
self
.
location
,
self
.
name
,
self
.
revision
,
self
.
networkcache
)
if
self
.
use_cache
:
upload_network_cached
(
os
.
path
.
join
(
self
.
location
,
'.git'
),
self
.
repository
,
self
.
revision
,
self
.
networkcache
)
except
CalledProcessError
:
print
(
"Unable to download from git repository. Trying from network "
"cache..."
)
if
os
.
path
.
exists
(
self
.
location
):
shutil
.
rmtree
(
self
.
location
)
if
self
.
forbid_download
_cache
:
if
not
self
.
use
_cache
:
raise
UserError
(
GIT_CLONE_ERROR_MESSAGE
)
if
not
download_network_cached
(
self
.
location
,
self
.
name
,
self
.
revision
,
self
.
networkcache
):
os
.
mkdir
(
self
.
location
)
if
not
download_network_cached
(
os
.
path
.
join
(
self
.
location
,
'.git'
),
self
.
repository
,
self
.
revision
,
self
.
networkcache
):
raise
UserError
(
GIT_CLONE_CACHE_ERROR_MESSAGE
)
self
.
gitReset
()
return
[
self
.
location
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment