Fix printing services. When CUPS is used, ${LOCALBASE}/bin/lpr must be used

to print a generated PostScript file.  When lpd(8) is used, lpr(1) from base
must be used.  Also, status command for lpc(8) requires a printer name.  If
no argument is specified, i.e., "/usr/sbin/lpc status", then it displays the
command usage, i.e., "usage: status  {all | printer ...}".  Unfortunately,
"usage" is interpreted as a printer name because ":" is included.  Add "all"
and adjust an expression for grep(1).
This commit is contained in:
Jung-uk Kim 2014-05-21 20:06:16 +00:00
parent d7cffff692
commit 0702846b6c
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=354762
4 changed files with 70 additions and 8 deletions

View file

@ -1,6 +1,6 @@
# $FreeBSD$
PORTREVISION= 2
PORTREVISION= 3
PKGNAMESUFFIX= ${JDK_MAJOR_VERSION}-jre
COMMENT= Java Runtime Environment ${JDK_MAJOR_VERSION}

View file

@ -2,7 +2,7 @@
PORTNAME= openjdk
PORTVERSION= ${JDK_MAJOR_VERSION}.${JDK_UPDATE_VERSION}.${JDK_BUILD_NUMBER:S/^0//}
PORTREVISION?= 6
PORTREVISION?= 7
CATEGORIES= java devel
MASTER_SITES= http://download.java.net/openjdk/jdk${JDK_MAJOR_VERSION}/promoted/b${JDK_BUILD_NUMBER}/:jdk \
https://adopt-openjdk.ci.cloudbees.com/job/jtreg/${JTREG_JENKINS_BUILD}/artifact/:jtreg \
@ -195,6 +195,7 @@ post-patch:
${WRKSRC}/common/autoconf/toolchain.m4 \
${WRKSRC}/configure \
${WRKSRC}/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java \
${WRKSRC}/jdk/src/share/classes/sun/print/PSPrinterJob.java \
${WRKSRC}/jdk/src/solaris/classes/sun/nio/fs/BsdFileSystemProvider.java
@${REINPLACE_CMD} -e 's|/usr/local/java/classes|${LOCALBASE}/share/java/classes|' \
${WRKSRC}/jdk/src/bsd/doc/man/*.1

View file

@ -8328,7 +8328,19 @@
/*
* Prevent recursions. Since LD_LIBRARY_PATH is the one which will be set by
@@ -928,9 +934,13 @@
@@ -900,8 +906,9 @@
* onwards the filename returned in DL_info structure from dladdr is
* an absolute pathname so technically realpath isn't required.
* On Linux we read the executable name from /proc/self/exe.
- * As a fallback, and for platforms other than Solaris and Linux,
- * we use FindExecName to compute the executable name.
+ * On FreeBSD we read the executable name from /proc/curproc/file.
+ * As a fallback, and for platforms other than Solaris, Linux, and
+ * FreeBSD, we use FindExecName to compute the executable name.
*/
const char*
SetExecname(char **argv)
@@ -928,9 +935,13 @@
}
}
}
@ -8343,7 +8355,7 @@
char buf[PATH_MAX+1];
int len = readlink(self, buf, PATH_MAX);
if (len >= 0) {
@@ -938,7 +948,7 @@
@@ -938,7 +949,7 @@
exec_path = JLI_StringDup(buf);
}
}
@ -8352,7 +8364,7 @@
{
/* Not implemented */
}
@@ -1000,7 +1010,7 @@
@@ -1000,7 +1011,7 @@
int
ContinueInNewThread0(int (JNICALL *continuation)(void *), jlong stack_size, void * args) {
int rslt;
@ -8361,7 +8373,7 @@
pthread_t tid;
pthread_attr_t attr;
pthread_attr_init(&attr);
@@ -1025,7 +1035,7 @@
@@ -1025,7 +1036,7 @@
}
pthread_attr_destroy(&attr);
@ -8370,7 +8382,7 @@
thread_t tid;
long flags = 0;
if (thr_create(NULL, stack_size, (void *(*)(void *))continuation, args, flags, &tid) == 0) {
@@ -1036,7 +1046,7 @@
@@ -1036,7 +1047,7 @@
/* See above. Continue in current thread if thr_create() failed */
rslt = continuation(args);
}
@ -8379,7 +8391,7 @@
return rslt;
}
@@ -1044,13 +1054,13 @@
@@ -1044,13 +1055,13 @@
#define MAX_PID_STR_SZ 20
void SetJavaLauncherPlatformProps() {
@ -8571,6 +8583,21 @@
osname.contains("OS X"));
}
@@ -140,12 +141,12 @@
static int cmdIndex = UNINITIALIZED;
String[] lpcFirstCom = {
- "/usr/sbin/lpc status | grep : | sed -ne '1,1 s/://p'",
+ "/usr/sbin/lpc status all | grep ':$' | sed -ne '1,1 s/://p'",
"/usr/sbin/lpc status | grep -E '^[ 0-9a-zA-Z_-]*@' | awk -F'@' '{print $1}'"
};
String[] lpcAllCom = {
- "/usr/sbin/lpc status all | grep : | sed -e 's/://'",
+ "/usr/sbin/lpc status all | grep ':$' | sed -e 's/://'",
"/usr/sbin/lpc status all | grep -E '^[ 0-9a-zA-Z_-]*@' | awk -F'@' '{print $1}' | sort"
};
--- jdk/src/solaris/classes/sun/tools/attach/BsdVirtualMachine.java
+++ jdk/src/solaris/classes/sun/tools/attach/BsdVirtualMachine.java
@@ -266,7 +266,7 @@

View file

@ -0,0 +1,34 @@
--- jdk/src/share/classes/sun/print/PSPrinterJob.java
+++ jdk/src/share/classes/sun/print/PSPrinterJob.java
@@ -1588,8 +1588,30 @@
String osname = System.getProperty("os.name");
if (osname.equals("Linux") || osname.endsWith("BSD") || osname.contains("OS X")) {
+ String lprPath = "/usr/bin/lpr";
+ if (osname.endsWith("BSD")) {
+ final PrintService pservice = getPrintService();
+ Boolean isIPPPrinter =
+ (Boolean)java.security.AccessController.doPrivileged(
+ new java.security.PrivilegedAction() {
+ public Object run() {
+ try {
+ Class psClass =
+ Class.forName("sun.print.IPPPrintService");
+ if (psClass.isInstance(pservice)) {
+ return Boolean.TRUE;
+ }
+ } catch (Throwable t) {
+ }
+ return Boolean.FALSE;
+ }
+ });
+ if (isIPPPrinter) {
+ lprPath = "%%LOCALBASE%%/bin/lpr";
+ }
+ }
execCmd = new String[ncomps];
- execCmd[n++] = "/usr/bin/lpr";
+ execCmd[n++] = lprPath;
if ((pFlags & PRINTER) != 0) {
execCmd[n++] = "-P" + printer;
}