emerge 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/commands/upload/snapshots/snapshots.rb +20 -9
- data/lib/version.rb +1 -1
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 65f13db01f807a85200615394b091f5bfea4cd3bf4cf4f94ec0a742d5b93c597
         | 
| 4 | 
            +
              data.tar.gz: 322a6582fd941518f080ae8d38af3555a404e295a99658083d5032a0127640d9
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 6e7adb6bafb19cec3408a3e866d9a148ebe99cf80dde147c47f9133fad0a6d8e7e655a2bfdce7ece4be9596235c650d7abf60ef07f899f30a0a700ef40eccb03
         | 
| 7 | 
            +
              data.tar.gz: 9ee165532fb1443fda2f5dce215bb545b9a9997d6684cc5e36d3b18de416a73496779dad9685fac1a03735d327077f040dcd4b17050027abe1accaf7ec1562f8
         | 
| @@ -68,7 +68,7 @@ module EmergeCLI | |
| 68 68 |  | 
| 69 69 | 
             
                          image_files = @profiler.measure('find_image_files') { find_image_files(client) }
         | 
| 70 70 |  | 
| 71 | 
            -
                           | 
| 71 | 
            +
                          check_duplicate_files(image_files, client)
         | 
| 72 72 |  | 
| 73 73 | 
             
                          run_id = @profiler.measure('create_run') { create_run }
         | 
| 74 74 |  | 
| @@ -130,18 +130,26 @@ module EmergeCLI | |
| 130 130 | 
             
                      found_images
         | 
| 131 131 | 
             
                    end
         | 
| 132 132 |  | 
| 133 | 
            -
                    def check_duplicate_files(image_files,  | 
| 133 | 
            +
                    def check_duplicate_files(image_files, _client)
         | 
| 134 134 | 
             
                      seen_files = {}
         | 
| 135 | 
            +
                      duplicate_files = {}
         | 
| 136 | 
            +
             | 
| 135 137 | 
             
                      image_files.each do |image_path|
         | 
| 136 | 
            -
                        file_name =  | 
| 138 | 
            +
                        file_name = File.basename(image_path)
         | 
| 137 139 |  | 
| 138 140 | 
             
                        if seen_files[file_name]
         | 
| 139 | 
            -
                           | 
| 140 | 
            -
             | 
| 141 | 
            -
             | 
| 141 | 
            +
                          duplicate_files[file_name] ||= []
         | 
| 142 | 
            +
                          duplicate_files[file_name] << image_path
         | 
| 143 | 
            +
                        else
         | 
| 144 | 
            +
                          seen_files[file_name] = image_path
         | 
| 142 145 | 
             
                        end
         | 
| 143 | 
            -
                        seen_files[file_name] = image_path
         | 
| 144 146 | 
             
                      end
         | 
| 147 | 
            +
             | 
| 148 | 
            +
                      duplicate_files.each do |filename, paths|
         | 
| 149 | 
            +
                        Logger.warn "Found #{paths.length} duplicate(s) of '#{filename}'. Duplicates: #{paths.join(', ')}"
         | 
| 150 | 
            +
                      end
         | 
| 151 | 
            +
             | 
| 152 | 
            +
                      [seen_files, duplicate_files]
         | 
| 145 153 | 
             
                    end
         | 
| 146 154 |  | 
| 147 155 | 
             
                    def create_run
         | 
| @@ -201,6 +209,8 @@ module EmergeCLI | |
| 201 209 | 
             
                        errors: []
         | 
| 202 210 | 
             
                      }
         | 
| 203 211 |  | 
| 212 | 
            +
                      used_filenames, = check_duplicate_files(image_files, client)
         | 
| 213 | 
            +
             | 
| 204 214 | 
             
                      @profiler.measure('process_image_metadata') do
         | 
| 205 215 | 
             
                        image_files.each do |image_path|
         | 
| 206 216 | 
             
                          metadata_semaphore.async do
         | 
| @@ -236,8 +246,9 @@ module EmergeCLI | |
| 236 246 | 
             
                            zipfile.get_output_stream('manifest.json') { |f| f.write(JSON.generate(image_metadata)) }
         | 
| 237 247 |  | 
| 238 248 | 
             
                            image_files.each do |image_path|
         | 
| 239 | 
            -
                               | 
| 240 | 
            -
                               | 
| 249 | 
            +
                              filename = File.basename(image_path)
         | 
| 250 | 
            +
                              # Only add files we haven't seen before
         | 
| 251 | 
            +
                              zipfile.add(filename, image_path) if used_filenames[filename] == image_path
         | 
| 241 252 | 
             
                            end
         | 
| 242 253 | 
             
                          end
         | 
| 243 254 | 
             
                        end
         | 
    
        data/lib/version.rb
    CHANGED