Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into v4-0-trivial
authorJelmer Vernooij <jelmer@samba.org>
Mon, 18 Feb 2008 10:31:40 +0000 (11:31 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Mon, 18 Feb 2008 10:31:40 +0000 (11:31 +0100)
(This used to be commit 2fb93e85eb5f415fbcdfb2fc0a1a58fad823138a)

.gitignore
source4/Makefile
source4/build/smb_build/input.pm
source4/build/smb_build/main.pl
source4/build/smb_build/makefile.pm
source4/build/smb_build/output.pm
source4/lib/basic.mk
source4/lib/gencache/gencache.h [new file with mode: 0644]
source4/rules.mk
source4/scripting/python/samba/provision.py

index a8c1f9a4cc3860eb35a21046d5610c72bc8b198b..b0786b66d65845679d4ad923e7641b28f583180d 100644 (file)
@@ -1,7 +1,6 @@
 source/pidl/Makefile
 source/mkconfig.mk
 source/test-results
-source/lib/gencache/gencache.h
 source/lib/ldb/bin
 *.pc
 autom4te.cache
index a99dc825f17a5a466b4dc2627364b1293a9744a4..a2f0afc5f1f7e18d6b838531138f4a21e54f16f7 100644 (file)
@@ -27,7 +27,7 @@ include data.mk
 DEFAULT_HEADERS = $(srcdir)/lib/util/dlinklist.h \
                  $(srcdir)/version.h
 
-binaries:: $(BINARIES)
+binaries::
 libraries:: $(STATIC_LIBS) $(SHARED_LIBS)
 modules:: $(SHARED_MODULES)
 headers:: $(PUBLIC_HEADERS) $(DEFAULT_HEADERS)
@@ -122,8 +122,10 @@ installbin:: $(SBIN_PROGS) $(BIN_PROGS) $(TORTURE_PROGS) installdirs
                $(DESTDIR)$(TORTUREDIR) \
                $(TORTURE_PROGS)
 
-installlib:: $(INSTALLABLE_SHARED_LIBS) $(STATIC_LIBS) installdirs
-       @$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(libdir) "$(SHLIBEXT)" $(INSTALLABLE_SHARED_LIBS) 
+installplugins::
+
+installlib:: $(SHARED_LIBS) $(STATIC_LIBS) installdirs
+       @$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(libdir) "$(SHLIBEXT)" $(SHARED_LIBS) 
        #@$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(libdir) "$(STLIBEXT)" $(STATIC_LIBS)
 
 installheader:: headers installdirs
@@ -165,6 +167,8 @@ uninstallheader::
 uninstallman::
        @$(SHELL) $(srcdir)/script/uninstallman.sh $(DESTDIR)$(mandir) $(MANPAGES)
 
+uninstallplugins::
+
 config.status:
        @echo "config.status does not exist. Please run ./configure."
        @/bin/false
index 51c89a834f1269d3e533bc95437b867e53413ee4..ed584e185c846d9bf2f9688ea884f88e0336b27b 100644 (file)
@@ -66,8 +66,6 @@ sub check_subsystem($$$)
 
        unless (defined($subsys->{INIT_FUNCTION_TYPE})) { $subsys->{INIT_FUNCTION_TYPE} = "NTSTATUS (*) (void)"; }
        unless (defined($subsys->{INIT_FUNCTION_SENTINEL})) { $subsys->{INIT_FUNCTION_SENTINEL} = "NULL"; }
-
-       add_libreplace($subsys);
 }
 
 sub check_module($$$)
@@ -76,8 +74,6 @@ sub check_module($$$)
 
        die("Module $mod->{NAME} does not have a SUBSYSTEM set") if not defined($mod->{SUBSYSTEM});
 
-       my $use_default = 0;
-       
        if (not exists($INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTIONS})) {
                $INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTIONS} = [];
        }
@@ -113,11 +109,11 @@ sub check_module($$$)
                $sane_subsystem =~ s/^lib//;
                $mod->{INSTALLDIR} = "MODULESDIR/$sane_subsystem";
                push (@{$mod->{PUBLIC_DEPENDENCIES}}, $mod->{SUBSYSTEM});
+               add_libreplace($mod);
        } 
        if (grep(/INTEGRATED/, @{$mod->{OUTPUT_TYPE}})) {
                push (@{$INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTIONS}}, $mod->{INIT_FUNCTION}) if defined($mod->{INIT_FUNCTION});
        }
