Bug 1047510 - Review Request: php-opencloud - PHP SDK for OpenStack/Rackspace APIs
Summary: Review Request: php-opencloud - PHP SDK for OpenStack/Rackspace APIs
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: Package Review
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Adam Williamson
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-12-31 12:46 UTC by Gregor Tätzner
Modified: 2014-11-05 15:07 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-01-30 09:37:42 UTC
Type: ---
Embargoed:
awilliam: fedora-review+
gwync: fedora-cvs+


Attachments (Terms of Use)

Description Gregor Tätzner 2013-12-31 12:46:27 UTC
Spec URL: http://brummbq.fedorapeople.org/php-opencloud.spec
SRPM URL: http://brummbq.fedorapeople.org/php-opencloud-1.6.0-1.fc19.src.rpm
Description: The PHP SDK should work with most OpenStack-based cloud deployments, though it
specifically targets the Rackspace public cloud. In general, whenever a
Rackspace deployment is substantially different than a pure OpenStack one, a
separate Rackspace subclass is provided so that you can still use the SDK with
a pure OpenStack instance (for example, see the OpenStack class (for OpenStack)
and the Rackspace subclass).
Fedora Account System Username: brummbq

this lib is mainly intended for owncloud 6. For that reason I'm sticking here to the old release 1.6 until owncloud updates to 1.8 or later. php-opencloud replaces php-cloudfiles

Comment 1 Remi Collet 2013-12-31 13:47:05 UTC
Quick notes:

See https://github.com/rackspace/php-opencloud/blob/master/composer.json

There are some additional dependencies.
guzzle/http (mandatory)
guzzle/plugin-mock
guzzle/plugin-log
psr/log

As this library is PSR-0 compliant, it will be cleaner to install it so any PSR-0 aware app can load it, simply relying on include patch [1], so 
   /usr/share/php/OpenCloud

You can drop the "lib/php-opencloud.php" (this file is composer specific).

composer.json don't need to be installed (so can add it in %doc if you want, as it provides some interesting info).


[1] See http://fedoraproject.org/wiki/Packaging:PHP#File_Placement

