summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-05-29 02:00:05 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2014-05-29 02:00:05 -0400
commitf2a925202fc783906178bea96fa5b261ffa10b49 (patch)
treeccb20748cbc0654765399f044565df554981dcb9
parentf6e0e953209abb322b1d44e6d04e88c2230d9111 (diff)
refactor
-rw-r--r--.gitignore5
-rw-r--r--Makefile233
-rw-r--r--conf/maven.local.repo.txt (renamed from conf_maven.local.repo.txt)0
-rw-r--r--conf/sources.mk31
-rw-r--r--conf_apache-maven_mirror.txt1
-rw-r--r--conf_apache-maven_version.txt1
-rw-r--r--conf_apache-svn_map.txt16
-rw-r--r--conf_git-urls.txt22
-rw-r--r--makefiles/plexus-containers.mk49
-rwxr-xr-xutils/file2base9
-rwxr-xr-xutils/file2extra9
-rwxr-xr-xutils/file2url10
-rwxr-xr-xutils/spec2file10
13 files changed, 185 insertions, 211 deletions
diff --git a/.gitignore b/.gitignore
index b4e4b14..0a9e742 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,2 @@
/build/
-/packages/
-/upstream/
-/gen_*
-/token_*
+/.tokens/
diff --git a/Makefile b/Makefile
index 0c8aa04..3037fe7 100644
--- a/Makefile
+++ b/Makefile
@@ -1,125 +1,122 @@
top := $(shell pwd)
-export maven_dist_top := $(top)
-export makefiles := $(top)/makefiles
-
-mvn_ver = $(shell cat conf_apache-maven_version.txt)
-MAVEN_LOCAL_REPO_INSTALL = $(shell cat conf_maven.local.repo.txt)
-MAVEN_LOCAL_REPO_SEARCH = $(top)/packages/dest/$(MAVEN_LOCAL_REPO_INSTALL)
-export MAVEN_LOCAL_REPO_INSTALL MAVEN_LOCAL_REPO_SEARCH
-
-all: extract gen_version-maven-svn.txt
-
-# We get slf4j from git because the official distribution tarball for 1.7.5 is
-# incomplete.
-
-download: \
- upstream/apache-maven-$(mvn_ver) \
- upstream/maven-svn \
- upstream/slf4j-git \
- upstream/plexus-compiler-git \
- upstream/plexus-utils-git \
- upstream/plexus-archiver-git \
- upstream/plexus-classworlds-git \
- upstream/plexus-io-git \
- upstream/plexus-containers-git \
- upstream/plexus-cipher-git \
- upstream/plexus-interpolation-git \
- upstream/plexus-pom-git
-
-extract: \
- build/maven \
- build/maven-extras \
- build/slf4j \
- build/plexus-compiler \
- build/plexus-utils \
- build/plexus-archiver \
- build/plexus-classworlds \
- build/plexus-io \
- build/plexus-containers \
- build/plexus-cipher \
- build/plexus-interpolation \
- build/plexus-pom
-
-package: \
- packages/plexus-utils \
- packages/plexus-interpolation \
- packages/plexus-classworlds \
- packages/plexus-containers \
-
-token_%:
- touch $@
-
-# apache-maven #################################################################
-
-upstream/apache-maven-${mvn_ver}-src.tar.gz: upstream/apache-maven-%-src.tar.gz: conf_apache-maven_mirror.txt token_network
- mkdir -p ${@D}
- ver=$* && mirror=$$(< $<) && wget -c -O $@ "$${mirror}/maven/maven-$${ver%%.*}/$${ver}/source/${@F}"
- touch $@
-upstream/apache-maven-${mvn_ver}: upstream/apache-maven-%: upstream/apache-maven-%-src.tar.gz
- rm -rf $@
- mkdir ${@D}
- cd ${@D} && tar xaf "${top}/$<"
- cd $@ && git init && git add . && git commit -q -m 'tarball of apache maven $*'
-build/maven: upstream/apache-maven-${mvn_ver}
- rm -rf $@
- mkdir -p $@
- lndir -silent "${top}/$<" "${top}/$@"
-####
-
-upstream/apache-svn: conf_apache-svn_map.txt token_network
- if ! [[ -d "$@/.svn" ]]; then \
- mkdir -p ${@D} && \
- svn checkout --depth=empty https://svn.apache.org/repos/asf "$@"; \
- else \
- cd "$@" && svn update; \
- fi
- cd "$@" && \
- while read svnpath buildpath; do \
- svn update --parents "$$svnpath"; \
- done <"${top}/$<"
- touch $@
-
-$(addprefix build/,$(shell awk '{ print $$2 }' < conf_apache-svn_map.txt)): \
-build/%: upstream/apache-svn conf_apache-svn_map.txt
- rm -rf $@
- mkdir -p $@
- lndir -silent "${top}/$</$(shell sed -n 's|\s*\s$(subst .,\.,$*)$$||p' conf_apache-svn_map.txt)" "${top}/$@"
- if [ -d patches/$* ]; then \
- for patch in patches/$*/*; do \
- patch -Np1 -i $$patch $@; \
- done \
- fi
-
-# git wildcard #################################################################
-
-upstream/%-git: conf_git-urls.txt token_network
- gitget checkout $$(grep -v '^#' $< | grep -- $*) $@
- touch $@
-build/%: upstream/%-git
- rm -rf $@
- mkdir -p $@
- lndir -silent "${top}/$<" "${top}/$@"
- if [ -d patches/$* ]; then \
- for patch in patches/$*/*; do \
- patch -Np1 -i $$patch $@ \
- done \
- fi
-################################################################################
+export MAVEN_LOCAL_REPO_INSTALL = $(shell cat conf/maven.local.repo.txt)
+export MAVEN_LOCAL_REPO_SEARCH = $(top)/build/packages/dest/$(MAVEN_LOCAL_REPO_INSTALL)
-$(patsubst makefiles/%.mk,packages/%,$(wildcard makefiles/*.mk)): \
-packages/%: RECURSIVE build/% makefiles/%.mk
- $(MAKE) -C build/$* -f "$(top)/makefiles/$*.mk" install DESTDIR="$(top)/$@"
- mkdir -p packages/dest && lndir -silent "$(top)/$@" packages/dest
+export PATH := $(top)/utils:$(PATH)
-packages/%: RECURSIVE build/% makefiles/mvn-simple.mk
- $(MAKE) -C build/$* -f "$(top)/makefiles/mvn-simple.mk" install DESTDIR="$(top)/$@"
- mkdir -p packages/dest && lndir -silent "$(top)/$@" packages/dest
+all: package
+packages := $(filter-out _%,$(shell sed "s/[\# ].*//" conf/sources.mk))
+include conf/sources.mk
-packages/plexus-containers: packages/plexus-utils packages/plexus-classworlds
+# download #####################################################################
-distclean:
- rm -rf upstream build packatges
- rm -f token_* gen_*
+download: PHONY $(foreach package,$(packages),build/upstream/$(shell utils/spec2file '$($(package))'))
-.PHONY: RECURSIVE
+build/upstream/git/%: .tokens/network
+ if [ -d '$@' ]; then \
+ cd '$@' && git fetch --all -p; \
+ else \
+ mkdir -p '$(@D)' && git clone --mirror "$$(file2url 'git/$*')" '$@'; \
+ fi
+ touch '$@'
+build/upstream/svn/%: .tokens/network
+ if ! [ -d "$$(file2base 'svn/$*')" ]; then \
+ rm -rf '$@' && \
+ mkdir -p build/upstream/svn && \
+ svn checkout --depth=empty \
+ "$$(file2url 'svn/$*')" \
+ build/upstream/"$$(file2base 'svn/$*')" && \
+ cd build/upstream/"$$(file2base 'svn/$*')"; \
+ else \
+ cd build/upstream/"$$(file2base 'svn/$*')" && \
+ svn update; \
+ fi && \
+ svn update --parents "$$(file2extra 'svn/$*')"
+ touch '$@'
+build/upstream/tar/%: .tokens/network
+ mkdir -p '$(@D)'
+ wget -c -O '$@' "$$(file2url tar/$*)"
+ touch '$@'
+
+# extract ######################################################################
+
+extract: PHONY $(foreach package,$(packages),build/extract/$(shell utils/spec2file '$($(package))'))
+
+build/extract/git/%:
+ rm -rf '$@'
+ mkdir -p '$(@D)'
+ { \
+ git clone build/upstream/"$$(file2base 'git/$*')" '$@' && \
+ cd '$@' && git checkout "$$(file2extra 'git/$*')"; \
+ } || rm -rf '$@'
+ touch '$@'
+$(foreach package,$(packages),$(if $(filter git|%,$($(package))),$(eval \
+ build/extract/$(shell utils/spec2file '$($(package))'): \
+ build/upstream/$(shell utils/file2base "$$(utils/spec2file '$($(package))')") \
+)))
+
+build/extract/svn/%: build/upstream/svn/%
+ rm -rf '$@'
+ mkdir -p '$@'
+ lndir -silent '$(top)/$($<)' '$@'
+build/extract/tar/%: build/upstream/tar/%
+ rm -rf '$@'
+ mkdir -p '$(@D)'
+ cd '$(@D)' && tar xaf '$(top)/$<'
+ cd '$@' && git init && git add . && git commit -q -m "extracted $$(file2url 'tar/$*')" # XXX
+
+# place ########################################################################
+
+place: PHONY $(addprefix,build/compile/,$(packages))
+
+compile_patch =$(filter $(patsubst patches/%/,%,$(wildcard,patches/*/)),$(packages))
+compile_direct=$(filter-out $(patsubst patches/%/,%,$(wildcard,patches/*/)),$(packages))
+
+$(addprefix build/compile/,$(compile_patch)): build/compile/%:
+ rm -rf '$@'
+ mkdir -p '$@'
+ lndir -silent '$(top)/$<' '$@'
+ for patch in patches/$*/*; do \
+ patch -Np1 -i $$patch '$@' || { rm -rf '$@'; exit 1; }; \
+ done
+$(addprefix build/compile/,$(compile_direct)): build/compile/%:
+ rm -rf '$@'
+ mkdir -p '$@'
+ lndir -silent '$(top)/$<' '$@'
+$(foreach package,$(packages),$(eval \
+ build/compile/$(package): \
+ build/extract/$(shell utils/spec2file '$($(package))') \
+))
+
+# package ######################################################################
+
+package: PHONY $(addprefix build/packages/,$(packages))
+
+package_specific=$(filter $(patsubst makefiles/%.mk,%,$(wildcard makefiles/*.mk)),$(packages))
+package_generic =$(filter-out $(patsubst makefiles/%.mk,%,$(wildcard makefiles/*.mk)),$(packages))
+
+$(addprefix build/packages/,$(package_specific)): build/packages/%: RECURSIVE build/compile/% makefiles/%.mk
+ $(MAKE) -C build/compile/$* -f "$(top)/makefiles/$*.mk" install DESTDIR="$(top)/$@"
+ mkdir -p build/packages/dest && lndir -silent "$(top)/$@" build/packages/dest
+
+$(addprefix build/packages/,$(package_generic)): build/packages/%: RECURSIVE build/compile/% makefiles/mvn-simple.mk
+ $(MAKE) -C build/compile/$* -f "$(top)/makefiles/mvn-simple.mk" install DESTDIR="$(top)/$@"
+ mkdir -p build/packages/dest && lndir -silent "$(top)/$@" build/packages/dest
+
+# dependencies #################################################################
+
+build/packages/plexus-containers: \
+ build/packages/plexus-utils \
+ build/packages/plexus-classworlds
+
+###############################################################################
+
+clean: PHONY
+ rm -rf .tokens build/compile build/packages
+distclean: PHONY
+ rm -rf .tokens build
+.tokens/%:
+ mkdir -p '$(@D)' && touch '$@'
+
+.PHONY: RECURSIVE PHONY
diff --git a/conf_maven.local.repo.txt b/conf/maven.local.repo.txt
index c0f17b1..c0f17b1 100644
--- a/conf_maven.local.repo.txt
+++ b/conf/maven.local.repo.txt
diff --git a/conf/sources.mk b/conf/sources.mk
new file mode 100644
index 0000000..65baa9d
--- /dev/null
+++ b/conf/sources.mk
@@ -0,0 +1,31 @@
+_apache_svn = https://svn.apache.org/repos/asf
+_apache_mirror = http://archive.apache.org/dist
+
+maven = tar|$(_apache_mirror)/maven/maven-3/3.2.1/source/apache-maven-3.2.1-src.tar.gz
+maven-extras-enforcer = svn|$(_apache_svn)|maven/enforcer/tags/enforcer-1.3
+maven-extras-maven-clean-plugin = svn|$(_apache_svn)|maven/plugins/tags/maven-clean-plugin-2.5
+maven-extras-maven-compiler-plugin = svn|$(_apache_svn)|maven/plugins/tags/maven-compiler-plugin-3.1
+maven-extras-maven-deploy-plugin = svn|$(_apache_svn)|maven/plugins/tags/maven-deploy-plugin-2.8.1
+maven-extras-maven-install-plugin = svn|$(_apache_svn)|maven/plugins/tags/maven-install-plugin-2.5.1
+maven-extras-maven-plugins = svn|$(_apache_svn)|maven/plugins/tags/maven-plugins-24
+maven-extras-maven-remote-resources-plugin = svn|$(_apache_svn)|maven/plugins/tags/maven-remote-resources-plugin-1.5
+maven-extras-maven-resources-plugin = svn|$(_apache_svn)|maven/plugins/tags/maven-resources-plugin-2.6
+maven-extras-maven-site-plugin = svn|$(_apache_svn)|maven/plugins/tags/maven-site-plugin-3.3
+maven-extras-maven-verifier-plugin = svn|$(_apache_svn)|maven/plugins/tags/maven-verifier-plugin-1.0
+maven-extras-plugin-tools = svn|$(_apache_svn)|maven/plugin-tools/tags/maven-plugin-tools-3.2
+maven-extras-pom-asf = svn|$(_apache_svn)|maven/pom/tags/apache-13
+maven-extras-pom-maven = svn|$(_apache_svn)|maven/pom/tags/maven-parent-23
+plexus-archiver = git|git://github.com/sonatype/plexus-archiver.git|plexus-archiver-2.4.3
+plexus-cipher = git|git://github.com/sonatype/plexus-cipher.git|plexus-cipher-1.7
+plexus-classworlds = git|git://github.com/sonatype/plexus-classworlds.git|plexus-classworlds-2.5.1
+plexus-compiler = git|git://github.com/sonatype/plexus-compiler.git|plexus-compiler-2.3
+plexus-containers = git|git://github.com/sonatype/plexus-containers.git|plexus-containers-1.5.5
+plexus-interpolation = git|git://github.com/sonatype/plexus-interpolation.git|plexus-interpolation-1.19
+plexus-io = git|git://github.com/sonatype/plexus-io.git|plexus-io-2.0.9
+plexus-pom = git|git://github.com/sonatype/plexus-pom.git|plexus-3.3.1
+plexus-utils = git|git://github.com/sonatype/plexus-utils.git|plexus-utils-3.0.17
+# We get slf4j from git because the official distribution tarball for 1.7.5 is
+# incomplete.
+slf4j = git|git://github.com/qos-ch/slf4j.git|v_1.7.5
+# yes, I know xbean 3.4 is old
+xbean-reflect = svn|$(_apache_svn)|geronimo/xbean/tags/xbean-3.4/xbean-reflect
diff --git a/conf_apache-maven_mirror.txt b/conf_apache-maven_mirror.txt
deleted file mode 100644
index 7c21d7f..0000000
--- a/conf_apache-maven_mirror.txt
+++ /dev/null
@@ -1 +0,0 @@
-http://archive.apache.org/dist
diff --git a/conf_apache-maven_version.txt b/conf_apache-maven_version.txt
deleted file mode 100644
index e4604e3..0000000
--- a/conf_apache-maven_version.txt
+++ /dev/null
@@ -1 +0,0 @@
-3.2.1
diff --git a/conf_apache-svn_map.txt b/conf_apache-svn_map.txt
deleted file mode 100644
index 32d29eb..0000000
--- a/conf_apache-svn_map.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-maven/enforcer/tags/enforcer-1.3 maven-extras/enforcer
-maven/plugin-tools/tags/maven-plugin-tools-3.2 maven-extras/plugin-tools
-maven/plugins/tags/maven-clean-plugin-2.5 maven-extras/plugins/maven-clean-plugin
-maven/plugins/tags/maven-compiler-plugin-3.1 maven-extras/plugins/maven-compiler-plugin
-maven/plugins/tags/maven-deploy-plugin-2.8.1 maven-extras/plugins/maven-deploy-plugin
-maven/plugins/tags/maven-install-plugin-2.5.1 maven-extras/plugins/maven-install-plugin
-maven/plugins/tags/maven-plugins-24 maven-extras/plugins/maven-plugins
-maven/plugins/tags/maven-remote-resources-plugin-1.5 maven-extras/plugins/maven-remote-resources-plugin
-maven/plugins/tags/maven-resources-plugin-2.6 maven-extras/plugins/maven-resources-plugin
-maven/plugins/tags/maven-site-plugin-3.3 maven-extras/plugins/maven-site-plugin
-maven/plugins/tags/maven-verifier-plugin-1.0 maven-extras/plugins/maven-verifier-plugin
-maven/pom/tags/apache-13 maven-extras/pom/asf
-maven/pom/tags/maven-parent-23 maven-extras/pom/maven
-geronimo/xbean/tags/xbean-3.18 xbean
-geronimo/xbean/tags/xbean-3.18/xbean-reflect xbean-reflect-latest
-geronimo/xbean/tags/xbean-3.4/xbean-reflect xbean-reflect
diff --git a/conf_git-urls.txt b/conf_git-urls.txt
deleted file mode 100644
index 07f6b7c..0000000
--- a/conf_git-urls.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-git://github.com/sonatype/plexus-classworlds.git#tag=plexus-classworlds-2.5.1
-# commonsCli
-# easyMock
-# junit
-git://github.com/sonatype/plexus-containers.git#tag=plexus-containers-1.5.5
-git://github.com/sonatype/plexus-interpolation.git#tag=plexus-interpolation-1.19
-git://github.com/sonatype/plexus-utils.git#tag=plexus-utils-3.0.17
-# guava
-# sisu guice
-# sisuInject
-# wagon
-# securitydispatcher
-git://github.com/sonatype/plexus-cipher.git#tag=plexus-cipher-1.7
-# modello
-# jxpath
-# aether
-git://github.com/qos-ch/slf4j.git#tag=v_1.7.5
-
-git://github.com/sonatype/plexus-compiler.git#tag=plexus-compiler-2.3
-git://github.com/sonatype/plexus-archiver.git#tag=plexus-archiver-2.4.3
-git://github.com/sonatype/plexus-io.git#tag=plexus-io-2.0.9
-git://github.com/sonatype/plexus-pom.git#tag=plexus-3.3.1
diff --git a/makefiles/plexus-containers.mk b/makefiles/plexus-containers.mk
deleted file mode 100644
index 46defda..0000000
--- a/makefiles/plexus-containers.mk
+++ /dev/null
@@ -1,49 +0,0 @@
-DESTDIR ?=
-MAVEN_LOCAL_REPO ?= ~/.m2
-
-export DESTDIR
-export MAVEN_LOCAL_REPO
-
-####
-
-version=$(shell xml sel -T -t -c /_:project/_:version pom.xml)
-artifact=$(shell xml sel -T -t -c /_:project/_:artifactId pom.xml)
-group=org.codehaus.plexus
-
-####
-
-JAVAC_FLAGS = -classpath $(shell find $(maven_dist_top)/packages/dest/$(MAVEN_LOCAL_REPO) -name '*.jar' -printf '%h/%f:'):$(JAVA_HOME)/lib/tools.jar
-dirs = $(wildcard plexus-*)
-
-####
-
-all: PHONY \
- target/$(artifact)-$(version).pom \
- $(addsuffix /all,$(dirs))
-
-target/$(artifact)-$(version).pom: pom.xml
- mkdir -p $@
- sed -r '/<properties>/,/<\/properties>/ { s|<(.*Version)>(.*)</.*Version>|<\1>[\2,)</\1>|; }' < $< > $@
-
-####
-
-install: PHONY \
- $(DESTDIR)$(MAVEN_LOCAL_REPO)/$(subst .,/,$(group))/$(artifact)/$(version)/$(artifact)-$(version).pom \
- $(addsuffix /install,$(dirs))
-
-$(DESTDIR)$(MAVEN_LOCAL_REPO)/$(subst .,/,$(group))/$(artifact)/$(version)/%: target/%
- install -Dm644 $< $@
-
-####
-
-$(addsuffix /%,$(dirs)): PHONY
- $(MAKE) -C $(@D) -f $(maven_dist_top)/makefiles/plexus.mk version=$(version) JAVAC_FLAGS='$(JAVAC_FLAGS)'
-
-####
-
-clean: PHONY
- rm -rf target */target
-
-####
-
-.PHONY: PHONY FORCE
diff --git a/utils/file2base b/utils/file2base
new file mode 100755
index 0000000..17951e0
--- /dev/null
+++ b/utils/file2base
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+
+IFS=/ read -r type url extra <<<"$*"
+case "$type" in
+ git) :;;
+ svn) :;;
+ tar) url=${url}/${extra};;
+esac
+echo "${type}/${url}"
diff --git a/utils/file2extra b/utils/file2extra
new file mode 100755
index 0000000..972e5df
--- /dev/null
+++ b/utils/file2extra
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+
+IFS=/ read -r type url extra <<<"$*"
+case "$type" in
+ git) :;;
+ svn) :;;
+ tar) extra='';;
+esac
+echo "${extra}"
diff --git a/utils/file2url b/utils/file2url
new file mode 100755
index 0000000..868f94f
--- /dev/null
+++ b/utils/file2url
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+
+IFS=/ read -r type url extra <<<"$*"
+case "$type" in
+ git|svn) url=${url//^2F//};;
+ tar) :;;
+esac
+url=${url//^3A/:}
+url=${url//^5E/^}
+echo "${url}"
diff --git a/utils/spec2file b/utils/spec2file
new file mode 100755
index 0000000..3b5e883
--- /dev/null
+++ b/utils/spec2file
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+
+IFS='|' read -r type url extra <<<"$*"
+url=${url//^/^5E}
+url=${url//:/^3A}
+case "$type" in
+ git|svn) url=${url//\//^2F};;
+ tar) :;;
+esac
+echo "${type}/${url}/${extra}"