Imported Upstream version 4.3.1

This commit is contained in:
Mario Fetka
2021-08-10 02:37:58 +02:00
parent a791de49a2
commit 2f177da8f2
2056 changed files with 421730 additions and 1668138 deletions

View File

@@ -20,7 +20,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Build script for FreeIPA Web UI
set -o errexit
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
@@ -32,5 +31,6 @@ if [[ ! $profile ]] ; then
exit 1
fi
node $DIR/build/build.js load=build profile=$DIR/../src/$profile.profile.js
RHINO="java -Xss${JAVA_STACK_SIZE:-512k} -classpath /usr/share/java/js.jar org.mozilla.javascript.tools.shell.Main"
$RHINO $DIR/build/build.js baseUrl=$DIR/build load=build profile=$DIR/../src/$profile.profile.js
exit $?

View File

@@ -1,108 +0,0 @@
exports.config = function(config){
// summary:
// This module provides bootstrap configuration for running dojo in node.js
// any command line arguments with the load flag are pushed into deps
for(var deps = [], args = [], i = 0; i < process.argv.length; i++){
var arg = (process.argv[i] + "").split("=");
if(arg[0] == "load"){
deps.push(arg[1]);
}else if(arg[0] == "mapPackage") {
var parts = arg[1].split(":"),
name = parts[0],
location=parts[1],
isPrexisting = false;
for (var j = 0; j < config.packages.length; j++) {
var pkg = config.packages[j];
if (pkg.name === name) {
pkg.location = location;
isPrexisting = true;
break;
}
}
if (!isPrexisting) {
config.packages.push({
name: name,
location: location
});
}
}else{
args.push(arg);
}
}
var fs = require("fs");
// make sure global require exists
//if (typeof global.require=="undefined"){
// global.require= {};
//}
// reset the has cache with node-appropriate values;
var hasCache = {
"host-node":1,
"host-browser":0,
"dom":0,
"dojo-has-api":1,
"dojo-xhr-factory":0,
"dojo-inject-api":1,
"dojo-timeout-api":0,
"dojo-trace-api":1,
"dojo-dom-ready-api":0,
"dojo-publish-privates":1,
"dojo-sniff":0,
"dojo-loader":1,
"dojo-test-xd":0,
"dojo-test-sniff":0
};
for(var p in hasCache){
config.hasCache[p] = hasCache[p];
}
var vm = require('vm'),
path = require('path');
// reset some configuration switches with node-appropriate values
var nodeConfig = {
baseUrl: path.dirname(process.argv[1]),
commandLineArgs:args,
deps:deps,
timeout:0,
// TODO: really get the locale
locale:"en-us",
loaderPatch: {
log:function(item){
// define debug for console messages during dev instead of console.log
// (node's heavy async makes console.log confusing sometimes)
var util = require("util");
util.debug(util.inspect(item));
},
eval: function(__text, __urlHint){
return vm.runInThisContext(__text, __urlHint);
},
injectUrl: function(url, callback){
try{
vm.runInThisContext(fs.readFileSync(url, "utf8"), url);
callback();
}catch(e){
this.log("failed to load resource (" + url + ")");
this.log(e);
}
},
getText: function(url, sync, onLoad){
// TODO: implement async and http/https handling
onLoad(fs.readFileSync(url, "utf8"));
}
}
};
for(p in nodeConfig){
config[p] = nodeConfig[p];
}
};

View File

