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
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
slapos.recipe.build
Commits
c2405a6c
Commit
c2405a6c
authored
Sep 04, 2012
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add some doctests for gitclone recipe
parent
f869cb59
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
95 additions
and
24 deletions
+95
-24
README.rst
README.rst
+85
-21
setup.py
setup.py
+5
-0
slapos/recipe/build/__init__.py
slapos/recipe/build/__init__.py
+0
-0
slapos/recipe/gitclone.py
slapos/recipe/gitclone.py
+5
-3
No files found.
README.rst
View file @
c2405a6c
...
...
@@ -249,9 +249,11 @@ the full path in cpan like in ::
Notes
=====
Currently, the modules will be installed in site-perl directory. Location of this
Currently, the modules will be installed in site-perl directory. Location of this
directory changes depending on the perl installation.
****************************
slapos.recipe.build:gitclone
****************************
...
...
@@ -262,20 +264,36 @@ Supports slapos.libnetworkcache if present.
Examples
********
Those examples use slapos.recipe.build repository as an example.
Simple clone
------------
Only `
url
` parameter is required. For each buildout run,
Only `
repository
` parameter is required. For each buildout run,
the recipe will pick up the latest commit on the remote master branch::
[buildout]
parts = git-clone
[git-clone]
recipe = slapos.recipe.build:gitclone
repository = http://example.net/example.git/
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... parts = git-clone
...
... [git-clone]
... recipe = slapos.recipe.build:gitclone
... repository = http://git.erp5.org/repos/slapos.recipe.build.git
... """)
This will clone the git repository in `parts/git-clone` directory.
Then let's run the buildout::
>>> print system(buildout)
Installing git-clone.
Cloning into '/sample-buildout/parts/git-clone'...
Let's take a look at the buildout parts directory now::
>>> ls(sample_buildout, 'parts')
d buildout
d git-clone
Specific branch
---------------
...
...
@@ -283,13 +301,35 @@ Specific branch
You can specify a specific branch using `branch` option. For each
run it will take the latest commit on this remote branch::
[buildout]
parts = git-clone
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... parts = git-clone
...
... [git-clone]
... recipe = slapos.recipe.build:gitclone
... repository = http://git.erp5.org/repos/slapos.recipe.build.git
... branch = build
... """)
[git-clone]
recipe = slapos.recipe.build:gitclone
repository = http://example.net/example.git/
branch = testing
Then let's run the buildout::
>>> print system(buildout)
Uninstalling git-clone.
Installing git-clone.
Cloning into '/sample-buildout/parts/git-clone'...
Let's take a look at the buildout parts directory now::
>>> ls(sample_buildout, 'parts')
d buildout
d git-clone
And let's see that current branch is "build"::
>>> import subprocess
>>> cd('parts', 'git-clone')
>>> subprocess.check_output(['git', 'branch'])
'* build\n'
Specific revision
-----------------
...
...
@@ -297,13 +337,37 @@ Specific revision
You can specify a specific commit hash or tag using `revision` option.
This option is not compatible with "branch" option::
[buildout]
parts = git-clone
>>> cd(sample_buildout)
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... parts = git-clone
...
... [git-clone]
... recipe = slapos.recipe.build:gitclone
... repository = http://git.erp5.org/repos/slapos.recipe.build.git
... revision = 2566127
... """)
[git-clone]
recipe = slapos.recipe.build:gitclone
repository = http://example.net/example.git/
revision = 0123456789abcdef
Then let's run the buildout::
>>> print system(buildout)
Uninstalling git-clone.
Installing git-clone.
Cloning into '/sample-buildout/parts/git-clone'...
Let's take a look at the buildout parts directory now::
>>> ls(sample_buildout, 'parts')
d buildout
d git-clone
And let's see that current branch is "gitclone"::
>>> import subprocess
>>> cd(sample_buildout, 'parts', 'git-clone')
>>> subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD'])
'2566127\n'
Specific git binary
-------------------
...
...
@@ -361,7 +425,7 @@ Here is example to install one or several modules::
modules =
colors
express
# Optional argument specifying perl buildout part, if existing.
# If specified, recipe will use the perl installed by buildout.
# If not specified, will take the globally available perl executable.
...
...
setup.py
View file @
c2405a6c
...
...
@@ -26,6 +26,11 @@ setup(name=name,
'zc.buildout'
,
# plays with buildout
'slapos.libnetworkcache>=0.13.1'
,
# Uses helper new in this version
],
extras_require
=
{
'test'
:
[
'zope.testing'
],
},
tests_require
=
[
'zope.testing'
],
test_suite
=
'%s.tests.test_suite'
%
name
,
zip_safe
=
True
,
entry_points
=
{
'zc.buildout'
:
[
...
...
slapos/recipe/build.py
→
slapos/recipe/build
/__init__
.py
View file @
c2405a6c
File moved
slapos/recipe/gitclone.py
View file @
c2405a6c
...
...
@@ -57,6 +57,9 @@ 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'
)):
return
False
try
:
print
'Uploading git repository to cache...'
metadata_dict
=
{
...
...
@@ -126,8 +129,7 @@ class Recipe(object):
if
options
.
get
(
'develop'
)
in
TRUE_VALUES
:
self
.
develop
=
True
# XXX clean
self
.
networkcache
=
buildout
.
get
(
'networkcache'
)
self
.
networkcache
=
buildout
.
get
(
'networkcache'
,
{})
# Check if input is correct
if
not
self
.
repository
:
...
...
@@ -175,7 +177,7 @@ class Recipe(object):
except
CalledProcessError
:
print
(
"Unable to download from git repository. Trying from network "
"cache..."
)
if
not
download_network_cached
(
self
.
location
,
self
.
name
,
self
.
revision
,
if
not
download_network_cached
(
self
.
location
,
self
.
name
,
self
.
revision
,
self
.
networkcache
):
if
os
.
path
.
exists
(
self
.
location
):
shutil
.
rmtree
(
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