Bug#281287: java-package: patch to generate packages without some parts

Peter Marschall Peter Marschall <peter@adpm.de>, 281287@bugs.debian.org
Sun Jan 2 14:39:07 2005


This is a multi-part MIME message sent by reportbug.

--===============1035460656==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Package: java-package
Version: 0.17pm1
Followup-For: Bug #281287

Hi,

the attached patch gives a possible solution to let admins choose what
to install into a package generated by make-jpkg.

It adds 4 further optinos to make-jpkg, each one starting with
--without-... .
If these options are given as parts of the commandine of make-jpkg
the corresponding parts of the original Java JRE/JDK will be removed
from the installation directory and thus will not make it into the
generated package.

Using this patch I was able to trim down a Sun JDK 1.5.0+01 package by
over 30 MB installed size and 20 MB deb file size.

In addition to that the patch also fixes the output of the --version
option: the program name and the version number.

Hope it helps
Peter

PS: Please release a new vrsion of java-package with Alex Owen's and my
    patches.


-- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.7-1-k7
Locale: LANG=de_DE@euro, LC_CTYPE=de_DE@euro (charmap=ISO-8859-15)

Versions of packages java-package depends on:
ii  debhelper                     4.2.28     helper programs for debian/rules

-- no debconf information

--===============1035460656==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="java-package-without.patch"

--- lib/j2re.sh	2004-10-12 01:24:31.000000000 +0200
+++ lib/j2re.sh	2005-01-02 15:24:11.000000000 +0100
@@ -42,6 +42,10 @@
     j2se_build
 }
 
+function j2re_without() {
+    j2se_without "$@"
+}
+
 # build debian package
 function j2re_run() {
     echo
@@ -54,6 +58,7 @@
     install -d -m 755 "$( dirname "$target" )"
     extract_bin "$archive_path" "$j2se_expected_min_size" "$target"
     rm -rf "$target/.systemPrefs"
+    j2re_without $target
     j2re_readme > "$debian_dir/README.Debian"
     j2re_changelog > "$debian_dir/changelog"
     j2re_control > "$debian_dir/control"
--- lib/j2sdk.sh	2004-10-12 01:24:31.000000000 +0200
+++ lib/j2sdk.sh	2005-01-02 15:24:30.000000000 +0100
@@ -44,6 +44,10 @@
     j2se_build
 }
 
+function j2sdk_without() {
+    j2se_without "$@"
+}
+
 # build debian package
 function j2sdk_run() {
     echo
@@ -56,6 +60,7 @@
     install -d -m 755 "$( dirname "$target" )"
     extract_bin "$archive_path" "$j2se_expected_min_size" "$target"
     rm -rf "$target/.systemPrefs"
+    j2sdk_without $target
     j2sdk_readme > "$debian_dir/README.Debian"
     j2sdk_changelog > "$debian_dir/changelog"
     j2sdk_control > "$debian_dir/control"
--- lib/j2se.sh	2004-10-12 01:24:31.000000000 +0200
+++ lib/j2se.sh	2005-01-02 15:25:03.000000000 +0100
@@ -115,6 +115,16 @@
 EOF
 }
 
+function j2se_without()
+{
+    local target="$1"
+
+    test $without_sample   &&  rm -rf $target/sample
+    test $without_demo     &&  rm -rf $target/demo
+    test $without_src_zip  &&  rm -rf $target/src.zip
+    test $without_man_ja   &&  rm -rf $target/man/ja*
+}
+
 function j2se_build() {
     cd "$tmp"
     echo "Create debian package:"
--- make-jpkg	2004-10-12 02:14:31.000000000 +0200
+++ make-jpkg	2005-01-02 15:26:20.000000000 +0100
@@ -5,7 +5,7 @@
 ### global variables
 
 # version of this package
-version="0.15"
+version="0.17"
 
 working_dir="$( pwd )"
 program_name="$( basename "$0" )"
@@ -18,6 +18,11 @@
 maintainer_email="$J2SE_PACKAGE_EMAIL"
 genchanges=""
 
+without_demo=""
+without_sample=""
+without_src_zip=""
+without_man_ja=""
+
 
 ### Parse options
 
@@ -31,6 +36,11 @@
   --email EMAIL      email address used in the maintainer field of the package
   --changes          create a .changes file
 
+  --without-demo     exclude demo/ directory (in some JDKs)
+  --without-sample   exclude sample/ directory (in some JDKs)
+  --without-src.zip  exclude src.zip (in some JDKs)
+  --without-man-ja   exclude japanese manpages (in some JDKs/JREs)
+
   --help             display this help and exit
   --version          output version information and exit
 
@@ -56,7 +66,7 @@
 # options
 while [[ $# -gt 0 && "x$1" == x--* ]]; do
     if [[ "x$1" == x--version ]]; then
-	echo "j2se-package $version"
+	echo "$program_name $version"
 	exit 0
     elif [[ "x$1" == x--help ]]; then
 	print_usage
@@ -71,6 +81,14 @@
 	maintainer_email="$1"
     elif [[ "x$1" == x--changes ]]; then
 	genchanges="true"
+    elif [[ "x$1" == x--without-demo ]]; then
+	without_demo="true"
+    elif [[ "x$1" == x--without-sample ]]; then
+	without_sample="true"
+    elif [[ "x$1" == x--without-src.zip ]]; then
+	without_src_zip="true"
+    elif [[ "x$1" == x--without-man-ja ]]; then
+	without_man_ja="true"
     else
 	unrecognized_option "$1"
     fi
--- make-jpkg.1	2004-10-12 01:10:23.000000000 +0200
+++ make-jpkg.1	2005-01-02 15:30:12.000000000 +0100
@@ -38,6 +38,18 @@
 .B --email \fIEMAIL\fR
 email address used in the maintainer field of the package
 .TP
+.B --without-demo
+do not include the demo/ directory (in some JDKs) into the package
+.TP
+.B --without-sample
+do not include the sample/ directory (in some JDKs) into the package
+.TP
+.B --without-src.zip
+do not include the src.zip file (in some JDKs) into the package
+.TP
+.B --without-man-ja
+do not include the japanese manual pages (in some JDKs/JREs) into the package
+.TP
 .B --changes
 create a .changes file
 .TP

--===============1035460656==--