[carto] Initial import of carto
Tom Hughes
tomh at fedoraproject.org
Tue Mar 12 13:06:10 UTC 2013
commit 19c513dac28902a6f40f11dc9adec9c71948b348
Author: Tom Hughes <tom at compton.nu>
Date: Tue Mar 12 13:05:51 2013 +0000
Initial import of carto
.gitignore | 2 +
carto-0.9.4-manpage.1 | 24 ++++++++++++++
carto-dl-tests.sh | 23 ++++++++++++++
carto-underscore.patch | 11 +++++++
carto-xml2js.patch | 55 +++++++++++++++++++++++++++++++++
carto.spec | 79 ++++++++++++++++++++++++++++++++++++++++++++++++
sources | 2 +
7 files changed, 196 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..b138eb2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1,2 @@
+/carto-0.9.4.tgz
+/carto-tests-v0.9.4.tar.bz2
diff --git a/carto-0.9.4-manpage.1 b/carto-0.9.4-manpage.1
new file mode 100644
index 0000000..85c00db
--- /dev/null
+++ b/carto-0.9.4-manpage.1
@@ -0,0 +1,24 @@
+.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.40.12.
+.TH CARTO "1" "March 2013" "carto 0.9.4" "User Commands"
+.SH NAME
+carto \- Carto map stylesheet compiler
+.SH SYNOPSIS
+.B carto [OPTION]
+\fI<source_MML_file>\fR
+.SH DESCRIPTION
+Carto is a stylesheet renderer for Mapnik. It's an evolution of
+the Cascadenik idea and language, with an emphasis on speed and
+flexibility.
+.SH OPTIONS
+.TP
+\fB\-v\fR \fB\-\-version\fR
+Parse JSON map manifest
+.TP
+\fB\-b\fR \fB\-\-benchmark\fR
+Outputs total compile time
+.TP
+\fB\-n\fR \fB\-\-nosymlink\fR
+Use absolute paths instead of symlinking files
+.SH REPORTING BUGS
+Please report bugs on the GitHub issue tracker:
+<\fBhttps://github.com/mapbox/carto/issues\fR>
diff --git a/carto-dl-tests.sh b/carto-dl-tests.sh
new file mode 100755
index 0000000..ab6e7fb
--- /dev/null
+++ b/carto-dl-tests.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+tag=v0.9.4
+
+set -e
+
+tmp=$(mktemp -d)
+
+trap cleanup EXIT
+cleanup() {
+ set +e
+ [ -z "$tmp" -o ! -d "$tmp" ] || rm -rf "$tmp"
+}
+
+unset CDPATH
+pwd=$(pwd)
+
+pushd "$tmp"
+git clone git://github.com/mapbox/carto.git
+cd carto
+git archive --prefix="test/" --format=tar tags/${tag}:test/ \
+ | bzip2 > "$pwd"/carto-tests-${tag}.tar.bz2
+popd
diff --git a/carto-underscore.patch b/carto-underscore.patch
new file mode 100644
index 0000000..b320c01
--- /dev/null
+++ b/carto-underscore.patch
@@ -0,0 +1,11 @@
+--- package.json.underscore 2013-02-13 00:03:31.869854769 +0000
++++ package.json 2013-02-13 00:03:40.833130363 +0000
+@@ -35,7 +35,7 @@
+ "node": ">=0.4.x"
+ },
+ "dependencies": {
+- "underscore": "~1.3.3",
++ "underscore": "~1.4.3",
+ "mapnik-reference": "~5.0.0",
+ "xml2js": "~0.2.4"
+ },
diff --git a/carto-xml2js.patch b/carto-xml2js.patch
new file mode 100644
index 0000000..19b1ff1
--- /dev/null
+++ b/carto-xml2js.patch
@@ -0,0 +1,55 @@
+commit 48d89889fe4293bc91ea1b89d6ce725bd2c4cbbc
+Author: Tom Hughes <tom at compton.nu>
+Date: Sun Feb 10 20:46:12 2013 +0000
+
+ Update to use v0.2.x of xml2js
+
+diff --git a/bin/mml2json.js b/bin/mml2json.js
+index 1291a35..dd25389 100755
+--- a/bin/mml2json.js
++++ b/bin/mml2json.js
+@@ -25,8 +25,8 @@ fs.readFile(process.argv[2], 'utf-8', function(err, data) {
+ });
+
+ function addAttributes(obj) {
+- if (obj['@']) for (var key in obj['@']) obj[key] = obj['@'][key];
+- delete obj['@'];
++ if (obj['$']) for (var key in obj['$']) obj[key] = obj['$'][key];
++ delete obj['$'];
+ return obj;
+ }
+
+@@ -35,7 +35,10 @@ fs.readFile(process.argv[2], 'utf-8', function(err, data) {
+ else return obj;
+ }
+
+- var parser = new xml2js.Parser();
++ var parser = new xml2js.Parser({
++ explicitRoot: false,
++ explicitArray: false
++ });
+ parser.addListener('end', function(json) {
+ console.log(JSON.stringify(json, function(key, value) {
+ if (!key) {
+@@ -52,7 +55,7 @@ fs.readFile(process.argv[2], 'utf-8', function(err, data) {
+ else if (key === 'Datasource') {
+ value = addAttributes(value);
+ value.Parameter.forEach(function(parameter) {
+- value[parameter['@'].name] = parameter['#'];
++ value[parameter['$'].name] = parameter['_'];
+ });
+ delete value.Parameter;
+ return value;
+diff --git a/package.json b/package.json
+index 5b63d71..5f81688 100644
+--- a/package.json
++++ b/package.json
+@@ -37,7 +37,7 @@
+ "dependencies": {
+ "underscore": "~1.3.3",
+ "mapnik-reference": "~5.0.0",
+- "xml2js": "~0.1.13"
++ "xml2js": "~0.2.4"
+ },
+ "devDependencies": {
+ "mocha": "1.3.x",
diff --git a/carto.spec b/carto.spec
new file mode 100644
index 0000000..4c8697b
--- /dev/null
+++ b/carto.spec
@@ -0,0 +1,79 @@
+%global enable_tests 0
+
+Name: carto
+Version: 0.9.4
+Release: 1%{?dist}
+Summary: Mapnik style sheet compiler
+
+License: ASL 2.0
+URL: https://github.com/mapbox/carto
+Source0: http://registry.npmjs.org/carto/-/carto-%{version}.tgz
+# The test files are not included in the npm tarball.
+# Source1 is generated using Source10, which pulls from the upstream
+# version control repository.
+Source1: carto-tests-v%{version}.tar.bz2
+# Accepted upstream - see https://github.com/mapbox/carto/pull/257
+Source2: carto-%{version}-manpage.1
+Source10: carto-dl-tests.sh
+# Accepted upstream - see https://github.com/mapbox/carto/pull/250
+Patch0: carto-xml2js.patch
+# Already changed upstream in 43073fa1e89f916e0290a38a5071355c284467f7
+Patch1: carto-underscore.patch
+BuildArch: noarch
+
+Requires: npm(millstone)
+
+BuildRequires: nodejs-devel
+
+%if 0%{?enable_tests}
+BuildRequires: npm(mocha)
+BuildRequires: npm(mapnik-reference)
+BuildRequires: npm(sax)
+BuildRequires: npm(underscore)
+%endif
+
+%description
+Carto is a style sheet compiler for Mapnik. It's an evolution of
+the Cascadenik idea and language, with an emphasis on speed and
+flexibility.
+
+
+%prep
+%setup -q -n package
+%setup -T -D -a 1 -q -n package
+%patch0 -p1
+%patch1 -p0 -b .carto
+rm -rf node_modules
+
+
+%build
+
+
+%if 0%{?enable_tests}
+%check
+ln -s %{nodejs_sitelib} .
+NODE_PATH=lib %{nodejs_sitelib}/mocha/bin/mocha -R spec test/*.test.js
+%endif
+
+
+%install
+mkdir -p %{buildroot}/%{nodejs_sitelib}/carto
+cp -pr package.json bin lib %{buildroot}/%{nodejs_sitelib}/carto
+mkdir -p %{buildroot}/%{nodejs_sitelib}/carto/bin
+mkdir -p %{buildroot}/%{_bindir}
+ln -s %{nodejs_sitelib}/carto/bin/carto %{buildroot}/%{_bindir}/carto
+mkdir -p %{buildroot}%{_mandir}/man1
+install -p -D -m0644 %{SOURCE2} %{buildroot}%{_mandir}/man1/carto.1
+%nodejs_symlink_deps
+
+
+%files
+%doc LICENSE README.md CHANGELOG.md
+%{nodejs_sitelib}/carto
+%{_bindir}/carto
+%{_mandir}/man1/carto.1*
+
+
+%changelog
+* Sun Feb 10 2013 Tom Hughes <tom at compton.nu> - 0.9.4-1
+- Initial build of 0.9.4
diff --git a/sources b/sources
index e69de29..fdaf3ab 100644
--- a/sources
+++ b/sources
@@ -0,0 +1,2 @@
+f44e7f141395537e0f7031d3fc8b7cba carto-0.9.4.tgz
+e7a2ad082c2ac3f1dfa941a62faa8504 carto-tests-v0.9.4.tar.bz2
More information about the scm-commits
mailing list