Comment 2 Gregor Tätzner 2013-12-31 16:23:48 UTC
(In reply to Remi Collet from comment #1)
> Quick notes:
> As this library is PSR-0 compliant, it will be cleaner to install it so any
> PSR-0 aware app can load it, simply relying on include patch [1], so 
>    /usr/share/php/OpenCloud
> 
> You can drop the "lib/php-opencloud.php" (this file is composer specific).

makes sense, but what to do with the autoloader? Note that the old 1.6.0 contains some more files in lib.

owncloud, on the other side, requires lib/openstack.php which registers all classes, I assume.

Comment 3 Remi Collet 2013-12-31 17:31:44 UTC
Ok, my mistake, I have look in master (so 1.8.x).

1.6 is not really PSR-0 compliant because of those files

In all case for 1.8 you will have to either
- provide a working autoloader (not relying on composer)
- adapt owncloud autoloader to be able to load this PSR-0 library

Second seems better .

Comment 4 Remi Collet 2013-12-31 17:33:09 UTC
lib/openstack.php => load php-opencloud.php => load Autoload.php (which is the composer autoloader, "bundled"), so really should drop all those files.

Comment 5 Adam Williamson 2014-01-02 04:27:28 UTC
I've been looking into making OC's loading of 3rdparty libs for apps sane today. AFAICS, OwnCloud's autoloader doesn't handle libs in apps/some_app/3rdparty directories. It only handles core stuff. It might be nice to make it handle this well - something like look in apps/some_app/3rdparty when something from apps/some_app tries to access a function - but I don't think it's trivial, and I'm not sure they'd want to take patches which simply added apps/some_app/3rdparty/foo to the autoloader *unconditionally*.

right now I'm working on a patch set which would make all apps consistent in how they do things: add some_app/3rdparty to the include_path, then require_once whatever they need to require relative to that. But for us not to carry patches downstream, that does require us to use the same layout in /usr/share/php or /usr/share/pear or whatever that OC has in some_app/3rdparty .

Comment 6 Adam Williamson 2014-01-02 04:30:45 UTC
Upstream is very responsive, though, and I doubt they particularly *care* about the directory layouts under 3rdparty/ directories. I suspect we might get mileage out of submitting patches upstream to make *their* layout match *ours*, when we don't want to make *our* layout match *theirs*. Especially if we can make a good case for the change, like here, for PSR-0 compliance.

Comment 7 Remi Collet 2014-01-02 14:46:36 UTC
Hmm... shouldn't both layout match upstream layout ? ;)

So it should only be a matter of root tree path ?
Have you specific case with layout issue ?

Comment 8 Adam Williamson 2014-01-02 18:17:38 UTC
"shouldn't both layout match upstream layout ? ;)"

I'm not entirely sure about that, actually, and we should probably have a policy. I find layouts like this pretty ugly:

/usr/share/php/foo/lib/monkeys/hellolookshiny/here_are_the_damn_libraries_at_last/*.php

but that's how upstreams frequently provide things - there's a bunch of bumpf in one, two or even three directory levels above where the actual bit we care about is. In theory we could strip those.

But probably it's safest just to replicate the layout of upstream's most preferred static distribution method for non-PSR0 stuff, I guess, and ensure Debian and OC do the same (with the 'root' as /usr/share/php for distros and owncloud/3rdparty for OC, of course). Which is what Gregor did for php-opencloud 1.6.0 indeed.

Comment 9 Adam Williamson 2014-01-03 00:19:09 UTC
Oh, I do see an issue here, though not necessarily ours: Debian stripped the directory structure in their 1.6.0 package. They dropped the lib/ directory and moved the autoloader and the legacy entry points up to /usr/share/php/php-opencloud .

OwnCloud keeps the lib/ directory, like we do, so we can unbundle cleanly with this layout, but we're inconsistent with Debian, and I'm hoping to keep those lined up.

It should all go away for 1.8, though, so possibly not a huge deal.

Comment 10 Gregor Tätzner 2014-01-03 22:06:44 UTC
Spec URL: http://brummbq.fedorapeople.org/php-opencloud.spec
SRPM URL: http://brummbq.fedorapeople.org/php-opencloud-1.6.0-2.fc19.src.rpm

I've followed remis suggestion from comment 1 and moved the lib to php/OpenStack. The autoloader files aren't part of this pkg any more.

@adam
as it turns out the owncloud autoloader is quite capable of loading psr-0 libs. Thanks to your autoloader-relative branch the loader picks the openstack classes up without a problem. You just need to set the proper include_path.

Comment 11 Adam Williamson 2014-01-03 23:11:18 UTC
Gregor: I'm still buried deep in autoloader theory, but I'm starting to think my approach is bad and yours is good. The convention seems to be to be relatively conservative with autoloading: only use it on classes that are explicitly registered with it, and have the autoloader implement some kind of prefix handling rather than using the include_path.

I'll probably send an alternative PR which is closer to your approach, but tries to be efficient for the case where upstream's 3rdparty directory is present. I'm currently studying the Composer autoloader, which is quite an advanced one, for hints.

I *do* think any reasonable autoloader implementation ought to try loading the PSR-0 (or PSR-4! look that one up :/) class path relative to the defined include path as a fallback if it can't find the class any other way, which is roughly the approach you took. At least, this morning I do. Maybe this afternoon I'll find another layer of this onion and change my mind :/

Comment 12 Adam Williamson 2014-01-04 08:00:57 UTC
My new PR for OC's autoloader is https://github.com/owncloud/core/pull/6628 . It should still find anything that's in a PSR-0 compliant location wrt the include_path, and so does your patch that we currently use. So packaging it this way should be fine for OC, but might possibly be a problem for anything else which tries to include php-opencloud's autoloader and doesn't have its own autoloader. still, upstream 1.8 expects you to bring your own autoloader (possibly via composer) anyway, so doesn't seem like a huge issue.

Comment 13 Adam Williamson 2014-01-04 08:03:29 UTC
Oh, for composer stuff - composer's autoloader has the ability to fall back to trying to load the PSR-0 class path relative to the system include path (which is what we're implicitly expecting when we package things such that they're PSR-0 compliant wrt /usr/share/php) but it has a boolean that controls that function and it defaults to false. Still, that just means we'd have to flip one switch for anything that uses composer's autoloader to find our system copies of things.

Comment 14 Adam Williamson 2014-01-14 20:52:45 UTC
Would it be sensible to include upstream's samples/ and docs/ as docs?

Comment 15 Gregor Tätzner 2014-01-22 19:15:14 UTC
(In reply to Adam Williamson from comment #14)
> Would it be sensible to include upstream's samples/ and docs/ as docs?

What do you mean? I'm doing that right now in doc subpkg, not?

Comment 16 Adam Williamson 2014-01-24 23:48:46 UTC
"What do you mean? I'm doing that right now in doc subpkg, not?"

Whoops, indeed you are - I missed that.

As Remi doesn't seem to be taking the review, I guess I will.

Comment 17 Adam Williamson 2014-01-25 00:30:25 UTC
rpmlint
-------

php-opencloud-doc.noarch: W: wrong-file-end-of-line-encoding /usr/share/doc/php-opencloud-doc/docs/api/css/jquery.treeview.css
php-opencloud.src: W: strange-permission php-opencloud-1.6.0.tar.gz 0600L

not blockers, but worth fixing.

Comment 18 Adam Williamson 2014-01-25 00:35:35 UTC
phpcompatinfo gives date, hash, json and pcre extensions, all listed in the spec - looks fine.

Comment 19 Adam Williamson 2014-01-25 00:59:53 UTC
https://fedoraproject.org/wiki/Packaging:SourceURL#Github seems fairly clear that a commit ID should be used for github sourced projects if they don't have some kind of 'external to github' tarball distribution, though I'm not sure if it's really *meant* to.

Comment 20 Adam Williamson 2014-01-25 01:06:26 UTC
Aside from the above, looks good. c#17 and c#18 are not blockers. c#19 may be, at least I'd like you to consider it and give an opinion before approving the review. If you disagree with the guideline, we might want to ask FPC to clarify it.

https://fedorahosted.org/fpc/ticket/233

does seem to suggest they explicitly considered the question of whether using tarballs generated from tags was OK and seem to have decided 'no'. I still might suggest that they make that _absolutely_ clear in the text, though.

Comment 21 Adam Williamson 2014-01-25 01:19:31 UTC
I should note - I checked it built (for F20), installed it, and manually unbundled php-opencloud from owncloud: I dropped the manual loading of php-opencloud's autoloader, and wiped owncloud's copy of php-opencloud. Then I checked that I could still add an openstack/rackspace external storage item in OC configuration. I don't have an actual openstack space to test with, but I would've expected it to barf before getting to that point if this was broken.

IOW, it looks like owncloud's class loader as patched by us is capable of autoloading this copy of php-opencloud, as we expected.

Comment 22 Gregor Tätzner 2014-01-25 07:29:19 UTC
Spec URL: http://brummbq.fedorapeople.org/php-opencloud.spec
SRPM URL: http://brummbq.fedorapeople.org/php-opencloud-1.6.0-3.fc19.src.rpm

okay adjusted source url according to guidelines and fixed some wee issues.

(In reply to Adam Williamson from comment #21)
> IOW, it looks like owncloud's class loader as patched by us is capable of
> autoloading this copy of php-opencloud, as we expected.

cool, so we should be fine

Comment 23 Adam Williamson 2014-01-25 16:59:43 UTC
Looks good to me with changes from c#22 - all MUST items in the guidelines pass. Review is approved.

Comment 24 Gregor Tätzner 2014-01-27 08:30:36 UTC
New Package SCM Request
=======================
Package Name: php-opencloud
Short Description: PHP SDK for OpenStack/Rackspace APIs
Owners: brummbq
Branches: f20 el6
InitialCC:

Comment 25 Gregor Tätzner 2014-01-27 08:41:07 UTC
actually I think I forgot to add the proper obsoletes for php-cloudfiles. Well, I'll add this before import and retire cloudfiles afterwards.

Comment 26 Gwyn Ciesla 2014-01-27 13:16:26 UTC
Git done (by process-git-requests).

Comment 27 Gregor Tätzner 2014-01-30 09:37:42 UTC
imported

Comment 28 Shawn Iwinski 2014-11-02 06:40:12 UTC
Package Change Request
======================
Package Name: php-opencloud
New Branches: epel7
Owners: siwinski
InitialCC:

Comment 29 Gwyn Ciesla 2014-11-03 13:17:44 UTC
Git done (by process-git-requests).

Comment 30 Shawn Iwinski 2014-11-05 14:12:23 UTC
Package Change Request
======================
Package Name: php-opencloud
New Branches: epel7
Owners: siwinski
InitialCC:

Comment 31 Gwyn Ciesla 2014-11-05 15:07:34 UTC
Git done (by process-git-requests).


Note You need to log in before you can comment on or make changes to this bug.