mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH 2/2] ptxdist getdev: Download dev packages from ${PTXCONF_SETUP_DEVMIRROR}
@ 2014-01-18  1:06 jon
  2014-01-20 10:44 ` Michael Olbrich
  0 siblings, 1 reply; 2+ messages in thread
From: jon @ 2014-01-18  1:06 UTC (permalink / raw)
  To: ptxdist; +Cc: Jon Ringle

From: Jon Ringle <jringle@gridpoint.com>

There's probably clean up to be done with this, but here goes... :)

This patch allows you to setup a dev package mirror to hold *-dev.tar.gz
packages.

Upload your *-dev.tar.gz packages to your mirror, then you can avoid
rebuilding all your packages by doing:

ptxdist getdev


Signed-off-by: Jon Ringle <jringle@gridpoint.com>
---
 bin/ptxdist                         |    5 +++++
 config/setup/Kconfig                |   10 ++++++++++
 rules/post/get.make                 |    1 +
 rules/post/ptxd_make_world_get.make |   12 ++++++++++++
 scripts/lib/ptxd_lib_dgen.awk       |    5 +++++
 scripts/lib/ptxd_make_get.sh        |   28 +++++++++++++++++++++-------
 6 files changed, 54 insertions(+), 7 deletions(-)

diff --git a/bin/ptxdist b/bin/ptxdist
index f9cbdec..663c41e 100755
--- a/bin/ptxdist
+++ b/bin/ptxdist
@@ -1789,6 +1789,11 @@ EOF
 			fi
 			exit
 			;;
+		getdev)
+			check_premake &&
+			ptxd_make_log getdev
+			exit
+			;;
 		go|images)
 			do_${cmd}
 			exit
diff --git a/config/setup/Kconfig b/config/setup/Kconfig
index 790276b..e90949b 100644
--- a/config/setup/Kconfig
+++ b/config/setup/Kconfig
@@ -93,6 +93,16 @@ config SETUP_PROJECTPATH
 
 endmenu
 
+menu "Dev Download      "
+
+config SETUP_DEVMIRROR
+	string "Dev package Mirror"
+	help
+	  Enter a URL where *-dev.tar.gz packages can be downloaded
+	  Use: ptxdist getdev
+
+endmenu
+
 menu "Source Directories"
 
 config SETUP_SRCDIR
diff --git a/rules/post/get.make b/rules/post/get.make
index 7e7ad25..58ea81d 100644
--- a/rules/post/get.make
+++ b/rules/post/get.make
@@ -1,6 +1,7 @@
 # -*-makefile-*-
 
 get: $(addprefix $(STATEDIR)/,$(addsuffix .get,$(PACKAGES) $(HOST_PACKAGES) $(CROSS_PACKAGES) $(LAZY_PACKAGES)))
+getdev: $(addprefix $(STATEDIR)/,$(addsuffix .getdev,$(PACKAGES) $(HOST_PACKAGES) $(CROSS_PACKAGES) $(LAZY_PACKAGES)))
 
 # vim600:set foldmethod=marker:
 # vim600:set syntax=make:
diff --git a/rules/post/ptxd_make_world_get.make b/rules/post/ptxd_make_world_get.make
index 152674c..828a73e 100644
--- a/rules/post/ptxd_make_world_get.make
+++ b/rules/post/ptxd_make_world_get.make
@@ -26,6 +26,9 @@ $(SRCDIR)/%:
 	@$(call targetinfo)
 	@$(call get, $($@))
 
+$(call remove_quotes, $(PTXCONF_PROJECT_DEVPKGDIR))/%:
+	@$(call targetinfo)
+	@$(call getdev, $@)
 
 $(STATEDIR)/%.get:
 	@$(call targetinfo)
@@ -35,6 +38,12 @@ $(STATEDIR)/%.get:
 		$(call world/check_src, $($(src)));)
 	@$(call touch)
 
+$(STATEDIR)/%.getdev:
+	@$(call targetinfo)
+#	@$(foreach src,$($(PTX_MAP_TO_PACKAGE_$(*))_DEVPKG), \
+#		$(call world/getdev, $($(src)));)
+	@$(call touch)
+
 world/get = \
 	$(call world/env, $(1)) \
 	ptxd_make_world_get
@@ -59,4 +68,7 @@ get = \
 check_src = \
 	ptxd_make_check_src "$($(strip $(1))_SOURCE)" "$($(strip $(1))_MD5)"
 
+getdev = \
+	ptxd_make_getdev "$(strip $(1))" "$(call remove_quotes, $(PTXCONF_SETUP_DEVMIRROR))/$(notdir $(1))"
+
 # vim: syntax=make
diff --git a/scripts/lib/ptxd_lib_dgen.awk b/scripts/lib/ptxd_lib_dgen.awk
index 7f790c9..1829d64 100644
--- a/scripts/lib/ptxd_lib_dgen.awk
+++ b/scripts/lib/ptxd_lib_dgen.awk
@@ -241,6 +241,11 @@ function write_deps_pkg_all(this_PKG, this_pkg) {
 	# .get rule
 	#
 	print "$(STATEDIR)/" this_pkg ".get: $(" this_PKG "_SOURCES)"	> DGEN_DEPS_POST;
+	print "ifneq ($(strip $(PTXCONF_SETUP_DEVMIRROR)),)" > DGEN_DEPS_POST;
+	print "ifneq ($($(" this_PKG "_DEVPKG)),NO)" > DGEN_DEPS_POST;
+	print "$(STATEDIR)/" this_pkg ".getdev: $(call remove_quotes, $(PTXCONF_PROJECT_DEVPKGDIR))/$(" this_PKG "_DEVPKG)" > DGEN_DEPS_POST;
+	print "endif" > DGEN_DEPS_POST;
+	print "endif" > DGEN_DEPS_POST;
 }
 
 function write_deps_pkg_active(this_PKG, this_pkg, prefix) {
diff --git a/scripts/lib/ptxd_make_get.sh b/scripts/lib/ptxd_make_get.sh
index f4d7922..d310ac2 100644
--- a/scripts/lib/ptxd_make_get.sh
+++ b/scripts/lib/ptxd_make_get.sh
@@ -252,7 +252,10 @@ export -f ptxd_make_get_download_permitted
 # - no-check-certificate	don't check server certificate (https only)
 # - no-proxy			don't use proxy even if configured
 #
-ptxd_make_get() {
+_ptxd_make_get() {
+	local exit_on_fail="${1}"
+	shift
+
 	local -a argv
 	local ptxmirror_url
 	local mrd=false		# is mirror already part of urls?
@@ -280,7 +283,7 @@ ptxd_make_get() {
 		shift
 
 		case "${url}" in
-		${PTXCONF_SETUP_PTXMIRROR}/*/*)
+		${PTXCONF_SETUP_PTXMIRROR}/*/*|${PTXCONF_SETUP_DEVMIRROR}/*)
 			# keep original URL, for stuff like glibc
 			argv[${#argv[@]}]="${url}"
 			mrd=true
@@ -397,11 +400,22 @@ ptxd_make_get() {
 		esac
 	done
 
-	echo
-	echo "Could not download package"
-	echo "URL: ${orig_argv[@]}"
-	echo
-	exit 1
+	if [ "${exit_on_fail}" = "y" ]; then
+		echo
+		echo "Could not download package"
+		echo "URL: ${orig_argv[@]}"
+		echo
+		exit 1
+	fi
 }
+export -f _ptxd_make_get
 
+ptxd_make_get() {
+	_ptxd_make_get y "${@}"
+}
 export -f ptxd_make_get
+
+ptxd_make_getdev() {
+	_ptxd_make_get n "${@}"
+}
+export -f ptxd_make_getdev
-- 
1.7.10.4


-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ptxdist] [PATCH 2/2] ptxdist getdev: Download dev packages from ${PTXCONF_SETUP_DEVMIRROR}
  2014-01-18  1:06 [ptxdist] [PATCH 2/2] ptxdist getdev: Download dev packages from ${PTXCONF_SETUP_DEVMIRROR} jon
@ 2014-01-20 10:44 ` Michael Olbrich
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Olbrich @ 2014-01-20 10:44 UTC (permalink / raw)
  To: ptxdist