-       add_libreplace($mod);
 }
 
 sub check_library($$$)
@@ -126,9 +122,7 @@ sub check_library($$$)
 
        return if ($lib->{ENABLE} ne "YES");
 
-       unless (defined($lib->{OUTPUT_TYPE})) {
-               $lib->{OUTPUT_TYPE} = $default_ot;
-       }
+       unless (defined($lib->{OUTPUT_TYPE})) { $lib->{OUTPUT_TYPE} = $default_ot; }
 
        if (defined($lib->{VERSION}) and not defined($lib->{SO_VERSION})) {
                print "$lib->{NAME}: Please specify SO_VERSION when specifying VERSION\n";
@@ -141,12 +135,8 @@ sub check_library($$$)
        }
 
        unless (defined($lib->{INIT_FUNCTION_TYPE})) { $lib->{INIT_FUNCTION_TYPE} = "NTSTATUS (*) (void)"; }
-
        unless (defined($lib->{INIT_FUNCTION_SENTINEL})) { $lib->{INIT_FUNCTION_SENTINEL} = "NULL"; }
-
-       unless(defined($lib->{INSTALLDIR})) {
-               $lib->{INSTALLDIR} = "LIBDIR";
-       }
+       unless (defined($lib->{INSTALLDIR})) { $lib->{INSTALLDIR} = "LIBDIR"; }
 
        add_libreplace($lib);
 }
@@ -234,6 +224,7 @@ sub calc_unique_deps($$$$$$$$)
                if (defined ($dep->{OUTPUT_TYPE}) && 
                        ($withlibs or 
                        (@{$dep->{OUTPUT_TYPE}}[0] eq "INTEGRATED") or 
+                       (@{$dep->{OUTPUT_TYPE}}[0] eq "MERGED_OBJ") or 
                        (@{$dep->{OUTPUT_TYPE}}[0] eq "STATIC_LIBRARY"))) {
                                push (@$busy, $dep->{NAME});
                                calc_unique_deps($dep->{NAME}, $INPUT, $dep->{PUBLIC_DEPENDENCIES}, $udeps, $withlibs, $forward, $pubonly, $busy);
@@ -280,9 +271,7 @@ sub check($$$$$)
                }
        }
 
