[pacman-dev] [PATCH] Move geninteg block in makepkg before error checking
This pactch moves the generating of integrity checks to before any error checking takes place in the PKGBUILD file. This allows integrity generation to complete when unrelated errors exist in a PKGBUILD file and allows the removal of multiple checks of the GENINTEG variable that would otherwise be needed. In addition a minor fix is made to a comment Signed-off-by: Allan McRae <mcrae_allan@hotmail.com> --- scripts/makepkg.sh.in | 23 ++++++++++++----------- 1 files changed, 12 insertions(+), 11 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index cc44c68..38b22a5 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1187,8 +1187,7 @@ while true; do done if [ "$HOLDVER" = "1" -a "$FORCE_VER" != "" ]; then - # The extra '--' is here to prevent gettext from thinking --holdver is - # an option + # The '\\0' is here to prevent gettext from thinking --holdver is an option error "$(gettext "\\0--holdver and --forcever cannot both be specified" )" exit 1 fi @@ -1288,6 +1287,14 @@ fi source "$BUILDSCRIPT" +if [ "$GENINTEG" = "1" ]; then + mkdir -p "$srcdir" + cd "$srcdir" + download_sources + generate_checksums + exit 0 # $E_OK +fi + # check for no-no's in the build script if [ -z "$pkgname" ]; then error "$(gettext "%s is not allowed to be empty.")" "pkgname" @@ -1340,7 +1347,7 @@ devel_check devel_update if [ -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" \ - -a "$FORCE" = "0" -a "$GENINTEG" = "0" -a "$SOURCEONLY" = "0" ]; then + -a "$FORCE" = "0" -a "$SOURCEONLY" = "0" ]; then if [ "$INSTALL" = "1" ]; then warning "$(gettext "A package has already been built, installing existing package...")" install_package @@ -1386,11 +1393,11 @@ if [ "$SOURCEONLY" = "1" ]; then fi # fix flyspray bug #5973 -if [ "$NODEPS" = "1" -o "$GENINTEG" = "1" -o "$NOBUILD" = "1" -o "$REPKG" = "1" ]; then +if [ "$NODEPS" = "1" -o "$NOBUILD" = "1" -o "$REPKG" = "1" ]; then if [ "$NODEPS" = "1" ]; then warning "$(gettext "Skipping dependency checks.")" fi - # skip printing a warning message for the others: geninteg, nobuild, repkg + # skip printing a warning message for the others: nobuild, repkg elif [ $(type -p pacman) ]; then unset pkgdeps # Set by resolve_deps() and used by remove_deps() deperr=0 @@ -1416,12 +1423,6 @@ umask 0022 mkdir -p "$srcdir" cd "$srcdir" -if [ "$GENINTEG" = "1" ]; then - download_sources - generate_checksums - exit 0 # $E_OK -fi - if [ "$NOEXTRACT" = "1" -o "$REPKG" = "1" ]; then warning "$(gettext "Skipping source retrieval -- using existing src/ tree")" warning "$(gettext "Skipping source integrity checks -- using existing src/ tree")" -- 1.5.5.1
Allan McRae wrote:
This pactch moves the generating of integrity checks to before any error checking takes place in the PKGBUILD file. This allows integrity generation to complete when unrelated errors exist in a PKGBUILD file and allows the removal of multiple checks of the GENINTEG variable that would otherwise be needed.
<snip>
This was part of a conglomerate patch I sent earlier which has now been split. I like this move because it removes two checks of GENINTEG plus and additional check which would be needed in the block checking the arch array. It now also skips all the other PKGBUILD checks which shouldn't cause an error when only generating the integrity checks. However, it does put the geninteg code block in the middle of nowhere, but I suppose it is an awkward but helpful addition to makepkg anyway. Allan
On Mon, May 26, 2008 at 8:46 AM, Allan McRae <mcrae_allan@hotmail.com> wrote:
This was part of a conglomerate patch I sent earlier which has now been split.
I like this move because it removes two checks of GENINTEG
Yes, I don't like much all these checks everywhere which control the flow of makepkg.
plus an additional check which would be needed in the block checking the arch array. It now also skips all the other PKGBUILD checks which shouldn't cause an error when only generating the integrity checks. However, it does put the geninteg code block in the middle of nowhere, but I suppose it is an awkward but helpful addition to makepkg anyway.
Well, I am still not fully convinced this is a good thing. All these errors that makepkg can detect needs to be fixed. If you run makepkg -g, it is usually after you have finished writing the PKGBUILD, so all errors should be fixed at that step. But if everyone else thinks otherwise (you, Roman, Dan), and that these errors are irrelevant to makepkg -g which can indeed still be run, then fine. And in this case, I prefer the new patch over the old one.
2008/5/26 Xavier <shiningxc@gmail.com>:
On Mon, May 26, 2008 at 8:46 AM, Allan McRae <mcrae_allan@hotmail.com> wrote:
This was part of a conglomerate patch I sent earlier which has now been split.
I like this move because it removes two checks of GENINTEG
Yes, I don't like much all these checks everywhere which control the flow of makepkg.
plus an additional check which would be needed in the block checking the arch array. It now also skips all the other PKGBUILD checks which shouldn't cause an error when only generating the integrity checks. However, it does put the geninteg code block in the middle of nowhere, but I suppose it is an awkward but helpful addition to makepkg anyway.
Well, I am still not fully convinced this is a good thing. All these errors that makepkg can detect needs to be fixed. If you run makepkg -g, it is usually after you have finished writing the PKGBUILD, so all errors should be fixed at that step.
But if everyone else thinks otherwise (you, Roman, Dan), and that these errors are irrelevant to makepkg -g which can indeed still be run, then fine. And in this case, I prefer the new patch over the old one.
AFAIR I proposed the same thing as Allan in the past. And IIRC Dan's answer was similar to yours. :-) Both opinions are valid, so it just a matter of preferrence. -- Roman Kyrylych (Роман Кирилич)
On Mon, May 26, 2008 at 3:29 PM, Roman Kyrylych <roman.kyrylych@gmail.com> wrote:
2008/5/26 Xavier <shiningxc@gmail.com>:
On Mon, May 26, 2008 at 8:46 AM, Allan McRae <mcrae_allan@hotmail.com> wrote:
This was part of a conglomerate patch I sent earlier which has now been split.
I like this move because it removes two checks of GENINTEG
Yes, I don't like much all these checks everywhere which control the flow of makepkg.
plus an additional check which would be needed in the block checking the arch array. It now also skips all the other PKGBUILD checks which shouldn't cause an error when only generating the integrity checks. However, it does put the geninteg code block in the middle of nowhere, but I suppose it is an awkward but helpful addition to makepkg anyway.
Well, I am still not fully convinced this is a good thing. All these errors that makepkg can detect needs to be fixed. If you run makepkg -g, it is usually after you have finished writing the PKGBUILD, so all errors should be fixed at that step.
But if everyone else thinks otherwise (you, Roman, Dan), and that these errors are irrelevant to makepkg -g which can indeed still be run, then fine. And in this case, I prefer the new patch over the old one.
AFAIR I proposed the same thing as Allan in the past. And IIRC Dan's answer was similar to yours. :-) Both opinions are valid, so it just a matter of preferrence.
So I just reread this patch after seeing it on Allan's "patches pending" wiki page section. TBH it seems OK to me, especially since it reduces the number of checks needed later in the script, although I do see the benefit of running all these checks when generating checksums. So I guess I am OK with merging this even though I think there are a few drawbacks- any objections? -Dan
Dan McGee wrote:
So I just reread this patch after seeing it on Allan's "patches pending" wiki page section. TBH it seems OK to me, especially since it reduces the number of checks needed later in the script, although I do see the benefit of running all these checks when generating checksums. So I guess I am OK with merging this even though I think there are a few drawbacks- any objections?
Well, I don't know what to add. It is not a big deal either way, so if you are ok with it, just pull it ;)
participants (4)
-
Allan McRae
-
Dan McGee
-
Roman Kyrylych
-
Xavier