From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-lb0-x229.google.com ([2a00:1450:4010:c04::229]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1W1ng6-0002Ku-IY for ptxdist@pengutronix.de; Sat, 11 Jan 2014 02:48:00 +0100 Received: by mail-lb0-f169.google.com with SMTP id q8so973326lbi.28 for ; Fri, 10 Jan 2014 17:47:52 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <20140110153743.GC20358@pengutronix.de> References: <201401080859.43988.jbe@pengutronix.de> <20140109090334.GI2156@pengutronix.de> <20140109160612.GA7098@pengutronix.de> <20140110153743.GC20358@pengutronix.de> Date: Fri, 10 Jan 2014 20:47:52 -0500 Message-ID: From: Jon Ringle Subject: Re: [ptxdist] git ptxdist best practices Reply-To: ptxdist@pengutronix.de List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============0571852555==" Sender: ptxdist-bounces@pengutronix.de Errors-To: ptxdist-bounces@pengutronix.de To: ptxdist@pengutronix.de --===============0571852555== Content-Type: multipart/alternative; boundary=001a11c33e4adb008204efa8070e --001a11c33e4adb008204efa8070e Content-Type: text/plain; charset=ISO-8859-1 On Fri, Jan 10, 2014 at 10:37 AM, Michael Olbrich wrote: > On Thu, Jan 09, 2014 at 11:37:15AM -0500, Jon Ringle wrote: > > Would the following approach work: > > > > 1. In ptxdist/rules/post/ptxd_make_world_common.make add to > world/env/impl: > > pkg_url_safe="$(call ptx/escape,$($(1)_URL_SAFE))" > > > > 2. In ptxdist/scripts/lib/ptxd_make_get.sh function ptxd_make_get > > change all occurances of: > > if [ -z "${PTXCONF_SETUP_PTXMIRROR_ONLY}" ]; then > > with something like: > > if [ -z "${PTXCONF_SETUP_PTXMIRROR_ONLY}" -o -n "${pkg_url_safe}" ]; > > then > > > > Then in the rule file you can do: > > FOO_URL_SAFE := y > > > > So that you can whitelist a specific URL if PTXCONF_SETUP_PTXMIRROR_ONLY > is > > set > > Hmmm, this is not so nice. How about making PTXCONF_SETUP_PTXMIRROR a list? > Then you can add http://opensource/pool/ and your git server to the > 'whitelist'. > > The approach you are proposing has several issue for which I don't have the necessary bash chops to figure out how to tackle: 1. In the 1st while loop in ptxd_make_get(), I don't know how to get the case to accept multiple array values for ${PTXCONF_SETUP_PTXMIRROR}: case "${url}" in ${PTXCONF_SETUP_PTXMIRROR}/*/*) # keep original URL, for stuff like glibc argv[${#argv[@]}]="${url}" mrd=true ;; ${PTXCONF_SETUP_PTXMIRROR}/*) # if mirror is given us to download, add it, but only once if ! ${mrd}; then argv[${#argv[@]}]="${url}" mrd=true fi ;; Replacing with ${PTXCONF_SETUP_PTXMIRROR[@]} clear won't help as the various options aren't separate by PIPE character |. 2. Where ptxmirror_url gets assigned, it would also need to be an array too 3. And then also where ${ptxmirror_url} gets added to the argv array Quite frankly, I really like my approach much better... and it does not preclude you from implementing your solution as well. If I created and tested a patch that allows FOO_URL_SAFE, would you consider it for inclusion to ptxdist? Thanks, Jon --001a11c33e4adb008204efa8070e Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On F= ri, Jan 10, 2014 at 10:37 AM, Michael Olbrich <m.olbrich@pengutroni= x.de> wrote:
On Thu, Jan 09, 2014 at 11:37:15AM -0500, Jon Ringle wrote:
> Would the following approach work:
>
> 1. In ptxdist/rules/post/ptxd_make_world_common.make add to world/env/= impl:
> =A0 =A0 pkg_url_safe=3D"$(call ptx/escape,$($(1)_URL_SAFE))"=
>
> 2. In ptxdist/scripts/lib/ptxd_make_get.sh function ptxd_make_get
> change all occurances of:
> =A0 =A0 if [ -z "${PTXCONF_SETUP_PTXMIRROR_ONLY}" ]; then > with something like:
> =A0 =A0 if [ -z "${PTXCONF_SETUP_PTXMIRROR_ONLY}" -o -n &quo= t;${pkg_url_safe}" ];
> then
>
> Then in the rule file you can do:
> FOO_URL_SAFE :=3D y
>
> So that you can whitelist a specific URL if PTXCONF_SETUP_PTXMIRROR_ON= LY is
> set

Hmmm, this is not so nice. How about making PTXCONF_SETUP_PTXMI= RROR a list?
Then you can add http= ://opensource/pool/ and your git server to the
'whitelist'.

The ap= proach you are proposing has several issue for which I don't have the n= ecessary bash chops to figure out how to tackle:

1. In the 1st while loop in ptxd_make_get(), I don't know how to get th= e case to accept multiple array values for ${PTXCONF_SETUP_PTXMIRROR}:
= =A0=A0=A0=A0=A0=A0=A0 case "${url}" in
=A0=A0=A0=A0=A0=A0=A0 $= {PTXCONF_SETUP_PTXMIRROR}/*/*)
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 # keep original URL, for stuff like glibc=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 argv[${#argv[@]}]=3D"${url}"= ;
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 mrd=3Dtrue
=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0 ;;
=A0=A0=A0=A0=A0=A0=A0 ${PTXCONF_SETUP_PTXMIRROR}/*)
= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 # if mirror is given us to download, add = it, but only once
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if ! ${mrd}; then
=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0 argv[${#argv[@]}]=3D"${url}"
=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 mrd=3Dtrue
=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0 fi
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ;;

Replacing with ${PTXCONF_SETUP_PTXMIRROR[@]} clear = won't help as the various options aren't separate by PIPE character= |.

2. Where ptxmirror_url gets assigned, = it would also need to be an array too
3= . And then also where ${ptxmirror_url} gets added to the argv array

Quite frankly, I really like my approach m= uch better... and it does not preclude you from implementing your solution = as well.
If I created and tested a patc= h that allows FOO_URL_SAFE, would you consider it for inclusion to ptxdist?=

Thanks,
Jon
--001a11c33e4adb008204efa8070e-- --===============0571852555== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline -- ptxdist mailing list ptxdist@pengutronix.de --===============0571852555==--