Index: patches/src680/apply
===================================================================
--- patches/src680/apply	(revision 11534)
+++ patches/src680/apply	(working copy)
@@ -199,11 +199,11 @@
 # Fix linkoo, the ultimate hacker tool
 fix-linkoo.diff, i#83548, jholesov
 
-[ TemporaryHacks < ooh680-m5 ]
+[ TemporaryHacks < ooh680-m5 || < src680-m241 ]
 # libspl680*so does not have to be loaded when we present no startup wizard
 startup-wizard-speedup.diff, i#84169, jholesov
 
-[ TemporaryHacks < ooh680-m4 ]
+[ TemporaryHacks < ooh680-m4 || < src680-m241 ]
 # fixed for n#200505
 Simplified_Traditional_Chinese_convertion_table_n200505.diff, Fong Lin, n#200505
 
@@ -227,7 +227,7 @@
 # always enable file save even when the document is not modified.
 sfx2-always-allow-save-document.diff, n#347423, kohei
 
-[ CJK ]
+[ CJK < src680-m241 ]
 #set default CJK font fontsize as 10.5pt
 sw-default-cjk-fontsize.diff i#72010, jianhua
 
@@ -280,16 +280,16 @@
 cws-unifysound01-svx.diff
 cws-unifysound01-sw.diff
 
-[ CWSBackports < ooh680-m2 ]
+[ CWSBackports < ooh680-m2 || < src680-m241 ]
 cws-unifysound01-vcl-m1.diff
 
-[ CWSBackports >= ooh680-m2 < ooh680-m5 ]
+[ CWSBackports >= ooh680-m2 < ooh680-m5 || < src680-m241 ]
 cws-unifysound01-vcl-m4.diff
 
-[ CWSBackports >= ooh680-m5 ]
+[ CWSBackports >= ooh680-m5 || < src680-m241 ]
 cws-unifysound01-vcl.diff
 
-[ CWSBackports < ooh680-m4 ]
+[ CWSBackports < ooh680-m4 || < src680-m241 ]
 # Use stlport just on the archs where it is needed from historical reasons
 cws-newportstl.diff
 
@@ -300,14 +300,14 @@
 cws-npower10.diff
 #api changes
 cws-npower11.diff
-[ CWSBackports < ooh680-m2 ]
+[ CWSBackports < ooh680-m2 || < src680-m41 ]
 buildfix-stl-anachronism.diff, i#83519
 
 [ CWSBackports ]
 # not for upstreaming: hack to work even on gcc's with broken -fvisibility-inlines-hidden
 buildfix-x86-64-visibility-workaround.diff
 
-[ CWSBackports < ooh680-m3 ]
+[ CWSBackports < ooh680-m3 || < src680-m241 ]
 cws-thiscomponent-basctl.diff
 cws-thiscomponent-sfx2.diff
 
@@ -333,7 +333,7 @@
 # JDKs too
 buildfix-qadevOOo-java-encoding.diff, brosenk
 
-[ GCJ >= ooh680-m2 < ooh680-m4 ]
+[ GCJ >= ooh680-m2 < ooh680-m4 || < src680-m241 ]
 buildfix-libformula-gcj-source.diff, i#85249
 
 # Fixes that were not accepted up-stream, but are still useful
@@ -362,11 +362,11 @@
 
 sdext-no-license.diff
 
-[ FixesNotForUpstream < ooh680-m2 ]
+[ FixesNotForUpstream < ooh680-m2 || < src680-m241 ]
 # no bogus license question when registering this extension
 reportdesigner-no-license-m1.diff
 
-[ FixesNotForUpstream >= ooh680-m2 < ooh680-m4 ]
+[ FixesNotForUpstream >= ooh680-m2 < ooh680-m4 || < src680-m241 ]
 # no bogus license question when registering this extension
 reportdesigner-no-license-m3.diff
 
@@ -381,7 +381,7 @@
 # let sd accept uri-list drop, n#183719
 sd-accept-uri-list-drop.diff, n#183719, rodo
 
-[ Fixes < ooh680-m4 ]
+[ Fixes < ooh680-m4 || < src680-m241 ]
 # default formatting PPT export bug n#285959
 sd-default-format-n285959.diff, i#81395, n#285959, hub
 
@@ -403,7 +403,7 @@
 # disable font management dialog in padmin
 padmin-nofontconfig.diff, michael
 
-[ Fixes < ooh680-m4 ]
+[ Fixes < ooh680-m4 || < src680-m241 ]
 # Fix for n#113235
 wizards-source-importwizard-filesmodul-xba-m3.diff, i#56633, noelpwer
 
@@ -452,11 +452,11 @@
 # allow dmake create_patch produce diffable patches
 solenv-dmake-create_patch.diff, i#68917, fridrich
 
-[ Fixes < ooh680-m4 ] 
+[ Fixes < ooh680-m4 || < src680-m241 ] 
 # fix visibility for controls
 svx-sdr-contact-visibility.diff, i#83611. noelpwer
 
-[ Fixes ]
+[ Fixes < src680-m241 ]
 # look for libmawt.so on x86_64 too
 sun-java-amd64-jreextralibdir.diff
 
@@ -482,7 +482,7 @@
 # fix a regression created by my header/footer patch
 sw-my-mess.diff, fridrich
 
-[ Fixes < ooh680-m4 ]
+[ Fixes < ooh680-m4 || < src680-m241 ]
 #fix conversion of date/time strings in Dutch Word documents
 sw-special-locales-date-string.diff, i#84469, n#344306, fridrich
 
@@ -493,7 +493,7 @@
 # Fix pasting Czech characters (UTF-8 html was not treated as UTF-8)
 sw-paste-czech-characters.diff, i#84642, n#334930, jholesov
 
-[ Fixes == ooh680-m3 ]
+[ Fixes == ooh680-m3 || == src680-m241 ]
 # not REPRORTJARFILES
 reportdesigner-fix-jarlist.diff, i#85359
 
@@ -552,21 +552,21 @@
 # Move gnome-vfs out of the startup sequence, load it only when needed
 gnome-vfs-late-init.diff, i#84137, jholesov
 
-[ GnomeVFS >= ooh680-m4 ]
+[ GnomeVFS >= ooh680-m4 || >= src680-m241 ]
 # WebDAV locking
 # It is in this section because it needs part of the gvfs-related patches
 webdav-locking.diff, n#346711, i#29152, jholesov
 
-[ GnomeVFS < ooh680-m4 ]
+[ GnomeVFS < ooh680-m4 || < src680-m241 ]
 # WebDAV locking
 # It is in this section because it needs part of the gvfs-related patches
 webdav-locking-m3.diff, n#346711, i#29152, jholesov
 
-[ QuickStarter < ooh680-m2 ]
+[ QuickStarter < ooh680-m2 || < src680-m241 ]
 # External splash screen implementation / 2nd time accelerator
 unxsplash-rework-m1.diff, i#60696, michael/jholesov
 
-[ QuickStarter >= ooh680-m2 ]
+[ QuickStarter >= ooh680-m2 || >= src680-m241 ]
 # External splash screen implementation / 2nd time accelerator
 unxsplash-rework.diff, i#60696, michael/jholesov
 
@@ -574,7 +574,7 @@
 # handling of osl pipe has changed, see i#84045
 unxsplash-new-osl-pipe.diff, i#60696, jholesov
 
-[ QuickStarter < ooh680-m5 ]
+[ QuickStarter < ooh680-m5 || < src680-m241 ]
 # libstartup-notification is not necessary with oosplash.bin
 libsn-removal.diff, i#84179, jholesov
 
@@ -662,7 +662,7 @@
 # Paste clipboard when ENTER is pressed, then clear clipboard.
 sc-paste-on-enter.diff, n#358545, i#28535, jonp
 
-[ CalcFixes < ooh680-m4 ]
+[ CalcFixes < ooh680-m4 || < src680-m241 ]
 # Add named range support for INDIRECT and INDIRECT_XL
 sc-indirect-named-range.diff, i#4695, n#274387, kohei
 
@@ -686,7 +686,7 @@
 # Ensure that Print Preview is consistent with Print output.
 sc-print-selected-sheets.diff, n#335684, i#45497, jonp
 
-[ CalcFixes < ooh680-m4 ]
+[ CalcFixes < ooh680-m4 || < src680-m241 ]
 # allow Excel A1 style format (e.g. #Sheet2!A2) in hyperlink destination.
 sc-hyperlink-excel-a1-style.diff, i#80448, kohei
 
@@ -719,7 +719,7 @@
 # Launch navigator when double-clicking the leftmost status area box.
 sc-status-bar-launch-navigator.diff, i#49491, kohei
 
-[ CalcFixes < ooh680-m4 ]
+[ CalcFixes < ooh680-m4 || < src680-m241 ]
 # Fix crashes on erf(0.65).  This is fixed in dr58 CWS upstream.
 scaddins-erf-crash-fix-065.diff, i#84395, kohei
 
@@ -790,7 +790,7 @@
 # display command line help '-h' to stdout instead of stderr.
 desktop-cmdhelp-stdout.diff, kohei
 
-[ Misc < ooh680-m5 ]
+[ Misc < ooh680-m5 || < src680-m241 ]
 # Don't substitute downloadable fonts with resident fonts.
 psprint-do-not-substitute.diff, i#84481, kohei
 
@@ -807,12 +807,12 @@
 # Some Novell colors ...
 novell-palette.diff, michael
 
-[ NovellOnly > ooh680-m1 ]
+[ NovellOnly > ooh680-m1 || > src680-m241 ]
 
 # finally disable -fsigned-char on pcc
 solenv-really-use-unsinged-char-on-ppc.diff, i#81127, n#169875, pmladek
 
-[ NovellOnly <= ooh680-m1 ]
+[ NovellOnly <= ooh680-m1 || <= src680-m241 ]
 
 # finally disable -fsigned-char on pcc
 solenv-really-use-unsinged-char-on-ppc-m1.diff, i#81127, n#169875, pmladek
@@ -834,7 +834,7 @@
 # disabled for Debian as Debian policy (for now) is to use=both
 speed-hash-style.diff, pmladek
 
-[ DebianBaseOnly < ooh680-m4 ]
+[ DebianBaseOnly < ooh680-m4 || < src680-m241 ]
 sdk-remove-non-free.diff
 
 [ DebianBaseOnly ]
@@ -917,10 +917,10 @@
 split-icons-search-usr-share.diff, n#296502, pmladek
 
 
-[ BuildBits ]
+[ BuildBits < src680-m241 ]
 novell-win32-agfa-monotype-fonts.diff, tml
 
-[ BuildBits < ooh680-m4 ]
+[ BuildBits < ooh680-m4 || < src680-m241 ]
 # allow to define java target, so the build is usable with the JVM 1.4
 # even when it is built with JDK 1.5
 build-java-target-m3.diff, pmladek
@@ -930,7 +930,7 @@
 # even when it is built with JDK 1.5
 build-java-target.diff, pmladek
 
-[ BuildBits < ooh680-m5 ]
+[ BuildBits < ooh680-m5 || < src680-m241 ]
 # don't include asm/sigcontext.h, see Debian Bug #442418
 buildfix-sal-system.h-no-asm-sigcontext.h.diff
 
@@ -938,11 +938,11 @@
 # fix build with gcc-4.2.1 and -fvisibility-hidden
 buildfix-xmloff-exportxforms.diff, i#84965
 
-[ BuildBits < ooh680-m2 ]
+[ BuildBits < ooh680-m2 || < src680-m241 ]
 # fix building with system neon-0.24
 ucb-neon-0.24.diff, pmladek, i#85265
 
-[ BuildBits == ooh680-m4 ]
+[ BuildBits == ooh680-m4 || == src680-m241 ]
 # fix evoab2 build
 evoab2-adapt-to-new-api.diff, i#85487
 
@@ -1057,7 +1057,8 @@
 
 # fix build with system libnss installed apart from mozilla
 # strictly required on SL10.1/SLED10 where the xulrunner-nss.pc is broken, n#195272
-libxmlsec-system-nss.diff, i#69368, pmladek
+# FIXME: src680
+# libxmlsec-system-nss.diff, i#69368, pmladek
 
 # allow separate helpcontent build
 #FIXME src680: separate-helpcontent.diff, jholesov
@@ -1114,7 +1115,7 @@
 # fix build with gcc-4.3 on x86_64
 gcc-4.3-icc.diff, i#85771, pmladek
 
-[ BuildBits >= ooh680-m5 < ooh680-m6  ]
+[ BuildBits >= ooh680-m5 < ooh680-m6  || < src680-m241 ]
 
 # fixes missing sprintf argument
 warning-too-few-arguments-icc.diff. i#85736, pmladek
@@ -1339,8 +1340,15 @@
 cli_ure-source-bootstrap-native_glue-cxx.diff
 mono-testtools.diff
 
+[ Mono > ooh680-m0 || < src680-m241 ]
 # The build
 mono-build.diff
+
+[ Mono >= src680-m241 ]
+# The build
+mono-build-src680.diff
+
+[ Mono ]
 build-mono-link.diff, jholesov
 
 cli_ure-prj-build-lst.diff
@@ -1379,7 +1387,7 @@
 vba-workbook-worksheet-events.diff
 vba-workbook-worksheet-events-buildfix.diff
 
-[ VBAObjects < ooh680-m4 ]
+[ VBAObjects < ooh680-m4 || < src680-m241 ]
 vba-keep-codenames-in-sync-m3.diff
 
 [ VBAObjects >= ooh680-m4 ]
@@ -1389,7 +1397,7 @@
 #associating sheet and codename when insert a sheet
 # sc-insert-sheet-codename.diff, i#80869, jianhua
 
-[ VBAObjects < ooh680-m4 ]
+[ VBAObjects < ooh680-m4 || < src680-m241 ]
 vba-brackets-params-fix.diff, i#79918, n#292861
 vba-negnumber-inparam-withoutbrackets.diff, n#294302
 
@@ -1422,7 +1430,7 @@
 # core changes not yet upstream
 sc-source-ui-vba-makefile-mk.diff
 
-[ VBAObjects < ooh680-m4 ]
+[ VBAObjects < ooh680-m4 || < src680-m241 ]
 # export of macro bindings for shapes
 sc-export-shape-macro-bindings-m3.diff, n#304739, noelpwer
 
@@ -1561,13 +1569,13 @@
 #scsolver-enable-extension.diff
 
 
-[ OOXML < ooh680-m4 ]
+[ OOXML < ooh680-m4 || < src680-m241 ]
 cws-xmlfilter02-sc-m3.diff
 
-[ OOXML >= ooh680-m4 ]
+[ OOXML >= ooh680-m4 || == src680-m241 ]
 cws-xmlfilter02-sc.diff
 
-[ OOXML ]
+[ OOXML < src680-m241 ]
 cws-xmlfilter02-config_office.diff
 cws-xmlfilter02-filter.diff
 cws-xmlfilter02-goodies.diff
@@ -1590,7 +1598,7 @@
 oox-depends-on-tools.diff, i#85614
 writerfilter-module-writer.diff
 
-[ OOXML < ooh680-m6 ]
+[ OOXML < ooh680-m6 || < src680-m241 ]
 gperf-3-is-needed-m5.diff
 
 [ OOXML >= ooh680-m6 ]
@@ -1667,7 +1675,7 @@
 cairo-config_office-configure-in.diff, i#70519, tml
 cairo-cairo-1-4-10-diff.diff, i#70519, tml
 
-[ cairocanvas < ooh680-m4 ]
+[ cairocanvas < ooh680-m4 || < src680-m241 ]
 # don't crash if xrender extension is not present
 cairo-canvas-fail-if-no-xrender.diff, i#84049, fridrich
 
@@ -1675,7 +1683,7 @@
 # Additional diffs for cairocanvas on Win32
 cairo-canvas-win32.diff, i#70519, n#300398, tml
 
-[ OpenGLTransitions < ooh680-m4 ]
+[ OpenGLTransitions < ooh680-m4 || < src680-m241 ]
 cws-transogl02-officecfg.diff
 cws-transogl02-sd.diff
 cws-transogl02-slideshow.diff
@@ -1745,7 +1753,7 @@
 [ FedoraFixes ]
 ooo64508.vcl.honourfontconfighinting.diff
 
-[ FedoraFixes < ooh680-m5 ]
+[ FedoraFixes < ooh680-m5 || < src680-m241 ]
 ooo84684.vcl.fixfontconfig.diff
 
 [ FedoraFixes ]
@@ -1876,13 +1884,13 @@
 novell-win32-avoid-premature-shutdown.diff
 
 
-[ WMF < ooh680-m4 ]
+[ WMF < ooh680-m4 || < src680-m241 ]
 wmf-pattern-brush-m3.diff, n#232232, rodo
 [ WMF >= ooh680-m4 ]
 wmf-pattern-brush.diff, n#232232, rodo
 
 
-[ Layout < ooh680-m2]
+[ Layout < ooh680-m2 || < src680-m241 ]
 SectionOwner => michael
 cws-awtfixes1.diff, i#78291, i#80754
 
@@ -1892,9 +1900,12 @@
 layout-svtools.diff
 
 
-[ LayoutDialogs]
+[ LayoutDialogs < src680-m241 ]
 SectionOwner => janneke
 layout-dialogs-config_office-scp2.diff
+
+[ LayoutDialogs >= src680-m241 ]
+layout-dialogs-config_office-scp2-src680.diff
 layout-dialogs-layout.diff
 layout-dialogs-svx-sw.diff
 layout-dialogs-transex3.diff
@@ -2057,7 +2068,7 @@
 cairocanvas-image-borders.diff, n#340142, rodo
 goodies-eps-filter-unix.diff, n#200053, rodo
 
-[ Fixes < ooh680-m3 ]
+[ Fixes < ooh680-m3 || < src680-m241 ]
 solaris-dont-depend-on-core10.diff, fridrich
 
 [ EMFPlus ]
@@ -2131,9 +2142,14 @@
 # split binfilter from core
 split-binfilter-filter.diff, i#79800
 split-binfilter-setup_native.diff, i#79800
+
+[ Split < src680-m241 ]
 split-binfilter-scp2.diff, i#79800
 
+[ Split >= src680-m241 ]
+##split-binfilter-scp2.diff, i#79800
 
+
 [ Win32Only ]
 mozilla-source-1.7.5.patch.diff, i#84961, tml
 
@@ -2153,7 +2169,7 @@
 [ Fixes ]
 sc-xclimpchangetrack-discard-bogus-formula-size.diff, n#355304, tml
 
-[ Fixes < ooh680-m6 ]
+[ Fixes < ooh680-m6 || < src680-m241 ]
 dmake-heap-corruption.diff, i#85381, tml
 
 [ Glib2 ]
Index: patches/apply.pl.in
===================================================================
--- patches/apply.pl.in	(revision 11534)
+++ patches/apply.pl.in	(working copy)
@@ -6,8 +6,7 @@
 sub get_search_paths()
 {
     my @paths = ();
-    my @search = split /:/, $options{'PATCHPATH'};
-
+    my @search = split /:/, $options{'PATCHPATH'}; # help emacs a bit /,
     for my $stem (@search) {
 	push @paths, "$patch_dir/$stem";
     }
@@ -143,11 +142,23 @@
     return lc($a) eq lc($b);
 }
 
-sub rules_pass($)
+sub rules_pass($$)
 {
     my $original_rule = shift;
     my $rule = $original_rule;
+    my $ignore_result = shift;
+    my $mws = $tag;
+    $mws =~ s/[-_].*//;
 
+    # if our milestone is present in rule, all no-matching leaves fail
+    if ($rule =~ /$mws/) {
+	$ignore_result = 0;
+    }
+    # or: LinuxOnly <= ooh680-m5 || <= src680-m240
+    if ($rule =~ /\s*([^\|]+)\s*\|\|\s*(.*)/) {
+	return rules_pass ($1, $ignore_result) || rules_pass ($2, $ignore_result);
+    }
+
     while ($rule ne '') {
 	my $lastrule = $rule;
 #	print "verify rule '$rule' vs '$tag'\n";
@@ -156,6 +167,7 @@
 	    # ignore milestones from other MWSes
 #	    print "ignoring rule '$rule' for '$tag'\n";
 	    $rule =~ s/[\!\<\=\>]+\s*(\S+)//;
+	    return $ignore_result;
 	} else {
 	    # equal to (==)
 	    if ($rule =~ s/\=\=\s*(\S+)// ) {
@@ -208,7 +220,7 @@
 	    unless exists $referenced_subsets{$target};
     }
 
-    $rules_passed = rules_pass ($rules);
+    $rules_passed = rules_pass ($rules, 1);
 
 #    if ($rules_passed) {
 #	printf "Rule '$rules' passed ['@targets']\n";
@@ -227,9 +239,9 @@
 
     foreach $line (@lines) {
         if ( $line =~ /\+\+\+ ([^\s]*)/ ) {
-            my $file = $1;
-            $file =~ s#[/]+#/#g;
-            push @dest, $file;
+            my $f = $1;
+            $f =~ s#[/]+#/#g;
+            push @dest, $f;
         }
     }
 
@@ -507,10 +519,10 @@
 
 	    # new section
             if (/\[\s*(.*)\]/) {
-                my $tmp = $1;
-                $tmp =~ s/\s+$//;
-#               print "Target: '$tmp'\n"; 
-		($rules_passed, @targets) = filter_targets($tmp);
+                my $tmp2 = $1;  # FIXME: naming
+                $tmp2 =~ s/\s+$//;
+#               print "Target: '$tmp2'\n"; 
+		($rules_passed, @targets) = filter_targets($tmp2);
 		$section_owner = 'unknown';
 		$section_issue = '';
 		$first_section_found = 1;