On Fri, Jan 17, 2014 at 08:06:43PM -0500, jon@ringle.org wrote:
> From: Jon Ringle <jringle@gridpoint.com>
> 
> There's probably clean up to be done with this, but here goes... :)
> 
> This patch allows you to setup a dev package mirror to hold *-dev.tar.gz
> packages.
> 
> Upload your *-dev.tar.gz packages to your mirror, then you can avoid
> rebuilding all your packages by doing:
> 
> ptxdist getdev
> 
> 
> Signed-off-by: Jon Ringle <jringle@gridpoint.com>
> ---
>  bin/ptxdist                         |    5 +++++
>  config/setup/Kconfig                |   10 ++++++++++
>  rules/post/get.make                 |    1 +
>  rules/post/ptxd_make_world_get.make |   12 ++++++++++++
>  scripts/lib/ptxd_lib_dgen.awk       |    5 +++++
>  scripts/lib/ptxd_make_get.sh        |   28 +++++++++++++++++++++-------
>  6 files changed, 54 insertions(+), 7 deletions(-)
> 
> diff --git a/bin/ptxdist b/bin/ptxdist
> index f9cbdec..663c41e 100755
> --- a/bin/ptxdist
> +++ b/bin/ptxdist
> @@ -1789,6 +1789,11 @@ EOF
>  			fi
>  			exit
>  			;;
> +		getdev)
> +			check_premake &&
> +			ptxd_make_log getdev
> +			exit
> +			;;
>  		go|images)
>  			do_${cmd}
>  			exit
> diff --git a/config/setup/Kconfig b/config/setup/Kconfig
> index 790276b..e90949b 100644
> --- a/config/setup/Kconfig
> +++ b/config/setup/Kconfig
> @@ -93,6 +93,16 @@ config SETUP_PROJECTPATH
>  
>  endmenu
>  
> +menu "Dev Download      "
> +
> +config SETUP_DEVMIRROR
> +	string "Dev package Mirror"
> +	help
> +	  Enter a URL where *-dev.tar.gz packages can be downloaded
> +	  Use: ptxdist getdev
> +
> +endmenu
> +
>  menu "Source Directories"
>  
>  config SETUP_SRCDIR
> diff --git a/rules/post/get.make b/rules/post/get.make
> index 7e7ad25..58ea81d 100644
> --- a/rules/post/get.make
> +++ b/rules/post/get.make
> @@ -1,6 +1,7 @@
>  # -*-makefile-*-
>  
>  get: $(addprefix $(STATEDIR)/,$(addsuffix .get,$(PACKAGES) $(HOST_PACKAGES) $(CROSS_PACKAGES) $(LAZY_PACKAGES)))
> +getdev: $(addprefix $(STATEDIR)/,$(addsuffix .getdev,$(PACKAGES) $(HOST_PACKAGES) $(CROSS_PACKAGES) $(LAZY_PACKAGES)))
>  
>  # vim600:set foldmethod=marker:
>  # vim600:set syntax=make:
> diff --git a/rules/post/ptxd_make_world_get.make b/rules/post/ptxd_make_world_get.make
> index 152674c..828a73e 100644
> --- a/rules/post/ptxd_make_world_get.make
> +++ b/rules/post/ptxd_make_world_get.make
> @@ -26,6 +26,9 @@ $(SRCDIR)/%:
>  	@$(call targetinfo)
>  	@$(call get, $($@))
>  
> +$(call remove_quotes, $(PTXCONF_PROJECT_DEVPKGDIR))/%:
> +	@$(call targetinfo)
> +	@$(call getdev, $@)
>  
>  $(STATEDIR)/%.get:
>  	@$(call targetinfo)
> @@ -35,6 +38,12 @@ $(STATEDIR)/%.get:
>  		$(call world/check_src, $($(src)));)
>  	@$(call touch)
>  
> +$(STATEDIR)/%.getdev:
> +	@$(call targetinfo)
> +#	@$(foreach src,$($(PTX_MAP_TO_PACKAGE_$(*))_DEVPKG), \
> +#		$(call world/getdev, $($(src)));)
> +	@$(call touch)

