Skip to content

Unable to copy file while adding licenses #180

@Dartui

Description

@Dartui

I was testing latest changes from master and found out that there is an issue with Adding licenses... step. I don't know whether this is known issue but thought that I will share it anyway.

composer update brianhenryie/strauss              
Loading composer repositories with package information
Updating dependencies
Lock file operations: 2 installs, 1 update, 0 removals
  - Upgrading brianhenryie/strauss (0.19.5 => dev-master 74a2810)
  - Locking elazar/flystream (1.3.0)
  - Locking league/flysystem-memory (3.29.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 2 installs, 1 update, 0 removals
  - Downloading league/flysystem-memory (3.29.0)
  - Downloading elazar/flystream (1.3.0)
  - Downloading brianhenryie/strauss (dev-master 74a2810)
  - Installing league/flysystem-memory (3.29.0): Extracting archive
  - Installing elazar/flystream (1.3.0): Extracting archive
  - Upgrading brianhenryie/strauss (0.19.5 => dev-master 74a2810): Extracting archive
Generating autoload files
83 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> strauss
[notice] Starting... 
[notice] Loading package...
[notice] Loading composer.json config...
[notice] Loading cli config...
[notice] Building dependency list...
[notice] Enumerating files...
[notice] Copying files...
[notice] Copying files
[notice] Determining changes...
[notice] Performing replacements...
[notice] Adding licenses...
[error] Unable to copy file from [PLUGIN_DIR]/vendor/composer/spdx-licenses/res to from [PLUGIN_DIR]/dependencies/composer/spdx-licenses/res, because copy(): The first argument to copy() function cannot be a directory
Script strauss handling the prefix-namespaces-dev event returned with error code 1
Script @prefix-namespaces-dev was called via post-update-cmd

It seems that regex for detecting license files considers directories with "license" in the name as license file.

https://github.com/BrianHenryIE/strauss/blob/74a281090db4a1afdefbb5a9dd7977dd7d3e0cdc/src/Pipeline/Licenser.php#L154-156

Here is a dump of found license files from $this->getDiscoveredLicenseFiles() method:

...
  [11]=>
  string(73) "[PLUGIN_DIR]/vendor/composer/metadata-minifier/LICENSE"
  [12]=>
  string(62) "[PLUGIN_DIR]/vendor/composer/semver/LICENSE"
  [13]=>
  string(65) "[PLUGIN_DIR]/vendor/composer/spdx-licenses/res"
  [14]=>
  string(86) "[PLUGIN_DIR]/vendor/composer/spdx-licenses/res/spdx-exceptions.json"
  [15]=>
  string(84) "[PLUGIN_DIR]/vendor/composer/spdx-licenses/res/spdx-licenses.json"
  [16]=>
  string(69) "[PLUGIN_DIR]/vendor/composer/spdx-licenses/LICENSE"
  [17]=>
  string(74) "[PLUGIN_DIR]/vendor/composer/spdx-licenses/CHANGELOG.md"
  [18]=>
  string(71) "[PLUGIN_DIR]/vendor/composer/spdx-licenses/README.md"
  [19]=>
  string(79) "[PLUGIN_DIR]/vendor/composer/spdx-licenses/phpstan.neon.dist"
  [20]=>
  string(69) "[PLUGIN_DIR]/vendor/composer/spdx-licenses/.github"
  [21]=>
  string(79) "[PLUGIN_DIR]/vendor/composer/spdx-licenses/.github/workflows"
  [22]=>
  string(88) "[PLUGIN_DIR]/vendor/composer/spdx-licenses/.github/workflows/lint.yml"
  [23]=>
  string(106) "[PLUGIN_DIR]/vendor/composer/spdx-licenses/.github/workflows/continuous-integration.yml"
  [24]=>
  string(91) "[PLUGIN_DIR]/vendor/composer/spdx-licenses/.github/workflows/phpstan.yml"
  [25]=>
  string(75) "[PLUGIN_DIR]/vendor/composer/spdx-licenses/composer.json"
  [26]=>
  string(65) "[PLUGIN_DIR]/vendor/composer/spdx-licenses/src"
  [27]=>
  string(82) "[PLUGIN_DIR]/vendor/composer/spdx-licenses/src/SpdxLicenses.php"
  [28]=>
  string(70) "[PLUGIN_DIR]/vendor/composer/xdebug-handler/LICENSE"
  [29]=>
  string(72) "[PLUGIN_DIR]/vendor/justinrainbow/json-schema/LICENSE"
  [30]=>
  string(60) "[PLUGIN_DIR]/vendor/seld/jsonlint/LICENSE"
...

Is there any case in which script needs to operate on directories and files instead of only on files?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions