[jpackage-utils] Update to current guidelines.

Alexander Kurtakov akurtakov at fedoraproject.org
Fri Apr 15 13:02:35 UTC 2011


commit 60d4b1a0b689d496c0673ff4eab566b4ed00f4d0
Author: Alexander Kurtakov <akurtako at redhat.com>
Date:   Fri Apr 15 16:02:03 2011 +0300

    Update to current guidelines.
    
    - Drop patch enabling gcj_support macro by default.
    - Don't install ${_javadir}-{1.3.1,1.4.0,1.4.1,1.4.2} and
    ${_jnidir}-{1.3.1,1.4.0,1.4.1,1.4.2}.
    - Add mvn(groupId:artifactId) provides generator.

 jpackage-utils-enable-gcj-support.patch |   14 --------
 jpackage-utils.spec                     |   34 +++++++++++---------
 maven.attr                              |    3 ++
 maven.prov                              |   51 +++++++++++++++++++++++++++++++
 4 files changed, 73 insertions(+), 29 deletions(-)
---
diff --git a/jpackage-utils.spec b/jpackage-utils.spec
index 8a0e20a..08b0910 100644
--- a/jpackage-utils.spec
+++ b/jpackage-utils.spec
@@ -27,14 +27,14 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
-%define gcj_support 1
+%global gcj_support 1
 
-%define distver 1.7
-%define section free
+%global distver 1.7
+%global section free
 
 Name:           jpackage-utils
 Version:        1.7.5
-Release:        4.11%{?dist}
+Release:        4.12%{?dist}
 Epoch:          0
 Summary:        JPackage utilities
 License:        BSD
@@ -43,12 +43,12 @@ Source0:        %{name}-%{version}.tar.bz2
 Source1:        %{name}-README
 Source2:        abs2rel.sh
 Source3:        abs2rel.lua
-Patch0:         %{name}-enable-gcj-support.patch
+Source4:        maven.prov
+Source5:        maven.attr
 Patch1:         %{name}-own-mavendirs.patch
 Patch2:         %{name}-prefer-jre.patch
 Patch3:         %{name}-set-classpath.patch
 Group:          Utilities
-BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-buildroot
 
 BuildArch:      noarch
 
@@ -64,7 +64,6 @@ information.
 
 %prep
 %setup -q
-%patch0 -p0
 %patch1 -p1
 %patch2 -p1
 %patch3 -p1
@@ -77,8 +76,6 @@ echo "JPackage release %{distver} (%{distribution}) for %{buildarch}" \
 
 
 %install
-rm -rf $RPM_BUILD_ROOT
-
 # Pull macros out of macros.jpackage and emulate them during install for
 # smooth bootstrapping experience.
 for dir in \
@@ -109,11 +106,9 @@ install -dm 755 ${RPM_BUILD_ROOT}${_jvmcommonsysconfdir}
 install -dm 755 ${RPM_BUILD_ROOT}${_javadir}
 install -dm 755 ${RPM_BUILD_ROOT}${_javadir}-utils
 install -dm 755 ${RPM_BUILD_ROOT}${_javadir}-ext
-install -dm 755 ${RPM_BUILD_ROOT}${_javadir}-{1.3.1,1.4.0,1.4.1,1.4.2}
 install -dm 755 ${RPM_BUILD_ROOT}${_javadir}-{1.5.0,1.6.0,1.7.0}
 install -dm 755 ${RPM_BUILD_ROOT}${_jnidir}
 install -dm 755 ${RPM_BUILD_ROOT}${_jnidir}-ext
-install -dm 755 ${RPM_BUILD_ROOT}${_jnidir}-{1.3.1,1.4.0,1.4.1,1.4.2}
 install -dm 755 ${RPM_BUILD_ROOT}${_jnidir}-{1.5.0,1.6.0,1.7.0}
 install -dm 755 ${RPM_BUILD_ROOT}${_javadocdir}
 install -dm 755 ${RPM_BUILD_ROOT}${_mavenpomdir}
