Please review: Mercurial Repo in gar

Jan Holzhueter jh at opencsw.org
Mon Aug 29 16:40:06 CEST 2016


Hi,
nice
since you are add it. could you please review the git implementation also.
iirc it's broken.
I could be wrong though :)

Greetings
Jan



Am 29.08.16 um 15:59 schrieb cgrzemba at opencsw.org:
> I added download from Mercurial Repos in mgar.
> Please review and merge if you found this usefull
> 
> Carsten
> 
> -------- Original Message --------
> From: cgrzemba at users.sourceforge.net
> Date: Aug 29, 2016 3:54:36 PM
> Subject: SF.net SVN: gar:[25913] csw/mgar/gar
> To: devel at lists.opencsw.org
> 
> Revision: 25913
>           http://sourceforge.net/p/gar/code/25913
> Author:   cgrzemba
> Date:     2016-08-29 13:53:58 +0000 (Mon, 29 Aug 2016)
> Log Message:
> -----------
> add download from Mercurial repository
> - use variable HG_REPOS for the mercurial download URL
> - use HG_TREEISH_repo-name for repo tag to extract (default 'tip')
> 
> Modified Paths:
> --------------
>     csw/mgar/gar/v2-hg/gar.lib.mk
>     csw/mgar/gar/v2-hg/gar.mk
> 
> Added Paths:
> -----------
>     csw/mgar/gar/v2-hg/
> 
> Modified: csw/mgar/gar/v2-hg/gar.lib.mk
> ===================================================================
> --- csw/mgar/gar/v2/gar.lib.mk 2016-08-29 13:38:26 UTC (rev 25911)
> +++ csw/mgar/gar/v2-hg/gar.lib.mk 2016-08-29 13:53:58 UTC (rev 25913)
> @@ -10,6 +10,8 @@
>  # software causes damage.
>  #
>  
> +# md5sum ?= md5sum
> +md5sum ?= $(if $(filter no%,$(shell which md5sum)),gmd5sum,md5sum)
>  # cookies go here, so we have to be able to find them for
>  # dependency checking.
>  VPATH += $(COOKIEDIR)
> @@ -24,6 +26,7 @@
>  # override GIT_PROXY_SCRIPT to something else if you need to.
>  GIT_MAYBEPROXY = $(if
> $(GIT_USE_PROXY),GIT_PROXY_COMMAND=$(GIT_PROXY_SCRIPT))
>  GIT_TREEISH = $(if $(GIT_TREEISH_$(1)),$(GIT_TREEISH_$(1)),HEAD)
> +HG_TREEISH = $(if $(HG_TREEISH_$(1)),$(HG_TREEISH_$(1)),tip)
>  
>  #################### FETCH RULES ####################
>  
> @@ -43,6 +46,14 @@
>  URLS += $(foreach R,$(GIT_REPOS),gitrepo://$(call GITPROJ,$(R))
> $(foreach gitproto,git http file ssh,$(call gitsubst,$(gitproto),$(R))))
>  endif
>  
> +define hgsubst
> +$(subst hg-hg,hg,$(if $(findstring $(1)://,$(2)),$(patsubst
> $(1)%,hg-$(1)%,$(call URLSTRIP,$(2)) )))
> +endef
> +
> +ifdef HG_REPOS
> +URLS += $(foreach R,$(HG_REPOS),$(foreach hgproto,hg http file
> ssh,$(call hgsubst,$(hgproto),$(R))))
> +endif
> +
>  # Download the file if and only if it doesn't have a preexisting
>  # checksum file.  Loop through available URLs and stop when you
>  # get one that doesn't return an error code.
> @@ -55,18 +66,18 @@
>   $(if $(_FLIST),,$(error INTERNAL ERROR: The file $* is requested but
> not in the list of generated URLs))
>   @if test -f $(COOKIEDIR)/checksum-$*; then : ; else \
>           echo " ==> Grabbing $@"; \
> -         ( for i in $(filter %/$*,$(URLS)) $(foreach URL,$(URLS),$(if
> $(findstring $(GITHUB_HOST),$(URL)),$(URL),)); do  \
> +         ( for i in $(filter %/$(*:%.hg=%),$(URLS)) $(foreach
> URL,$(URLS),$(if $(findstring $(GITHUB_HOST),$(URL)),$(URL),)); do  \
>                   echo "  ==> Trying $$i"; \
>                   $(MAKE) -s `echo $$i | tr -d :` || continue; \
>                   case $$i in \
>                           *$(GITHUB_HOST)*) \
>                                   mv $(PARTIALDIR)/$(GITHUB_REFERENCE)
> $@ ;; \
>                           *) \
> -                                 mv $(PARTIALDIR)/$* $@ ;; \
> +                                 mv $(PARTIALDIR)/$(*:%.hg=%)
> $(@:%.hg=%) ;; \
>                   esac; \
>                   break; \
>           done; ) 2>&1 | grep -v '^$(MAKE)'; \
> -         if test -r $@ ; then : ; else \
> +         if test -r $(@:%.hg=%) ; then : ; else \
>                   echo '(!!!) Failed to download $@!' 1>&2; \
>                   false; \
>           fi; \
> @@ -104,6 +115,14 @@
>   @( cd $(PARTIALDIR)/$(call GITPROJ,$*); \
>           git config remote.origin.fetch $(if $(GIT_REFS_$(call
> GITPROJ,$*)),$(GIT_REFS_$(call GITPROJ,$*)),$(GIT_DEFAULT_TRACK)); )
>  
> +hg-http//%:
> + hg clone http://$* $(PARTIALDIR)/$(call GITPROJ,$*)
> +hg-hg//%:
> + hg clone hg://$* $(PARTIALDIR)/$(call GITPROJ,$*)
> +hg-ssh//%:
> + hg clone ssh://$* $(PARTIALDIR)/$(call GITPROJ,$*)
> +hg-file//%:
> + hg clone file://$* $(PARTIALDIR)/$(call GITPROJ,$*)
>  
>  # create ADMSCRIPTS 'on the fly' from variables defined by the caller
>  # This version is private and should only be called from the non-private
> @@ -182,7 +201,7 @@
>  checksum-%: $(CHECKSUM_FILE)
>   @echo " ==> Running checksum on $*"
>   @if ggrep -- '[ /]$*$$' $(CHECKSUM_FILE); then \
> -         if cat $(CHECKSUM_FILE) | sed -e 's!download/!!' | (cd
> $(DOWNLOADDIR); LC_ALL="C" LANG="C" gmd5sum -c 2>&1) | \
> +         if cat $(CHECKSUM_FILE) | sed -e 's!download/!!' | (cd
> $(DOWNLOADDIR); LC_ALL="C" LANG="C" $(md5sum) -c 2>&1) | \
>                   ggrep -- '$*' | ggrep -v ':[ ]\+OK'; then \
>                   echo '(!!!) $* failed checksum test!' 1>&2; \
>                   false; \
> @@ -632,6 +651,10 @@
>   @echo " ===> Extracting Git Repo $(DOWNLOADDIR)/$* (Treeish: $(call
> GIT_TREEISH,$*))"
>   ( cd $(abspath $(DOWNLOADDIR))/$*/; git --bare archive
> --prefix=$(NAME)-$(VERSION)/ $(call GIT_TREEISH,$*)) | gtar -xf - -C
> $(EXTRACTDIR)
>   @$(MAKECOOKIE)
> +hg-extract-%:
> + @echo " ===> Extracting Mercurial Repo $(DOWNLOADDIR)/$* (Tag: $(call
> HG_TREEISH,$*))"
> + ( cd $(abspath $(DOWNLOADDIR))/$*/; hg archive
> --prefix=$(NAME)-$(VERSION)/ --rev=$(call HG_TREEISH,$*) --type tar -)|
> gtar -xf - -C $(EXTRACTDIR)
> + @$(MAKECOOKIE)
>  
>  # rule to extract files with unzip
>  zip-extract-%:
> @@ -723,6 +746,9 @@
>  extract-archive-%.git: git-extract-%.git
>   @$(MAKECOOKIE)
>  
> +extract-archive-%.hg: hg-extract-%
> + @$(MAKECOOKIE)
> +
>  extract-copy-%: cp-extract-%
>   @$(MAKECOOKIE)
>  
> 
> Modified: csw/mgar/gar/v2-hg/gar.mk
> ===================================================================
> --- csw/mgar/gar/v2/gar.mk 2016-08-29 13:38:26 UTC (rev 25911)
> +++ csw/mgar/gar/v2-hg/gar.mk 2016-08-29 13:53:58 UTC (rev 25913)
> @@ -11,6 +11,8 @@
>  # Comment this out to make much verbosity
>  #.SILENT:
>  
> +md5sum ?= $(if $(filter no%,$(shell which md5sum)),gmd5sum,md5sum)
> +
>  ifneq ($(abspath /),/)
>  $(error Your version of 'make' is too old: $(MAKE_VERSION). Please make
> sure you are using at least 3.81)
>  endif
> @@ -45,7 +47,7 @@
>  
>  DYNSCRIPTS := $(foreach PKG,$(SPKG_SPECS),$(foreach
> SCR,$(ADMSCRIPTS),$(if $(value $(PKG)_$(SCR)), $(PKG).$(SCR))))
>  _LOCALFILES = $(notdir $(wildcard files/*))
> -_NOCHECKSUM += $(DYNSCRIPTS) $(_LOCALFILES) $(foreach
> R,$(GIT_REPOS),$(call GITPROJ,$(R))) $(_EXTRA_GAR_NOCHECKSUM)
> +_NOCHECKSUM += $(DYNSCRIPTS) $(_LOCALFILES) $(foreach
> R,$(GIT_REPOS),$(call GITPROJ,$(R))) $(foreach R,$(HG_REPOS),$(call
> GITPROJ,$(R).hg)) $(_EXTRA_GAR_NOCHECKSUM)
>  
>  DISTFILES += $(_EXTRA_GAR_DISTFILES)
>  
> @@ -54,7 +56,8 @@
>  ALLFILES_PATCHFILES ?= $(PATCHFILES) $(foreach
> M,$(MODULATIONS),$(PATCHFILES_$M))
>  ALLFILES_DYNSCRIPTS ?= $(DYNSCRIPTS)
>  ALLFILES_GIT_REPOS ?= $(foreach R,$(GIT_REPOS),$(call GITPROJ,$(R)))
> -ALLFILES ?= $(sort $(ALLFILES_DISTFILES) $(ALLFILES_PATCHFILES)
> $(ALLFILES_DYNSCRIPTS) $(ALLFILES_GIT_REPOS) $(EXTRA_ALLFILES)
> $(_EXTRA_GAR_ALLFILES))
> +ALLFILES_HG_REPOS ?= $(foreach R,$(HG_REPOS),$(call GITPROJ,$(R).hg))
> +ALLFILES ?= $(sort $(ALLFILES_DISTFILES) $(ALLFILES_PATCHFILES)
> $(ALLFILES_DYNSCRIPTS) $(ALLFILES_GIT_REPOS) $(ALLFILES_HG_REPOS)
> $(EXTRA_ALLFILES) $(_EXTRA_GAR_ALLFILES))
>  
>  ifeq ($(MAKE_INSTALL_DIRS),1)
>  INSTALL_DIRS = $(addprefix $(DESTDIR),$(prefix) $(exec_prefix)
> $(bindir) $(sbindir) $(libexecdir) $(datadir) $(sysconfdir)
> $(sharedstatedir) $(localstatedir) $(libdir) $(infodir) $(lispdir)
> $(includedir) $(mandir) $(foreach NUM,1 2 3 4 5 6 7 8,
> $(mandir)/man$(NUM)) $(sourcedir))
> @@ -337,6 +340,8 @@
>   @$(foreach D,$(DYNSCRIPTS),echo " $D";)
>   @echo "Git Repos tracked: "
>   @$(foreach R,$(GIT_REPOS),echo "       $R";)
> + @echo "Mercurial Repos tracked: "
> + @$(foreach R,$(HG_REPOS),echo "       $R";)
>   @echo "All potential URLS: "
>   @$(foreach U,$(URLS),echo "       $U";)
>  
> @@ -382,7 +387,7 @@
>  
>  makesum: fetch $(addprefix $(DOWNLOADDIR)/,$(MAKESUM_TARGETS))
> $(GARCHIVE_TARGETS)
>   @if test "x$(MAKESUM_TARGETS)" != "x"; then \
> -         (cd $(DOWNLOADDIR) && gmd5sum $(MAKESUM_TARGETS)) >
> $(CHECKSUM_FILE) ; \
> +         (cd $(DOWNLOADDIR) && $(md5sum) $(MAKESUM_TARGETS)) >
> $(CHECKSUM_FILE) ; \
>           echo "Checksums made for $(MAKESUM_TARGETS)" ; \
>           cat $(CHECKSUM_FILE) ; \
>   else \
> @@ -395,8 +400,8 @@
>  garchive: checksum $(GARCHIVE_TARGETS) ;
>  
>  # extract         - Unpacks $(DISTFILES) into $(EXTRACTDIR) (patches
> are "zcatted" into the patch program)
> -EXTRACT_TARGETS-global ?= $(addprefix extract-copy-,$(filter-out
> $(NOEXTRACT),$(DISTFILES) $(DYNSCRIPTS) $(foreach R,$(GIT_REPOS),$(call
> GITPROJ,$(R)))))
> -EXTRACT_TARGETS-default = $(addprefix extract-archive-,$(filter-out
> $(NOEXTRACT),$(DISTFILES) $(DYNSCRIPTS) $(foreach R,$(GIT_REPOS),$(call
> GITPROJ,$(R)))))
> +EXTRACT_TARGETS-global ?= $(addprefix extract-copy-,$(filter-out
> $(NOEXTRACT),$(DISTFILES) $(DYNSCRIPTS) $(foreach R,$(GIT_REPOS),$(call
> GITPROJ,$(R))) $(foreach R,$(HG_REPOS),$(call GITPROJ,$(R).hg))))
> +EXTRACT_TARGETS-default = $(addprefix extract-archive-,$(filter-out
> $(NOEXTRACT),$(DISTFILES) $(DYNSCRIPTS) $(foreach R,$(GIT_REPOS),$(call
> GITPROJ,$(R))) $(foreach R,$(HG_REPOS),$(call GITPROJ,$(R).hg))))
>  EXTRACT_TARGETS = $(or
> $(EXTRACT_TARGETS-$(MODULATION)),$(EXTRACT_TARGETS-default))
>  
>  ifdef REINPLACE_FILES
> 
> This was sent by the SourceForge.net collaborative development platform,
> the world's largest Open Source development site.
> 
> 
> 



More information about the maintainers mailing list