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
Thomas Leymonerie
slapos.recipe.build
Commits
e09557b4
Commit
e09557b4
authored
Aug 30, 2012
by
Antoine Catton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add git clone recipe
parent
a8881f01
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
162 additions
and
0 deletions
+162
-0
README.rst
README.rst
+85
-0
setup.py
setup.py
+1
-0
slapos/recipe/gitclone.py
slapos/recipe/gitclone.py
+76
-0
No files found.
README.rst
View file @
e09557b4
...
...
@@ -252,6 +252,91 @@ Notes
Currently, the modules will be installed in site-perl directory. Location of this
directory changes depending on the perl installation.
****************************
slapos.recipe.build:gitclone
****************************
Checkout a git repository.
Examples
********
Simple clone
------------
Only `url` 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
url = http://example.net/example.git/
This will clone the git repository in `parts/git-clone` directory.
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
[git-clone]
recipe = slapos.recipe.build:gitclone
url = http://example.net/example.git/
branch = testing
Specific revision
-----------------
You can specify a specific commit hash or tag using `revision` option.
This option will cancel `branch` option, making it useless::
[buildout]
parts = git-clone
[git-clone]
recipe = slapos.recipe.build:gitclone
url = http://example.net/example.git/
revision = 0123456789abcdef
Specific git binary
-------------------
The default git command is `git`, if for a any reason you don't
have git in your path, you can specify git binary path with `git-command`
option::
[buildout]
parts = git-clone
[git-clone]
recipe = slapos.recipe.build:gitclone
url = http://example.net/example.git/
git-command = /usr/local/git/bin/git
Full example
------------
::
[buildout]
parts = git-clone
[git-binary]
recipe = hexagonit.recipe.cmmi
url = http://git-core.googlecode.com/files/git-1.7.12.tar.gz
[git-clone]
recipe = slapos.recipe.build:gitclone
url = http://example.net/example.git/
git-command = ${git-binary:location}/bin/git
revision = specific-tag
***********************
slapos.recipe.build:npm
...
...
setup.py
View file @
e09557b4
...
...
@@ -33,6 +33,7 @@ setup(name=name,
'cpan = slapos.recipe.cpan:Cpan'
,
'download = slapos.recipe.download:Recipe'
,
'download-unpacked = slapos.recipe.downloadunpacked:Recipe'
,
'gitclone = slapos.recipe.gitclone:Recipe'
,
'npm = slapos.recipe.npm:Npm'
,
]},
)
slapos/recipe/gitclone.py
0 → 100644
View file @
e09557b4
##############################################################################
#
# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import
os
from
subprocess
import
check_call
GIT_DEFAULT_REMOTE_NAME
=
'origin'
GIT_DEFAULT_BRANCH_NAME
=
'master'
class
Recipe
(
object
):
def
__init__
(
self
,
buildout
,
name
,
options
):
options
.
setdefault
(
'branch'
,
GIT_DEFAULT_BRANCH_NAME
)
options
.
setdefault
(
'revision'
,
''
)
options
.
setdefault
(
'git-command'
,
'git'
)
options
.
setdefault
(
'location'
,
os
.
path
.
join
(
buildout
[
'buildout'
][
'parts-directory'
],
name
)
)
self
.
options
=
options
def
install
(
self
):
if
not
os
.
path
.
exists
(
self
.
options
[
'location'
]):
check_call
([
self
.
options
[
'git-command'
],
'clone'
,
self
.
options
[
'url'
],
self
.
options
[
'location'
]])
self
.
update
()
return
[]
def
update
(
self
):
check_call
([
self
.
options
[
'git-command'
],
'fetch'
,
'--all'
],
cwd
=
self
.
options
[
'location'
])
if
self
.
options
[
'revision'
]:
check_call
([
self
.
options
[
'git-command'
],
'reset'
,
'--hard'
,
self
.
options
[
'revision'
]],
cwd
=
self
.
options
[
'location'
])
else
:
check_call
([
self
.
options
[
'git-command'
],
'pull'
,
GIT_DEFAULT_REMOTE_NAME
,
self
.
options
[
'branch'
]],
cwd
=
self
.
options
[
'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