@@ -170,6 +165,11 @@ install -pm 644 man/* ${RPM_BUILD_ROOT}%{_mandir}/man1
 %{__mkdir_p} ${RPM_BUILD_ROOT}${_javadir}-utils/xml
 install -pm 644 xml/* ${RPM_BUILD_ROOT}${_javadir}-utils/xml
 
+# Add the provides script
+install -m0755 -D %{SOURCE4} $RPM_BUILD_ROOT%{_rpmconfigdir}/maven.prov
+# Add the maven poms file attribute entry (rpm >= 4.9.0)
+install -m0644 -D %{SOURCE5} $RPM_BUILD_ROOT%{_rpmconfigdir}/fileattrs/maven.attr
+
 cat <<EOF > %{name}-%{version}.files
 %{_bindir}/*
 %{_mandir}/man1/*
@@ -196,6 +196,8 @@ cat <<EOF > %{name}-%{version}.files
 %dir ${_mavendepmapdir}
 %dir ${_mavendepmapfragdir}
 ${_javadir}-utils/*
+%{_rpmconfigdir}/maven.prov
+%{_rpmconfigdir}/fileattrs/maven.attr
 %config %{_sysconfdir}/java/jpackage-release
 %config(noreplace) %{_sysconfdir}/java/java.conf
 %config(noreplace) %{_sysconfdir}/java/font.properties
@@ -203,16 +205,18 @@ ${_javadir}-utils/*
 %config(noreplace) ${_mavendepmapdir}/maven2-depmap.xml
 EOF
 
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
 %files -f %{name}-%{version}.files
 %defattr(-,root,root,-)
 %doc %{name}-README LICENSE.txt HEADER.JPP doc/* etc/httpd-javadoc.conf
 
 
 %changelog
+* Fri Apr 15 2011 Alexander Kurtakov <akurtako at redhat.com> 0:1.7.5-4.12
+- Update to current guidelines.
+- Drop patch enabling gcj_support macro by default.
+- Don't install ${_javadir}-{1.3.1,1.4.0,1.4.1,1.4.2} and ${_jnidir}-{1.3.1,1.4.0,1.4.1,1.4.2}. 
+- Add mvn(groupId:artifactId) provides generator.
+
 * Wed Feb 09 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0:1.7.5-4.11
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
 
diff --git a/maven.attr b/maven.attr
new file mode 100644
index 0000000..9964c69
--- /dev/null
+++ b/maven.attr
@@ -0,0 +1,3 @@
+%__maven_provides	%{_rpmconfigdir}/maven.prov
+%__maven_path	^%{_datadir}/maven2/.*\.pom
+
diff --git a/maven.prov b/maven.prov
new file mode 100644
index 0000000..85c4d47
--- /dev/null
+++ b/maven.prov
@@ -0,0 +1,51 @@
+#!/usr/bin/python
+
+## Copyright (C) 2011 Red Hat, Inc.
+## Author: Aleksandar Kurtakov <akurtako at redhat.com>
+
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+import sys
+import xml.etree.ElementTree as ET
+
+class TagBuilder:
+    mavenns = "{http://maven.apache.org/POM/4.0.0}"
+    
+    def __init__ (self, filelist=None):
+        if filelist == None:
+            filelist = sys.stdin
+        paths = map (lambda x: x.rstrip (), filelist.readlines ())
+        for path in paths:
+	        self.get_mvn_provide (path)
+	  
+    def get_mvn_provide (self, path):
+        doc = ET.parse(path)
+        artifactId = doc.getroot().findtext("%sartifactId"%(self.mavenns))
+        if artifactId is None:
+            artifactId = doc.getroot().findtext("artifactId")
+        if artifactId is None:
+            return
+        groupId = doc.getroot().findtext("%sgroupId"%(self.mavenns))
+        if groupId is None:
+            groupId = doc.getroot().findtext("groupId")
+        if groupId is None:
+            groupId = doc.getroot().findtext("%sparent/%sgroupId"%(self.mavenns, self.mavenns))
+        if groupId is None:
+            groupId = doc.getroot().findtext("parent/groupId")
+        if groupId is not None:
+            print "mvn(%s:%s)" %(groupId, artifactId)
+
+if __name__ == "__main__":
+    builder = TagBuilder ()


More information about the scm-commits mailing list