]> git.sven.stormbind.net Git - sven/java-package.git/commitdiff
Refactor Debian package build code
authorBenjamin Drung <benjamin.drung@profitbricks.com>
Thu, 17 Mar 2016 16:02:35 +0000 (17:02 +0100)
committerBenjamin Drung <benjamin.drung@profitbricks.com>
Thu, 17 Mar 2016 16:41:56 +0000 (17:41 +0100)
j2sdk_run() and j2re_run() are quite similar. Thus merge them to
j2se_run() and move the remaining function from {jdk,jre}.sh to
oracle-{jdk,jre}.sh.

lib/javase.sh
lib/jdk.sh [deleted file]
lib/jre.sh [deleted file]
lib/oracle-jdk.sh
lib/oracle-jre.sh

index 6bde5ec5c82aef279bf0d37897925e4b6ab33781..37a9254f1776ba2b6748e91aefa123f25c63e3b6 100644 (file)
@@ -263,3 +263,29 @@ You can install the package as root with:
 EOF
     fi
 }
+
+# build debian package
+j2se_run() {
+    echo
+    diskfree "$j2se_required_space"
+    read_maintainer_info
+    j2se_name="jre-$j2se_release-$j2se_vendor-$j2se_arch"
+    local target="$package_dir/$j2se_name"
+    install -d -m 755 "$( dirname "$target" )"
+    extract_bin "$archive_path" "$j2se_expected_min_size" "$target"
+    rm -rf "$target/.systemPrefs"
+    echo "9" > "$debian_dir/compat"
+    j2se_readme > "$debian_dir/README.Debian"
+    j2se_changelog > "$debian_dir/changelog"
+    eval "$j2se_control" > "$debian_dir/control"
+    j2se_copyright > "$debian_dir/copyright"
+    j2se_rules > "$debian_dir/rules"
+    chmod +x "$debian_dir/rules"
+    j2se_install_scripts
+    install -d "$target/debian"
+    j2se_info > "$target/debian/info"
+    eval "$j2se_jinfo" > "$package_dir/.$j2se_name.jinfo"
+    echo ".$j2se_name.jinfo $jvm_base" > "$debian_dir/install"
+    echo "$j2se_name $jvm_base" >> "$debian_dir/install"
+    j2se_build
+}
diff --git a/lib/jdk.sh b/lib/jdk.sh
deleted file mode 100644 (file)
index 46dec6f..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-
-j2sdk_control() {
-    build_depends="libasound2, libgl1-mesa-glx, libgtk2.0-0, libxslt1.1, libxtst6, libxxf86vm1"
-    j2se_control
-    java_browser_plugin="java-browser-plugin, "
-    depends="\${shlibs:Depends}"
-    if [ "${DEB_BUILD_ARCH:0:3}" = "arm" -a "${j2se_arch}" != "arm-vfp-hflt" ]; then
-        # ARM is only softfloat ATM so if building on armhf
-        # force the dependencies to pickup cross platform fu
-        if [ "${DEB_BUILD_ARCH}" == "armhf" ]; then
-            depends="libc6-armel, libsfgcc1, libsfstdc++6"
-        fi
-        # No browser on ARM yet
-        java_browser_plugin=""
-    fi
-    if [ "$create_cert_softlinks" == "true" ]; then
-        depends="$depends, ca-certificates-java"
-    fi
-    for i in `seq 5 ${j2se_release}`;
-    do
-        provides_runtime="${provides_runtime} java${i}-runtime,"
-        provides_headless="${provides_headless} java${i}-runtime-headless,"
-        provides_sdk="${provides_sdk} java${i}-sdk,"
-    done
-    cat << EOF
-Package: $j2se_package
-Architecture: any
-Depends: \${misc:Depends}, $depends
-Recommends: netbase
-Provides: java-virtual-machine, java-runtime, java2-runtime, $provides_runtime $java_browser_plugin java-compiler, java2-compiler, java-runtime-headless, java2-runtime-headless, $provides_headless java-sdk, java2-sdk, $provides_sdk
-Description: $j2se_title
- The Java(TM) SE JDK is a development environment for building
- applications, applets, and components that can be deployed on the
- Java(TM) platform.
- .
- The Java(TM) SE JDK software includes tools useful for developing and
- testing programs written in the Java programming language and running
- on the Java platform. These tools are designed to be used from the
- command line. Except for appletviewer, these tools do not provide a
- graphical user interface.
- .
- This package has been automatically created with java-package ($version).
-EOF
-}
-
-# build debian package
-j2sdk_run() {
-    echo
-    diskfree "$j2se_required_space"
-    read_maintainer_info
-    j2se_package="$j2se_vendor-java$j2se_release-jdk"
-    j2se_name="jdk-$j2se_release-$j2se_vendor-$j2se_arch"
-    local target="$package_dir/$j2se_name"
-    install -d -m 755 "$( dirname "$target" )"
-    extract_bin "$archive_path" "$j2se_expected_min_size" "$target"
-    rm -rf "$target/.systemPrefs"
-    echo "9" > "$debian_dir/compat"
-    j2se_readme > "$debian_dir/README.Debian"
-    j2se_changelog > "$debian_dir/changelog"
-    j2sdk_control > "$debian_dir/control"
-    j2se_copyright > "$debian_dir/copyright"
-    j2se_rules > "$debian_dir/rules"
-    chmod +x "$debian_dir/rules"
-    j2se_install_scripts
-    install -d "$target/debian"
-    j2se_info > "$target/debian/info"
-    eval "$j2se_jinfo" > "$package_dir/.$j2se_name.jinfo"
-    echo ".$j2se_name.jinfo $jvm_base" > "$debian_dir/install"
-    echo "$j2se_name $jvm_base" >> "$debian_dir/install"
-    j2se_build
-}
diff --git a/lib/jre.sh b/lib/jre.sh
deleted file mode 100644 (file)
index 7b339d8..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-
-j2re_control() {
-    j2se_control
-    if [ "$create_cert_softlinks" == "true" ]; then
-        depends="ca-certificates-java"
-    fi
-    for i in `seq 5 ${j2se_release}`;
-    do
-        provides_runtime="${provides_runtime} java${i}-runtime,"
-        provides_headless="${provides_headless} java${i}-runtime-headless,"
-    done
-    cat << EOF
-Package: $j2se_package
-Architecture: any
-Depends: \${misc:Depends}, \${shlibs:Depends}, $depends
-Recommends: netbase
-Provides: java-virtual-machine, java-runtime, java2-runtime, $provides_runtime java-runtime-headless, java2-runtime-headless, $provides_headless java-browser-plugin
-Description: $j2se_title
- The Java(TM) SE Runtime Environment contains the Java virtual machine,
- runtime class libraries, and Java application launcher that are
- necessary to run programs written in the Java programming language.
- It is not a development environment and does not contain development
- tools such as compilers or debuggers.  For development tools, see the
- Java SE Development Kit (JDK).
- .
- This package has been automatically created with java-package ($version).
-EOF
-}
-
-# build debian package
-j2re_run() {
-    echo
-    diskfree "$j2se_required_space"
-    read_maintainer_info
-    j2se_package="$j2se_vendor-java$j2se_release-jre"
-    j2se_name="jre-$j2se_release-$j2se_vendor-$j2se_arch"
-    local target="$package_dir/$j2se_name"
-    install -d -m 755 "$( dirname "$target" )"
-    extract_bin "$archive_path" "$j2se_expected_min_size" "$target"
-    rm -rf "$target/.systemPrefs"
-    echo "9" > "$debian_dir/compat"
-    j2se_readme > "$debian_dir/README.Debian"
-    j2se_changelog > "$debian_dir/changelog"
-    j2re_control > "$debian_dir/control"
-    j2se_copyright > "$debian_dir/copyright"
-    j2se_rules > "$debian_dir/rules"
-    chmod +x "$debian_dir/rules"
-    j2se_install_scripts
-    install -d "$target/debian"
-    j2se_info > "$target/debian/info"
-    eval "$j2se_jinfo" > "$package_dir/.$j2se_name.jinfo"
-    echo ".$j2se_name.jinfo $jvm_base" > "$debian_dir/install"
-    echo "$j2se_name $jvm_base" >> "$debian_dir/install"
-    j2se_build
-}
index a6a894a5138cc4ace71af23262ef0f05a980c3e5..ebc0efd8df32757c50beb4a1efddbfd435646e99 100644 (file)
@@ -92,6 +92,7 @@ EOF
       j2se_install=oracle_j2sdk_install
       j2se_remove=oracle_j2sdk_remove
       j2se_jinfo=oracle_j2sdk_jinfo
