Sources

The Tree of Radix and Third Party Sources

1388 Commits   0 Branches   11 Tags
author: kx <kx@radix.pro> 2021-05-02 12:03:43 +0300 committer: kx <kx@radix.pro> 2021-05-02 12:03:43 +0300 commit: 4d273de4e5252c26b2531bc242fdbcb6d0f4954b parent: 18a8573e1a51cecebcfee2f227e4ec1061a5a7d9
Commit Summary:
OpenVPN-2.5.2
Diffstat:
1 file changed, 46 insertions, 26 deletions
diff --git a/packages/n/openvpn/Makefile b/packages/n/openvpn/Makefile
index 8069e50..11e6192 100644
--- a/packages/n/openvpn/Makefile
+++ b/packages/n/openvpn/Makefile
@@ -1,47 +1,71 @@
 #
 # Project Home:
 # ============
-# http://openvpn.net
+# https://github.com/OpenVPN/openvpn
 #
-# Downloads:
-# =========
-# http://openvpn.net/index.php/open-source/downloads.html
-# https://swupdate.openvpn.org/community/releases
+# GitHub:
+# ======
+# https://github.com/OpenVPN/openvpn
 #
+# Clone:
+# =====
+# https://github.com/OpenVPN/openvpn.git
+#
+
+url        = https://github.com/OpenVPN
 
-url          = https://swupdate.openvpn.org/community/releases
+repo_name  = openvpn
 
-versions     = 2.3.5 2.3.9 2.4.8 2.5.1
-pkgname      = openvpn
-suffix       = tar.xz
+#
+# List of tags to be extracted:
+# ============================
+#                                               hash | tag
+#            ----------------------------------------+-----
+revisions  = 23ae78e657052748be68b623ca8122e4103dc7e0:2.5.2
 
-tarballs     = $(addsuffix .$(suffix), $(addprefix $(pkgname)-, $(versions)))
-signatures   = $(addsuffix .asc, $(tarballs))
-sha1s        = $(addsuffix .sha1sum, $(tarballs))
+git_repo   = .git_clone
 
-all: $(tarballs) $(signatures) $(sha1s)
+suffix     = tar.xz
 
-.PHONY: downloads_clean
+versions   = $(foreach tag, $(revisions), $(shell echo $(tag) | cut -f 2 -d ':'))
 
+tarballs   = $(addsuffix .$(suffix), $(addprefix $(repo_name)-, $(versions)))
+sha1s      = $(addsuffix .sha1sum, $(tarballs))
 
-$(tarballs):
-	@echo -e "\n======= Downloading source tarballs =======\n"
-	@for tarball in $(tarballs) ; do \
-	  wget -N $(url)/$$tarball ; \
-	done
+TARGETS = repository_clean
 
-$(signatures): %.$(suffix).asc : %.$(suffix)
-	@for signature in $@ ; do \
-	  echo -e "\n======= Downloading '$$signature' signature =======\n" ; \
-	  wget -N $(url)/$$signature ; \
-	  touch $$signature ; \
+all: $(TARGETS)
+
+.PHONY: downloads_clean repository_clean
+
+$(git_repo):
+	@echo -e "\n======= Clone $(repo_name).git repository =======\n"
+	@rm -rf $(repo_name)
+	@git clone $(url)/$(repo_name).git $(repo_name)
+	@touch $@
+
+$(tarballs): $(git_repo)
+	@for revision in $(revisions) ; do \
+	  hash=`echo $$revision    | cut -f 1 -d ':'` ; \
+	  version=`echo $$revision | cut -f 2 -d ':'` ; \
+	  if [ ! -f $(repo_name)-$$version.$(suffix) ]; then \
+	    echo -e "\n======= Creating '$(repo_name)-$$version.$(suffix)' snapshot =======" ; \
+	    ( cd $(repo_name) && \
+	      git archive --format=tar --prefix=$(repo_name)-$$version/ $$hash | \
+	      xz >../$(repo_name)-$$version.$(suffix) ) ; \
+	  fi ; \
 	done
 
 $(sha1s): %.$(suffix).sha1sum : %.$(suffix)
 	@for tarball in $< ; do \
-	  echo -e "\n======= Calculation the '$$tarball' sha1sum =======\n" ; \
+	  echo -e "\n======= Calculation the '$$tarball' sha1sum =======" ; \
 	  sha1sum --binary $$tarball > $$tarball.sha1sum ; \
 	done
 
+repository_clean: $(sha1s)
+	@echo -e "\n======= Remove cloned $(repo_name).git repository =======\n"
+	@rm -rf $(git_repo) $(repo_name)
+
 downloads_clean:
-	@rm -rf $(tarballs) $(signatures) $(sha1s)
+	@rm -rf $(tarballs) $(sha1s)
+	@rm -rf $(git_repo) $(repo_name)