-       foreach my $k (keys %$INPUT) {
-               my $part = $INPUT->{$k};
-
+       foreach my $part (values %$INPUT) {
                $part->{LINK_FLAGS} = [];
                $part->{FULL_OBJ_LIST} = ["\$($part->{NAME}_OBJ_LIST)"];
 
index a85eab32de59665a6c54c43ac22c06211de86400..4c09e32422bddfc21f9ebfee192b0abbff48727f 100644 (file)
@@ -20,7 +20,7 @@ my $INPUT = {};
 my $mkfile = smb_build::config_mk::run_config_mk($INPUT, $config::config{srcdir}, $config::config{builddir}, "main.mk");
 
 my $subsys_output_type;
-$subsys_output_type = ["STATIC_LIBRARY"];
+$subsys_output_type = ["MERGED_OBJ"];
 
 my $library_output_type;
 if ($config::config{USESHARED} eq "true") {
@@ -59,6 +59,7 @@ my $shared_libs_used = 0;
 foreach my $key (values %$OUTPUT) {
        next unless defined $key->{OUTPUT_TYPE};
 
+       $mkenv->MergedObj($key) if grep(/MERGED_OBJ/, @{$key->{OUTPUT_TYPE}});
        $mkenv->StaticLibrary($key) if grep(/STATIC_LIBRARY/, @{$key->{OUTPUT_TYPE}});
        if (defined($key->{PC_FILE})) {
                push(@{$mkenv->{pc_files}}, "$key->{BASEDIR}/$key->{PC_FILE}");
index 7fd31a511401e17d79a9a3778f827af2ed357961..16b46ed34343ea04b2f1970a0d5e80c5d2ad6d72 100644 (file)
@@ -28,12 +28,9 @@ sub new($$$)
        $self->{python_dsos} = [];
        $self->{python_pys} = [];
        $self->{shared_libs} = [];
-       $self->{installable_shared_libs} = [];
        $self->{headers} = [];
        $self->{shared_modules} = [];
        $self->{plugins} = [];
-       $self->{install_plugins} = "";
-       $self->{uninstall_plugins} = "";
        $self->{pc_files} = [];
        $self->{proto_headers} = [];
        $self->{output} = "";
@@ -154,16 +151,24 @@ sub SharedModule($$)
        } else {
                push (@{$self->{shared_modules}}, "$ctx->{TARGET_SHARED_LIBRARY}");
                push (@{$self->{plugins}}, "$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}");
-               $self->{install_plugins} .= "\t\@echo Installing $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} as \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
-               $self->{install_plugins} .= "\t\@mkdir -p \$(DESTDIR)\$(modulesdir)/$sane_subsystem/\n";
-               $self->{install_plugins} .= "\t\@cp $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
-               $self->{uninstall_plugins} .= "\t\@echo Uninstalling \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
-               $self->{uninstall_plugins} .= "\t\@-rm \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
+               $self->output("installplugins:: $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}\n");
+               $self->output("\t\@echo Installing $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} as \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n");
+               $self->output("\t\@mkdir -p \$(DESTDIR)\$(modulesdir)/$sane_subsystem/\n");
+               $self->output("\t\@cp $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n");
                if (defined($ctx->{ALIASES})) {
                        foreach (@{$ctx->{ALIASES}}) {
-                               $self->{install_plugins} .= "\t\@rm -f \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n";
-                               $self->{install_plugins} .= "\t\@ln -fs $ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n";
-                               $self->{uninstall_plugins} .= "\t\@-rm \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n";
+                               $self->output("\t\@rm -f \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n");
+                               $self->output("\t\@ln -fs $ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n");
+                       }
+               }
+
+               $self->output("uninstallplugins::\n");
+               $self->output("\t\@echo Uninstalling \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n");
+               $self->output("\t\@-rm \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n");
+
+               if (defined($ctx->{ALIASES})) {
+                       foreach (@{$ctx->{ALIASES}}) {
+                               $self->output("\t\@-rm \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n");
                        }
                }
        }
@@ -237,7 +242,6 @@ sub SharedLibrary($$)
        my ($self,$ctx) = @_;
 
        push (@{$self->{shared_libs}}, "$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}") if (defined($ctx->{SO_VERSION}));
-       push (@{$self->{installable_shared_libs}}, "$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}") if (defined($ctx->{SO_VERSION}));
 
        $self->_prepare_list($ctx, "DEPEND_LIST");
        $self->_prepare_list($ctx, "LINK_FLAGS");
@@ -273,6 +277,25 @@ __EOD__
        $self->output("\n");
 }
 
+sub MergedObj($$)
+{
+       my ($self, $ctx) = @_;
+
+       $self->output("$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n");
+       $self->_prepare_list($ctx, "OBJ_LIST");
+       $self->_prepare_list($ctx, "FULL_OBJ_LIST");
+       push(@{$self->{all_objs}}, "\$($ctx->{NAME}_FULL_OBJ_LIST)");
+       $self->output(<< "__EOD__"
+#
+$ctx->{TARGET_MERGED_OBJ}: \$($ctx->{NAME}_FULL_OBJ_LIST)
+       \@echo Partially linking \$@
+       \@mkdir -p bin/mergedobj
+       \$(PARTLINK) -o \$@ \$($ctx->{NAME}_FULL_OBJ_LIST)
+
+__EOD__
+);
+}
+
 sub StaticLibrary($$)
 {
        my ($self,$ctx) = @_;
@@ -328,7 +351,7 @@ sub Binary($$)
                push (@{$self->{bin_progs}}, "$installdir/$ctx->{BINARY}");
        }
 
-       push (@{$self->{binaries}}, "$localdir/$ctx->{BINARY}");
+       $self->output("binaries:: $localdir/$ctx->{BINARY}\n");
 
        $self->_prepare_list($ctx, "OBJ_LIST");
        $self->_prepare_list($ctx, "FULL_OBJ_LIST");
@@ -425,12 +448,10 @@ sub write($$)
        $self->output("MANPAGES = " . array2oneperline($self->{manpages})."\n");
        $self->output("BIN_PROGS = " . array2oneperline($self->{bin_progs}) . "\n");
        $self->output("SBIN_PROGS = " . array2oneperline($self->{sbin_progs}) . "\n");
-       $self->output("BINARIES = " . array2oneperline($self->{binaries}) . "\n");
        $self->output("STATIC_LIBS = " . array2oneperline($self->{static_libs}) . "\n");
        $self->output("SHARED_LIBS = " . array2oneperline($self->{shared_libs}) . "\n");
        $self->output("PYTHON_DSOS = " . array2oneperline($self->{python_dsos}) . "\n");
        $self->output("PYTHON_PYS = " . array2oneperline($self->{python_pys}) . "\n");
-       $self->output("INSTALLABLE_SHARED_LIBS = " . array2oneperline($self->{installable_shared_libs}) . "\n");
        $self->output("PUBLIC_HEADERS = " . array2oneperline($self->{headers}) . "\n");
        $self->output("PC_FILES = " . array2oneperline($self->{pc_files}) . "\n");
        $self->output("ALL_OBJS = " . array2oneperline($self->{all_objs}) . "\n");
@@ -438,9 +459,6 @@ sub write($$)
        $self->output("SHARED_MODULES = " . array2oneperline($self->{shared_modules}) . "\n");
        $self->output("PLUGINS = " . array2oneperline($self->{plugins}) . "\n");
 
-       $self->output("\ninstallplugins: \$(PLUGINS)\n".$self->{install_plugins}."\n");
-       $self->output("\nuninstallplugins:\n".$self->{uninstall_plugins}."\n");
-
        $self->_prepare_mk_files();
 
        $self->output($self->{mkfile});
index 4350370fbf8a8b8d31a169acd2f9c0f7a1f5697a..0ddb9e4efbe3d127264f49091a1894b25c654d92 100644 (file)
@@ -89,6 +89,17 @@ sub generate_shared_library($)
        $lib->{OUTPUT_SHARED_LIBRARY} = $lib->{TARGET_SHARED_LIBRARY};
 }
 
+sub generate_merged_obj($)
+{
+       my $lib = shift;
+
+       my $link_name = $lib->{NAME};
+       $link_name =~ s/^LIB//;
+
+       $lib->{MERGED_OBJNAME} = lc($link_name).".o";
+       $lib->{TARGET_MERGED_OBJ} = $lib->{OUTPUT_MERGED_OBJ} = "bin/mergedobj/$lib->{MERGED_OBJNAME}";
+}
+
 sub generate_static_library($)
 {
        my $lib = shift;
@@ -153,6 +164,7 @@ sub create_output($$)
                generate_binary($part) if grep(/BINARY/, @{$part->{OUTPUT_TYPE}});
                generate_shared_library($part) if grep(/SHARED_LIBRARY/, @{$part->{OUTPUT_TYPE}});
                generate_static_library($part) if grep(/STATIC_LIBRARY/, @{$part->{OUTPUT_TYPE}});
+               generate_merged_obj($part) if grep(/MERGED_OBJ/, @{$part->{OUTPUT_TYPE}});
                $part->{OUTPUT} = $part->{"OUTPUT_" . @{$part->{OUTPUT_TYPE}}[0]};
                $part->{TARGET} = $part->{"TARGET_" . @{$part->{OUTPUT_TYPE}}[0]};
        }
index 86537790441f6e9db4612cf1b0076e2848b963a3..53eb0d038f8db916f3483f2c513db40d1bb64f57 100644 (file)
@@ -18,15 +18,11 @@ include tdr/config.mk
 include dbwrap/config.mk
 include crypto/config.mk
 
-################################################
-# Start SUBSYSTEM LIBCOMPRESSION
 [SUBSYSTEM::LIBCOMPRESSION]
 OBJ_FILES = compression/mszip.o
-# End SUBSYSTEM LIBCOMPRESION
-################################################
 
 [SUBSYSTEM::GENCACHE]
-PRIVATE_PROTO_HEADER = gencache/gencache.h
+PUBLIC_HEADERS = gencache/gencache.h
 OBJ_FILES = gencache/gencache.o
 PRIVATE_DEPENDENCIES = TDB_WRAP
 
diff --git a/source4/lib/gencache/gencache.h b/source4/lib/gencache/gencache.h
new file mode 100644 (file)
index 0000000..1481676
--- /dev/null
@@ -0,0 +1,94 @@
+#ifndef __LIB_GENCACHE_GENCACHE_H__
+#define __LIB_GENCACHE_GENCACHE_H__
+
+/**
+ * Cache initialisation function. Opens cache tdb file or creates
+ * it if does not exist.
+ *
+ * @return true on successful initialisation of the cache or
+ *         false on failure
+ **/
+bool gencache_init(struct loadparm_context *lp_ctx);
+
+/**
+ * Cache shutdown function. Closes opened cache tdb file.
+ *
+ * @return true on successful closing the cache or
+ *         false on failure during cache shutdown
+ **/
+bool gencache_shutdown(void);
+
+/**
+ * Set an entry in the cache file. If there's no such
+ * one, then add it.
+ *
+ * @param keystr string that represents a key of this entry
+ * @param value text representation value being cached
+ * @param timeout time when the value is expired
+ *
+ * @retval true when entry is successfuly stored
+ * @retval false on failure
+ **/
+bool gencache_set(const char *keystr, const char *value, time_t timeout);
+
+/**
+ * Set existing entry to the cache file.
+ *
+ * @param keystr string that represents a key of this entry
+ * @param valstr text representation value being cached
+ * @param timeout time when the value is expired
+ *
+ * @retval true when entry is successfuly set
+ * @retval false on failure
+ **/
+bool gencache_set_only(const char *keystr, const char *valstr, time_t timeout);
+
+/**
+ * Delete one entry from the cache file.
+ *
+ * @param keystr string that represents a key of this entry
+ *
+ * @retval true upon successful deletion
+ * @retval false in case of failure
+ **/
+bool gencache_del(const char *keystr);
+
+/**
+ * Get existing entry from the cache file.
+ *
+ * @param keystr string that represents a key of this entry
+ * @param valstr buffer that is allocated and filled with the entry value
+ *        buffer's disposing must be done outside
+ * @param timeout pointer to a time_t that is filled with entry's
+ *        timeout
+ *
+ * @retval true when entry is successfuly fetched
+ * @retval false for failure
+ **/
+bool gencache_get(const char *keystr, char **valstr, time_t *timeout);
+
+/**
+ * Iterate through all entries which key matches to specified pattern
+ *
+ * @param fn pointer to the function that will be supplied with each single
+ *        matching cache entry (key, value and timeout) as an arguments
+ * @param data void pointer to an arbitrary data that is passed directly to the fn
+ *        function on each call
+ * @param keystr_pattern pattern the existing entries' keys are matched to
+ *
+ **/
+void gencache_iterate(void (*fn)(const char* key, const char *value, time_t timeout, void* dptr),
+                      void* data, const char* keystr_pattern);
+
+/********************************************************************
+ lock a key
+********************************************************************/
+int gencache_lock_entry( const char *key );
+
+/********************************************************************
+ unlock a key
+********************************************************************/
+void gencache_unlock_entry( const char *key );
+
+#endif /* __LIB_GENCACHE_GENCACHE_H__ */
+
index 1ef751b00abd4c7e42e7e4e8c77bd4250df2d858..4e7841fa93bc6d7718792b8e9e35c18b59b250cd 100644 (file)
@@ -37,6 +37,9 @@ PCHCOMPILE = @$(CC) -Ilib/replace \
     $(CFLAGS) `$(PERL) $(srcdir)/script/cflags.pl $@` \
     $(PICFLAG) $(CPPFLAGS) -c $(FIRST_PREREQ) -o $@
 
+# Partial linking
+PARTLINK = @$(PROG_LD) -r
+
 include/config.h:
        @echo "include/config.h not present"
        @echo "You need to rerun ./autogen.sh and ./configure"
index d30eaf3d7fdd376669feb3f9d1b4b1f6cdc55683..3e88b68509c9370d04da52b411a6c75fcb62f9f2 100644 (file)
@@ -335,9 +335,9 @@ def setup_samdb_partitions(samdb_path, setup_path, message, lp, session_info,
        schemadn_ldb = ldap_backend
        
     if ldap_backend_type == "fedora-ds":
-        backend_modules = ["nsuniqueid","paged_searches"]
+        backend_modules = ["nsuniqueid", "paged_searches"]
     elif ldap_backend_type == "openldap":
-        backend_modules = ["normalise","entryuuid","paged_searches"]
+        backend_modules = ["normalise", "entryuuid", "paged_searches"]
     elif serverrole == "domain controller":
         backend_modules = ["repl_meta_data"]
     else:
@@ -695,6 +695,7 @@ def setup_samdb(path, setup_path, session_info, credentials, lp,
     samdb.transaction_commit()
     return samdb
 
+
 FILL_FULL = "FULL"
 FILL_NT4SYNC = "NT4SYNC"
 FILL_DRS = "DRS"