@@ -0,0 +1,121 @@
function rhinoDojoConfig(config, baseUrl, rhinoArgs){
// summary:
// This module provides bootstrap configuration for running dojo in rhino.
// TODO: v1.6 tries to set dojo.doc and dojo.body in rhino; why?
// get a minimal console up
var log = function(hint, args){
print((hint ? hint + ":" : "") + args[0]);
for(var i = 1; i < args.length; i++){
print(", " + args[i]);
}
};
// intentionally define console in the global namespace
console= {
log: function(){ log(0, arguments); },
error: function(){ log("ERROR", arguments); },
warn: function(){ log("WARN", arguments); }
};
// any command line arguments with the load flag are pushed into deps
for(var deps = [], i = 0; i < rhinoArgs.length; i++){
var arg = (rhinoArgs[i] + "").split("=");
if(arg[0] == "load"){
deps.push(arg[1]);
}
}
// provides timed callbacks using Java threads
if(typeof setTimeout == "undefined" || typeof clearTimeout == "undefined"){
var timeouts = [];
clearTimeout = function(idx){
if(!timeouts[idx]){ return; }
timeouts[idx].stop();
};
setTimeout = function(func, delay){
var def = {
sleepTime:delay,
hasSlept:false,
run:function(){
if(!this.hasSlept){
this.hasSlept = true;
java.lang.Thread.currentThread().sleep(this.sleepTime);
}
try{
func();
}catch(e){
console.debug("Error running setTimeout thread:" + e);
}
}
};
var runnable = new java.lang.Runnable(def);
var thread = new java.lang.Thread(runnable);
thread.start();
return timeouts.push(thread) - 1;
};
}
var isLocal = function(url){
return (new java.io.File(url)).exists();
};
// reset the has cache with node-appropriate values;
var hasCache = {
"host-rhino":1,
"host-browser":0,
"dom":0,
"dojo-has-api":1,
"dojo-xhr-factory":0,
"dojo-inject-api":1,
"dojo-timeout-api":0,
"dojo-trace-api":1,
"dojo-loader-catches":1,
"dojo-dom-ready-api":0,
"dojo-publish-privates":1,
"dojo-sniff":0,
"dojo-loader":1,
"dojo-test-xd":0,
"dojo-test-sniff":0
};
for(var p in hasCache){
config.hasCache[p] = hasCache[p];
}
// reset some configuration switches with rhino-appropriate values
var rhinoConfig = {
baseUrl:baseUrl,
commandLineArgs:rhinoArgs,
deps:deps,
timeout:0,
locale:String(java.util.Locale.getDefault().toString().replace('_', '-').toLowerCase()),
loaderPatch:{
injectUrl: function(url, callback){
try{
if(isLocal(url)){
load(url);
}else{
require.eval(readUrl(url, "UTF-8"));
}
callback();
}catch(e){
console.log("failed to load resource (" + url + ")");
console.log(e);
}
},
getText: function(url, sync, onLoad){
// TODO: test https://bugzilla.mozilla.org/show_bug.cgi?id=471005; see v1.6 hostenv_rhino
// note: async mode not supported in rhino
onLoad(isLocal(url) ? readFile(url, "UTF-8") : readUrl(url, "UTF-8"));
}
}
};
for(p in rhinoConfig){
config[p] = rhinoConfig[p];
}
}

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,7 @@
From be32e8039fca859a8fc9202c50dcd8663023dd53 Mon Sep 17 00:00:00 2001
From c0962cfb520d25c367689243b71e43af1dcc0601 Mon Sep 17 00:00:00 2001
From: Petr Vobornik <pvoborni@redhat.com>
Date: Thu, 8 Nov 2012 13:22:30 +0100
Subject: [PATCH 1/2] Make dojo builder buildable by itself
Subject: [PATCH] Make dojo builder buildable by itself
Dojo builder is now buildable by itself. It just needed a packackage information,
profile and separating of internal definition of commanLineArgs module to separate
@@ -22,7 +22,7 @@ get rid of this dependency.
create mode 100644 build/package.json
diff --git a/build/argv.js b/build/argv.js
index c6589afb..98d95bf8 100644
index 18bda74b0eb80e37d9c83cb23a10f29f8ffe91d9..997576687eb74cbb6a6a293b3a855a6d15142368 100644
--- a/build/argv.js
+++ b/build/argv.js
@@ -5,7 +5,7 @@ define([
@@ -36,7 +36,7 @@ index c6589afb..98d95bf8 100644
"./messages",
diff --git a/build/build.profile.js b/build/build.profile.js
new file mode 100644
index 00000000..507728c2
index 0000000000000000000000000000000000000000..507728c283c5703106fe029c0fd282cb864c994d
--- /dev/null
+++ b/build/build.profile.js
@@ -0,0 +1,32 @@
@@ -75,7 +75,7 @@ index 00000000..507728c2
\ No newline at end of file
diff --git a/build/commandLineArgs.js b/build/commandLineArgs.js
new file mode 100644
index 00000000..41df62e3
index 0000000000000000000000000000000000000000..41df62e31a05ef2c00e1eb609c0fabe8641e2d03
--- /dev/null
+++ b/build/commandLineArgs.js
@@ -0,0 +1,7 @@
@@ -88,7 +88,7 @@ index 00000000..41df62e3
+});
\ No newline at end of file
diff --git a/build/main.js b/build/main.js
index 131ed644..c0eb36e9 100644
index eeb329c91c0eb4df94178cdfc445e5235409401a..89ad7a9d639257ec99ca86be59abdb74d54939a3 100644
--- a/build/main.js
+++ b/build/main.js
@@ -33,16 +33,14 @@
@@ -105,7 +105,7 @@ index 131ed644..c0eb36e9 100644
- return process.argv.slice(2);
- });
+ //arg[0] is node; argv[1] is dojo.js; therefore, start with argv[2]
+ commandLineArgs.push.apply(commandLineArgs, process.argv.slice(2));
+ commandLineArgs.push(process.argv.slice(2));
- // helps during dev or heavily async node...
+ // helps during dev or heavily async node
@@ -137,13 +137,13 @@ index 131ed644..c0eb36e9 100644
}else{
diff --git a/build/package.json b/build/package.json
new file mode 100644
index 00000000..576030f2
index 0000000000000000000000000000000000000000..568101cb1a182d3415c73d02e151359e1ce3e27d
--- /dev/null
+++ b/build/package.json
@@ -0,0 +1,23 @@
+{
+ "name": "build",
+ "version":"1.13.0",
+ "version":"1.8.1",
+ "directories": {
+ "lib": "."
+ },
@@ -165,5 +165,5 @@ index 00000000..576030f2
+ "dojoBuild": "build.profile.js"
+}
--
2.14.3
1.7.11.7

View File

@@ -18,7 +18,6 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
set -o errexit
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
RDIR=$DIR/../release
@@ -140,4 +139,4 @@ pushd $DIR/../js
git update-index --no-assume-unchanged ./dojo
git update-index --no-assume-unchanged ./freeipa
fi
popd
popd

View File

@@ -18,10 +18,9 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
set -o errexit
# Clean after build
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
rm -rf $DIR/../release
rm -rf $DIR/../release

View File

@@ -18,7 +18,6 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
set -o errexit
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
RDIR=$DIR/../release
@@ -105,7 +104,5 @@ if [[ ! $OUTPUT_FILE ]] ; then
OUTPUT_FILE=$RDIR/$RELEASE/$LAYER.js
fi
# compile using uglifyjs
echo "Minimizing: $RDIR/$RELEASE/$LAYER.js"
echo "Target file: $OUTPUT_FILE"
uglifyjs $RDIR/$RELEASE/$LAYER.js > $OUTPUT_FILE
# compile using uglify.js
$DIR/uglifyjs/uglify $RDIR/$RELEASE/$LAYER.js $OUTPUT_FILE

View File

@@ -18,7 +18,6 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
set -o errexit
# Build DOJO builder, overwrites util/build/build.js. Cleans after itself.
@@ -48,4 +47,4 @@ $DIR/clean.sh
# Delete DOJO symbolic links
rm -f $DIR/../src/dojo
rm -f $DIR/../src/build
rm -f $DIR/../src/build

View File

@@ -18,9 +18,8 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
set -o errexit
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
py3-lesscpy -x $DIR/../less/ipa.less > $DIR/../css/ipa.css
lesscpy -x $DIR/../less/ipa.less > $DIR/../css/ipa.css
exit $?

View File

@@ -18,7 +18,6 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
set -o errexit
# Build script for Dojo library
@@ -36,4 +35,4 @@ if [[ $? != 0 ]] ; then
fi
$DIR/compile.sh --release dojo --layer dojo/dojo --output $DIR/../build/dojo/dojo.js
$DIR/clean.sh
$DIR/clean.sh

View File

@@ -18,7 +18,6 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
set -o errexit
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

View File

@@ -18,7 +18,6 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
set -o errexit
# Build script for FreeIPA Web UI

View File

@@ -18,7 +18,6 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
set -o errexit
#
# This script prepares working enviroment to use dojo toolkit.
@@ -76,7 +75,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
DOJO_DIR=$DIR/../../../../dojo
# working version of Dojo toolkit
BRANCH='1.13.0'
BRANCH='1.8.3'
YES='YES'
args=`getopt -q -u -l help,checkout,clone,patches,links,dojo,util,all,branch:,dir: a $*`
@@ -203,4 +202,4 @@ if [[ $UTIL = $YES ]] ; then
fi
fi
popd # $DOJO_DIR
popd # $DOJO_DIR

View File

@@ -18,7 +18,6 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
set -o errexit
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
RDIR=$DIR/../release
@@ -61,7 +60,7 @@ OPTIONS
--config
files from html/
--strings
ipaserver/plugins/internal.py
ipalib/plugins/internal.py
-C
--compiled
changes source dir of --freeipa and --dojo to /src/build/freeipa
@@ -341,8 +340,8 @@ pushd $DIR/../../ #freeipa/install
popd
if [[ $STRINGS ]] ; then
SOURCE=ipaserver/plugins/internal.py
TARGET=/usr/lib/python2.7/site-packages/ipaserver/plugins
SOURCE=ipalib/plugins/internal.py
TARGET=/usr/lib/python2.7/site-packages/ipalib/plugins
RECURSIVE=0
CLEAN=0 # don't clean entire folder
pushd $DIR/../../../
@@ -358,4 +357,4 @@ if [[ $RESTART ]] ; then
echo "Restarting httpd: $HOST"
ssh $HOST "systemctl restart httpd.service"
fi
fi
fi

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,78 @@
var jsp = require("./parse-js"),
pro = require("./process"),
slice = jsp.slice,
member = jsp.member,
curry = jsp.curry,
MAP = pro.MAP,
PRECEDENCE = jsp.PRECEDENCE,
OPERATORS = jsp.OPERATORS;
function ast_squeeze_more(ast) {
var w = pro.ast_walker(), walk = w.walk, scope;
function with_scope(s, cont) {
var save = scope, ret;
scope = s;
ret = cont();
scope = save;
return ret;
};
function _lambda(name, args, body) {
return [ this[0], name, args, with_scope(body.scope, curry(MAP, body, walk)) ];
};
return w.with_walkers({
"toplevel": function(body) {
return [ this[0], with_scope(this.scope, curry(MAP, body, walk)) ];
},
"function": _lambda,
"defun": _lambda,
"new": function(ctor, args) {
if (ctor[0] == "name") {
if (ctor[1] == "Array" && !scope.has("Array")) {
if (args.length != 1) {
return [ "array", args ];
} else {
return walk([ "call", [ "name", "Array" ], args ]);
}
} else if (ctor[1] == "Object" && !scope.has("Object")) {
if (!args.length) {
return [ "object", [] ];
} else {
return walk([ "call", [ "name", "Object" ], args ]);
}
} else if ((ctor[1] == "RegExp" || ctor[1] == "Function" || ctor[1] == "Error") && !scope.has(ctor[1])) {
return walk([ "call", [ "name", ctor[1] ], args]);
}
}
},
"call": function(expr, args) {
if (expr[0] == "dot" && expr[1][0] == "string" && args.length == 1
&& (args[0][1] > 0 && expr[2] == "substring" || expr[2] == "substr")) {
return [ "call", [ "dot", expr[1], "slice"], args];
}
if (expr[0] == "dot" && expr[2] == "toString" && args.length == 0) {
// foo.toString() ==> foo+""
if (expr[1][0] == "string") return expr[1];
return [ "binary", "+", expr[1], [ "string", "" ]];
}
if (expr[0] == "name") {
if (expr[1] == "Array" && args.length != 1 && !scope.has("Array")) {
return [ "array", args ];
}
if (expr[1] == "Object" && !args.length && !scope.has("Object")) {
return [ "object", [] ];
}
if (expr[1] == "String" && !scope.has("String")) {
return [ "binary", "+", args[0], [ "string", "" ]];
}
}
}
}, function() {
return walk(pro.ast_add_scope(ast));
});
};
exports.ast_squeeze_more = ast_squeeze_more;
// Local variables:
// js-indent-level: 4
// End:

View File

@@ -0,0 +1 @@
//just empty file to make rhino happy

33
install/ui/util/uglifyjs/uglify Executable file
View File

@@ -0,0 +1,33 @@
#!/bin/bash
# Authors:
# Petr Vobornik <pvoborni@redhat.com>
#
# Copyright (C) 2012 Red Hat
# see file 'COPYING' for use and warranty information
#
# 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 3 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, see <http://www.gnu.org/licenses/>.
# Wrapper for calling uglify.js under rhino
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# rhino-1.7R4 doesn't have -main option to enable CommonJS support. It was
# replaced by -require option.
RHINO="java -Xss${JAVA_STACK_SIZE:-512k} -classpath /usr/share/java/js.jar org.mozilla.javascript.tools.shell.Main"
if [ `$RHINO --help | grep -e -require | wc -l` -gt 0 ] ; then
$RHINO -require $DIR/uglify-js.js $@
else
$RHINO -main $DIR/uglify-js.js $DIR/ug.js $@
fi

View File

@@ -0,0 +1,86 @@
// Modified version of the orignal uglify-js.js. Modified to be runnable
// under rhino by Petr Vobornik, Red Hat
// writeFile(), read() code written by John Resig.
function uglify(orig_code, options){
options || (options = {});
var jsp = uglify.parser;
var pro = uglify.uglify;
var ast = jsp.parse(orig_code, options.strict_semicolons); // parse code and get the initial AST
ast = pro.ast_mangle(ast, options.mangle_options); // get a new AST with mangled names
ast = pro.ast_squeeze(ast, options.squeeze_options); // get an AST with compression optimizations
var final_code = pro.gen_code(ast, options.gen_options); // compressed code here
return final_code;
};
uglify.parser = require("./lib/parse-js");
uglify.uglify = require("./lib/process");
uglify.consolidator = require("./lib/consolidator");
module.exports = uglify
importPackage(java.io);
function writeFile( file, stream ) {
var buffer = new PrintWriter( new FileWriter( file ) );
buffer.print( stream );
buffer.close();
}
function read( file ) {
var f = new File(file);
var reader = new BufferedReader(new FileReader(f));
var line = null;
var buffer = new java.lang.StringBuffer(f.length());
while( (line = reader.readLine()) != null) {
buffer.append(line);
buffer.append("\n");
}
return buffer.toString();
}
var options = {
ast: false,
consolidate: false,
mangle: true,
mangle_toplevel: false,
no_mangle_functions: false,
squeeze: true,
make_seqs: true,
dead_code: true,
verbose: false,
show_copyright: true,
out_same_file: false,
max_line_length: 32 * 1024,
unsafe: false,
reserved_names: null,
defines: { },
lift_vars: false,
codegen_options: {
ascii_only: false,
beautify: false,
indent_level: 4,
indent_start: 0,
quote_keys: false,
space_colon: false,
inline_script: false
},
make: false,
output: true // stdout
};
if (arguments.length < 2) {
print('Invalid input\nUsage: uglify inputFile outputFile');
quit();
}
if (arguments.indexOf('-v')) {
print('Uglifying '+arguments[0] +'\nOutput: '+arguments[1]);
}
//read input file
var input = read(arguments[0]) + '';
var output = uglify(input, options);
writeFile(arguments[1], output);