[pacman-dev] [PATCH 1/3] makepkg: Move .PKGINFO creation into a function.
Signed-off-by: Loui Chang <louipc.ist@gmail.com> --- scripts/makepkg.sh.in | 24 ++++++++++++++---------- 1 files changed, 14 insertions(+), 10 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 433fe34..d396480 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -871,22 +871,13 @@ tidy_install() { fi } -create_package() { +write_pkginfo() { if [ -z "$1" ]; then nameofpkg="$pkgname" else nameofpkg="$1" fi - if [ ! -d "$pkgdir" ]; then - error "$(gettext "Missing pkg/ directory.")" - plain "$(gettext "Aborting...")" - exit 1 # $E_MISSING_PKGDIR - fi - - cd "$pkgdir" - msg "$(gettext "Creating package...")" - local builddate=$(date -u "+%s") if [ -n "$PACKAGER" ]; then local packager="$PACKAGER" @@ -951,6 +942,19 @@ create_package() { fi fi done +} + +create_package() { + if [ ! -d "$pkgdir" ]; then + error "$(gettext "Missing pkg/ directory.")" + plain "$(gettext "Aborting...")" + exit 1 # $E_MISSING_PKGDIR + fi + + write_pkginfo $@ + + cd "$pkgdir" + msg "$(gettext "Creating package...")" # TODO maybe remove this at some point # warn if license array is not present or empty -- 1.6.3.2
It wouldn't be very nice to ship a PKGBUILD with the wrong checksums. Signed-off-by: Loui Chang <louipc.ist@gmail.com> --- scripts/makepkg.sh.in | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index d396480..ef36e8f 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1016,15 +1016,15 @@ create_package() { create_srcpackage() { cd "$startdir" - if [ "$SOURCEONLY" -eq 2 ]; then - # get back to our src directory so we can begin with sources - mkdir -p "$srcdir" - cd "$srcdir" - download_sources - # we can only check checksums if we have all files - check_checksums - cd "$startdir" - fi + + # Get back to our src directory so we can begin with sources. + mkdir -p "$srcdir" + cd "$srcdir" + download_sources + # We can only check checksums if we have all files. + check_checksums + cd "$startdir" + msg "$(gettext "Creating source package...")" local srclinks="$(mktemp -d "$startdir"/srclinks.XXXXXXXXX)" mkdir "${srclinks}"/${pkgbase} -- 1.6.3.2
Loui Chang wrote:
It wouldn't be very nice to ship a PKGBUILD with the wrong checksums.
Signed-off-by: Loui Chang <louipc.ist@gmail.com> --- scripts/makepkg.sh.in | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-)
Seems a good idea to me. @Dan: was there a reason why we did this? Pulled to my working branch. @Loui: you should look into enabling commit hooks to avoid white space issues. Allan
Loui Chang wrote:
Signed-off-by: Loui Chang <louipc.ist@gmail.com> --- scripts/makepkg.sh.in | 24 ++++++++++++++---------- 1 files changed, 14 insertions(+), 10 deletions(-)
I like the idea but have a few comments on the implementation.
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 433fe34..d396480 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -871,22 +871,13 @@ tidy_install() { fi }
-create_package() { +write_pkginfo() {
I'd like this to stay at the top of create_package as nameofpkg is also needed there. Then write_pkginfo can just be called with "write_pkginfo $nameofpkg"
if [ -z "$1" ]; then nameofpkg="$pkgname" else nameofpkg="$1" fi
- if [ ! -d "$pkgdir" ]; then - error "$(gettext "Missing pkg/ directory.")" - plain "$(gettext "Aborting...")" - exit 1 # $E_MISSING_PKGDIR - fi - - cd "$pkgdir" - msg "$(gettext "Creating package...")" - local builddate=$(date -u "+%s") if [ -n "$PACKAGER" ]; then local packager="$PACKAGER" @@ -951,6 +942,19 @@ create_package() { fi fi done +} + +create_package() { + if [ ! -d "$pkgdir" ]; then + error "$(gettext "Missing pkg/ directory.")" + plain "$(gettext "Aborting...")" + exit 1 # $E_MISSING_PKGDIR + fi
Note comment above:
+ write_pkginfo $@ + + cd "$pkgdir" + msg "$(gettext "Creating package...")"
The warning about license should be moved to the write_pkginfo function.
# TODO maybe remove this at some point # warn if license array is not present or empty
Allan
participants (2)
-
Allan McRae
-
Loui Chang