[pacman-dev] [PATCH 2/2] Accept all bzr URLs in the source array
From: Alucryd <alucryd@gmail.com> This check will run 'bzr info' on the distant URL provided in the source array and compare the branch root URL with the output of 'bzr config parent_location' run inside the local repo to make sure we are building from the right sources. Previously, the check was only run locally, as a result the local parent_location had to be used in the source array. makepkg will fallback to this behavior for offline builds. Signed-off-by: Maxime Gauduin <alucryd@gmail.com> --- scripts/makepkg.sh.in | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index d5b9077..0ac4975 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -474,10 +474,21 @@ download_bzr() { fi elif (( ! HOLDVER )); then # Make sure we are fetching the right repo - if [[ "$url" != "$(bzr config parent_location -d $dir)" ]] ; then - error "$(gettext "%s is not a branch of %s")" "$dir" "$url" - plain "$(gettext "Aborting...")" - exit 1 + local distant_url="$(bzr info $url 2> /dev/null | grep root | sed 's| branch root: ||')" + local local_url="$(bzr config parent_location -d $dir)" + if [[ ! -z "$distant_url" ]]; then + if [[ "$distant_url" != "$local_url" ]]; then + error "$(gettext "%s is not a branch of %s")" "$dir" "$url" + plain "$(gettext "Aborting...")" + exit 1 + fi + else + if [[ "$url" != "$local_url" ]] ; then + error "$(gettext "%s is not a branch of %s")" "$dir" "$url" + error "$(gettext "The local URL is %s")" "$local_url" + plain "$(gettext "Aborting...")" + exit 1 + fi fi msg2 "$(gettext "Pulling %s ...")" "${displaylocation}" cd_safe "$dir" -- 1.8.2
On Mon, Apr 8, 2013 at 12:33 PM, Maxime Gauduin <alucryd@gmail.com> wrote:
From: Alucryd <alucryd@gmail.com>
This check will run 'bzr info' on the distant URL provided in the source array and compare the branch root URL with the output of 'bzr config parent_location' run inside the local repo to make sure we are building from the right sources. Previously, the check was only run locally, as a result the local parent_location had to be used in the source array. makepkg will fallback to this behavior for offline builds.
Signed-off-by: Maxime Gauduin <alucryd@gmail.com> --- scripts/makepkg.sh.in | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index d5b9077..0ac4975 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -474,10 +474,21 @@ download_bzr() { fi elif (( ! HOLDVER )); then # Make sure we are fetching the right repo - if [[ "$url" != "$(bzr config parent_location -d $dir)" ]] ; then - error "$(gettext "%s is not a branch of %s")" "$dir" "$url" - plain "$(gettext "Aborting...")" - exit 1 + local distant_url="$(bzr info $url 2> /dev/null | grep root | sed 's| branch root: ||')" + local local_url="$(bzr config parent_location -d $dir)" + if [[ ! -z "$distant_url" ]]; then + if [[ "$distant_url" != "$local_url" ]]; then + error "$(gettext "%s is not a branch of %s")" "$dir" "$url" + plain "$(gettext "Aborting...")" + exit 1 + fi + else + if [[ "$url" != "$local_url" ]] ; then + error "$(gettext "%s is not a branch of %s")" "$dir" "$url" + error "$(gettext "The local URL is %s")" "$local_url" + plain "$(gettext "Aborting...")" + exit 1 + fi fi msg2 "$(gettext "Pulling %s ...")" "${displaylocation}" cd_safe "$dir" -- 1.8.2
Hmm, I realize that the grep command will fail if the project name contains root, it should be changed to "grep 'branch root'". Need I git send-email the modified patch or will copy/paste/modify the original mail suffice? Cheers. -- Maxime
On 09/04/13 03:59, Maxime GAUDUIN wrote:
On Mon, Apr 8, 2013 at 12:33 PM, Maxime Gauduin <alucryd@gmail.com> wrote:
From: Alucryd <alucryd@gmail.com>
This check will run 'bzr info' on the distant URL provided in the source array and compare the branch root URL with the output of 'bzr config parent_location' run inside the local repo to make sure we are building from the right sources. Previously, the check was only run locally, as a result the local parent_location had to be used in the source array. makepkg will fallback to this behavior for offline builds.
Signed-off-by: Maxime Gauduin <alucryd@gmail.com> --- scripts/makepkg.sh.in | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index d5b9077..0ac4975 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -474,10 +474,21 @@ download_bzr() { fi elif (( ! HOLDVER )); then # Make sure we are fetching the right repo - if [[ "$url" != "$(bzr config parent_location -d $dir)" ]] ; then - error "$(gettext "%s is not a branch of %s")" "$dir" "$url" - plain "$(gettext "Aborting...")" - exit 1 + local distant_url="$(bzr info $url 2> /dev/null | grep root | sed 's| branch root: ||')" + local local_url="$(bzr config parent_location -d $dir)" + if [[ ! -z "$distant_url" ]]; then + if [[ "$distant_url" != "$local_url" ]]; then + error "$(gettext "%s is not a branch of %s")" "$dir" "$url" + plain "$(gettext "Aborting...")" + exit 1 + fi + else + if [[ "$url" != "$local_url" ]] ; then + error "$(gettext "%s is not a branch of %s")" "$dir" "$url" + error "$(gettext "The local URL is %s")" "$local_url" + plain "$(gettext "Aborting...")" + exit 1 + fi fi msg2 "$(gettext "Pulling %s ...")" "${displaylocation}" cd_safe "$dir" -- 1.8.2
Hmm, I realize that the grep command will fail if the project name contains root, it should be changed to "grep 'branch root'". Need I git send-email the modified patch or will copy/paste/modify the original mail suffice?
Please resend using git send-email.
On 09/04/13 10:39, Allan McRae wrote:
On 09/04/13 03:59, Maxime GAUDUIN wrote:
On Mon, Apr 8, 2013 at 12:33 PM, Maxime Gauduin <alucryd@gmail.com> wrote:
From: Alucryd <alucryd@gmail.com>
This check will run 'bzr info' on the distant URL provided in the source array and compare the branch root URL with the output of 'bzr config parent_location' run inside the local repo to make sure we are building from the right sources. Previously, the check was only run locally, as a result the local parent_location had to be used in the source array. makepkg will fallback to this behavior for offline builds.
Signed-off-by: Maxime Gauduin <alucryd@gmail.com> --- scripts/makepkg.sh.in | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index d5b9077..0ac4975 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -474,10 +474,21 @@ download_bzr() { fi elif (( ! HOLDVER )); then # Make sure we are fetching the right repo - if [[ "$url" != "$(bzr config parent_location -d $dir)" ]] ; then - error "$(gettext "%s is not a branch of %s")" "$dir" "$url" - plain "$(gettext "Aborting...")" - exit 1 + local distant_url="$(bzr info $url 2> /dev/null | grep root | sed 's| branch root: ||')" + local local_url="$(bzr config parent_location -d $dir)" + if [[ ! -z "$distant_url" ]]; then + if [[ "$distant_url" != "$local_url" ]]; then + error "$(gettext "%s is not a branch of %s")" "$dir" "$url" + plain "$(gettext "Aborting...")" + exit 1 + fi + else + if [[ "$url" != "$local_url" ]] ; then + error "$(gettext "%s is not a branch of %s")" "$dir" "$url" + error "$(gettext "The local URL is %s")" "$local_url" + plain "$(gettext "Aborting...")" + exit 1 + fi fi msg2 "$(gettext "Pulling %s ...")" "${displaylocation}" cd_safe "$dir" -- 1.8.2
Hmm, I realize that the grep command will fail if the project name contains root, it should be changed to "grep 'branch root'". Need I git send-email the modified patch or will copy/paste/modify the original mail suffice?
Please resend using git send-email.
In fact, for this I can just make the change when I pull it. Allan
On 08/04/13 20:33, Maxime Gauduin wrote:
From: Alucryd <alucryd@gmail.com>
This check will run 'bzr info' on the distant URL provided in the source array and compare the branch root URL with the output of 'bzr config parent_location' run inside the local repo to make sure we are building from the right sources. Previously, the check was only run locally, as a result the local parent_location had to be used in the source array. makepkg will fallback to this behavior for offline builds.
Signed-off-by: Maxime Gauduin <alucryd@gmail.com> --- scripts/makepkg.sh.in | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index d5b9077..0ac4975 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -474,10 +474,21 @@ download_bzr() { fi elif (( ! HOLDVER )); then # Make sure we are fetching the right repo - if [[ "$url" != "$(bzr config parent_location -d $dir)" ]] ; then - error "$(gettext "%s is not a branch of %s")" "$dir" "$url" - plain "$(gettext "Aborting...")" - exit 1 + local distant_url="$(bzr info $url 2> /dev/null | grep root | sed 's| branch root: ||')"
Does this need an LC_ALL=C in the front?
+ local local_url="$(bzr config parent_location -d $dir)" + if [[ ! -z "$distant_url" ]]; then
if [[ -n ... ?
+ if [[ "$distant_url" != "$local_url" ]]; then + error "$(gettext "%s is not a branch of %s")" "$dir" "$url" + plain "$(gettext "Aborting...")" + exit 1 + fi + else + if [[ "$url" != "$local_url" ]] ; then + error "$(gettext "%s is not a branch of %s")" "$dir" "$url" + error "$(gettext "The local URL is %s")" "$local_url" + plain "$(gettext "Aborting...")" + exit 1 + fi fi msg2 "$(gettext "Pulling %s ...")" "${displaylocation}" cd_safe "$dir"
On Tue, 2013-04-09 at 11:46 +1000, Allan McRae wrote:
On 08/04/13 20:33, Maxime Gauduin wrote:
From: Alucryd <alucryd@gmail.com>
This check will run 'bzr info' on the distant URL provided in the source array and compare the branch root URL with the output of 'bzr config parent_location' run inside the local repo to make sure we are building from the right sources. Previously, the check was only run locally, as a result the local parent_location had to be used in the source array. makepkg will fallback to this behavior for offline builds.
Signed-off-by: Maxime Gauduin <alucryd@gmail.com> --- scripts/makepkg.sh.in | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index d5b9077..0ac4975 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -474,10 +474,21 @@ download_bzr() { fi elif (( ! HOLDVER )); then # Make sure we are fetching the right repo - if [[ "$url" != "$(bzr config parent_location -d $dir)" ]] ; then - error "$(gettext "%s is not a branch of %s")" "$dir" "$url" - plain "$(gettext "Aborting...")" - exit 1 + local distant_url="$(bzr info $url 2> /dev/null | grep root | sed 's| branch root: ||')"
Does this need an LC_ALL=C in the front?
I tried several locales, it seems bzr info always outputs in english, there should be no need for this.
+ local local_url="$(bzr config parent_location -d $dir)" + if [[ ! -z "$distant_url" ]]; then
if [[ -n ... ?
Yeah, I put the ! in front without even thinking, -n is indeed better.
+ if [[ "$distant_url" != "$local_url" ]]; then + error "$(gettext "%s is not a branch of %s")" "$dir" "$url" + plain "$(gettext "Aborting...")" + exit 1 + fi + else + if [[ "$url" != "$local_url" ]] ; then + error "$(gettext "%s is not a branch of %s")" "$dir" "$url" + error "$(gettext "The local URL is %s")" "$local_url" + plain "$(gettext "Aborting...")" + exit 1 + fi fi msg2 "$(gettext "Pulling %s ...")" "${displaylocation}" cd_safe "$dir"
Thank you for taking care of the modifications. Cheers. -- Maxime
On Tue, Apr 9, 2013 at 9:39 AM, Maxime Gauduin <alucryd@gmail.com> wrote:
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index d5b9077..0ac4975 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -474,10 +474,21 @@ download_bzr() { fi elif (( ! HOLDVER )); then # Make sure we are fetching the right repo - if [[ "$url" != "$(bzr config parent_location -d $dir)" ]] ; then - error "$(gettext "%s is not a branch of %s")" "$dir" "$url" - plain "$(gettext "Aborting...")" - exit 1 + local distant_url="$(bzr info $url 2> /dev/null | grep root | sed 's| branch root: ||')"
UMQ! + local distant_url="$(bzr info "$url" 2> /dev/null | sed -r 's| branch root: ||p')"
Does this need an LC_ALL=C in the front?
I tried several locales, it seems bzr info always outputs in english, there should be no need for this.
+ local local_url="$(bzr config parent_location -d $dir)" UMQ! local local_url="$(bzr config parent_location -d "$dir")"
+ if [[ ! -z "$distant_url" ]]; then
if [[ -n ... ?
Yeah, I put the ! in front without even thinking, -n is indeed better.
Use More Quotes™! cheers! mar77i
On Tue, 2013-04-09 at 10:20 +0200, Martti Kühne wrote:
On Tue, Apr 9, 2013 at 9:39 AM, Maxime Gauduin <alucryd@gmail.com> wrote:
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index d5b9077..0ac4975 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -474,10 +474,21 @@ download_bzr() { fi elif (( ! HOLDVER )); then # Make sure we are fetching the right repo - if [[ "$url" != "$(bzr config parent_location -d $dir)" ]] ; then - error "$(gettext "%s is not a branch of %s")" "$dir" "$url" - plain "$(gettext "Aborting...")" - exit 1 + local distant_url="$(bzr info $url 2> /dev/null | grep root | sed 's| branch root: ||')"
UMQ! + local distant_url="$(bzr info "$url" 2> /dev/null | sed -r 's| branch root: ||p')"
Does this need an LC_ALL=C in the front?
I tried several locales, it seems bzr info always outputs in english, there should be no need for this.
+ local local_url="$(bzr config parent_location -d $dir)" UMQ! local local_url="$(bzr config parent_location -d "$dir")"
+ if [[ ! -z "$distant_url" ]]; then
if [[ -n ... ?
Yeah, I put the ! in front without even thinking, -n is indeed better.
Use More Quotes™!
cheers! mar77i
Didn't know that was patented :) I've git send-email the patch again with all modifications so far. Cheers. -- Maxime
also it should not be sed -r but -n... damn, I knew I shouldn't be writing this stuff from memory :)
On Tue, Apr 9, 2013 at 12:12 PM, Martti Kühne <mysatyre@gmail.com> wrote:
also it should not be sed -r but -n... damn, I knew I shouldn't be writing this stuff from memory :)
Your command returns an empty string.The output of 'bzr info' is several lines long, sed -n seems to fail with or without grep anyway. Did you try it on a distant repo? BTW, support for lp: URLs is still not perfect. I just noticed that if I don't specify a target dir in 'dir::bzr+lp:audience', makepkg will pull the repo into a dir named 'bzr+lp:audience' and can't create a working copy in $srcdir. I'm looking into it and will try to have a third patch ready soon to correct this behavior. Cheers. -- Maxime
On Tue, Apr 9, 2013 at 12:37 PM, Maxime GAUDUIN <alucryd@gmail.com> wrote:
On Tue, Apr 9, 2013 at 12:12 PM, Martti Kühne <mysatyre@gmail.com> wrote:
also it should not be sed -r but -n... damn, I knew I shouldn't be writing this stuff from memory :)
Your command returns an empty string.The output of 'bzr info' is several lines long, sed -n seems to fail with or without grep anyway. Did you try it on a distant repo?
sure it's empty. another thing I had added to your sed line was a 'p' (like print) right after the substitution. cheers! mar77i
On Tue, Apr 9, 2013 at 1:03 PM, Martti Kühne <mysatyre@gmail.com> wrote:
On Tue, Apr 9, 2013 at 12:37 PM, Maxime GAUDUIN <alucryd@gmail.com> wrote:
On Tue, Apr 9, 2013 at 12:12 PM, Martti Kühne <mysatyre@gmail.com> wrote:
also it should not be sed -r but -n... damn, I knew I shouldn't be writing this stuff from memory :)
Your command returns an empty string.The output of 'bzr info' is several lines long, sed -n seems to fail with or without grep anyway. Did you try it on a distant repo?
sure it's empty. another thing I had added to your sed line was a 'p' (like print) right after the substitution.
cheers! mar77i
Oh nice, sorry I didn't see that, thx for the tip! Cheers. -- Maxime
On Tue, Apr 9, 2013 at 12:37 PM, Maxime GAUDUIN <alucryd@gmail.com> wrote:
On Tue, Apr 9, 2013 at 12:12 PM, Martti Kühne <mysatyre@gmail.com> wrote:
also it should not be sed -r but -n... damn, I knew I shouldn't be writing this stuff from memory :)
Your command returns an empty string.The output of 'bzr info' is several lines long, sed -n seems to fail with or without grep anyway. Did you try it on a distant repo?
BTW, support for lp: URLs is still not perfect. I just noticed that if I don't specify a target dir in 'dir::bzr+lp:audience', makepkg will pull the repo into a dir named 'bzr+lp:audience' and can't create a working copy in $srcdir. I'm looking into it and will try to have a third patch ready soon to correct this behavior.
Cheers. -- Maxime
Okay, fix for lp: URLs destdir is up, the patch can be applied before or after the 2 other patches, it doesn't overlap with them. Cheers. -- Maxime
participants (4)
-
Allan McRae
-
Martti Kühne
-
Maxime GAUDUIN
-
Maxime Gauduin