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
Boxiang Sun
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
Show 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
...
@@ -252,6 +252,8 @@ Notes
...
@@ -252,6 +252,8 @@ 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.
directory changes depending on the perl installation.
****************************
****************************
slapos.recipe.build:gitclone
slapos.recipe.build:gitclone
****************************
****************************
...
@@ -262,20 +264,36 @@ Supports slapos.libnetworkcache if present.
...
@@ -262,20 +264,36 @@ Supports slapos.libnetworkcache if present.
Examples
Examples
********
********
Those examples use slapos.recipe.build repository as an example.
Simple clone
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::
the recipe will pick up the latest commit on the remote master branch::
[buildout]
>>> write(sample_buildout, 'buildout.cfg',
parts = git-clone
... """
... [buildout]
[git-clone]
... parts = git-clone
recipe = slapos.recipe.build:gitclone
...
repository = http://example.net/example.git/
... [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.
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
Specific branch
---------------
---------------
...
@@ -283,13 +301,35 @@ Specific branch
...
@@ -283,13 +301,35 @@ Specific branch
You can specify a specific branch using `branch` option. For each
You can specify a specific branch using `branch` option. For each
run it will take the latest commit on this remote branch::
run it will take the latest commit on this remote branch::
[buildout]
>>> write(sample_buildout, 'buildout.cfg',
parts = git-clone
... """
... [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]
Then let's run the buildout::
recipe = slapos.recipe.build:gitclone
repository = http://example.net/example.git/
>>> print system(buildout)
branch = testing
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
Specific revision
-----------------
-----------------
...
@@ -297,13 +337,37 @@ Specific revision
...
@@ -297,13 +337,37 @@ Specific revision
You can specify a specific commit hash or tag using `revision` option.
You can specify a specific commit hash or tag using `revision` option.
This option is not compatible with "branch" option::
This option is not compatible with "branch" option::
[buildout]
>>> cd(sample_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
... revision = 2566127
... """)
[git-clone]
Then let's run the buildout::
recipe = slapos.recipe.build:gitclone
repository = http://example.net/example.git/
>>> print system(buildout)
revision = 0123456789abcdef
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
Specific git binary
-------------------
-------------------
...
...
setup.py
View file @
c2405a6c
...
@@ -26,6 +26,11 @@ setup(name=name,
...
@@ -26,6 +26,11 @@ setup(name=name,
'zc.buildout'
,
# plays with buildout
'zc.buildout'
,
# plays with buildout
'slapos.libnetworkcache>=0.13.1'
,
# Uses helper new in this version
'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
,
zip_safe
=
True
,
entry_points
=
{
entry_points
=
{
'zc.buildout'
:
[
'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):
...
@@ -57,6 +57,9 @@ def upload_network_cached(path, name, revision, networkcache_options):
"""
"""
Creates uploads repository to cache.
Creates uploads repository to cache.
"""
"""
if
not
(
LIBNETWORKCACHE_ENABLED
and
networkcache_options
.
get
(
'shacache-cert-file'
)):
return
False
try
:
try
:
print
'Uploading git repository to cache...'
print
'Uploading git repository to cache...'
metadata_dict
=
{
metadata_dict
=
{
...
@@ -126,8 +129,7 @@ class Recipe(object):
...
@@ -126,8 +129,7 @@ class Recipe(object):
if
options
.
get
(
'develop'
)
in
TRUE_VALUES
:
if
options
.
get
(
'develop'
)
in
TRUE_VALUES
:
self
.
develop
=
True
self
.
develop
=
True
# XXX clean
self
.
networkcache
=
buildout
.
get
(
'networkcache'
,
{})
self
.
networkcache
=
buildout
.
get
(
'networkcache'
)
# Check if input is correct
# Check if input is correct
if
not
self
.
repository
:
if
not
self
.
repository
:
...
...
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