+      j2se_control=oracle_j2sdk_control
       if [ "${DEB_BUILD_ARCH:0:3}" = "arm" ]; then
         # javaws is not available for ARM
         oracle_jre_bin_hl="java keytool orbd pack200 rmid rmiregistry servertool tnameserv unpack200 policytool"
@@ -105,7 +106,8 @@ EOF
       fi
       oracle_jre_lib_hl="jexec"
       oracle_bin_jdk="appletviewer extcheck idlj jar jarsigner javac javadoc javah javap jcmd jconsole jdb jdeps jhat jinfo jmap jmc jps jrunscript jsadebugd jstack jstat jstatd jvisualvm native2ascii rmic schemagen serialver wsgen wsimport xjc"
-      j2sdk_run
+      j2se_package="$j2se_vendor-java$j2se_release-jdk"
+      j2se_run
     fi
   fi
 }
@@ -177,3 +179,47 @@ EOF
         done
     fi
 }
+
+oracle_j2sdk_control() {
+    build_depends="libasound2, libgl1-mesa-glx, libgtk2.0-0, libxslt1.1, libxtst6, libxxf86vm1"
+    j2se_control
+    java_browser_plugin="java-browser-plugin, "
+    depends="\${shlibs:Depends}"
+    if [ "${DEB_BUILD_ARCH:0:3}" = "arm" -a "${j2se_arch}" != "arm-vfp-hflt" ]; then
+        # ARM is only softfloat ATM so if building on armhf
+        # force the dependencies to pickup cross platform fu
+        if [ "${DEB_BUILD_ARCH}" == "armhf" ]; then
+            depends="libc6-armel, libsfgcc1, libsfstdc++6"
+        fi
+        # No browser on ARM yet
+        java_browser_plugin=""
+    fi
+    if [ "$create_cert_softlinks" == "true" ]; then
+        depends="$depends, ca-certificates-java"
+    fi
+    for i in `seq 5 ${j2se_release}`;
+    do
+        provides_runtime="${provides_runtime} java${i}-runtime,"
+        provides_headless="${provides_headless} java${i}-runtime-headless,"
+        provides_sdk="${provides_sdk} java${i}-sdk,"
+    done
+    cat << EOF
+Package: $j2se_package
+Architecture: any
+Depends: \${misc:Depends}, $depends
+Recommends: netbase
+Provides: java-virtual-machine, java-runtime, java2-runtime, $provides_runtime $java_browser_plugin java-compiler, java2-compiler, java-runtime-headless, java2-runtime-headless, $provides_headless java-sdk, java2-sdk, $provides_sdk
+Description: $j2se_title
+ The Java(TM) SE JDK is a development environment for building
+ applications, applets, and components that can be deployed on the
+ Java(TM) platform.
+ .
+ The Java(TM) SE JDK software includes tools useful for developing and
+ testing programs written in the Java programming language and running
+ on the Java platform. These tools are designed to be used from the
+ command line. Except for appletviewer, these tools do not provide a
+ graphical user interface.
+ .
+ This package has been automatically created with java-package ($version).
+EOF
+}
index d69de39dc57c023b94c527eae6078a8e8f3bbf85..a555182b9f8dc6f3c9da2e25f01594498ed69f3d 100644 (file)
@@ -76,11 +76,13 @@ EOF
       j2se_install=oracle_j2re_install
       j2se_remove=oracle_j2re_remove
       j2se_jinfo=oracle_j2re_jinfo
+      j2se_control=oracle_j2re_control
       oracle_jre_bin_hl="java javaws keytool orbd pack200 rmid rmiregistry servertool tnameserv unpack200 policytool"
       oracle_jre_bin_jre="javaws policytool"
       oracle_no_man_jre_bin_jre="ControlPanel jcontrol"
       oracle_jre_lib_hl="jexec"
-      j2re_run
+      j2se_package="$j2se_vendor-java$j2se_release-jre"
+      j2se_run
     fi
   fi
 }
@@ -136,3 +138,30 @@ EOF
     done
 }
 
+oracle_j2re_control() {
+    j2se_control
+    if [ "$create_cert_softlinks" == "true" ]; then
+        depends="ca-certificates-java"
+    fi
+    for i in `seq 5 ${j2se_release}`;
+    do
+        provides_runtime="${provides_runtime} java${i}-runtime,"
+        provides_headless="${provides_headless} java${i}-runtime-headless,"
+    done
+    cat << EOF
+Package: $j2se_package
+Architecture: any
+Depends: \${misc:Depends}, \${shlibs:Depends}, $depends
+Recommends: netbase
+Provides: java-virtual-machine, java-runtime, java2-runtime, $provides_runtime java-runtime-headless, java2-runtime-headless, $provides_headless java-browser-plugin
+Description: $j2se_title
+ The Java(TM) SE Runtime Environment contains the Java virtual machine,
+ runtime class libraries, and Java application launcher that are
+ necessary to run programs written in the Java programming language.
+ It is not a development environment and does not contain development
+ tools such as compilers or debuggers.  For development tools, see the
+ Java SE Development Kit (JDK).
+ .
+ This package has been automatically created with java-package ($version).
+EOF
+}