[pacman-dev] [PATCH] makepkg: fix check for previously built packages with package splitting
Checks if some or all packages are built before overwriting/installing. Adds two new translation strings Signed-off-by: Allan McRae <allan@archlinux.org> --- scripts/makepkg.sh.in | 41 ++++++++++++++++++++++++++++++++--------- 1 files changed, 32 insertions(+), 9 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 2bb7eb9..61ae037 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1646,15 +1646,38 @@ if [ "${#pkgname[@]}" -gt "1" ]; then SPLITPKG=1 fi -if [ -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" \ - -a "$FORCE" -eq 0 -a "$SOURCEONLY" -eq 0 -a "$NOBUILD" -eq 0 ]; then - if [ "$INSTALL" -eq 1 ]; then - warning "$(gettext "A package has already been built, installing existing package...")" - install_package - exit $? - else - error "$(gettext "A package has already been built. (use -f to overwrite)")" - exit 1 +if [ "$SPLITPKG" -eq 0 ]; then + if [ -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" \ + -a "$FORCE" -eq 0 -a "$SOURCEONLY" -eq 0 -a "$NOBUILD" -eq 0 ]; then + if [ "$INSTALL" -eq 1 ]; then + warning "$(gettext "A package has already been built, installing existing package...")" + install_package + exit $? + else + error "$(gettext "A package has already been built. (use -f to overwrite)")" + exit 1 + fi + fi +else + local allpkgbuilt=1 + local somepkgbuilt=0 + for pkg in ${pkgname[@]}; do + if [ -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" ]; then + somepkgbuilt=1 + else + allpkgbuilt=0 + fi + done + if [ -f "$FORCE" -eq 0 -a "$SOURCEONLY" -eq 0 -a "$NOBUILD" -eq 0 ]; then + if [ "$INSTALL" -eq 1 -a "$allpkgbuilt" -eq 1 ]; then + warning "$(gettext "The package group has already been built, installing existing packages...")" + install_package + exit $? + fi + if [ "$somepkgbuilt" -eq 1 ]; then + error "$(gettext "The package group has already been (partially) built. (use -f to overwrite)")" + exit 1 + fi fi fi -- 1.6.3.3
On Wed, Jul 1, 2009 at 2:36 AM, Allan McRae<allan@archlinux.org> wrote:
Checks if some or all packages are built before overwriting/installing. Adds two new translation strings
Signed-off-by: Allan McRae <allan@archlinux.org> --- scripts/makepkg.sh.in | 41 ++++++++++++++++++++++++++++++++--------- 1 files changed, 32 insertions(+), 9 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 2bb7eb9..61ae037 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1646,15 +1646,38 @@ if [ "${#pkgname[@]}" -gt "1" ]; then SPLITPKG=1 fi
-if [ -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" \ - -a "$FORCE" -eq 0 -a "$SOURCEONLY" -eq 0 -a "$NOBUILD" -eq 0 ]; then - if [ "$INSTALL" -eq 1 ]; then - warning "$(gettext "A package has already been built, installing existing package...")" - install_package - exit $? - else - error "$(gettext "A package has already been built. (use -f to overwrite)")" - exit 1 +if [ "$SPLITPKG" -eq 0 ]; then + if [ -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" \ + -a "$FORCE" -eq 0 -a "$SOURCEONLY" -eq 0 -a "$NOBUILD" -eq 0 ]; then + if [ "$INSTALL" -eq 1 ]; then + warning "$(gettext "A package has already been built, installing existing package...")" + install_package + exit $? + else + error "$(gettext "A package has already been built. (use -f to overwrite)")" + exit 1 + fi + fi +else + local allpkgbuilt=1 + local somepkgbuilt=0 Declared local which doesn't make sense outside of a bash function. You probably want to just leave them as plain variables here and add an "unset" at the end of the outer else/fi block.
+ for pkg in ${pkgname[@]}; do + if [ -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" ]; then $pkgver/$pkgrel can't be overridden in subpackages, correct? Otherwise this line will not work right.
+ somepkgbuilt=1 + else + allpkgbuilt=0 + fi + done + if [ -f "$FORCE" -eq 0 -a "$SOURCEONLY" -eq 0 -a "$NOBUILD" -eq 0 ]; then + if [ "$INSTALL" -eq 1 -a "$allpkgbuilt" -eq 1 ]; then + warning "$(gettext "The package group has already been built, installing existing packages...")" + install_package + exit $? + fi + if [ "$somepkgbuilt" -eq 1 ]; then + error "$(gettext "The package group has already been (partially) built. (use -f to overwrite)")" Awkward English text, trying to think of something better...I'd at least drop the () around partially, maybe something like: "Part of the package group has already been built. (use -f to overwrite)"
+ exit 1 + fi fi (unset goes here) fi
--
I didn't actually run through the patch and test, so I trust the logic is reasonably correct. :) -Dan
Dan McGee wrote:
On Wed, Jul 1, 2009 at 2:36 AM, Allan McRae<allan@archlinux.org> wrote:
Checks if some or all packages are built before overwriting/installing. Adds two new translation strings
Signed-off-by: Allan McRae <allan@archlinux.org> --- scripts/makepkg.sh.in | 41 ++++++++++++++++++++++++++++++++--------- 1 files changed, 32 insertions(+), 9 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 2bb7eb9..61ae037 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1646,15 +1646,38 @@ if [ "${#pkgname[@]}" -gt "1" ]; then SPLITPKG=1 fi
-if [ -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" \ - -a "$FORCE" -eq 0 -a "$SOURCEONLY" -eq 0 -a "$NOBUILD" -eq 0 ]; then - if [ "$INSTALL" -eq 1 ]; then - warning "$(gettext "A package has already been built, installing existing package...")" - install_package - exit $? - else - error "$(gettext "A package has already been built. (use -f to overwrite)")" - exit 1 +if [ "$SPLITPKG" -eq 0 ]; then + if [ -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" \ + -a "$FORCE" -eq 0 -a "$SOURCEONLY" -eq 0 -a "$NOBUILD" -eq 0 ]; then + if [ "$INSTALL" -eq 1 ]; then + warning "$(gettext "A package has already been built, installing existing package...")" + install_package + exit $? + else + error "$(gettext "A package has already been built. (use -f to overwrite)")" + exit 1 + fi + fi +else + local allpkgbuilt=1 + local somepkgbuilt=0
Declared local which doesn't make sense outside of a bash function. You probably want to just leave them as plain variables here and add an "unset" at the end of the outer else/fi block.
Crap, I removed the local and added the unset on the version of makepkg-git running on my system but not here... Declaring local outside a function in bash does not actually work at all.
+ for pkg in ${pkgname[@]}; do + if [ -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" ]; then
$pkgver/$pkgrel can't be overridden in subpackages, correct? Otherwise this line will not work right.
Correct.
+ somepkgbuilt=1 + else + allpkgbuilt=0 + fi + done + if [ -f "$FORCE" -eq 0 -a "$SOURCEONLY" -eq 0 -a "$NOBUILD" -eq 0 ]; then + if [ "$INSTALL" -eq 1 -a "$allpkgbuilt" -eq 1 ]; then + warning "$(gettext "The package group has already been built, installing existing packages...")" + install_package + exit $? + fi + if [ "$somepkgbuilt" -eq 1 ]; then + error "$(gettext "The package group has already been (partially) built. (use -f to overwrite)")"
Awkward English text, trying to think of something better...I'd at least drop the () around partially, maybe something like: "Part of the package group has already been built. (use -f to overwrite)"
The problem is it could be all of the package group, or just part of it. I found this whole patch awkward... Allan
On Wed, Jul 1, 2009 at 8:54 PM, Allan McRae<allan@archlinux.org> wrote:
Dan McGee wrote:
On Wed, Jul 1, 2009 at 2:36 AM, Allan McRae<allan@archlinux.org> wrote:
Checks if some or all packages are built before overwriting/installing. Adds two new translation strings
Signed-off-by: Allan McRae <allan@archlinux.org> --- scripts/makepkg.sh.in | 41 ++++++++++++++++++++++++++++++++--------- 1 files changed, 32 insertions(+), 9 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 2bb7eb9..61ae037 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1646,15 +1646,38 @@ if [ "${#pkgname[@]}" -gt "1" ]; then SPLITPKG=1 fi
-if [ -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" \ - -a "$FORCE" -eq 0 -a "$SOURCEONLY" -eq 0 -a "$NOBUILD" -eq 0 ]; then - if [ "$INSTALL" -eq 1 ]; then - warning "$(gettext "A package has already been built, installing existing package...")" - install_package - exit $? - else - error "$(gettext "A package has already been built. (use -f to overwrite)")" - exit 1 +if [ "$SPLITPKG" -eq 0 ]; then + if [ -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" \ + -a "$FORCE" -eq 0 -a "$SOURCEONLY" -eq 0 -a "$NOBUILD" -eq 0 ]; then + if [ "$INSTALL" -eq 1 ]; then + warning "$(gettext "A package has already been built, installing existing package...")" + install_package + exit $? + else + error "$(gettext "A package has already been built. (use -f to overwrite)")" + exit 1 + fi + fi +else + local allpkgbuilt=1 + local somepkgbuilt=0
Declared local which doesn't make sense outside of a bash function. You probably want to just leave them as plain variables here and add an "unset" at the end of the outer else/fi block.
Crap, I removed the local and added the unset on the version of makepkg-git running on my system but not here... Declaring local outside a function in bash does not actually work at all.
+ for pkg in ${pkgname[@]}; do + if [ -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" ]; then
$pkgver/$pkgrel can't be overridden in subpackages, correct? Otherwise this line will not work right.
Correct.
+ somepkgbuilt=1 + else + allpkgbuilt=0 + fi + done + if [ -f "$FORCE" -eq 0 -a "$SOURCEONLY" -eq 0 -a "$NOBUILD" -eq 0 ]; then + if [ "$INSTALL" -eq 1 -a "$allpkgbuilt" -eq 1 ]; then + warning "$(gettext "The package group has already been built, installing existing packages...")" + install_package + exit $? + fi + if [ "$somepkgbuilt" -eq 1 ]; then + error "$(gettext "The package group has already been (partially) built. (use -f to overwrite)")"
Awkward English text, trying to think of something better...I'd at least drop the () around partially, maybe something like: "Part of the package group has already been built. (use -f to overwrite)"
The problem is it could be all of the package group, or just part of it. I found this whole patch awkward...
You have somepkgbuilt and allpkgbuilt; do a different message for each case? -Dan
Dan McGee wrote:
On Wed, Jul 1, 2009 at 8:54 PM, Allan McRae<allan@archlinux.org> wrote:
Dan McGee wrote:
On Wed, Jul 1, 2009 at 2:36 AM, Allan McRae<allan@archlinux.org> wrote:
Checks if some or all packages are built before overwriting/installing. Adds two new translation strings
Signed-off-by: Allan McRae <allan@archlinux.org> --- scripts/makepkg.sh.in | 41 ++++++++++++++++++++++++++++++++--------- 1 files changed, 32 insertions(+), 9 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 2bb7eb9..61ae037 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1646,15 +1646,38 @@ if [ "${#pkgname[@]}" -gt "1" ]; then SPLITPKG=1 fi
-if [ -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" \ - -a "$FORCE" -eq 0 -a "$SOURCEONLY" -eq 0 -a "$NOBUILD" -eq 0 ]; then - if [ "$INSTALL" -eq 1 ]; then - warning "$(gettext "A package has already been built, installing existing package...")" - install_package - exit $? - else - error "$(gettext "A package has already been built. (use -f to overwrite)")" - exit 1 +if [ "$SPLITPKG" -eq 0 ]; then + if [ -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" \ + -a "$FORCE" -eq 0 -a "$SOURCEONLY" -eq 0 -a "$NOBUILD" -eq 0 ]; then + if [ "$INSTALL" -eq 1 ]; then + warning "$(gettext "A package has already been built, installing existing package...")" + install_package + exit $? + else + error "$(gettext "A package has already been built. (use -f to overwrite)")" + exit 1 + fi + fi +else + local allpkgbuilt=1 + local somepkgbuilt=0
Declared local which doesn't make sense outside of a bash function. You probably want to just leave them as plain variables here and add an "unset" at the end of the outer else/fi block.
Crap, I removed the local and added the unset on the version of makepkg-git running on my system but not here... Declaring local outside a function in bash does not actually work at all.
+ for pkg in ${pkgname[@]}; do + if [ -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" ]; then
$pkgver/$pkgrel can't be overridden in subpackages, correct? Otherwise this line will not work right.
Correct.
+ somepkgbuilt=1 + else + allpkgbuilt=0 + fi + done + if [ -f "$FORCE" -eq 0 -a "$SOURCEONLY" -eq 0 -a "$NOBUILD" -eq 0 ]; then + if [ "$INSTALL" -eq 1 -a "$allpkgbuilt" -eq 1 ]; then + warning "$(gettext "The package group has already been built, installing existing packages...")" + install_package + exit $? + fi + if [ "$somepkgbuilt" -eq 1 ]; then + error "$(gettext "The package group has already been (partially) built. (use -f to overwrite)")"
Awkward English text, trying to think of something better...I'd at least drop the () around partially, maybe something like: "Part of the package group has already been built. (use -f to overwrite)"
The problem is it could be all of the package group, or just part of it. I found this whole patch awkward...
You have somepkgbuilt and allpkgbuilt; do a different message for each case?
Do we even want to warn when the package is partially built? Then the user is clearly trying to get a complete set of split packages. Allan
Allan McRae schrieb:
Dan McGee wrote:
On Wed, Jul 1, 2009 at 8:54 PM, Allan McRae<allan@archlinux.org> wrote:
Dan McGee wrote:
On Wed, Jul 1, 2009 at 2:36 AM, Allan McRae<allan@archlinux.org> wrote:
Checks if some or all packages are built before overwriting/installing. Adds two new translation strings
Signed-off-by: Allan McRae <allan@archlinux.org> --- scripts/makepkg.sh.in | 41 ++++++++++++++++++++++++++++++++--------- 1 files changed, 32 insertions(+), 9 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 2bb7eb9..61ae037 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1646,15 +1646,38 @@ if [ "${#pkgname[@]}" -gt "1" ]; then SPLITPKG=1 fi
-if [ -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" \ - -a "$FORCE" -eq 0 -a "$SOURCEONLY" -eq 0 -a "$NOBUILD" -eq 0 ]; then - if [ "$INSTALL" -eq 1 ]; then - warning "$(gettext "A package has already been built, installing existing package...")" - install_package - exit $? - else - error "$(gettext "A package has already been built. (use -f to overwrite)")" - exit 1 +if [ "$SPLITPKG" -eq 0 ]; then + if [ -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" \ + -a "$FORCE" -eq 0 -a "$SOURCEONLY" -eq 0 -a "$NOBUILD" -eq 0 ]; then + if [ "$INSTALL" -eq 1 ]; then + warning "$(gettext "A package has already been built, installing existing package...")" + install_package + exit $? + else + error "$(gettext "A package has already been built. (use -f to overwrite)")" + exit 1 + fi + fi +else + local allpkgbuilt=1 + local somepkgbuilt=0
Declared local which doesn't make sense outside of a bash function. You probably want to just leave them as plain variables here and add an "unset" at the end of the outer else/fi block.
Crap, I removed the local and added the unset on the version of makepkg-git running on my system but not here... Declaring local outside a function in bash does not actually work at all.
+ for pkg in ${pkgname[@]}; do + if [ -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" ]; then
$pkgver/$pkgrel can't be overridden in subpackages, correct? Otherwise this line will not work right.
Correct.
+ somepkgbuilt=1 + else + allpkgbuilt=0 + fi + done + if [ -f "$FORCE" -eq 0 -a "$SOURCEONLY" -eq 0 -a "$NOBUILD" -eq 0 ]; then + if [ "$INSTALL" -eq 1 -a "$allpkgbuilt" -eq 1 ]; then + warning "$(gettext "The package group has already been built, installing existing packages...")" + install_package + exit $? + fi + if [ "$somepkgbuilt" -eq 1 ]; then + error "$(gettext "The package group has already been (partially) built. (use -f to overwrite)")"
Awkward English text, trying to think of something better...I'd at least drop the () around partially, maybe something like: "Part of the package group has already been built. (use -f to overwrite)"
The problem is it could be all of the package group, or just part of it. I found this whole patch awkward...
You have somepkgbuilt and allpkgbuilt; do a different message for each case?
Do we even want to warn when the package is partially built? Then the user is clearly trying to get a complete set of split packages.
Is there a way to rebuild only a subset of split packages? Marc
Marc - A. Dahlhaus wrote:
Is there a way to rebuild only a subset of split packages?
No. Mainly because I don't know of a case where this is useful. If you adjust something in one of the package function, the repackage option will just run the packaging steps which will be very fast. Allan
Checks if some or all packages are built before overwriting/installing. Adds some new strings for translation. Signed-off-by: Allan McRae <allan@archlinux.org> --- scripts/makepkg.sh.in | 47 ++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 38 insertions(+), 9 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 2bb7eb9..91e2518 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1646,16 +1646,45 @@ if [ "${#pkgname[@]}" -gt "1" ]; then SPLITPKG=1 fi -if [ -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" \ - -a "$FORCE" -eq 0 -a "$SOURCEONLY" -eq 0 -a "$NOBUILD" -eq 0 ]; then - if [ "$INSTALL" -eq 1 ]; then - warning "$(gettext "A package has already been built, installing existing package...")" - install_package - exit $? - else - error "$(gettext "A package has already been built. (use -f to overwrite)")" - exit 1 +if [ "$SPLITPKG" -eq 0 ]; then + if [ -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" \ + -a "$FORCE" -eq 0 -a "$SOURCEONLY" -eq 0 -a "$NOBUILD" -eq 0 ]; then + if [ "$INSTALL" -eq 1 ]; then + warning "$(gettext "A package has already been built, installing existing package...")" + install_package + exit $? + else + error "$(gettext "A package has already been built. (use -f to overwrite)")" + exit 1 + fi + fi +else + allpkgbuilt=1 + somepkgbuilt=0 + for pkg in ${pkgname[@]}; do + if [ -f "$PKGDEST/${pkg}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" ]; then + somepkgbuilt=1 + else + allpkgbuilt=0 + fi + done + if [ "$FORCE" -eq 0 -a "$SOURCEONLY" -eq 0 -a "$NOBUILD" -eq 0 ]; then + if [ "$allpkgbuilt" -eq 1 ]; then + if [ "$INSTALL" -eq 1 ]; then + warning "$(gettext "The package group has already been built, installing existing packages...")" + install_package + exit $? + else + error "$(gettext "The package group has already been built. (use -f to overwrite)")" + exit 1 + fi + fi + if [ "$somepkgbuilt" -eq 1 ]; then + error "$(gettext "Part of the package group has already been built. (use -f to overwrite)")" + exit 1 + fi fi + unset allpkgbuilt somepkgbuilt fi # Run the bare minimum in fakeroot -- 1.6.3.3
participants (3)
-
Allan McRae
-
Dan McGee
-
Marc - A. Dahlhaus