Use dpkg-buildpackage to build the guest package.
authorBenjamin Drung <benjamin.drung@profitbricks.com>
Thu, 8 May 2014 11:21:23 +0000 (13:21 +0200)
committerBenjamin Drung <benjamin.drung@profitbricks.com>
Thu, 8 May 2014 11:21:23 +0000 (13:21 +0200)
debian/control
lib/javase.sh
lib/jdk-doc.sh
lib/jdk.sh
lib/jre.sh
make-jpkg

index 753f37b..db98df0 100644 (file)
@@ -10,9 +10,9 @@ Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-java/java-package.git
 
 Package: java-package
 Architecture: all
-Depends: ${misc:Depends}, debhelper (>= 9), fakeroot, unzip, libx11-6, libasound2,
+Depends: ${misc:Depends}, debhelper (>= 9), dpkg-dev, fakeroot, unzip, libx11-6, libasound2,
  lsb-release
-Recommends: dpkg-dev, gcc
+Recommends: gcc
 Suggests: openjdk-7-jre
 Description: Utility for creating Java Debian packages
  This package provides the capability to build a Debian package from
index 10f2f5e..4285bd5 100644 (file)
@@ -46,12 +46,12 @@ subdirectories.
 ----------------------------------------------------------------------
 EOF
     (
-    cd "$install_dir"
-    find * -type f -iname copyright |
+    cd "$package_dir"
+    find * -type f -iname copyright ! -path debian/copyright |
     while read file; do
         cat << EOF
 
-File: /$file
+File: $jvm_base$file
 
 ----------------------------------------------------------------------
 
@@ -71,6 +71,12 @@ j2se_rules() {
 
 %:
        dh \$@
+
+override_dh_compress:
+       dh_compress \$(shell find $j2se_name/man/ -type f ! -name '*.gz' -printf '${jvm_base##/}/%p\n')
+
+override_dh_shlibdeps:
+       dh_shlibdeps --exclude=fxavcodecplugin -l\$(shell find $j2se_name -type f -name '*.so*' -printf '${jvm_base##/}/%h\n' | sort -u | tr '\n' ':' | sed 's/:\$\$//')
 EOF
 }
 
@@ -193,57 +199,17 @@ jinfos() {
 }
 
 j2se_build() {
-    cd "$tmp"
+    cd "$package_dir"
     echo "Create debian package:"
 
-    #export DH_VERBOSE=1
-    export DH_OPTIONS=--tmpdir="$install_dir"
-
-    echo "    dh_testdir"
-    dh_testdir
-    echo "    dh_testroot"
-    dh_testroot
-    echo "    dh_installchangelogs"
-    dh_installchangelogs
-    # Problem: dh_installchangelogs thinks this is a native package.
-    echo "    dh_installdocs"
-    dh_installdocs
-    # dh_install
-    # dh_link
-    # Conditionally wrapping this as not all JRE/JDKs have man directories
-    if [ -e "$install_dir/$jvm_base$j2se_name/man" ]; then
-        echo "    dh_compress"
-        dh_compress $( find "$install_dir/$jvm_base$j2se_name/man" -type f ! -name "*.gz" )
-    fi
-    echo "    dh_fixperms"
-    dh_fixperms
-    echo "    dh_installdeb"
-    dh_installdeb
-    echo "    dh_shlibdeps"
-    ldpath=
-    for dir in $( find "$install_dir" -type f -name "*.so*" -printf "%h\n" | sort -u ); do
-        if [[ -z "$ldpath" ]]; then
-            ldpath="$dir"
-        else
-            ldpath="$ldpath:$dir"
-        fi
-    done
-    # suppress some warnings
-    dh_shlibdeps --exclude=fxavcodecplugin -l"$ldpath" 2>&1 |
-    { grep -v "warning: format of \`NEEDED lib.*\.so' not recognized" >&2 || true; }
-    echo "    dh_gencontrol"
-    dh_gencontrol
-    echo "    dh_md5sums"
-    dh_md5sums
-    echo "    dh_builddeb"
-    dh_builddeb --destdir="$tmp"
+    dpkg-buildpackage -b -uc -us
+    cd "$tmp"
     local deb_filename="$( echo "${j2se_package}_"*.deb )"
     echo "    copy $deb_filename into directory $working_dir/"
     cp "$deb_filename" "$working_dir/"
     if [ -n "$genchanges" ]; then
         echo "    dpkg-genchanges"
         local changes_filename="${deb_filename%.deb}.changes"
-        dpkg-genchanges -b -u. > "$changes_filename"
         echo "    copy $changes_filename into directory $working_dir/"
         cp "$changes_filename" "$working_dir/"
     fi
index d9efde7..4dbfa04 100644 (file)
@@ -40,7 +40,7 @@ j2sdk_doc_run() {
     read_maintainer_info
     j2se_package="$j2se_vendor-java$j2se_release-doc"
     j2se_name="jdk$j2se_release-$j2se_vendor-doc"
-    local target="$install_dir$javadoc_base$j2se_name"
+    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"
@@ -49,6 +49,7 @@ j2sdk_doc_run() {
     j2se_changelog > "$debian_dir/changelog"
     j2sdk_doc_control > "$debian_dir/control"
     j2se_copyright > "$debian_dir/copyright"
+    echo "$j2se_name $javadoc_base" > "$debian_dir/install"
     j2sdk_doc_doc-base > "$debian_dir/$j2se_package.doc-base"
     j2se_rules > "$debian_dir/rules"
     chmod +x "$debian_dir/rules"
index 9205fab..55802e6 100644 (file)
@@ -40,7 +40,7 @@ j2sdk_run() {
     read_maintainer_info
     j2se_package="$j2se_vendor-java$j2se_release-jdk"
     j2se_name="jdk-$j2se_release-$j2se_vendor-$j2se_arch"
-    local target="$install_dir$jvm_base$j2se_name"
+    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"
@@ -49,11 +49,13 @@ j2sdk_run() {
     j2se_changelog > "$debian_dir/changelog"
     j2sdk_control > "$debian_dir/control"
     j2se_copyright > "$debian_dir/copyright"
+    echo "$j2se_name $jvm_base" > "$debian_dir/install"
     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" > "$install_dir$jvm_base.$j2se_name.jinfo"
+    eval "$j2se_jinfo" > "$package_dir/.$j2se_name.jinfo"
+    echo ".$j2se_name.jinfo $jvm_base" >> "$debian_dir/install"
     j2se_build
 }
index 5231e38..9d12cb6 100644 (file)
@@ -26,7 +26,7 @@ j2re_run() {
     read_maintainer_info
     j2se_package="$j2se_vendor-java$j2se_release-jre"
     j2se_name="jre-$j2se_release-$j2se_vendor-$j2se_arch"
-    local target="$install_dir$jvm_base$j2se_name"
+    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"
@@ -35,11 +35,13 @@ j2re_run() {
     j2se_changelog > "$debian_dir/changelog"
     j2re_control > "$debian_dir/control"
     j2se_copyright > "$debian_dir/copyright"
+    echo "$j2se_name $jvm_base" > "$debian_dir/install"
     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" > "$install_dir$jvm_base.$j2se_name.jinfo"
+    eval "$j2se_jinfo" > "$package_dir/.$j2se_name.jinfo"
+    echo ".$j2se_name.jinfo $jvm_base" >> "$debian_dir/install"
     j2se_build
 }
index 758bcf8..9eb0fab 100755 (executable)
--- a/make-jpkg
+++ b/make-jpkg
@@ -200,11 +200,11 @@ echo -n "Creating temporary directory: "
 tmp="$( mktemp -d -t "$program_name.XXXXXXXXXX" )"
 echo "$tmp"
 
-debian_dir="$tmp/debian"
-install -d -m 755 "$debian_dir"
+package_dir="$tmp/package"
+install -d -m 755 "$package_dir"
 
-install_dir="$tmp/install"
-install -d -m 755 "$install_dir"
+debian_dir="$package_dir/debian"
+install -d -m 755 "$debian_dir"
 
 # load and execute plugins
 echo -n "Loading plugins:"