As long as this stage does nothing, I think we can just remove it and let
"getdev" depend on the packages directly.

> +
>  world/get = \
>  	$(call world/env, $(1)) \
>  	ptxd_make_world_get
> @@ -59,4 +68,7 @@ get = \
>  check_src = \
>  	ptxd_make_check_src "$($(strip $(1))_SOURCE)" "$($(strip $(1))_MD5)"
>  
> +getdev = \
> +	ptxd_make_getdev "$(strip $(1))" "$(call remove_quotes, $(PTXCONF_SETUP_DEVMIRROR))/$(notdir $(1))"
> +
>  # vim: syntax=make
> diff --git a/scripts/lib/ptxd_lib_dgen.awk b/scripts/lib/ptxd_lib_dgen.awk
> index 7f790c9..1829d64 100644
> --- a/scripts/lib/ptxd_lib_dgen.awk
> +++ b/scripts/lib/ptxd_lib_dgen.awk
> @@ -241,6 +241,11 @@ function write_deps_pkg_all(this_PKG, this_pkg) {
>  	# .get rule
>  	#
>  	print "$(STATEDIR)/" this_pkg ".get: $(" this_PKG "_SOURCES)"	> DGEN_DEPS_POST;
> +	print "ifneq ($(strip $(PTXCONF_SETUP_DEVMIRROR)),)" > DGEN_DEPS_POST;

I don't think that works correctly, PTXCONF_SETUP_DEVMIRROR is a string so
you need to add remove_quotes here.

> +	print "ifneq ($($(" this_PKG "_DEVPKG)),NO)" > DGEN_DEPS_POST;
> +	print "$(STATEDIR)/" this_pkg ".getdev: $(call remove_quotes, $(PTXCONF_PROJECT_DEVPKGDIR))/$(" this_PKG "_DEVPKG)" > DGEN_DEPS_POST;

As mentioned above, just "getdev: ..." here.

> +	print "endif" > DGEN_DEPS_POST;
> +	print "endif" > DGEN_DEPS_POST;
>  }
>  
>  function write_deps_pkg_active(this_PKG, this_pkg, prefix) {
> diff --git a/scripts/lib/ptxd_make_get.sh b/scripts/lib/ptxd_make_get.sh
> index f4d7922..d310ac2 100644
> --- a/scripts/lib/ptxd_make_get.sh
> +++ b/scripts/lib/ptxd_make_get.sh
> @@ -252,7 +252,10 @@ export -f ptxd_make_get_download_permitted
>  # - no-check-certificate	don't check server certificate (https only)
>  # - no-proxy			don't use proxy even if configured
>  #
> -ptxd_make_get() {
> +_ptxd_make_get() {
> +	local exit_on_fail="${1}"
> +	shift
> +
>  	local -a argv
>  	local ptxmirror_url
>  	local mrd=false		# is mirror already part of urls?
> @@ -280,7 +283,7 @@ ptxd_make_get() {
>  		shift
>  
>  		case "${url}" in
> -		${PTXCONF_SETUP_PTXMIRROR}/*/*)
> +		${PTXCONF_SETUP_PTXMIRROR}/*/*|${PTXCONF_SETUP_DEVMIRROR}/*)
>  			# keep original URL, for stuff like glibc
>  			argv[${#argv[@]}]="${url}"
>  			mrd=true
> @@ -397,11 +400,22 @@ ptxd_make_get() {
>  		esac
>  	done
>  
> -	echo
> -	echo "Could not download package"
> -	echo "URL: ${orig_argv[@]}"
> -	echo
> -	exit 1
> +	if [ "${exit_on_fail}" = "y" ]; then

Make this a global variable and invert it, so it only needs to be added for
getdev:

	if [ "${ptxd_make_get_nofail}" = "y" ]; then

> +		echo
> +		echo "Could not download package"
> +		echo "URL: ${orig_argv[@]}"
> +		echo
> +		exit 1
> +	fi
>  }
> +export -f _ptxd_make_get
>  
> +ptxd_make_get() {
> +	_ptxd_make_get y "${@}"
> +}
>  export -f ptxd_make_get
> +
> +ptxd_make_getdev() {
> +	_ptxd_make_get n "${@}"
> +}
> +export -f ptxd_make_getdev

remove those and set ptxd_make_get_nofail in the makefile.

Michael

> -- 
> 1.7.10.4
> 
> 
> -- 
> ptxdist mailing list
> ptxdist@pengutronix.de
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-01-20 10:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-18  1:06 [ptxdist] [PATCH 2/2] ptxdist getdev: Download dev packages from ${PTXCONF_SETUP_DEVMIRROR} jon
2014-01-20 10:44 ` Michael Olbrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox