[Why] Support more version's PKGBUILD.
[How] Replace the previous content with two source command.
example:
PKGBUILD_TAG=-1.1 BUILDFILE -> PKGBUILD BUILDFILE$PKGBUILD_TAG -> PKGBUILD-1.1
PKGBUILD-1.1 contains only the changed part. % cat PKGBUILD-1.1 pkgver=1.1 pkgrel=2
build() { make install DESTDIR="${pkgdir}/lkp/benchmarks/${pkgname}" }
Signed-off-by: Lin Jiaxin ljx.joe@qq.com --- sbin/makepkg | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/sbin/makepkg b/sbin/makepkg index 25773621..fbe9c432 100755 --- a/sbin/makepkg +++ b/sbin/makepkg @@ -888,7 +888,7 @@ update_pkgver() { exit 1 fi sed --follow-symlinks -i "s:^pkgrel=[^ ]*:pkgrel=1:" "$BUILDFILE" - source_safe "$BUILDFILE" + source_safe "$BUILDFILE" "$BUILDFILE$PKGBUILD_TAG" local fullver=$(get_full_version) msg "$(gettext "Updated version: %s")" "$pkgbase $fullver" else @@ -1604,10 +1604,14 @@ cd_safe() {
source_safe() { shopt -u extglob - if ! source "$@"; then - error "$(gettext "Failed to source %s")" "$1" - exit 1 - fi + local file + for file in "$@" + do + if ! source "$file"; then + error "$(gettext "Failed to source %s")" "$file" + exit 1 + fi + done shopt -s extglob }
@@ -1626,7 +1630,6 @@ merge_arch_attrs() {
source_buildfile() { source_safe "$@" - if (( !SOURCEONLY )); then merge_arch_attrs fi @@ -3661,6 +3664,7 @@ SRCEXT=${_SRCEXT:-$SRCEXT} GPGKEY=${_GPGKEY:-$GPGKEY} PACKAGER=${_PACKAGER:-$PACKAGER} CARCH=${_CARCH:-$CARCH} +PKGBUILD_TAG=$PKGBUILD_TAG
if (( INFAKEROOT )); then if [[ -z $FAKEROOTKEY ]]; then @@ -3691,7 +3695,7 @@ else if [[ ${BUILDFILE:0:1} != "/" ]]; then BUILDFILE="$startdir/$BUILDFILE" fi - source_buildfile "$BUILDFILE" + source_buildfile "$BUILDFILE" "$BUILDFILE$PKGBUILD_TAG" fi
# set defaults if they weren't specified in buildfile
+PKGBUILD_TAG=$PKGBUILD_TAG
Is that necessary?
if (( INFAKEROOT )); then if [[ -z $FAKEROOTKEY ]]; then @@ -3691,7 +3695,7 @@ else if [[ ${BUILDFILE:0:1} != "/" ]]; then BUILDFILE="$startdir/$BUILDFILE" fi
- source_buildfile "$BUILDFILE"
- source_buildfile "$BUILDFILE" "$BUILDFILE$PKGBUILD_TAG"
What if the latter file does not exist?
Thanks, Fengguang
On Tue, Nov 10, 2020 at 04:20:40PM +0800, Wu Fengguang wrote:
+PKGBUILD_TAG=$PKGBUILD_TAG
Is that necessary?
Unnecessary, i will delete it.
if (( INFAKEROOT )); then if [[ -z $FAKEROOTKEY ]]; then @@ -3691,7 +3695,7 @@ else if [[ ${BUILDFILE:0:1} != "/" ]]; then BUILDFILE="$startdir/$BUILDFILE" fi
- source_buildfile "$BUILDFILE"
- source_buildfile "$BUILDFILE" "$BUILDFILE$PKGBUILD_TAG"
What if the latter file does not exist?
Thanks, Fengguang
If $PKGBUILD_TAG undefined, it will source_buildfile "$BUILDFILE" twice now.
How about source_buildfile "$BUILDFILE" [[ -n $PKGBUILD_TAG ]] && source_buildfile "$BUILDFILE$PKGBUILD_TAG"
Thanks, Jiaxin
On Tue, Nov 10, 2020 at 04:32:56PM +0800, Lin Jiaxin wrote:
On Tue, Nov 10, 2020 at 04:20:40PM +0800, Wu Fengguang wrote:
+PKGBUILD_TAG=$PKGBUILD_TAG
Is that necessary?
Unnecessary, i will delete it.
if (( INFAKEROOT )); then if [[ -z $FAKEROOTKEY ]]; then @@ -3691,7 +3695,7 @@ else if [[ ${BUILDFILE:0:1} != "/" ]]; then BUILDFILE="$startdir/$BUILDFILE" fi
- source_buildfile "$BUILDFILE"
- source_buildfile "$BUILDFILE" "$BUILDFILE$PKGBUILD_TAG"
What if the latter file does not exist?
Thanks, Fengguang
If $PKGBUILD_TAG undefined, it will source_buildfile "$BUILDFILE" twice now.
How about source_buildfile "$BUILDFILE" [[ -n $PKGBUILD_TAG ]] && source_buildfile "$BUILDFILE$PKGBUILD_TAG"
That looks better.
Thanks, Fengguang
On Tue, Nov 10, 2020 at 04:01:41PM +0800, Lin Jiaxin wrote:
[Why] Support more version's PKGBUILD.
[How] Replace the previous content with two source command.
example:
PKGBUILD_TAG=-1.1 BUILDFILE -> PKGBUILD BUILDFILE$PKGBUILD_TAG -> PKGBUILD-1.1
PKGBUILD-1.1 contains only the changed part. % cat PKGBUILD-1.1 pkgver=1.1 pkgrel=2
build() { make install DESTDIR="${pkgdir}/lkp/benchmarks/${pkgname}" }
Signed-off-by: Lin Jiaxin ljx.joe@qq.com
sbin/makepkg | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/sbin/makepkg b/sbin/makepkg index 25773621..fbe9c432 100755 --- a/sbin/makepkg +++ b/sbin/makepkg @@ -888,7 +888,7 @@ update_pkgver() { exit 1 fi sed --follow-symlinks -i "s:^pkgrel=[^ ]*:pkgrel=1:" "$BUILDFILE"
source_safe "$BUILDFILE"
elsesource_safe "$BUILDFILE" "$BUILDFILE$PKGBUILD_TAG" local fullver=$(get_full_version) msg "$(gettext "Updated version: %s")" "$pkgbase $fullver"
@@ -1604,10 +1604,14 @@ cd_safe() {
source_safe() { shopt -u extglob
- if ! source "$@"; then
error "$(gettext "Failed to source %s")" "$1"
exit 1
- fi
- local file
- for file in "$@"
^^^ This line can be "for file".
Thanks, Baijing
- do
if ! source "$file"; then
error "$(gettext "Failed to source %s")" "$file"
exit 1
fi
- done shopt -s extglob
}
@@ -1626,7 +1630,6 @@ merge_arch_attrs() {
source_buildfile() { source_safe "$@"
- if (( !SOURCEONLY )); then merge_arch_attrs fi
@@ -3661,6 +3664,7 @@ SRCEXT=${_SRCEXT:-$SRCEXT} GPGKEY=${_GPGKEY:-$GPGKEY} PACKAGER=${_PACKAGER:-$PACKAGER} CARCH=${_CARCH:-$CARCH} +PKGBUILD_TAG=$PKGBUILD_TAG
if (( INFAKEROOT )); then if [[ -z $FAKEROOTKEY ]]; then @@ -3691,7 +3695,7 @@ else if [[ ${BUILDFILE:0:1} != "/" ]]; then BUILDFILE="$startdir/$BUILDFILE" fi
- source_buildfile "$BUILDFILE"
- source_buildfile "$BUILDFILE" "$BUILDFILE$PKGBUILD_TAG"
fi
# set defaults if they weren't specified in buildfile
2.23.0