[pkg-wpa-devel] r1726 - in /wpa/trunk/debian: get-orig-source rules

slh-guest at users.alioth.debian.org slh-guest at users.alioth.debian.org
Mon Apr 16 21:21:39 UTC 2012


Author: slh-guest
Date: Mon Apr 16 21:21:38 2012
New Revision: 1726

URL: http://svn.debian.org/wsvn/pkg-wpa/?sc=1&rev=1726
Log:
move get-orig-source logic into a separate script

Added:
    wpa/trunk/debian/get-orig-source   (with props)
Modified:
    wpa/trunk/debian/rules

Added: wpa/trunk/debian/get-orig-source
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/get-orig-source?rev=1726&op=file
==============================================================================
--- wpa/trunk/debian/get-orig-source (added)
+++ wpa/trunk/debian/get-orig-source Mon Apr 16 21:21:38 2012
@@ -1,0 +1,60 @@
+#!/bin/sh
+
+if [ -n "${1}" ]; then
+	CURDIR="${1}"
+else
+	echo "ERROR: not called with \$(CURDIR) parameter" >&2
+	exit 1
+fi
+
+# parse versions
+VERSION="$(dpkg-parsechangelog -l${CURDIR}/debian/changelog | sed -ne 's,^Version: *\([0-9]*:\)\?\(.*\)$,\2,p')"
+DEB_VER="$(echo ${VERSION} | sed 's,\-[0-9a-z\~\.]*,,')"
+UP_VER="$(echo ${DEB_VER} | sed 's,\~,\-,g')"
+UP_VER_TAG="hostap_$(echo $UP_VER | sed -e 's,\.,_,g' -e 's,\-,_,g')"
+
+# write to ../tarballs/, if it exists - ../ otherwise
+if [ -d "${CURDIR}/../tarballs" ]; then
+	ORIG_TARBALL="${CURDIR}/../tarballs/wpa_${DEB_VER}.orig.tar.gz"
+else
+	ORIG_TARBALL="${CURDIR}/../wpa_${DEB_VER}.orig.tar.gz"
+fi
+
+# don't overwrite existing tarballs
+if [ -e "${ORIG_TARBALL}" ]; then
+	echo "ERROR: don't overwrite existing ${ORIG_TARBALL}" >&2
+	exit 2
+fi
+
+TEMP_SOURCE="$(mktemp -d --tmpdir wpa-orig-source.XXXXXXXXXX)"
+if [ "$?" -ne 0 ] || [ -z "${TEMP_SOURCE}" ] || [ ! -d "${TEMP_SOURCE}" ]; then
+	echo "ERROR: failed to create temporary working directory" >&2
+	exit 3
+fi
+
+# clone upstream git repository
+git clone git://w1.fi/srv/git/hostap-1.git "${TEMP_SOURCE}"
+if [ "$?" -ne 0 ] || [ ! -d "${TEMP_SOURCE}" ]; then
+	echo "ERROR: cloning git://w1.fi/srv/git/hostap-1.git failed" >&2
+	rm -rf "${TEMP_SOURCE}"
+	exit 4
+fi
+
+# create new usptream tarball
+cd "${TEMP_SOURCE}" && \
+	git archive \
+		--format=tar \
+		--prefix="wpa-${UP_VER}/" \
+		"${UP_VER_TAG}" \
+			README COPYING patches src wpa_supplicant hostapd | \
+				gzip -c9 > "${ORIG_TARBALL}"
+if [ "$?" -ne 0 ] || [ ! -e "${ORIG_TARBALL}" ]; then
+	echo "ERROR: failure to create ${ORIG_TARBALL}" >&2
+	rm -rf "${TEMP_SOURCE}"
+	exit 5
+else
+	echo "SUCCESS: New upstream tarball has been saved at ${ORIG_TARBALL}"
+	rm -rf "${TEMP_SOURCE}"
+	exit 0
+fi
+

Propchange: wpa/trunk/debian/get-orig-source
------------------------------------------------------------------------------
    svn:executable = *

Modified: wpa/trunk/debian/rules
URL: http://svn.debian.org/wsvn/pkg-wpa/wpa/trunk/debian/rules?rev=1726&op=diff
==============================================================================
--- wpa/trunk/debian/rules (original)
+++ wpa/trunk/debian/rules Mon Apr 16 21:21:38 2012
@@ -116,28 +116,6 @@
 	dh $@
 
 get-orig-source:
-	VERSION=$$(dpkg-parsechangelog | sed -ne 's,^Version: *\([0-9]*:\)\?\(.*\)$$,\2,p'); \
-	DEB_VER=$$(echo $$VERSION | sed 's,\-[0-9a-z\~\.]*,,'); \
-	UP_VER=$$(echo $$DEB_VER | sed 's,\~,\-,g'); \
-	UP_VER_TAG=hostap_$$(echo $$UP_VER | sed -e 's,\.,_,g' -e 's,\-,_,g'); \
-	if [ -d $(CURDIR)/../tarballs ]; then \
-		ORIG_LOCATION="$(CURDIR)/../tarballs"; \
-	else \
-		ORIG_LOCATION="$(CURDIR)/.."; \
-	fi; \
-	if [ -e $$ORIG_LOCATION/wpa_$$DEB_VER.orig.tar.gz ]; then \
-		echo "ERROR: $$ORIG_LOCATION/wpa_$$DEB_VER.orig.tar.gz exists"; \
-		exit 1; \
-	fi; \
-	test -d orig-source && exit 1 || :; \
-	git clone git://w1.fi/srv/git/hostap-1.git orig-source; \
-	test -d orig-source || exit 1; \
-	cd orig-source && \
-		git archive \
-			--format=tar \
-			--prefix=wpa-$$UP_VER/ \
-			$$UP_VER_TAG \
-				README COPYING patches src wpa_supplicant hostapd | \
-					gzip -c9 > $$ORIG_LOCATION/wpa_$$DEB_VER.orig.tar.gz
-	rm -rf orig-source
+	chmod +x $(CURDIR)/debian/get-orig-source
+	$(CURDIR)/debian/get-orig-source $(CURDIR)
 




More information about the Pkg-wpa-devel mailing list