[Frugalware-darcs] pacman-tools: pear-makefb

VMiklos vmiklos at frugalware.org
Sat Oct 21 01:39:58 CEST 2006


Darcsweb-Url: http://darcs.frugalware.org/darcsweb/darcsweb.cgi?r=pacman-tools;a=darcs_commitdiff;h=20061020233823-e2957-6dcf0794f92409feef5245f09288508c7464b58c.gz;

[pear-makefb
VMiklos <vmiklos at frugalware.org>**20061020233823
 1) support for pecl packages
 2) added a user-readable error message if the xml version is too new
] {
hunk ./pear-makefb 14
-	print "Usage: %s packagename" % sys.argv[0]
+	print "Usage: %s packagename [--pecl]" % sys.argv[0]
hunk ./pear-makefb 31
+pear = True
+try:
+	if sys.argv[2] == "--pecl":
+		pear = False
+except:
+	pass
hunk ./pear-makefb 41
-sock = urllib.urlopen("http://cvs.php.net/viewvc.cgi/pear/%s/package.xml?revision=HEAD" % name)
+if pear:
+	sock = urllib.urlopen("http://cvs.php.net/viewvc.cgi/pear/%s/package.xml?revision=HEAD" % name)
+else:
+	sock = urllib.urlopen("http://cvs.php.net/viewvc.cgi/pecl/%s/package.xml?revision=HEAD" % name)
hunk ./pear-makefb 54
-out.write('_F_pear_name="%s"\n' % name)
+if pear:
+	out.write('_F_pear_name="%s"\n' % name)
+else:
+	out.write('_F_pecl_name="%s"\n' % name)
hunk ./pear-makefb 63
-	os.unlink("FrugalBuild")
hunk ./pear-makefb 68
-for i in pkg.getElementsByTagName('deps')[0].getElementsByTagName("dep"):
-	# we do not list optional deps in the FB
-	# currently extensions are not splitted to separate subpackages
-	if i.attributes["optional"].value == "yes" or i.attributes["type"].value == "ext":
-		continue
-	if i.attributes["type"].value == "php":
-		s = "php"
-	if i.attributes["type"].value == "pkg":
-		s = "php-pear-%s" % i.firstChild.toxml().lower()
-	# turn the separator to a string
-	rel = {
-		"has": None,
-		"eq": "=",
-		"lt": "<=",
-		"le": "<=",
-		"gt": ">=",
-		"ge": ">="
-	} [i.attributes["rel"].value]
-	if rel:
-		s += rel + i.attributes["version"].value
-	deps.append(s)
+try:
+	for i in pkg.getElementsByTagName('deps')[0].getElementsByTagName("dep"):
+		# we do not list optional deps in the FB
+		# currently extensions are not splitted to separate subpackages
+		try:
+			if i.attributes["optional"].value == "yes":
+				continue
+		except KeyError:
+			pass
+		if i.attributes["type"].value == "ext":
+			continue
+		if i.attributes["type"].value == "php":
+			s = "php"
+		if i.attributes["type"].value == "pkg":
+			s = "php-pear-%s" % i.firstChild.toxml().lower()
+		# turn the separator to a string
+		rel = {
+			"has": None,
+			"eq": "=",
+			"lt": "<=",
+			"le": "<=",
+			"gt": ">=",
+			"ge": ">="
+		} [i.attributes["rel"].value]
+		if rel:
+			s += rel + i.attributes["version"].value
+		deps.append(s)
+except IndexError:
+	print " The version of the package xml is probably not 1.0!"
+	os.unlink("FrugalBuild")
+	sys.exit(1)
hunk ./pear-makefb 100
-out.write("Finclude pear\n")
+if pear:
+	out.write("Finclude pear\n")
+else:
+	out.write("Finclude pecl\n")
hunk ./pear-makefb 105
-remote = urllib.urlopen('http://pear.php.net/get/%s-%s.tgz' % (name, pkgver))
+if pear:
+	remote = urllib.urlopen('http://pear.php.net/get/%s-%s.tgz' % (name, pkgver))
+else:
+	remote = urllib.urlopen('http://pecl.php.net/get/%s-%s.tgz' % (name, pkgver))
}


More information about the Frugalware-darcs mailing list