Elendev / composer-push

Provide a `push` command to composer to push to repositories
Apache License 2.0
49 stars 29 forks source link

package sources should be in a folder in the zip file instead of being in root #1

Closed cooperl22 closed 5 years ago

cooperl22 commented 5 years ago

Hi @Elendev.

Zip files generated by this package before being sent to Nexus Repository have files directly stored at root path.

It seems that packages from packagist (composer public repository) have a root folder in the zip file.

here what happens with dependency while composer install or update from Nexus then:

Package operations: 101 installs, 0 updates, 0 removals
  - Installing cooperl/laravel-monitoring (0.0.1): Downloading (100%)
    Failed to execute unzip -qq  '/home/************/vendor/************/laravel-monitoring/9f4e0aea62e010dcfa22cf6199eb91d3.zip' -d '/home/************/vendor/composer/81d64773'

warning:  stripped absolute path spec from /composer.json
warning:  stripped absolute path spec from /src/LumenServiceProvider.php
warning:  stripped absolute path spec from /src/Contracts/Monitorer.php
warning:  stripped absolute path spec from /src/MonitoringLog.php
warning:  stripped absolute path spec from /src/Monitorer.php
warning:  stripped absolute path spec from /src/ServiceProvider.php
warning:  stripped absolute path spec from /src/Concerns/Monitorable.php
warning:  stripped absolute path spec from /src/Middleware/Monitore.php
warning:  stripped absolute path spec from /LICENSE.md
warning:  stripped absolute path spec from /config/monitoring.php
warning:  stripped absolute path spec from /README.md

    The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems)
    Unzip with unzip command failed, falling back to ZipArchive class

Best regards,

Elendev commented 5 years ago

Hello @cooperl22,

For this feature I've mimicked the composer archive behavior. I've also fixed some issues in the Nexus plugin regarding this behavior (https://github.com/sonatype-nexus-community/nexus-repository-composer/pull/27). I've not been able to reproduce your issue, but I'll change the way the archive is generated to put everything in a subdirectory to be aligned with what's provided by Packagist.

Elendev commented 5 years ago

@cooperl22 I've created the release 0.0.1-alpha2 with the fix in it.

cooperl22 commented 5 years ago

Hi @Elendev.

I think we could/should forget/remove alpha2. It doesn't fix my issue at all and worse it breaks autoloading when requiring my package in any project.

I don't know why but when I use previous alpha to push my package to Nexus repository then it works... not with alpha2.

Last commit should be reverted too. I really don't understand what happens because when package is unzipped in vendor folder it looks the same with alpha and alpha2.

I'm gonna try to find out the issue a little while...

Best regards,

Elendev commented 5 years ago

First: it would be greatly appreciated if you could start your issues / messages with a simple "Hello" and if you were a little bit more friendly. I invite you to take a look at https://www.contributor-covenant.org/version/1/4/code-of-conduct.

This aside, I've removed the release alpha-2 and I'll take a look when I have some time.

cooperl22 commented 5 years ago

Hi @Elendev.

First sorry if you didn't appeciate my lack of politeness but I don't think you need to get on your high horse for this. Plus I've read my previous posts and I really don't see where I'm not friendly but... if you say so...

Now here what I've found out.

I think the problem comes from Nexus Repository when it receives packages. here is the asset json metadata generated on the Nexus side:

{
  "packages": {
    "cooperl/laravel-monitoring": {
      "0.0.1": {
        "name": "cooperl/laravel-monitoring",
        "version": "0.0.1",
        "dist": {
          "url": "http://******.cooperl.net/nexus/repository/******/laravel-monitoring/0.0.1/cooperl-laravel-monitoring-0.0.1.zip",
          "type": "zip",
          "reference": "14f23738f811187a2e2607e8cfa50ceae97a3a3a",
          "shasum": "14f23738f811187a2e2607e8cfa50ceae97a3a3a"
        },
        "time": "2018-12-10T13:20:04+00:00",
        "uid": 3357042768,
        "autoload": {
          "psr-4": {
            "Cooperl\\Monitoring\\": "src/"
          }
        },
        "require": {
          "php": ">=7.0"
        },
        "authors": [
          {
            "name": "********** ***********",
            "email": "**********@**********"
          }
        ],
        "description": "Librairie de monitoring des flux",
        "extra": {
          "laravel": {
            "providers": [
              "Cooperl\\Monitoring\\ServiceProvider"
            ]
          },
          "nexus-push": {
            "url": "http://**********.cooperl.net/nexus/repository/composer-releases/",
            "username": "**********",
            "password": "**********"
          }
        },
        "keywords": [
          "monitoring",
          "logging",
          "journalisation",
          "flux",
          "intégration"
        ]
      },
      "0.0.2": {
        "name": "cooperl/laravel-monitoring",
        "version": "0.0.2",
        "dist": {
          "url": "http://******.cooperl.net/nexus/repository/**********/laravel-monitoring/0.0.2/cooperl-laravel-monitoring-0.0.2.zip",
          "type": "zip",
          "reference": "32341818091156ab48a7fb01b9685a12f8e6b8e3",
          "shasum": "32341818091156ab48a7fb01b9685a12f8e6b8e3"
        },
        "time": "2018-12-10T13:35:12+00:00",
        "uid": 2730047025
      }
    }
  }
}

The version 0.0.1 was generated with your alpha1 and the 0.0.2 with alpha2. As you can see a lot of properties miss with the alpha2.

Hope it can help you. But as I said my initial problem wasn't solved with alpha2 and it was just warning messages so you can forget it maybe...

Best regards,

Elendev commented 5 years ago

It looks like for the 0.0.2 the composer.json was not found. When the Nexus plugin doesn't find the composer.json file in the archive, it tries to generate an empty one.

On which system are you running composer ? Is it a Windows ? It might be related to this issue: The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems)

What's the exact content of the generated .zip file (the file tree) ?

Elendev commented 5 years ago

I've released v0.0.1-alpha3 that fixes the subdirectory issue. The package is now correctly generated in a subdirectory. @cooperl22 Can you confirm that this version works fine on your side ?

Nevertheless, I don't think it will fix the warnings you've mentioned initially in this issue because it might be related to your OS and your package.

cooperl22 commented 5 years ago

Hi @Elendev

Version v0.0.1-alpha3 works great.

It works great because I don't have the error I mentionned at the beginning. The problem with unzipping the archive is now gone!

Thank you very much

Elendev commented 5 years ago

@cooperl22 you are welcome !