[OS-BUILD PATCHv3] Use upstream/master for merge-base with fallback to master

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

 



From: Don Zickus <dzickus@xxxxxxxxxx>

Use upstream/master for merge-base with fallback to master

In Makefile.common there is logic that determines what the
merge-base is and is used to generate changelogs correctly.

The logic assumes a 'master' branch exists and is up to date.
However, the documentation recommends using 'upstream/master' to
keep everything up to date.

Let's sync the documentation and code and use upstream/master if
it exists otherwise, use 'master' as the fallback.  If neither
exists error out.

Update redhat/genspec.sh to handle a different master too.

The 'error' out solves another problem when a master branch is not
defined not is 'upstream' used as recommended.

V2: change 'upstream' to 'origin' (Justin F.)

Signed-off-by: Don Zickus <dzickus@xxxxxxxxxx>

diff a/redhat/Makefile.common b/redhat/Makefile.common
--- a/redhat/Makefile.common
+++ b/redhat/Makefile.common
@@ -48,7 +48,12 @@ else
 endif
 ifeq ($(VERSION_ON_UPSTREAM),1)
   # master is expected to track mainline.
-  MERGE_BASE:=$(shell $(GIT) merge-base $(HEAD) master)
+  MASTER:=$(shell $(GIT) rev-parse -q --verify origin/master || \
+                  $(GIT) rev-parse -q --verify master)
+  ifeq ($(MASTER),)
+      $(error "Missing an 'origin/master' or 'master' branch")
+  endif
+  MERGE_BASE:=$(shell $(GIT) merge-base $(HEAD) $(MASTER))
   _TAG:=$(shell $(GIT) describe $(MERGE_BASE))
   # a snapshot off of a tagged git is of the form [tag]-[cnt]-g[hash]
   SNAPSHOT:=$(shell echo $(_TAG) | grep -c '\-g')
diff a/redhat/genspec.sh b/redhat/genspec.sh
--- a/redhat/genspec.sh
+++ b/redhat/genspec.sh
@@ -47,8 +47,12 @@ if [[ -z $lasttag ]]; then
     fi
 fi
 echo "Gathering new log entries since $lasttag"
+# master is expected to track mainline.
+MASTER="$(git rev-parse -q --verify origin/master || \
+          git rev-parse -q --verify master)"
+ 
 git log --topo-order --reverse --no-merges -z --format="- %s (%an)%n%b" \
-	^master "$lasttag".. -- ':!/redhat/rhdocs' | ${0%/*}/genlog.py >> "$clogf"
+	^${MASTER} "$lasttag".. -- ':!/redhat/rhdocs' | ${0%/*}/genlog.py >> "$clogf"
 
 grep -v "tagging $RPM_VERSION" "$clogf" > "$clogf.stripped"
 cp "$clogf.stripped" "$clogf"
@@ -167,7 +171,7 @@ ARK_COMMIT_URL="https://gitlab.com/cki-project/kernel-ark/-/commit";
 #
 # May need to preserve word splitting in EXCLUDE_FILES
 # shellcheck disable=SC2086
-git log --no-merges --pretty=oneline --no-decorate master.. $EXCLUDE_FILES | \
+git log --no-merges --pretty=oneline --no-decorate ${MASTER}.. $EXCLUDE_FILES | \
 	sed "s!^\([^ ]*\)!$ARK_COMMIT_URL/\1\n &!; s!\$!\n!" \
 	> "$SOURCES"/Patchlist.changelog
 

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/995
_______________________________________________
kernel mailing list -- kernel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to kernel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/kernel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure




[Index of Archives]     [Fedora General Discussion]     [Older Fedora Users Archive]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Announce]     [Fedora Package Review]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Coolkey]     [Yum Users]     [Tux]     [Yosemite News]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [USB]     [Asterisk PBX]

  Powered by Linux