From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1 of 3] GENTARGETS: add support for scp://
Date: Thu, 22 Sep 2011 21:49:21 +0200 [thread overview]
Message-ID: <20110922214921.1ae4ee6f@skate> (raw)
In-Reply-To: <8549a902c5c7070219ec.1316587332@localhost6.localdomain6>
Le Wed, 21 Sep 2011 08:42:12 +0200,
Thomas De Schampheleire <patrickdepinguin+buildroot@gmail.com> a ?crit :
> This patch adds support for scp:// both for use in the package Makefiles, as for
> the BR2_PRIMARY_SITE variable.
I'm ok with the principle. Some implementation comments below.
> +define DOWNLOAD_SCP
> + test -e $(DL_DIR)/$(2) || \
> + $(SCP) $(call stripurischeme,$(call qstrip,$(1)))/$(2) $(DL_DIR)
> +endef
> +
> +define SOURCE_CHECK_SCP
> + $(SSH) $(call stripurischeme,`echo "$(call qstrip,$(1))" | cut -d/ -f1`) ls /`echo "$(call qstrip,$(1))/$(2)" | cut -d/ -f2-` > /dev/null
> +endef
Ouch, this looks ugly. I guess you can use "test -f" instead of using
ls. Maybe something like:
scphost=$(firstword $(subst /, ,$(call stripurischeme,$(1))))
scpfile=$(patsubst $(call scphost,$(1))/%,/%/$(2),$(call stripurischeme,$(1)))
define SOURCE_CHECK_SCP
$(SSH) $(call scphost,$(1),$(2)) test -f $(call scpfile,$(1),$(2))
endef
Maybe it's possible to do better and/or to make those scphost/scpfile
macros a bit more generic. But the general comment is :
* Try to use make functions instead of shell functions when possible.
Every shell function requires a fork+exec and is very costly
compared to make functions. In the past, we had a single shell
function call for every package, and this was causing a 5-10 seconds
startup delay for the build process.
* Try to split in several small macros, whose name allows to
understand what it is doing.
> +define SHOW_EXTERNAL_DEPS_SCP
> + echo "$($(PKG)_SITE) [scp: $($(PKG)_DL_VERSION)]"
> +endef
As per a recent discussion with Peter, external-deps shouldn't show the
URL of the tarball of the package, but rather simply the tarball name,
as found in the $(DL_DIR). I know this is not consistent with the
current GIT/SVN/BZR helpers, but I have sent patches to fix this.
> define DOWNLOAD_WGET
> test -e $(DL_DIR)/$(2) || \
> $(WGET) -P $(DL_DIR) $(call qstrip,$(1))/$(2)
> @@ -186,13 +207,17 @@
>
> define DOWNLOAD
> $(Q)if test -n "$(call qstrip,$(BR2_PRIMARY_SITE))" ; then \
> - $(call $(DL_MODE)_WGET,$(BR2_PRIMARY_SITE),$(2)) && exit ; \
> + case "$(call geturischeme,$(BR2_PRIMARY_SITE))" in \
> + scp) $(call $(DL_MODE)_SCP,$(BR2_PRIMARY_SITE),$(2)) && exit ;; \
> + *) $(call $(DL_MODE)_WGET,$(BR2_PRIMARY_SITE),$(2)) && exit ;; \
> + esac ; \
It would be good to update the BR2_PRIMARY_SITE help text to mention
which URL types are possible.
Regards,
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
next prev parent reply other threads:[~2011-09-22 19:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-21 6:42 [Buildroot] [PATCH 0 of 3] gentargets: add scp and Mercurial download helpers Thomas De Schampheleire
2011-09-21 6:42 ` [Buildroot] [PATCH 1 of 3] GENTARGETS: add support for scp:// Thomas De Schampheleire
2011-09-22 19:49 ` Thomas Petazzoni [this message]
2011-09-21 6:42 ` [Buildroot] [PATCH 2 of 3] Add support for packages stored in Mercurial (hg) repositories Thomas De Schampheleire
2011-09-21 6:42 ` [Buildroot] [PATCH 3 of 3] Update documentation for scp and Mercurial support Thomas De Schampheleire
2011-09-21 7:24 ` Thomas Petazzoni
2011-09-21 7:26 ` Thomas De Schampheleire
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=20110922214921.1ae4ee6f@skate \
--to=thomas.petazzoni@free-electrons.com \
--cc=buildroot@busybox.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.