From: Alexander Dahl <post@lespocky.de>
To: ptxdist@pengutronix.de
Subject: Re: [ptxdist] git ptxdist best practices
Date: Wed, 08 Jan 2014 10:48:47 +0100 [thread overview]
Message-ID: <f16c3d0380a64f076b13aa040bf6efbc@idefix.lespocky.dyndns.org> (raw)
In-Reply-To: <7b9f505c08f5635b7ea7dd90cc41ce89@idefix.lespocky.dyndns.org>
[-- Attachment #1: Type: text/plain, Size: 487 bytes --]
Am 2014-01-08 10:21, schrieb Alexander Dahl:
> Okay I edited them a little and attached it. Note: the scripts itself
> are put in a subfolder of the BSP here named "scripts".
Guess what I forgot to attach?!
Alex
--
»With the first link, the chain is forged. The first speech censured,
the first thought forbidden, the first freedom denied, chains us all
irrevocably.« (Jean-Luc Picard, quoting Judge Aaron Satie)
*** GnuPG-FP: 02C8 A590 7FE5 CA5F 3601 D1D5 8FBA 7744 CC87 10D0 ***
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: get-git.sh --]
[-- Type: text/x-shellscript; name=get-git.sh, Size: 1747 bytes --]
#!/bin/sh
# ----------------------------------------------------------------------
# Clone a git repository in get stage or check if it's the right one
# in case already cloned.
#
# Authors: Alexander Dahl <post@lespocky.de>
#
# Copyright 2011,2012,2013 Alexander Dahl
# ----------------------------------------------------------------------
#set -x
#set -e
_RED="\033[31m"
_YELLOW="\033[33m\033[40m\033[1m"
_NOCOLOR="\033[0m\033[49m"
GITURL="$1"
DESTDIR="$2"
print_usage() {
echo "Usage: $0 giturl destdir"
}
if [ -z "$1" -o -z "$2" ]
then
print_usage
exit 1
fi
CHECKOUTDIR="$(basename ${DESTDIR})"
SRCDIR="$(dirname ${DESTDIR})"
if [ ! -d "${SRCDIR}" ]
then
echo "folder ${_YELLOW}local_src${_NOCOLOR} does not exist, please create it!"
exit 4
fi
cd "${SRCDIR}"
if [ ! -d "${CHECKOUTDIR}" ]
then
if [ -e "${CHECKOUTDIR}" ]
then
echo "${CHECKOUTDIR} exists but is no directory!"
exit 2
else
echo "${CHECKOUTDIR} does not exist."
fi
if git clone "${GITURL}" "${CHECKOUTDIR}"
then
echo 'git clone successful ...'
else
exit $?
fi
cd "${CHECKOUTDIR}"
if git fetch --all
then
echo 'git fetch successful ...'
else
exit $?
fi
else
if [ -L "${CHECKOUTDIR}" ]
then
echo "${_RED}WARNING: ${_YELLOW}${CHECKOUTDIR} is a symbolic link!${_NOCOLOR}"
exit 0
fi
cd "${CHECKOUTDIR}"
REMOTEURL="$(git remote -v | awk '/^origin.+(fetch)/ {print $2;}')"
if [ "${REMOTEURL}" = "${GITURL}" ]
then
echo "This already cloned repo is the right one."
exit 0
else
echo "Cloned repo remote is '${REMOTEURL}' but '${GITURL}' was expected!"
exit 3
fi
fi
[-- Attachment #3: foo.make --]
[-- Type: text/plain, Size: 2164 bytes --]
# -*-makefile-*-
#
# Copyright (C) 2012 by Alexander Dahl <post@lespocky.de>
#
# See CREDITS for details about who has contributed to this project.
#
# For further information about the PTXdist project and license conditions
# see the README file.
#
#
# We provide this package
#
PACKAGES-$(PTXCONF_FOO) += foo
#
# Paths and names
#
FOO_VERSION := git
#FOO_MD5 :=
FOO := foo-$(FOO_VERSION)
#FOO_SUFFIX :=
#FOO_URL := /$(FOO).$(FOO_SUFFIX)
#FOO_SOURCE := $(SRCDIR)/$(FOO).$(FOO_SUFFIX)
#FOO_DIR := $(BUILDDIR)/$(FOO)
FOO_LICENSE := proprietary
FOO_SOURCE_LOCAL := $(PTXDIST_WORKSPACE)/local_src/$(FOO)
FOO_GIT_URL := $(PTXCONF_FOO_CLONE_URL)
FOO_CHECKOUT_ENTITY := $(PTXCONF_FOO_CHECKOUT_ENTITY)
FOO_DIR := $(FOO_SOURCE_LOCAL)
# ----------------------------------------------------------------------------
# Get
# ----------------------------------------------------------------------------
$(STATEDIR)/foo.get:
@$(call targetinfo)
@$(PTXDIST_WORKSPACE)/scripts/get-git.sh "$(FOO_GIT_URL)" "$(FOO_SOURCE_LOCAL)"
@$(call touch)
# ----------------------------------------------------------------------------
# Extract
# ----------------------------------------------------------------------------
$(STATEDIR)/foo.extract:
@$(call targetinfo)
@cd $(FOO_SOURCE_LOCAL) && \
$(PTXDIST_WORKSPACE)/scripts/extract-git.sh "$(FOO_CHECKOUT_ENTITY)"
@$(call touch)
# ----------------------------------------------------------------------------
# Prepare
# ----------------------------------------------------------------------------
FOO_CONF_TOOL := cmake
# ----------------------------------------------------------------------------
# Target-Install
# ----------------------------------------------------------------------------
$(STATEDIR)/foo.targetinstall:
@$(call targetinfo)
@$(call install_init, foo)
@$(call install_fixup, foo,PRIORITY,optional)
@$(call install_fixup, foo,SECTION,base)
@$(call install_fixup, foo,AUTHOR,"Alexander Dahl <post@lespocky.de>")
@$(call install_fixup, foo,DESCRIPTION,missing)
@$(call install_copy, foo, 0, 0, 0755, -, /usr/bin/foo)
@$(call install_finish, foo)
@$(call touch)
# vim: ft=make noet
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: extract-git.sh --]
[-- Type: text/x-shellscript; name=extract-git.sh, Size: 1104 bytes --]
#!/bin/sh
# ----------------------------------------------------------------------
# In a git "working copy" checkout the given entity (branch, tag,
# changeset). In case of a branch pull the latest changes, in every
# other case leave it in detached HEAD state. This script performs no
# directory changes, so start it in the target directory!
#
# Authors: Alexander Dahl <post@lespocky.de>
#
# Copyright 2011,2013 Alexander Dahl
# ----------------------------------------------------------------------
ENTITY="$1"
BRANCH_EXISTS="no"
print_usage() {
echo "Usage: $0 checkoutentity"
}
if [ -z "$1" ]
then
print_usage
exit 1
fi
if git fetch
then
echo 'Git fetch successful!'
else
exit $?
fi
if git checkout "$1"
then
echo 'Git checkout successful!'
else
exit $?
fi
for branch in $(git branch | cut -c3-)
do
if [ "${ENTITY}" = "${branch}" ]
then
BRANCH_EXISTS="yes"
fi
done
if [ "${BRANCH_EXISTS}" = "yes" ]
then
git pull
fi
if git submodule update --init --recursive
then
echo 'Git submodule update successful!'
else
exit $?
fi
exit 0
[-- Attachment #5: foo.in --]
[-- Type: text/plain, Size: 578 bytes --]
## SECTION=project_specific
menuconfig FOO
tristate
prompt "foo "
select HOST_CMAKE
default y
help
Foo like in bar.
config FOO_CLONE_URL
string
depends on FOO
prompt "Git url to clone from"
default "git://git.example.com/git/foo.git"
help
Git URL to clone from. Defaults to local server, but can be
overwritten with any local or remote URL.
config FOO_CHECKOUT_ENTITY
string
depends on FOO
prompt "Git entity to checkout."
default "stable"
help
Check out a specific branch, tag or changeset.
# vim: ft=kconfig noet tw=72
[-- Attachment #6: Type: text/plain, Size: 48 bytes --]
--
ptxdist mailing list
ptxdist@pengutronix.de
next prev parent reply other threads:[~2014-01-08 9:49 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-08 2:32 Jon Ringle
2014-01-08 5:56 ` Alexander Dahl
2014-01-08 6:12 ` Jon Ringle
2014-01-08 9:21 ` Alexander Dahl
2014-01-08 9:48 ` Alexander Dahl [this message]
2014-01-08 9:52 ` Jürgen Beisert
2014-01-08 17:56 ` Jon Ringle
2014-01-08 20:43 ` Alexander Dahl
2014-01-08 7:59 ` Jürgen Beisert
2014-01-08 14:14 ` Jon Ringle
2014-01-09 8:10 ` Jürgen Beisert
2014-01-09 9:03 ` Olbrich, Michael
2014-01-09 15:23 ` Jon Ringle
2014-01-09 16:06 ` Michael Olbrich
2014-01-09 16:37 ` Jon Ringle
2014-01-10 15:37 ` Michael Olbrich
2014-01-10 15:41 ` Jon Ringle
2014-01-11 1:47 ` Jon Ringle
2014-01-24 9:21 ` Michael Olbrich
2014-01-24 13:10 ` Jon Ringle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f16c3d0380a64f076b13aa040bf6efbc@idefix.lespocky.dyndns.org \
--to=post@lespocky.de \
--cc=ptxdist@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox