diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2019-07-16 12:06:47 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-07-17 08:09:52 +0200 |
commit | cabadfc288e5e7324723c62f36b918a80db90323 (patch) | |
tree | 93d4570bf43a38bbfb1b7c148f71deec89b6ed39 /solenv | |
parent | 6d1e550df7fc4f710e15b6f5d63a58587a952378 (diff) |
Introduce gb_Package_add_empty_directories
...which will be needed in a subsequent patch to fix tdf#125693.
The installer code could not handle a directory in a .filelist, the simplest
hack appears to be to add a special case for an empty source dir to
copy_one_file in solenv/bin/modules/installer/systemactions.pm.
Includes changes made by Stephan Bergmann <sbergman@redhat.com>.
Change-Id: I52dca2543a66eb76117598d77d559592e26ce859
Reviewed-on: https://gerrit.libreoffice.org/75702
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'solenv')
-rw-r--r-- | solenv/bin/modules/installer/systemactions.pm | 14 | ||||
-rw-r--r-- | solenv/gbuild/Package.mk | 20 |
2 files changed, 34 insertions, 0 deletions
diff --git a/solenv/bin/modules/installer/systemactions.pm b/solenv/bin/modules/installer/systemactions.pm index 9b12ff63c271..4f7a18bba5e6 100644 --- a/solenv/bin/modules/installer/systemactions.pm +++ b/solenv/bin/modules/installer/systemactions.pm @@ -277,6 +277,16 @@ sub create_directories # Copying one file ######################## +sub is_empty_dir +{ + my ($dir) = @_; + my ($handle, $count); + opendir($handle, $dir) or return 0; + $count = scalar(grep { $_ ne '.' && $_ ne '..' } readdir($handle)); + closedir($handle); + return $count == 0; +} + sub copy_one_file { my ($source, $dest) = @_; @@ -286,6 +296,10 @@ sub copy_one_file if ( -l $source ) { $copyreturn = symlink(readlink("$source"), "$dest"); } + elsif (-d $source && is_empty_dir($source)) { + my $mode = (stat($source))[2] & 07777; + $copyreturn = mkdir($dest, $mode); + } else { $copyreturn = copy($source, $dest); } diff --git a/solenv/gbuild/Package.mk b/solenv/gbuild/Package.mk index b1f2c2f2cfe0..45a56ff44478 100644 --- a/solenv/gbuild/Package.mk +++ b/solenv/gbuild/Package.mk @@ -129,6 +129,26 @@ gb_Package_OUTDIR_$(1) := $(2) endef +# Add empty directory (if it's non-empty, don't use this, use +# gb_Package_add_file for the files in it instead!) +define gb_Package_add_empty_directory +$(call gb_Package__check,$(1)) +$(if $(strip $(2)),,$(call gb_Output_error,gb_Package_add_directory requires 2 arguments)) +$(call gb_Package_get_target,$(1)) :| $$(gb_Package_OUTDIR_$(1))/$(2)/.dir +gb_Package_$(1)_FILES += $$(gb_Package_OUTDIR_$(1))/$(2) +$(call gb_Package_get_clean_target,$(1)) : FILES += $$(gb_Package_OUTDIR_$(1))/$(2) + +endef + +# Example: +# $(eval $(call gb_Package_add_empty_directories,foo_inc,inc/foo)) +# # -> inc/foo +define gb_Package_add_empty_directories +$(call gb_Package__check,$(1)) +$(foreach file,$(2),$(call gb_Package_add_empty_directory,$(1),$(file))) + +endef + define gb_Package_add_symbolic_link $(call gb_Package__check,$(1)) $(if $(strip $(3)),,$(call gb_Output_error,gb_Package_add_symbolic_link requires 3 arguments)) |