[pacman-dev] [PATCH 1/2] makepkg: abstract license check into separate function
Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- scripts/makepkg.sh.in | 16 ++++++++++------ 1 files changed, 10 insertions(+), 6 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 13185ee..eada195 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1102,6 +1102,15 @@ find_libprovides() { done } +check_license() { + # TODO maybe remove this at some point + # warn if license array is not present or empty + if [[ -z $license ]]; then + warning "$(gettext "Please add a license line to your %s!")" "$BUILDSCRIPT" + plain "$(gettext "Example for GPL\'ed software: %s.")" "license=('GPL')" + fi +} + write_pkginfo() { local builddate=$(date -u "+%s") if [[ -n $PACKAGER ]]; then @@ -1179,12 +1188,7 @@ write_pkginfo() { fi done - # TODO maybe remove this at some point - # warn if license array is not present or empty - if [[ -z $license ]]; then - warning "$(gettext "Please add a license line to your %s!")" "$BUILDSCRIPT" - plain "$(gettext "Example for GPL\'ed software: %s.")" "license=('GPL')" - fi + check_license } check_package() { -- 1.7.8.1
Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- scripts/makepkg.sh.in | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index eada195..89681ea 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1336,6 +1336,8 @@ create_srcpackage() { local srclinks="$(mktemp -d "$startdir"/srclinks.XXXXXXXXX)" mkdir "${srclinks}"/${pkgbase} + check_license + msg2 "$(gettext "Adding %s...")" "$BUILDSCRIPT" ln -s "${BUILDFILE}" "${srclinks}/${pkgbase}/${BUILDSCRIPT}" -- 1.7.8.1
On 08/01/12 04:27, Dave Reisner wrote:
Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- scripts/makepkg.sh.in | 16 ++++++++++------ 1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 13185ee..eada195 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1102,6 +1102,15 @@ find_libprovides() { done }
+check_license() { + # TODO maybe remove this at some point + # warn if license array is not present or empty + if [[ -z $license ]]; then + warning "$(gettext "Please add a license line to your %s!")" "$BUILDSCRIPT" + plain "$(gettext "Example for GPL\'ed software: %s.")" "license=('GPL')" + fi +} +
Why not just move this into the check_sanity function? That would also remove the need for your next patch too.
write_pkginfo() { local builddate=$(date -u "+%s") if [[ -n $PACKAGER ]]; then @@ -1179,12 +1188,7 @@ write_pkginfo() { fi done
- # TODO maybe remove this at some point - # warn if license array is not present or empty - if [[ -z $license ]]; then - warning "$(gettext "Please add a license line to your %s!")" "$BUILDSCRIPT" - plain "$(gettext "Example for GPL\'ed software: %s.")" "license=('GPL')" - fi + check_license }
check_package() {
On Sun, Jan 08, 2012 at 10:16:49PM +1000, Allan McRae wrote:
On 08/01/12 04:27, Dave Reisner wrote:
Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- scripts/makepkg.sh.in | 16 ++++++++++------ 1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 13185ee..eada195 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1102,6 +1102,15 @@ find_libprovides() { done }
+check_license() { + # TODO maybe remove this at some point + # warn if license array is not present or empty + if [[ -z $license ]]; then + warning "$(gettext "Please add a license line to your %s!")" "$BUILDSCRIPT" + plain "$(gettext "Example for GPL\'ed software: %s.")" "license=('GPL')" + fi +} +
Why not just move this into the check_sanity function? That would also remove the need for your next patch too.
This sounds like a better idea.
write_pkginfo() { local builddate=$(date -u "+%s") if [[ -n $PACKAGER ]]; then @@ -1179,12 +1188,7 @@ write_pkginfo() { fi done
- # TODO maybe remove this at some point - # warn if license array is not present or empty - if [[ -z $license ]]; then - warning "$(gettext "Please add a license line to your %s!")" "$BUILDSCRIPT" - plain "$(gettext "Example for GPL\'ed software: %s.")" "license=('GPL')" - fi + check_license }
check_package() {
participants (2)
-
Allan McRae
-
Dave Reisner