esm-tools / esm_master

GNU General Public License v2.0
2 stars 2 forks source link

Hotfix/recomp standalone bin #19

Closed mandresm closed 4 years ago

mandresm commented 4 years ago

This solves a problem in issue esm-tools/esm_tools#77.

Recompilation of ECHAM was successful, but if a binary existed in the bin folder (i.e. echam-6.3.04p1/bin/echam6), the following lines will find it out and avoid entering in the if that builds the command for copying the binary from the src to the bin folder:

                            toplevel_bin_path = (
                                toplevel + "/"
                                + task.package.bin_type + "/"
                                + binfile.split("/")[-1]
                            )
                            if not os.path.exists(toplevel_bin_path):
                                command_list.append(
                                    "cp "
                                    + task.package.destination
                                    + "/"
                                    + binfile
                                    + " "
                                    + toplevel
                                    + "/"
                                    + task.package.bin_type
                                )
                                real_command_list.append(
                                    "cp "
                                    + task.package.destination
                                    + "/"
                                    + binfile
                                    + " "
                                    + toplevel
                                    + "/"
                                    + task.package.bin_type
                                )

This was solved by checking if there is already a rm -f command in the command_list and, if that exists, it means that the toplevel_bin_path file is going to be deleted and and the if that copies the binary is allowed.

pgierz commented 4 years ago

Might it be sensible to check the creation time?

mandresm commented 4 years ago

Might it be sensible to check the creation time?

If rm -f echam-6.3.04p1/bin/echam6 is already in the command_list doesn't it mean that the user is already trying to clean it, and that at the time of the copying, the binary won't exist anyway in the echam-6.3.04p1/bin folder?

Why would we then need to check the creation time?