From: Prarit Bhargava <pra...@redhat.com> redhat: remove GL_DISTGIT_USER, RHDISTGIT and unify dist-git cloning
Tested: make DISTRO=centos dist-git-test 1) GL_DISTGIT_USER is used for private fork cloning. There is no reason to use private fork in dist-git cloning. First this would require to keep the fork in sync with the orig repo main branch and moreover this behaves differently if the local repo cache is specified or not(*pkg vs git). 2) Copying sources from repo cache depends on working dir and it requires the sources to be updated anyways. Just remove this step. 3) *pkg commands allow to pass extra args to git. There is no need to use two ways how to clone the repo. This also makes RHDISTGIT obsolete. Use just *pkg for cloning and remove RHDISTGIT. 4) With these clean-ups there is no need to keep clone_tree.sh around. Just remove it and move the few commands directly into rh-dist-git.sh Signed-off-by: Frantisek Hrbata <fhrb...@redhat.com> Signed-off-by: Prarit Bhargava <pra...@redhat.com> diff --git a/redhat/Makefile b/redhat/Makefile index blahblah..blahblah 100644 --- a/redhat/Makefile +++ b/redhat/Makefile @@ -755,12 +755,6 @@ dist-git: dist-srpm $(KABI_TARBALL) $(KABIDW_TARBALL) ifeq ("$(RHDISTGIT_BRANCH)", "") $(error RHDISTGIT_BRANCH unset) endif - @if [ "$(DISTRO)" == "centos" ]; then \ - if [ -z "$(GL_DISTGIT_USER)" ]; then \ - echo "Error: please provide your gitlab username with GL_DISTGIT_USER"; \ - exit 1; \ - fi; \ - fi $(REDHAT)/scripts/rh-dist-git.sh dist-rtg: dist-release diff --git a/redhat/Makefile.rhpkg b/redhat/Makefile.rhpkg index blahblah..blahblah 100644 --- a/redhat/Makefile.rhpkg +++ b/redhat/Makefile.rhpkg @@ -30,16 +30,3 @@ ifeq ("$(RHDISTGIT_CACHE)", "") include $(TOPDIR)/.rhpkg.mk endif endif - -ifeq ("$(DISTRO)", "fedora") - RHDISTGIT:=ssh://$(RHDISTGIT_USER)@pkgs.fedoraproject.org/rpms/$(PACKAGE_NAME) -else ifeq ("$(DISTRO)", "centos") - # CentOS uses a fork + merge request based workflow with dist-git to - # handle changes, so you need to provide the gitlab username and we by - # default set the default user's fork path. The dist-git target in - # redhat/Makefile has a check to see if the variable is not set. - GL_FORK_PATH?=$(PACKAGE_NAME).git - RHDISTGIT:=g...@gitlab.com:$(GL_DISTGIT_USER)/$(GL_FORK_PATH) -else - RHDISTGIT:=ssh://$(RHDISTGIT_USER)@pkgs.devel.redhat.com/rpms/$(PACKAGE_NAME) -endif diff --git a/redhat/scripts/clone_tree.sh b/redhat/scripts/clone_tree.sh deleted file mode 100755 index blahblah..blahblah 0 --- a/redhat/scripts/clone_tree.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -# Clones a RHEL dist-git tree using a local reference if existent - -function die -{ - echo "Error: $1" >&2; - exit 1; -} - -date=$(date +"%Y-%m-%d") -tmp="$(mktemp -d --tmpdir="$RHDISTGIT_TMP" RHEL"$RHEL_MAJOR"."$date".XXXXXXXX)"; -cd "$tmp" || die "Unable to create temporary directory"; - -if [[ -n $RHDISTGIT && -n $RHDISTGIT_CACHE ]]; then - git clone --reference "$RHDISTGIT_CACHE" "$RHDISTGIT" "$PACKAGE_NAME" >/dev/null || die "Unable to clone using local cache"; - # if there're tarballs present that are listed in the "sources" file, - # copy them or it'll be downloaded again - if [ -e "$RHDISTGIT_CACHE/sources" ]; then - while IFS= read -r i; do - if [ -f "$RHDISTGIT_CACHE/$i" ]; then - cp "$RHDISTGIT_CACHE/$i" "$tmp/kernel/"; - fi - done < "$RHDISTGIT_CACHE"/sources - fi -else - echo "No local repo, cloning using $RHPKG_BIN" >&2; - $RHPKG_BIN clone "$PACKAGE_NAME" >/dev/null || die "Unable to clone using $RHPKG_BIN"; -fi - -echo "$tmp"; - diff --git a/redhat/scripts/rh-dist-git.sh b/redhat/scripts/rh-dist-git.sh index blahblah..blahblah 100755 --- a/redhat/scripts/rh-dist-git.sh +++ b/redhat/scripts/rh-dist-git.sh @@ -23,8 +23,13 @@ fi echo "Cloning the repository" # clone the dist-git, considering cache -tmpdir=$("$REDHAT"/scripts/clone_tree.sh); - +date=$(date +"%Y-%m-%d") +tmpdir="$(mktemp -d --tmpdir="$RHDISTGIT_TMP" RHEL"$RHEL_MAJOR"."$date".XXXXXXXX)" +cd "$tmpdir" || die "Unable to create temporary directory"; +test -n "$RHDISTGIT_CACHE" && reference="-- --reference $RHDISTGIT_CACHE" +echo "Cloning using $RHPKG_BIN" >&2; +eval $RHPKG_BIN clone "$PACKAGE_NAME" "$reference" >/dev/null || die "Unable to clone using $RHPKG_BIN"; + echo "Switching the branch" # change in the correct branch cd "$tmpdir/$PACKAGE_NAME"; -- https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2021 _______________________________________________ kernel mailing list -- kernel@lists.fedoraproject.org To unsubscribe send an email to kernel-le...@lists.fedoraproject.org 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@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue