X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=febootstrap.ml;h=7e48206e88ac6e3f97a9cda80fbcb3a16c80074e;hb=df569d49aa10af5995f771362ddc1400f16486e8;hp=9ea9885bc0a4915b1888598f5228d3678ba31ab6;hpb=0b4b977ff5ac03ee1efd5779ce134091433ff07e;p=febootstrap.git diff --git a/febootstrap.ml b/febootstrap.ml index 9ea9885..7e48206 100644 --- a/febootstrap.ml +++ b/febootstrap.ml @@ -72,6 +72,20 @@ let () = ) packages ) in + (* Canonicalize the name of directories, so that /a and /a/ are the same. *) + let files = + List.map ( + fun (filename, ft, pkg) -> + let len = String.length filename in + let filename = + if len > 1 (* don't rewrite "/" *) && ft.ft_dir + && filename.[len-1] = '/' then + String.sub filename 0 (len-1) + else + filename in + (filename, ft, pkg) + ) files in + (* Sort and combine duplicate files. *) let files = let files = List.sort compare files in @@ -79,16 +93,24 @@ let () = let combine (name1, ft1, pkg1) (name2, ft2, pkg2) = (* Rules for combining files. *) if ft1.ft_config || ft2.ft_config then ( - eprintf "febootstrap: error: %s is a config file which is listed in two packages (%s, %s)\n" - name1 pkg1 pkg2; - exit 1 - ); - if (ft1.ft_dir || ft2.ft_dir) && (not (ft1.ft_dir && ft2.ft_dir)) then ( + (* It's a fairly frequent bug in Fedora for two packages to + * incorrectly list the same config file. Allow this, provided + * the size of both files is 0. + *) + if ft1.ft_size = 0 && ft2.ft_size = 0 then + (name1, ft1, pkg1) + else ( + eprintf "febootstrap: error: %s is a config file which is listed in two packages (%s, %s)\n" + name1 pkg1 pkg2; + exit 1 + ) + ) + else if (ft1.ft_dir || ft2.ft_dir) && (not (ft1.ft_dir && ft2.ft_dir)) then ( eprintf "febootstrap: error: %s appears as both directory and ordinary file (%s, %s)\n" name1 pkg1 pkg2; exit 1 - ); - if ft1.ft_ghost then + ) + else if ft1.ft_ghost then (name2, ft2, pkg2) else (name1, ft1, pkg1) @@ -126,7 +148,8 @@ let () = else ( insert_dir parent; let newdir = (parent, { ft_dir = true; ft_config = false; - ft_ghost = false; ft_mode = 0o40755 }, + ft_ghost = false; ft_mode = 0o40755; + ft_size = 0 }, "") in newdir :: loop parent ) @@ -140,12 +163,12 @@ let () = if false then ( List.iter ( fun (name, { ft_dir = dir; ft_ghost = ghost; ft_config = config; - ft_mode = mode }, pkg) -> - printf "%s [%s%s%s%o] from %s\n" name + ft_mode = mode; ft_size = size }, pkg) -> + printf "%s [%s%s%s%o %d] from %s\n" name (if dir then "dir " else "") (if ghost then "ghost " else "") (if config then "config " else "") - mode + mode size pkg ) files );