[pacman-dev] [PATCH] makepkg: also clean cache if no character was entered at the prompt
If no character was entered, the preselected option (= the capital) should be assumed; just as pacman it does. Signed-off-by: Cedric Staniewski <cedric@gmx.ca> --- scripts/makepkg.sh.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 40367ae..3b29b31 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1600,7 +1600,7 @@ if [ "$CLEANCACHE" -eq 1 ]; then echo -n "$(gettext "[Y/n]")" read answer answer="${answer^^}" - if [ "$answer" = "$(gettext "YES")" -o "$answer" = "$(gettext "Y")" ]; then + if [ -z "$answer" -o "$answer" = "$(gettext "YES")" -o "$answer" = "$(gettext "Y")" ]; then rm "$SRCDEST"/* if [ $? -ne 0 ]; then error "$(gettext "Problem removing files; you may not have correct permissions in %s")" "$SRCDEST" -- 1.6.5.1
pkgbase is used in the following rm calls, and since pkgname can be present when pkgbase is not, it is safer to check for pkgbase. Signed-off-by: Cedric Staniewski <cedric@gmx.ca> --- scripts/makepkg.sh.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 3b29b31..e18ab15 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -156,7 +156,7 @@ clean_up() { # If it's a clean exit and -c/--clean has been passed... msg "$(gettext "Cleaning up...")" rm -rf "$pkgdir" "$srcdir" - if [ -n "$pkgname" ]; then + if [ -n "$pkgbase" ]; then # Can't do this unless the BUILDSCRIPT has been sourced. rm -f "${pkgbase}-${pkgver}-${pkgrel}-${CARCH}-build.log"* if [ "$PKGFUNC" -eq 1 ]; then -- 1.6.5.1
On Wed, Oct 21, 2009 at 9:06 AM, Cedric Staniewski <cedric@gmx.ca> wrote:
pkgbase is used in the following rm calls, and since pkgname can be present when pkgbase is not, it is safer to check for pkgbase.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca> Looks good to me, Allan?
-Dan
--- scripts/makepkg.sh.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 3b29b31..e18ab15 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -156,7 +156,7 @@ clean_up() { # If it's a clean exit and -c/--clean has been passed... msg "$(gettext "Cleaning up...")" rm -rf "$pkgdir" "$srcdir" - if [ -n "$pkgname" ]; then + if [ -n "$pkgbase" ]; then # Can't do this unless the BUILDSCRIPT has been sourced. rm -f "${pkgbase}-${pkgver}-${pkgrel}-${CARCH}-build.log"* if [ "$PKGFUNC" -eq 1 ]; then -- 1.6.5.1
Dan McGee wrote:
On Wed, Oct 21, 2009 at 9:06 AM, Cedric Staniewski <cedric@gmx.ca> wrote:
pkgbase is used in the following rm calls, and since pkgname can be present when pkgbase is not, it is safer to check for pkgbase.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Looks good to me, Allan?
-Dan
Makes sense to me. Although, I believe there is no way for makepkg to exit cleanly after sourcing the PKGBUILD without the setting of pkgbase. Pushed to my working branch. Allan
Allan McRae wrote:
Dan McGee wrote:
On Wed, Oct 21, 2009 at 9:06 AM, Cedric Staniewski <cedric@gmx.ca> wrote:
pkgbase is used in the following rm calls, and since pkgname can be present when pkgbase is not, it is safer to check for pkgbase.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Looks good to me, Allan?
-Dan
Makes sense to me. Although, I believe there is no way for makepkg to exit cleanly after sourcing the PKGBUILD without the setting of pkgbase.
Pushed to my working branch.
Allan
The, probably only, operation, which is affected by this, is '-gc'.
Cedric Staniewski wrote:
Allan McRae wrote:
Dan McGee wrote:
On Wed, Oct 21, 2009 at 9:06 AM, Cedric Staniewski <cedric@gmx.ca> wrote:
pkgbase is used in the following rm calls, and since pkgname can be present when pkgbase is not, it is safer to check for pkgbase.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Looks good to me, Allan?
-Dan
Makes sense to me. Although, I believe there is no way for makepkg to exit cleanly after sourcing the PKGBUILD without the setting of pkgbase.
Pushed to my working branch.
Allan
The, probably only, operation, which is affected by this, is '-gc'.
Good catch. Allan
Cedric Staniewski wrote:
If no character was entered, the preselected option (= the capital) should be assumed; just as pacman it does.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca> --- scripts/makepkg.sh.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 40367ae..3b29b31 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1600,7 +1600,7 @@ if [ "$CLEANCACHE" -eq 1 ]; then echo -n "$(gettext "[Y/n]")" read answer answer="${answer^^}" - if [ "$answer" = "$(gettext "YES")" -o "$answer" = "$(gettext "Y")" ]; then + if [ -z "$answer" -o "$answer" = "$(gettext "YES")" -o "$answer" = "$(gettext "Y")" ]; then rm "$SRCDEST"/* if [ $? -ne 0 ]; then error "$(gettext "Problem removing files; you may not have correct permissions in %s")" "$SRCDEST"
This is a fairly bad option to default to yes... I would prefer just changing the query to [n/Y] and keep the test as it is. Allan
Allan McRae wrote:
Cedric Staniewski wrote:
If no character was entered, the preselected option (= the capital) should be assumed; just as pacman it does.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca> --- scripts/makepkg.sh.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 40367ae..3b29b31 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1600,7 +1600,7 @@ if [ "$CLEANCACHE" -eq 1 ]; then echo -n "$(gettext "[Y/n]")" read answer answer="${answer^^}" - if [ "$answer" = "$(gettext "YES")" -o "$answer" = "$(gettext "Y")" ]; then + if [ -z "$answer" -o "$answer" = "$(gettext "YES")" -o "$answer" = "$(gettext "Y")" ]; then rm "$SRCDEST"/* if [ $? -ne 0 ]; then error "$(gettext "Problem removing files; you may not have correct permissions in %s")" "$SRCDEST"
This is a fairly bad option to default to yes... I would prefer just changing the query to [n/Y] and keep the test as it is.
Ugh... late at night. I meant [y/N]. Allan
Allan McRae wrote:
Allan McRae wrote:
Cedric Staniewski wrote:
If no character was entered, the preselected option (= the capital) should be assumed; just as pacman it does.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca> --- scripts/makepkg.sh.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 40367ae..3b29b31 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1600,7 +1600,7 @@ if [ "$CLEANCACHE" -eq 1 ]; then echo -n "$(gettext "[Y/n]")" read answer answer="${answer^^}" - if [ "$answer" = "$(gettext "YES")" -o "$answer" = "$(gettext "Y")" ]; then + if [ -z "$answer" -o "$answer" = "$(gettext "YES")" -o "$answer" = "$(gettext "Y")" ]; then rm "$SRCDEST"/* if [ $? -ne 0 ]; then error "$(gettext "Problem removing files; you may not have correct permissions in %s")" "$SRCDEST"
This is a fairly bad option to default to yes... I would prefer just changing the query to [n/Y] and keep the test as it is.
Ugh... late at night. I meant [y/N].
Allan
Also thought about that, but came to the conclusion an extra flag and a prompt are safe enough. Anyway, here you go.
From 2f5d122c7684233377817b9d62f3dd68cdfe2e44 Mon Sep 17 00:00:00 2001 -- 8< -- From: Cedric Staniewski <cedric@gmx.ca> Date: Wed, 21 Oct 2009 19:08:41 +0200 Subject: [PATCH] makepkg: change preselected option for cleaning the cache from Y to N
Signed-off-by: Cedric Staniewski <cedric@gmx.ca> --- scripts/makepkg.sh.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 40367ae..088edca 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1597,7 +1597,7 @@ if [ "$CLEANCACHE" -eq 1 ]; then if [ -n "$SRCDEST" -a "$SRCDEST" != "$startdir" ]; then msg "$(gettext "Cleaning up ALL files from %s.")" "$SRCDEST" echo -n "$(gettext " Are you sure you wish to do this? ")" - echo -n "$(gettext "[Y/n]")" + echo -n "$(gettext "[N/y]")" read answer answer="${answer^^}" if [ "$answer" = "$(gettext "YES")" -o "$answer" = "$(gettext "Y")" ]; then -- 1.6.5.1
On Wed, Oct 21, 2009 at 1:13 PM, Cedric Staniewski <cedric@gmx.ca> wrote:
Allan McRae wrote:
Allan McRae wrote:
Cedric Staniewski wrote:
If no character was entered, the preselected option (= the capital) should be assumed; just as pacman it does.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca> --- scripts/makepkg.sh.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 40367ae..3b29b31 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1600,7 +1600,7 @@ if [ "$CLEANCACHE" -eq 1 ]; then echo -n "$(gettext "[Y/n]")" read answer answer="${answer^^}" - if [ "$answer" = "$(gettext "YES")" -o "$answer" = "$(gettext "Y")" ]; then + if [ -z "$answer" -o "$answer" = "$(gettext "YES")" -o "$answer" = "$(gettext "Y")" ]; then rm "$SRCDEST"/* if [ $? -ne 0 ]; then error "$(gettext "Problem removing files; you may not have correct permissions in %s")" "$SRCDEST"
This is a fairly bad option to default to yes... I would prefer just changing the query to [n/Y] and keep the test as it is.
Ugh... late at night. I meant [y/N].
Allan
Also thought about that, but came to the conclusion an extra flag and a prompt are safe enough. Anyway, here you go.
From 2f5d122c7684233377817b9d62f3dd68cdfe2e44 Mon Sep 17 00:00:00 2001 -- 8< -- From: Cedric Staniewski <cedric@gmx.ca> Date: Wed, 21 Oct 2009 19:08:41 +0200 Subject: [PATCH] makepkg: change preselected option for cleaning the cache from Y to N
Signed-off-by: Cedric Staniewski <cedric@gmx.ca> --- scripts/makepkg.sh.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 40367ae..088edca 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1597,7 +1597,7 @@ if [ "$CLEANCACHE" -eq 1 ]; then if [ -n "$SRCDEST" -a "$SRCDEST" != "$startdir" ]; then msg "$(gettext "Cleaning up ALL files from %s.")" "$SRCDEST" echo -n "$(gettext " Are you sure you wish to do this? ")" - echo -n "$(gettext "[Y/n]")" + echo -n "$(gettext "[N/y]")"
Shouldn't the last line be: + echo -n "$(gettext "[y/N]")" i.e. put the y first?
On Wed, Oct 21, 2009 at 4:10 PM, Eric Bélanger <snowmaniscool@gmail.com> wrote:
On Wed, Oct 21, 2009 at 1:13 PM, Cedric Staniewski <cedric@gmx.ca> wrote:
Allan McRae wrote:
Allan McRae wrote:
Cedric Staniewski wrote:
If no character was entered, the preselected option (= the capital) should be assumed; just as pacman it does.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca> --- scripts/makepkg.sh.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 40367ae..3b29b31 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1600,7 +1600,7 @@ if [ "$CLEANCACHE" -eq 1 ]; then echo -n "$(gettext "[Y/n]")" read answer answer="${answer^^}" - if [ "$answer" = "$(gettext "YES")" -o "$answer" = "$(gettext "Y")" ]; then + if [ -z "$answer" -o "$answer" = "$(gettext "YES")" -o "$answer" = "$(gettext "Y")" ]; then rm "$SRCDEST"/* if [ $? -ne 0 ]; then error "$(gettext "Problem removing files; you may not have correct permissions in %s")" "$SRCDEST"
This is a fairly bad option to default to yes... I would prefer just changing the query to [n/Y] and keep the test as it is.
Ugh... late at night. I meant [y/N].
Allan
Also thought about that, but came to the conclusion an extra flag and a prompt are safe enough. Anyway, here you go.
From 2f5d122c7684233377817b9d62f3dd68cdfe2e44 Mon Sep 17 00:00:00 2001 -- 8< -- From: Cedric Staniewski <cedric@gmx.ca> Date: Wed, 21 Oct 2009 19:08:41 +0200 Subject: [PATCH] makepkg: change preselected option for cleaning the cache from Y to N
Signed-off-by: Cedric Staniewski <cedric@gmx.ca> --- scripts/makepkg.sh.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 40367ae..088edca 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1597,7 +1597,7 @@ if [ "$CLEANCACHE" -eq 1 ]; then if [ -n "$SRCDEST" -a "$SRCDEST" != "$startdir" ]; then msg "$(gettext "Cleaning up ALL files from %s.")" "$SRCDEST" echo -n "$(gettext " Are you sure you wish to do this? ")" - echo -n "$(gettext "[Y/n]")" + echo -n "$(gettext "[N/y]")"
Shouldn't the last line be:
+ echo -n "$(gettext "[y/N]")"
i.e. put the y first?
Yes, definitely, we want to match the existing translation used by pacman anyway. -Dan
Eric Bélanger wrote:
On Wed, Oct 21, 2009 at 1:13 PM, Cedric Staniewski <cedric@gmx.ca> wrote:
Allan McRae wrote:
Allan McRae wrote:
Cedric Staniewski wrote:
If no character was entered, the preselected option (= the capital) should be assumed; just as pacman it does.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca> --- scripts/makepkg.sh.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 40367ae..3b29b31 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1600,7 +1600,7 @@ if [ "$CLEANCACHE" -eq 1 ]; then echo -n "$(gettext "[Y/n]")" read answer answer="${answer^^}" - if [ "$answer" = "$(gettext "YES")" -o "$answer" = "$(gettext "Y")" ]; then + if [ -z "$answer" -o "$answer" = "$(gettext "YES")" -o "$answer" = "$(gettext "Y")" ]; then rm "$SRCDEST"/* if [ $? -ne 0 ]; then error "$(gettext "Problem removing files; you may not have correct permissions in %s")" "$SRCDEST"
This is a fairly bad option to default to yes... I would prefer just changing the query to [n/Y] and keep the test as it is. Ugh... late at night. I meant [y/N].
Allan
Also thought about that, but came to the conclusion an extra flag and a prompt are safe enough. Anyway, here you go.
From 2f5d122c7684233377817b9d62f3dd68cdfe2e44 Mon Sep 17 00:00:00 2001 -- 8< -- From: Cedric Staniewski <cedric@gmx.ca> Date: Wed, 21 Oct 2009 19:08:41 +0200 Subject: [PATCH] makepkg: change preselected option for cleaning the cache from Y to N
Signed-off-by: Cedric Staniewski <cedric@gmx.ca> --- scripts/makepkg.sh.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 40367ae..088edca 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1597,7 +1597,7 @@ if [ "$CLEANCACHE" -eq 1 ]; then if [ -n "$SRCDEST" -a "$SRCDEST" != "$startdir" ]; then msg "$(gettext "Cleaning up ALL files from %s.")" "$SRCDEST" echo -n "$(gettext " Are you sure you wish to do this? ")" - echo -n "$(gettext "[Y/n]")" + echo -n "$(gettext "[N/y]")"
Shouldn't the last line be:
+ echo -n "$(gettext "[y/N]")"
i.e. put the y first?
Haha, that's Allan's karma. At least, I capitalized the right character. :) Sorry for that and thanks Eric.
From c3b242554ef7958257743a975e3928dcb8903d69 Mon Sep 17 00:00:00 2001 From: Cedric Staniewski <cedric@gmx.ca> Date: Wed, 21 Oct 2009 19:08:41 +0200 -- 8< -- Subject: [PATCH] makepkg: change preselected option for cleaning the cache from Y to N
Signed-off-by: Cedric Staniewski <cedric@gmx.ca> --- scripts/makepkg.sh.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 40367ae..47f9873 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1597,7 +1597,7 @@ if [ "$CLEANCACHE" -eq 1 ]; then if [ -n "$SRCDEST" -a "$SRCDEST" != "$startdir" ]; then msg "$(gettext "Cleaning up ALL files from %s.")" "$SRCDEST" echo -n "$(gettext " Are you sure you wish to do this? ")" - echo -n "$(gettext "[Y/n]")" + echo -n "$(gettext "[y/N]")" read answer answer="${answer^^}" if [ "$answer" = "$(gettext "YES")" -o "$answer" = "$(gettext "Y")" ]; then -- 1.6.5.1
Cedric Staniewski wrote:
From c3b242554ef7958257743a975e3928dcb8903d69 Mon Sep 17 00:00:00 2001 From: Cedric Staniewski <cedric@gmx.ca> Date: Wed, 21 Oct 2009 19:08:41 +0200 -- 8< -- Subject: [PATCH] makepkg: change preselected option for cleaning the cache from Y to N
Signed-off-by: Cedric Staniewski <cedric@gmx.ca> --- scripts/makepkg.sh.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 40367ae..47f9873 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1597,7 +1597,7 @@ if [ "$CLEANCACHE" -eq 1 ]; then if [ -n "$SRCDEST" -a "$SRCDEST" != "$startdir" ]; then msg "$(gettext "Cleaning up ALL files from %s.")" "$SRCDEST" echo -n "$(gettext " Are you sure you wish to do this? ")" - echo -n "$(gettext "[Y/n]")" + echo -n "$(gettext "[y/N]")" read answer answer="${answer^^}" if [ "$answer" = "$(gettext "YES")" -o "$answer" = "$(gettext "Y")" ]; then
Pushed to my working branch. Allan
participants (4)
-
Allan McRae
-
Cedric Staniewski
-
Dan McGee
-
Eric Bélanger