satis icon indicating copy to clipboard operation
satis copied to clipboard

Using an 'artifact' repo results in bad links and bad dist files

Open GaryRogers opened this issue 11 years ago • 11 comments

Using an artifact repository results in bad links, and misnamed files in the dist directory.

{
    "name": "My Repository",
    "homepage": "http://localhost/artifacts",
    "repositories": [
        { "type": "artifact", "url": "./packages" }
    ],
        "archive": {
            "directory": "dist",
            "format": "tar"
        },  
    "require-all": true
}

creates links like: http://localhost/artifacts/dist/local-mypackage-1.0.5.7-local-mypackage-1.0.5.7.zip.tar as well as the corresponding .zip.tar files in dist

GaryRogers avatar May 30 '14 16:05 GaryRogers

What do you mean by links? I don't see how the homepage is connected to the artifact repo at all.. Or is the problem only occurring when creating archives? Please give more details.

Seldaek avatar Jun 07 '14 15:06 Seldaek

Ah nevermind I missed the fact that this was reported on the satis repo, it makes more sense now ;)

Seldaek avatar Jun 07 '14 15:06 Seldaek

Is this still an issue?

alcohol avatar Nov 21 '15 11:11 alcohol

The problem lies in the fact that the artifact repository's url parameter, which represents the path the artifacts reside in on the filesystem, is being used to form the package URL. Since the artifacts need to be exposed in the webroot (ie. the output dir for the satis build command), there's a mismatch between the physical location on the filesystem and the relative path to the package from Satis' web root.

I've tagged this issue in a commit on a fork I made of this repo. The fix is by far complete; I'm new to Satis and this is what I've been able to come up with after an hour or so trying to reverse engineer the way it works. Maybe the commit illustrates the problem and someone's able to come up with a more robust fix.

leonboot avatar Mar 15 '16 11:03 leonboot

is this merged? facing the same issue!

jtanmay-dev avatar Mar 06 '17 21:03 jtanmay-dev

Merged? This is an issue, not a pull-request.

alcohol avatar Mar 07 '17 08:03 alcohol

Yep. I thought @leonboot would have already sent the pull request, as he fixed it over a year ago! :)

jtanmay-dev avatar Mar 07 '17 18:03 jtanmay-dev

@jtanmay-dev I haven't filed a pull request, since I'm not sure the fix is complete or even correct. I haven't studied the innards of Satis well enough, so I thought I'd share what I did as a pointer for someone more qualified. But given the fact it's been over a year ago, I might have to consider having a second go at it and improve upon the fix and file a PR.

leonboot avatar Mar 08 '17 07:03 leonboot

Here's a workaround to use the fix @leonboot made:

git remote add nedbase https://github.com/nedbase/satis.git
git pull all
git cherry-pick fb54ffc2b5

Note: You have to add a url-prefix for the location of the zips, eg:

{ "type": "artifact", "url": "zips", "url-prefix": "https://your.url.here/zips/" },

forsvunnet avatar Aug 28 '17 10:08 forsvunnet

I created a sh script that replaces the relative url with an absolute url after generating the package lists

cd satisfy && /opt/plesk/php/7.1/bin/php bin/satis build satis.json web \;
cd web/include && find . -type f -exec sed -i 's#"url": "packages/#"url": "https://packages.example.org/packages/#g' {} \;

poldixd avatar Nov 15 '17 11:11 poldixd

Hi I found a workaround without using fix or additional scripts

I created a folder /data where I put module zip files

I have the following satis configuration:

{
    "name": "My Composer Repo",  
    "homepage": "http://satis.mydomain.com/" ,
    "repositories": [
        {
          "type": "artifact",
          "url": "/data"
        }
    ],
    "archive": {
        "directory": "data",
        "format": "zip",
        "prefix-url": "http:/satis.mydomain.com"
    },
    "require-all":true,
    "require-dependencies":true,
    "require-dev-dependencies":true,
    "minimum-stability":"dev"
}

This way satis finds the zips and indexes them. But at this point you are not able to download a zip file.

You also have to add a symlink: ln -s /data/ /satisfy/web/

Now everything works.

MarWestermann avatar Jul 27 '18 09:07 MarWestermann