pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/58295: wip/mk/git-package.mk broken GIT_REVISION support



>Number:         58295
>Category:       pkg
>Synopsis:       wip/mk/git-package.mk broken GIT_REVISION support
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue May 28 00:25:00 +0000 2024
>Originator:     Malte Dehling
>Release:        NetBSD 10.0
>Organization:
>Environment:
    NetBSD 10.0 (GENERIC) #4: Wed Apr 24 12:21:26 PDT 2024
    mdehling@nb-base-dev:/scratch/obj/sys/arch/amd64/compile/GENERIC amd64

>Description:
    For a package in wip with GIT_REPO & GIT_REVISION set (but not
    GIT_BRANCH), the "Updating Git working area" step fails every time.

    The issue is that rev_before=`git show-ref $revision` fails when
    $revision is a commit hash since git returns exit code 1.

>How-To-Repeat:

>Fix:
    The following seems to work for branches, tags, and commit hashes.
    Can someone who understands the infrastructure better confirm?

diff --git a/mk/git-package.mk b/mk/git-package.mk
index efb8491445..d1034bd7a2 100644
--- a/mk/git-package.mk
+++ b/mk/git-package.mk
@@ -190,10 +190,10 @@ _GIT_CMD.checkout.${repo}= \
 	\
 	${STEP_MSG} "Updating Git working area $$extractdir.";		\
 	revision=${_GIT_REV.${repo}:Q};					\
-	rev_before=`${_GIT_CMDLINE.${repo}} -C "$$extractdir" show-ref
"$$revision"`; \
+	rev_before=`${_GIT_CMDLINE.${repo}} -C "$$extractdir" rev-list -n 1
"$$revision"`; \
 	${_GIT_CMDLINE.${repo}} -C "$$extractdir"			\
 	  fetch ${_GIT_FETCH_FLAGS.${repo}};				\
-	rev_after=`${_GIT_CMDLINE.${repo}} -C "$$extractdir" show-ref "$$revision"`; \
+	rev_after=`${_GIT_CMDLINE.${repo}} -C "$$extractdir" rev-list -n 1
"$$revision"`; \
 	\
 	checkout_date=${CHECKOUT_DATE:Q};				\
 	if [ "$$checkout_date" ]; then					\

-- 
Malte Dehling



Home | Main Index | Thread Index | Old Index