diff options
| author | tony mancill <tmancill@debian.org> | 2022-01-04 16:18:35 -0800 |
|---|---|---|
| committer | tony mancill <tmancill@debian.org> | 2022-01-04 16:18:35 -0800 |
| commit | d47341d71ff3df889c1180eb7bfb4fc0272eb26b (patch) | |
| tree | 3619a37fe6de8027375348f068d463b5c69add1a /samples/make_contents.cmake | |
| parent | 941d45887769621879b83292f167142951977d69 (diff) | |
New upstream version 2.5.4+repackupstream/2.5.4+repack
Diffstat (limited to 'samples/make_contents.cmake')
| -rw-r--r-- | samples/make_contents.cmake | 107 |
1 files changed, 0 insertions, 107 deletions
diff --git a/samples/make_contents.cmake b/samples/make_contents.cmake deleted file mode 100644 index 42f2bead..00000000 --- a/samples/make_contents.cmake +++ /dev/null @@ -1,107 +0,0 @@ -string (REPLACE " " ";" FILES ${FILES}) # make back into a list - -function(JOIN VALUES GLUE OUTPUT) - string (REGEX REPLACE "([^\\]|^);" "\\1${GLUE}" _TMP_STR "${VALUES}") - string (REGEX REPLACE "[\\](.)" "\\1" _TMP_STR "${_TMP_STR}") #fixes escaping - set (${OUTPUT} "${_TMP_STR}" PARENT_SCOPE) -endfunction() - -function (indent) - foreach (temp RANGE ${level}) - file (APPEND ${contents_file} " ") - endforeach () -endfunction () - -function (end_entry) - file (APPEND ${contents_file} "\n") - set(first 0 PARENT_SCOPE) - math (EXPR level "${level} - 1") - indent () - file (APPEND ${contents_file} "]\n") - math (EXPR level "${level} - 2") - indent () - file (APPEND ${contents_file} "}") - string (FIND "${dirs}" "${cwd}" pos) - set (level ${level} PARENT_SCOPE) -endfunction () - -file (WRITE ${contents_file} "[") -set (cwd) -set (level 0) -set (first 1) -list (SORT FILES) -foreach (file IN LISTS FILES) - string (REGEX MATCHALL "[^/]*/" dirs "${file}") - string (REPLACE "/" "" dirs "${dirs}") - string (REGEX MATCH "[^/]*$" name "${file}") - string (FIND "${dirs}" "${cwd}" pos) - list (LENGTH cwd cwd_count) - if (${pos} EQUAL 0) - # same root - while (${cwd_count} GREATER 0) - list (REMOVE_AT dirs 0) - math (EXPR cwd_count "${cwd_count} - 1") - endwhile () - else () - # reduce cwd until matched - while ((NOT ${pos} EQUAL 0) AND ${cwd_count} GREATER 0) - math (EXPR cwd_count "${cwd_count} - 1") - list (REMOVE_AT cwd ${cwd_count}) - string (FIND "${dirs}" "${cwd}" pos) - end_entry () - endwhile () - # back to same root - while (${cwd_count} GREATER 0) - list (REMOVE_AT dirs 0) - math (EXPR cwd_count "${cwd_count} - 1") - endwhile () - endif () - list (LENGTH cwd cwd_count) - list (LENGTH dirs path_count) - while (${path_count} GREATER 0) - list (GET dirs 0 dir) - list (APPEND cwd "${dir}") - list (REMOVE_AT dirs 0) - if (${first}) - file (APPEND ${contents_file} "\n") - set (first 0) - else () - file (APPEND ${contents_file} ",\n") - endif () - indent () - file (APPEND ${contents_file} "{\n") - math (EXPR level "${level} + 1") - indent () - file (APPEND ${contents_file} "\"type\": \"directory\",\n") - indent () - file (APPEND ${contents_file} "\"name\": \"${dir}\",\n") - indent () - file (APPEND ${contents_file} "\"entries\": [") - set (first 1) - math (EXPR level "${level} + 2") - math (EXPR path_count "${path_count} - 1") - endwhile () - JOIN ("${cwd}" "/" path) - file (COPY "${file}" DESTINATION "${DEST}/web/samples/${path}") - if (${first}) - file (APPEND ${contents_file} "\n") - set (first 0) - else () - file (APPEND ${contents_file} ",\n") - endif () - indent () - file (APPEND ${contents_file} "{\n") - math (EXPR level "${level} + 1") - indent () - file (APPEND ${contents_file} "\"type\": \"file\",\n") - indent () - file (APPEND ${contents_file} "\"name\": \"${name}\"\n") - math (EXPR level "${level} - 1") - indent () - file (APPEND ${contents_file} "}") - set (first 0) -endforeach () -if (${level} GREATER 1) - end_entry () -endif () -file (APPEND ${contents_file} "\n]\n") |
