Commit 2930af11 authored by Anthony Mallet's avatar Anthony Mallet
Browse files

[mk] Allow the 'checkout' target to be re-invoked

The commit forces the checkout cookie to be outdated when the checkout target
is invoked again, allowing the checkout to be updated.

The checkout script then does the following, depending on MASTER_REPOSITORY:
 - with git, run git pull instead of git clone
 - with dir, sync the linkfarm by removing broken links (deleted files) and
   updating missing links (new files)
 - with cvs, svn: does the checkout again - it should work, although it's not
   been tested.
parent 1b3fc029
#!/bin/sh
#
# Copyright (c) 2009-2010,2012-2013 LAAS/CNRS
# Copyright (c) 2009-2010,2012-2013,2018 LAAS/CNRS
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
......@@ -114,14 +114,13 @@ repository="$1"; shift
#
case "$format" in
git)
if ${TEST} -n "$revision"; then
${GIT} clone -v ${CHECKOUT_VCS_OPTS} -n $repository $extract_dir
${TEST} -n "$extract_dir" && {
cd $extract_dir;
${GIT} checkout $revision;
}
if ${TEST} -d "$extract_dir"; then
${GIT} -C "$extract_dir" pull -v ${CHECKOUT_VCS_OPTS} $repository
else
${GIT} clone -v ${CHECKOUT_VCS_OPTS} $repository $extract_dir
${GIT} clone -v ${CHECKOUT_VCS_OPTS} $repository $extract_dir
fi
if ${TEST} -n "$revision"; then
${GIT} -C "$extract_dir" checkout $revision
fi
;;
......@@ -152,6 +151,11 @@ dir)
${ECHO} 1>&2 "$self: no extract dir defined: use -d."; exit 2
}
${TEST} -d "$extract_dir" || ${MKDIR} "$extract_dir"
# remove any broken link
${FIND} "$extract_dir" -type l \! -exec ${TEST} -e {} \; -delete
# mirror directory tree
{ cd "$repository" && ${FIND} "$sub" -type d; } |
{ cd "$extract_dir" && while read d; do ${MKDIR} "$d"; done; }
{ cd "$repository" && ${FIND} "$sub" ! -type d; } |
......
#
# Copyright (c) 2009-2014 LAAS/CNRS
# Copyright (c) 2009-2014,2018 LAAS/CNRS
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
......@@ -94,19 +94,23 @@ endif
# --- checkout-cookie (PRIVATE) --------------------------------------------
#
# checkout-cookie creates the "checkout" cookie file. The contents are the name
# of the package.
# checkout-cookie creates the "checkout" cookie file.
#
.PHONY: checkout-cookie
checkout-cookie: makedirs
${RUN}${TEST} ! -f ${_COOKIE.checkout} || ${FALSE}; \
exec >>${_COOKIE.checkout}; \
exec >${_COOKIE.checkout}; \
${ECHO} "_COOKIE.checkout.date:=`${_CDATE_CMD}`"
ifeq (yes,$(call exists,${_COOKIE.checkout}))
$(call require,${_COOKIE.checkout})
ifneq (,$(filter checkout,${MAKECMDGOALS}))
_MAKEFILE_WITH_RECIPES+=${_COOKIE.checkout}
${_COOKIE.checkout}: .FORCE
${RUN}${TEST} ! -f $@ || ${MV} -f $@ $@.prev
endif
else
$(call require, ${ROBOTPKG_DIR}/mk/checksum/checksum-vars.mk)
${_COOKIE.checkout}: real-checkout;
endif
......
#
# Copyright (c) 2009,2011-2013,2016 LAAS/CNRS
# Copyright (c) 2009,2011-2013,2016,2018 LAAS/CNRS
# All rights reserved.
#
# Permission to use, copy, modify, and distribute this software for any purpose
......@@ -51,7 +51,7 @@ endef
# Variable passed on the command line that are package-specific must not be
# exported to recursive make.
#
_NO_INHERIT= PREFIX PKGREQD WRKDIR
_NO_INHERIT= PREFIX PKGREQD WRKDIR WRKSRC
override define _env_nopropagate # (var)
ifeq (command line,$(origin $1))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment