Compare commits

...

50 commits

Author SHA1 Message Date
Jan-Hendrik Frintrop 22b2fcf742 Change default deb package name (#19)
* Change default deb package name

Changed default deb package name to `"{$name}_{$version}_{$arch}.deb"` since this is what normally would be generated.

* Fix tests for default deb name

The tests with default package name still expected the old version of the name.

* Fixed tests

Tests tried to get the Control via `$this->getControl()` which obviously failed.
2017-07-18 12:07:15 +02:00
Walter Dal Mut fe2ad18bb3 Merge pull request #18 from jhfrintrop/patch-6
Fix spacing in method names
2017-07-18 12:07:01 +02:00
Jan-Hendrik Frintrop c2fa2ffd7f Fix setMaintainer (#14)
* Fix brackets of maintainer email

The email address of the maintainer must use angle brackes as per https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Maintainer
Also there should be a space between name and email.

* Use variable interpolation for maintainer name

Since you already use interpolation for maintainer email you can use it for name too.

* Fix default value for maintainer

The default value for the maintainer still had the square brackets.

* Fix tests for StandardFile

The tests still used square brackets.
2017-07-18 12:06:01 +02:00
Walter Dal Mut eb7402f531 Merge pull request #17 from jhfrintrop/patch-5
Fix setReplaces
2017-07-18 12:05:32 +02:00
Walter Dal Mut e5eac39aeb Merge pull request #16 from jhfrintrop/patch-4
Fix setProvides
2017-07-18 12:05:05 +02:00
Walter Dal Mut 0a7965ca27 Merge pull request #13 from jhfrintrop/patch-1
Fix setRecommends
2017-07-18 12:04:24 +02:00
Walter Dal Mut c1db405718 Merge pull request #15 from jhfrintrop/patch-3
Fix setPriority
2017-07-18 12:03:53 +02:00
Jan-Hendrik Frintrop 9f73b61e7e Fix spacing in method names
Some method names were followed by spaces.
2017-07-18 09:14:45 +02:00
Jan-Hendrik Frintrop f02de6e4f0 Fix setReplaces
`setReplaces` used `"Conflicts"` as key which should be `"Replaces"`.
2017-07-18 09:07:36 +02:00
Jan-Hendrik Frintrop c31de5be5f Fix setProvides
Provided packages can also be a list of packages.
2017-07-18 09:05:56 +02:00
Jan-Hendrik Frintrop 26deac007c Fix setPriority
`setPriority` used `$this["Priority"]` as key which should be just `"Priority"`.
2017-07-18 09:03:50 +02:00
Jan-Hendrik Frintrop 9f0e89de59 Recommended packages can be a list
The field "Recommends" needs to accept a list of recommended packages.
2017-07-18 08:50:11 +02:00
Jan-Hendrik Frintrop 72f6bf643d Fix spelling mistake in property name
Property "Reccommends" does not exist.
It is "Recommends"
2017-07-18 08:46:05 +02:00
Walter Dal Mut c5db10bb90 Merge pull request #12 from Tony133/master
Fix identation method
2017-06-27 19:30:58 +02:00
Tony133 5616cfaedd Fix identation 2017-06-27 15:10:25 +02:00
Walter Dal Mut 4733e927cb Merge pull request #11 from Tony133/master
Fix spaces
2017-06-27 11:00:36 +02:00
Tony133 7f65a0aa86 Fix indentation 2017-04-19 12:12:32 +02:00
Walter Dal Mut ecc361aad0 Merge pull request #10 from DavidGoodwin/master
improve symlink copying
2016-06-21 14:50:09 +02:00
David Goodwin d04b3e44fa don't continue and try to set permissions on a symlink - that'll be covered by something else in this package, or is outside our scope and part of the O/S or another package 2016-06-21 13:33:34 +01:00
David Goodwin e5be8eac40 check retval from copy(src,dest) 2016-06-21 13:22:27 +01:00
David Goodwin eafedc1c8f Fix indentation 2016-06-21 13:19:46 +01:00
Walter Dal Mut 56493c7991 Merge pull request #9 from ashleyfraser/symlinks
Added support for copying symbolic links
2016-06-14 19:17:30 +02:00
Ashley Fraser 84d9e7f8d7 Added support for copying symbolic links 2016-06-14 14:36:06 +02:00
Walter Dal Mut 25e3350670 Merge pull request #8 from utkuaydin/master
Minor correction in readme file
2015-07-06 15:40:03 +02:00
Utku Aydın 4d5ec6074e Minor correction in readme file 2015-07-06 16:23:39 +03:00
Walter Dal Mut 5ed71d2b1c Merge branch 'release/0.0.13' 2015-05-27 00:02:47 +02:00
Walter Dal Mut 0b11235a62 Bumped version 0.0.13 2015-05-27 00:02:33 +02:00
Walter Dal Mut e05f29d86c Moved to a single changelog file 2015-05-26 10:35:00 +02:00
Walter Dal Mut 9ccde2227a Added functional test
* The packager will throws exceptions when the output folder exists
2015-05-26 10:23:25 +02:00
Walter Dal Mut 248c14d301 Merge tag '0.0.12' into develop
Fixes not empty output folder
2015-05-26 08:37:30 +02:00
Walter Dal Mut 03cd660ea0 Merge branch 'release/0.0.12' 2015-05-26 08:37:16 +02:00
Walter Dal Mut e03d099610 Bumped version 0.0.12 2015-05-26 08:37:01 +02:00
Walter Dal Mut 101c0f7cd6 Merge pull request #7 from wapmorgan/master
Fix for incorrent errors about non-empty output directory
2015-05-26 08:35:35 +02:00
wapmorgan 0dc9ace168 Fix for incorrent errors about non-empty output directory 2015-05-26 04:55:20 +03:00
Walter Dal Mut 14f59088aa Merge tag '0.0.11' into develop
Added permission fix
2015-05-21 22:08:24 +02:00
Walter Dal Mut f8cf01dd43 Merge branch 'release/0.0.11' 2015-05-21 22:08:10 +02:00
Walter Dal Mut 3fea36764b Bumped version 0.0.11 2015-05-21 22:07:43 +02:00
wapmorgan b4f5905d72 Add preserving original file permissions 2015-05-21 22:05:51 +02:00
Walter Dal Mut 56acfbdff1 Merge pull request #6 from wapmorgan/master
Fix for binary files
2015-05-21 22:02:28 +02:00
wapmorgan 14d67be8d8 Add preserving original file permissions 2015-05-21 20:07:23 +03:00
Walter Dal Mut 592dd77f85 Added describe project link 2015-04-12 17:37:25 +02:00
Walter Dal Mut df20d1654c Merge tag '0.0.10' into develop
Added getter for the output path
2015-04-12 13:13:39 +02:00
Walter Dal Mut 29a2ed1d46 Merge branch 'release/0.0.10' 2015-04-12 13:13:24 +02:00
Walter Dal Mut fc0640f9bc Bumped version 0.0.10 2015-04-12 13:13:17 +02:00
Walter Dal Mut 5251337b38 Use getters for the output path 2015-04-12 13:12:26 +02:00
Walter Dal Mut c52fb1b0ae Merge tag '0.0.9' into develop
New getter methods
2015-04-12 11:29:41 +02:00
Walter Dal Mut b2fc4bef81 Merge branch 'release/0.0.9' 2015-04-12 11:29:36 +02:00
Walter Dal Mut 1b296a55ac Bumped version 0.0.9 2015-04-12 11:29:29 +02:00
Walter Dal Mut 664cff2bf0 Added getControl method
In order to retrive the actual control file i have added a new getter
method for the control file
2015-04-12 11:27:56 +02:00
Walter Dal Mut 037933215a Merge tag '0.0.8' into develop
Removed version from composer.json
2015-04-12 10:37:49 +02:00
10 changed files with 550 additions and 149 deletions

View file

@ -1,4 +0,0 @@
# BC Breaks
* Build will returns the dpkg command instead print it to the user
* Removed internal autoloader -> use composer as a default

22
CHANGELOG.md Normal file
View file

@ -0,0 +1,22 @@
# 0.0.13
## BC Breaks
* The packager will throws a RuntimeException if the output folder already
exists and it is not empty.
# 0.0.10
## BC Breaks
## Deprecations
* Method `mount` will be replaced by method `addMount` in the future
# 0.0.4
## BC Breaks
* Build will returns the dpkg command instead print it to the user
* Removed internal autoloader -> use composer as a default

View file

@ -76,7 +76,7 @@ Adding scripts
$packager->setPreInstallScript(__DIR__ . '/my-pre-install-script.sh');
$packager->setPostInstallScript(__DIR__ . '/my-post-install-script.sh');
$packager->setPreRemoveScript(__DIR__ . '/my-pre-remove-script.sh');
$packager->setPreRemoveScript(__DIR__ . '/my-post-remove-script.sh');
$packager->setPostRemoveScript(__DIR__ . '/my-post-remove-script.sh');
```
See a script example
@ -92,3 +92,7 @@ echo "Goodbye Cruel World"
exit 0
```
## Use Yaml files instead the library directly
Just take a look to [wdalmut/php-deb-describe](https://github.com/wdalmut/php-deb-describe)

View file

@ -1 +1 @@
0.0.8
0.0.13

View file

@ -2,8 +2,7 @@
"name": "wdalmut/php-deb-packager",
"description": "A simple debian packager for PHP applications",
"type":"library",
"keywords":["deb","packager","ubuntu","php-deb"],
"time":"2012-07-31",
"keywords":["deb","packager","ubuntu","php-deb", "debian"],
"license":"MIT",
"authors": [
{
@ -20,17 +19,12 @@
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4"
"phpunit/phpunit": "~4",
"mikey179/vfsStream": "1.4.*"
},
"autoload": {
"psr-0": {
"wdm": ["src/", "tests/"]
}
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/wdalmut/php-deb-packager"
}
]
}
}

455
composer.lock generated
View file

@ -1,10 +1,10 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "b89ac83d7c4abbd18d2ada4d5e2eeae7",
"hash": "452e33232d90b29107daa9bb4740b3ea",
"packages": [],
"packages-dev": [
{
@ -62,17 +62,164 @@
"time": "2014-10-13 12:58:55"
},
{
"name": "phpunit/php-code-coverage",
"version": "2.0.13",
"name": "mikey179/vfsStream",
"version": "v1.4.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "0e7d2eec5554f869fa7a4ec2d21e4b37af943ea5"
"url": "https://github.com/mikey179/vfsStream.git",
"reference": "61b12172292cf539685507aa65b076c1530e83c1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/0e7d2eec5554f869fa7a4ec2d21e4b37af943ea5",
"reference": "0e7d2eec5554f869fa7a4ec2d21e4b37af943ea5",
"url": "https://api.github.com/repos/mikey179/vfsStream/zipball/61b12172292cf539685507aa65b076c1530e83c1",
"reference": "61b12172292cf539685507aa65b076c1530e83c1",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "~4.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4.x-dev"
}
},
"autoload": {
"psr-0": {
"org\\bovigo\\vfs\\": "src/main/php"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD"
],
"homepage": "http://vfs.bovigo.org/",
"time": "2014-09-14 10:18:53"
},
{
"name": "phpdocumentor/reflection-docblock",
"version": "2.0.4",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
"reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8",
"reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.0"
},
"suggest": {
"dflydev/markdown": "~1.0",
"erusev/parsedown": "~1.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"psr-0": {
"phpDocumentor": [
"src/"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mike van Riel",
"email": "mike.vanriel@naenius.com"
}
],
"time": "2015-02-03 12:10:50"
},
{
"name": "phpspec/prophecy",
"version": "v1.4.1",
"source": {
"type": "git",
"url": "https://github.com/phpspec/prophecy.git",
"reference": "3132b1f44c7bf2ec4c7eb2d3cb78fdeca760d373"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/3132b1f44c7bf2ec4c7eb2d3cb78fdeca760d373",
"reference": "3132b1f44c7bf2ec4c7eb2d3cb78fdeca760d373",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.0.2",
"phpdocumentor/reflection-docblock": "~2.0",
"sebastian/comparator": "~1.1"
},
"require-dev": {
"phpspec/phpspec": "~2.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4.x-dev"
}
},
"autoload": {
"psr-0": {
"Prophecy\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Konstantin Kudryashov",
"email": "ever.zet@gmail.com",
"homepage": "http://everzet.com"
},
{
"name": "Marcello Duarte",
"email": "marcello.duarte@gmail.com"
}
],
"description": "Highly opinionated mocking framework for PHP 5.3+",
"homepage": "https://github.com/phpspec/prophecy",
"keywords": [
"Double",
"Dummy",
"fake",
"mock",
"spy",
"stub"
],
"time": "2015-04-27 22:15:08"
},
{
"name": "phpunit/php-code-coverage",
"version": "2.0.17",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "c4e8e7725e351184a76544634855b8a9c405a6e3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c4e8e7725e351184a76544634855b8a9c405a6e3",
"reference": "c4e8e7725e351184a76544634855b8a9c405a6e3",
"shasum": ""
},
"require": {
@ -85,7 +232,7 @@
},
"require-dev": {
"ext-xdebug": ">=2.1.4",
"phpunit/phpunit": "~4.1"
"phpunit/phpunit": "~4"
},
"suggest": {
"ext-dom": "*",
@ -104,9 +251,6 @@
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
@ -124,35 +268,37 @@
"testing",
"xunit"
],
"time": "2014-12-03 06:41:44"
"time": "2015-05-25 05:11:59"
},
{
"name": "phpunit/php-file-iterator",
"version": "1.3.4",
"version": "1.4.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
"reference": "acd690379117b042d1c8af1fafd61bde001bf6bb"
"reference": "a923bb15680d0089e2316f7a4af8f437046e96bb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb",
"reference": "acd690379117b042d1c8af1fafd61bde001bf6bb",
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a923bb15680d0089e2316f7a4af8f437046e96bb",
"reference": "a923bb15680d0089e2316f7a4af8f437046e96bb",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4.x-dev"
}
},
"autoload": {
"classmap": [
"File/"
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
@ -169,7 +315,7 @@
"filesystem",
"iterator"
],
"time": "2013-10-10 15:34:57"
"time": "2015-04-02 05:19:05"
},
{
"name": "phpunit/php-text-template",
@ -261,16 +407,16 @@
},
{
"name": "phpunit/php-token-stream",
"version": "1.3.0",
"version": "1.4.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
"reference": "f8d5d08c56de5cfd592b3340424a81733259a876"
"reference": "eab81d02569310739373308137284e0158424330"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/f8d5d08c56de5cfd592b3340424a81733259a876",
"reference": "f8d5d08c56de5cfd592b3340424a81733259a876",
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/eab81d02569310739373308137284e0158424330",
"reference": "eab81d02569310739373308137284e0158424330",
"shasum": ""
},
"require": {
@ -283,7 +429,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3-dev"
"dev-master": "1.4-dev"
}
},
"autoload": {
@ -306,20 +452,20 @@
"keywords": [
"tokenizer"
],
"time": "2014-08-31 06:12:13"
"time": "2015-04-08 04:46:07"
},
{
"name": "phpunit/phpunit",
"version": "4.3.5",
"version": "4.6.7",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "2dab9d593997db4abcf58d0daf798eb4e9cecfe1"
"reference": "57bf06dd4eebe2a5ced79a8de71509e7d5c18b25"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2dab9d593997db4abcf58d0daf798eb4e9cecfe1",
"reference": "2dab9d593997db4abcf58d0daf798eb4e9cecfe1",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/57bf06dd4eebe2a5ced79a8de71509e7d5c18b25",
"reference": "57bf06dd4eebe2a5ced79a8de71509e7d5c18b25",
"shasum": ""
},
"require": {
@ -329,17 +475,19 @@
"ext-reflection": "*",
"ext-spl": "*",
"php": ">=5.3.3",
"phpunit/php-code-coverage": "~2.0",
"phpunit/php-file-iterator": "~1.3.2",
"phpspec/prophecy": "~1.3,>=1.3.1",
"phpunit/php-code-coverage": "~2.0,>=2.0.11",
"phpunit/php-file-iterator": "~1.4",
"phpunit/php-text-template": "~1.2",
"phpunit/php-timer": "~1.0.2",
"phpunit/php-timer": "~1.0",
"phpunit/phpunit-mock-objects": "~2.3",
"sebastian/comparator": "~1.0",
"sebastian/diff": "~1.1",
"sebastian/environment": "~1.0",
"sebastian/exporter": "~1.0",
"sebastian/comparator": "~1.1",
"sebastian/diff": "~1.2",
"sebastian/environment": "~1.2",
"sebastian/exporter": "~1.2",
"sebastian/global-state": "~1.0",
"sebastian/version": "~1.0",
"symfony/yaml": "~2.0"
"symfony/yaml": "~2.1|~3.0"
},
"suggest": {
"phpunit/php-invoker": "~1.1"
@ -350,7 +498,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.3.x-dev"
"dev-master": "4.6.x-dev"
}
},
"autoload": {
@ -359,10 +507,6 @@
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
"",
"../../symfony/yaml/"
],
"license": [
"BSD-3-Clause"
],
@ -374,35 +518,35 @@
}
],
"description": "The PHP Unit Testing framework.",
"homepage": "http://www.phpunit.de/",
"homepage": "https://phpunit.de/",
"keywords": [
"phpunit",
"testing",
"xunit"
],
"time": "2014-11-11 10:11:09"
"time": "2015-05-25 05:18:18"
},
{
"name": "phpunit/phpunit-mock-objects",
"version": "2.3.0",
"version": "2.3.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
"reference": "c63d2367247365f688544f0d500af90a11a44c65"
"reference": "74ffb87f527f24616f72460e54b595f508dccb5c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/c63d2367247365f688544f0d500af90a11a44c65",
"reference": "c63d2367247365f688544f0d500af90a11a44c65",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/74ffb87f527f24616f72460e54b595f508dccb5c",
"reference": "74ffb87f527f24616f72460e54b595f508dccb5c",
"shasum": ""
},
"require": {
"doctrine/instantiator": "~1.0,>=1.0.1",
"doctrine/instantiator": "~1.0,>=1.0.2",
"php": ">=5.3.3",
"phpunit/php-text-template": "~1.2"
},
"require-dev": {
"phpunit/phpunit": "~4.3"
"phpunit/phpunit": "~4.4"
},
"suggest": {
"ext-soap": "*"
@ -435,34 +579,34 @@
"mock",
"xunit"
],
"time": "2014-10-03 05:12:11"
"time": "2015-04-02 05:36:41"
},
{
"name": "sebastian/comparator",
"version": "1.0.1",
"version": "1.1.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/comparator.git",
"reference": "e54a01c0da1b87db3c5a3c4c5277ddf331da4aef"
"reference": "1dd8869519a225f7f2b9eb663e225298fade819e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/e54a01c0da1b87db3c5a3c4c5277ddf331da4aef",
"reference": "e54a01c0da1b87db3c5a3c4c5277ddf331da4aef",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1dd8869519a225f7f2b9eb663e225298fade819e",
"reference": "1dd8869519a225f7f2b9eb663e225298fade819e",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"sebastian/diff": "~1.1",
"sebastian/exporter": "~1.0"
"sebastian/diff": "~1.2",
"sebastian/exporter": "~1.2"
},
"require-dev": {
"phpunit/phpunit": "~4.1"
"phpunit/phpunit": "~4.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
"dev-master": "1.1.x-dev"
}
},
"autoload": {
@ -499,20 +643,20 @@
"compare",
"equality"
],
"time": "2014-05-11 23:00:21"
"time": "2015-01-29 16:28:08"
},
{
"name": "sebastian/diff",
"version": "1.2.0",
"version": "1.3.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/diff.git",
"reference": "5843509fed39dee4b356a306401e9dd1a931fec7"
"reference": "863df9687835c62aa423a22412d26fa2ebde3fd3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/5843509fed39dee4b356a306401e9dd1a931fec7",
"reference": "5843509fed39dee4b356a306401e9dd1a931fec7",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/863df9687835c62aa423a22412d26fa2ebde3fd3",
"reference": "863df9687835c62aa423a22412d26fa2ebde3fd3",
"shasum": ""
},
"require": {
@ -524,7 +668,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2-dev"
"dev-master": "1.3-dev"
}
},
"autoload": {
@ -551,32 +695,32 @@
"keywords": [
"diff"
],
"time": "2014-08-15 10:29:00"
"time": "2015-02-22 15:13:53"
},
{
"name": "sebastian/environment",
"version": "1.2.1",
"version": "1.2.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/environment.git",
"reference": "6e6c71d918088c251b181ba8b3088af4ac336dd7"
"reference": "5a8c7d31914337b69923db26c4221b81ff5a196e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6e6c71d918088c251b181ba8b3088af4ac336dd7",
"reference": "6e6c71d918088c251b181ba8b3088af4ac336dd7",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5a8c7d31914337b69923db26c4221b81ff5a196e",
"reference": "5a8c7d31914337b69923db26c4221b81ff5a196e",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.3"
"phpunit/phpunit": "~4.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev"
"dev-master": "1.3.x-dev"
}
},
"autoload": {
@ -601,32 +745,33 @@
"environment",
"hhvm"
],
"time": "2014-10-25 08:00:45"
"time": "2015-01-01 10:01:08"
},
{
"name": "sebastian/exporter",
"version": "1.0.2",
"version": "1.2.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/exporter.git",
"reference": "c7d59948d6e82818e1bdff7cadb6c34710eb7dc0"
"reference": "84839970d05254c73cde183a721c7af13aede943"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/c7d59948d6e82818e1bdff7cadb6c34710eb7dc0",
"reference": "c7d59948d6e82818e1bdff7cadb6c34710eb7dc0",
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/84839970d05254c73cde183a721c7af13aede943",
"reference": "84839970d05254c73cde183a721c7af13aede943",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
"php": ">=5.3.3",
"sebastian/recursion-context": "~1.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0"
"phpunit/phpunit": "~4.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
"dev-master": "1.2.x-dev"
}
},
"autoload": {
@ -666,20 +811,124 @@
"export",
"exporter"
],
"time": "2014-09-10 00:51:36"
"time": "2015-01-27 07:23:06"
},
{
"name": "sebastian/version",
"version": "1.0.3",
"name": "sebastian/global-state",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/version.git",
"reference": "b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43"
"url": "https://github.com/sebastianbergmann/global-state.git",
"reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/version/zipball/b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43",
"reference": "b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43",
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/c7428acdb62ece0a45e6306f1ae85e1c05b09c01",
"reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.2"
},
"suggest": {
"ext-uopz": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Snapshotting of global state",
"homepage": "http://www.github.com/sebastianbergmann/global-state",
"keywords": [
"global state"
],
"time": "2014-10-06 09:23:50"
},
{
"name": "sebastian/recursion-context",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/recursion-context.git",
"reference": "3989662bbb30a29d20d9faa04a846af79b276252"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/3989662bbb30a29d20d9faa04a846af79b276252",
"reference": "3989662bbb30a29d20d9faa04a846af79b276252",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Jeff Welch",
"email": "whatthejeff@gmail.com"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
},
{
"name": "Adam Harvey",
"email": "aharvey@php.net"
}
],
"description": "Provides functionality to recursively process PHP variables",
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
"time": "2015-01-24 09:48:32"
},
{
"name": "sebastian/version",
"version": "1.0.5",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/version.git",
"reference": "ab931d46cd0d3204a91e1b9a40c4bc13032b58e4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/version/zipball/ab931d46cd0d3204a91e1b9a40c4bc13032b58e4",
"reference": "ab931d46cd0d3204a91e1b9a40c4bc13032b58e4",
"shasum": ""
},
"type": "library",
@ -701,26 +950,29 @@
],
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
"homepage": "https://github.com/sebastianbergmann/version",
"time": "2014-03-07 15:35:33"
"time": "2015-02-24 06:35:25"
},
{
"name": "symfony/yaml",
"version": "v2.6.1",
"version": "v2.6.7",
"target-dir": "Symfony/Component/Yaml",
"source": {
"type": "git",
"url": "https://github.com/symfony/Yaml.git",
"reference": "3346fc090a3eb6b53d408db2903b241af51dcb20"
"reference": "f157ab074e453ecd4c0fa775f721f6e67a99d9e2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Yaml/zipball/3346fc090a3eb6b53d408db2903b241af51dcb20",
"reference": "3346fc090a3eb6b53d408db2903b241af51dcb20",
"url": "https://api.github.com/repos/symfony/Yaml/zipball/f157ab074e453ecd4c0fa775f721f6e67a99d9e2",
"reference": "f157ab074e453ecd4c0fa775f721f6e67a99d9e2",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"symfony/phpunit-bridge": "~2.7"
},
"type": "library",
"extra": {
"branch-alias": {
@ -737,24 +989,25 @@
"MIT"
],
"authors": [
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
},
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Yaml Component",
"homepage": "http://symfony.com",
"time": "2014-12-02 20:19:20"
"homepage": "https://symfony.com",
"time": "2015-05-02 15:18:45"
}
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=5.3.3"
},

View file

@ -1,6 +1,7 @@
<?php
namespace wdm\debian;
use RuntimeException;
use wdm\debian\control\StandardFile;
class Packager
@ -28,6 +29,16 @@ class Packager
return $this;
}
/**
* Return the actual control file
*
* @return StandardFile
*/
public function getControl()
{
return $this->_control;
}
/**
* Pre install script
*
@ -68,7 +79,15 @@ class Packager
$this->_postRM = $path;
}
/**
* @deprecated See addMount instead
*/
public function mount($sourcePath, $destinationPath)
{
return $this->addMount($sourcePath, $destinationPath);
}
public function addMount($sourcePath, $destinationPath)
{
$this->_mountPoints[$sourcePath] = $destinationPath;
return $this;
@ -80,48 +99,54 @@ class Packager
return $this;
}
public function getOutputPath()
{
return $this->_outputPath;
}
public function run()
{
if (file_exists($this->_outputPath)) {
$iterator = new \DirectoryIterator($this->_outputPath);
if (file_exists($this->getOutputPath())) {
$iterator = new \DirectoryIterator($this->getOutputPath());
foreach ($iterator as $path) {
if ($path != '.' || $path != '..') {
echo "OUTPUT DIRECTORY MUST BE EMPTY! Something exists, exit immediately!" . PHP_EOL;
exit();
if ($path != '.' && $path != '..') {
throw new RuntimeException("OUTPUT DIRECTORY MUST BE EMPTY! Something exists, exit immediately!");
}
}
}
mkdir($this->_outputPath, 0777);
foreach ($this->_mountPoints as $path => $dest) {
$this->_pathToPath($path, $this->_outputPath . DIRECTORY_SEPARATOR . $dest);
if (!file_exists($this->getOutputPath())) {
mkdir($this->getOutputPath(), 0777);
}
mkdir($this->_outputPath . "/DEBIAN", 0777);
foreach ($this->_mountPoints as $path => $dest) {
$this->_pathToPath($path, $this->getOutputPath() . DIRECTORY_SEPARATOR . $dest);
}
file_put_contents($this->_outputPath . "/DEBIAN/control", (string)$this->_control);
mkdir($this->getOutputPath() . "/DEBIAN", 0777);
file_put_contents($this->getOutputPath() . "/DEBIAN/control", (string)$this->_control);
if ($this->_preInst) {
$dest = $this->_outputPath . "/DEBIAN/preinst";
$dest = $this->getOutputPath() . "/DEBIAN/preinst";
$this->_copy($this->_preInst, $dest);
chmod($dest, 0755);
}
if ($this->_postInst) {
$dest = $this->_outputPath . "/DEBIAN/postinst";
$dest = $this->getOutputPath() . "/DEBIAN/postinst";
$this->_copy($this->_postInst, $dest);
chmod($dest, 0755);
}
if ($this->_preRM) {
$dest = $this->_outputPath . "/DEBIAN/prerm";
$dest = $this->getOutputPath() . "/DEBIAN/prerm";
$this->_copy($this->_preRM, $dest);
chmod($dest, 0755);
}
if ($this->_postRM) {
$dest = $this->_outputPath . "/DEBIAN/postrm";
$dest = $this->getOutputPath() . "/DEBIAN/postrm";
$this->_copy($this->_postRM, $dest);
chmod($dest, 0755);
}
@ -154,16 +179,31 @@ class Packager
if (!file_exists($destFolder)) {
mkdir($destFolder, 0777, true);
}
copy($source, $dest);
if (is_link($source)) {
symlink(readlink($source), $dest);
return; // don't set perms on symlink targets
} else {
if (!copy($source, $dest)) {
echo "Error: failed to copy: $source -> $dest \m";
return;
}
}
if (fileperms($source) != fileperms($dest)) {
chmod($dest, fileperms($source));
}
}
public function build($debPackageName = false)
{
if (!$debPackageName) {
$debPackageName = basename($this->_outputPath . ".deb");
$control = $this->getControl();
$name = $control['Package'];
$version = $control['Version'];
$arch = $control['Architecture'];
$debPackageName = "{$name}_{$version}_{$arch}.deb";
}
$command = "dpkg -b {$this->_outputPath} {$debPackageName}";
$command = "dpkg -b {$this->getOutputPath()} {$debPackageName}";
return $command;
}

View file

@ -44,7 +44,7 @@ class StandardFile
"Recommends" => false,
"Suggests" => false,
"Installed-Size" => 1024,
"Maintainer" => "name [email]",
"Maintainer" => "name <email>",
"Conflicts" => false,
"Replaces" => false,
"Provides" => "your-company",
@ -68,7 +68,7 @@ class StandardFile
public function setPriority($priority)
{
return $this->_setProperty($this["Priority"], $priority);
return $this->_setProperty("Priority", $priority);
}
public function setArchitecture($arch)
@ -93,7 +93,7 @@ class StandardFile
public function setRecommends($depends)
{
return $this->_setProperty("Reccommends", $depends);
return $this->_setProperty("Recommends", $this->_transformList($depends));
}
public function setSuggests($depends)
@ -109,7 +109,7 @@ class StandardFile
public function setMaintainer($maintainer, $email = false)
{
$email = ($email) ? $email : "---";
return $this->_setProperty("Maintainer", $maintainer . "[{$email}]");
return $this->_setProperty("Maintainer", "{$maintainer} <{$email}>");
}
public function setConflicts($conflicts)
@ -119,12 +119,12 @@ class StandardFile
public function setReplaces($replaces)
{
return $this->_setProperty("Conflicts", $this->_transformList($replaces));
return $this->_setProperty("Replaces", $this->_transformList($replaces));
}
public function setProvides($provides)
{
return $this->_setProperty("Provides", $provides);
return $this->_setProperty("Provides", $this->_transformList($provides));
}
public function setDescription($description)
@ -149,11 +149,13 @@ class StandardFile
return $this;
}
public function offsetExists ($offset) {
public function offsetExists($offset)
{
return array_key_exists($offset, $this->_keys);
}
public function offsetGet ($offset) {
public function offsetGet($offset)
{
if ($this->offsetExists($offset)) {
return $this->_keys[$offset];
} else {
@ -161,14 +163,16 @@ class StandardFile
}
}
public function offsetSet ($offset, $value) {
public function offsetSet($offset, $value)
{
if (!$this->offsetExists($offset)) {
throw new \InvalidArgumentException("Invalid property '{$offset}' for this control file.");
}
$this->_keys[$offset] = $value;
}
public function offsetUnset ($offset) {
public function offsetUnset($offset)
{
if ($this->offsetExists($offset)) {
unset($this->_keys[$offset]);
}
@ -183,7 +187,7 @@ class StandardFile
{
$control = '';
foreach ($this->_keys as $key => $value) {
if($value){
if ($value) {
$control .= "{$key}: {$value}" . PHP_EOL;
}
}

View file

@ -1,6 +1,8 @@
<?php
namespace wdm\debian;
use org\bovigo\vfs\vfsStream;
class PackagerTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
@ -14,4 +16,90 @@ class PackagerTest extends \PHPUnit_Framework_TestCase
$this->assertEquals("dpkg -b /tmp my.deb", $this->object->build("my.deb"));
}
public function testRetriveControlFile()
{
$control = new control\StandardFile();
$this->object->setControl($control);
$this->assertSame($control, $this->object->getControl());
}
/**
* @expectedException RuntimeException
* @expectedExceptionMessage OUTPUT DIRECTORY MUST BE EMPTY! Something exists, exit immediately!
*/
public function testOutputFolderIsNotEmpty()
{
$root = vfsStream::setup('root');
mkdir(vfsStream::url('root/tmp'));
file_put_contents(vfsStream::url('root/tmp/ciao.txt'), "ciao");
$this->object->setOutputPath(vfsStream::url('root/tmp'));
$control = new control\StandardFile();
$this->object->setControl($control);
$this->object->run();
}
public function testOutputFolderExistsButIsEmpty()
{
$root = vfsStream::setup('root');
mkdir(vfsStream::url('root/tmp'));
$this->object->setOutputPath(vfsStream::url('root/tmp'));
$control = new control\StandardFile();
$this->object->setControl($control);
$this->object->run();
$command = $this->object->build();
$control = $this->object->getControl();
$name = $control['Package'];
$version = $control['Version'];
$arch = $control['Architecture'];
$debPackageName = "{$name}_{$version}_{$arch}.deb";
$this->assertEquals("dpkg -b vfs://root/tmp {$debPackageName}", $command);
}
public function testCreateDebWhenOutputFolderIsMissing()
{
$root = vfsStream::setup('root');
$this->object->setOutputPath(vfsStream::url('root/tmp'));
$control = new control\StandardFile();
$this->object->setControl($control);
$this->object->run();
$command = $this->object->build();
$control = $this->object->getControl();
$name = $control['Package'];
$version = $control['Version'];
$arch = $control['Architecture'];
$debPackageName = "{$name}_{$version}_{$arch}.deb";
$this->assertEquals("dpkg -b vfs://root/tmp {$debPackageName}", $command);
}
public function testCreateDebPackageWithAnotherName()
{
$root = vfsStream::setup('root');
$this->object->setOutputPath(vfsStream::url('root/tmp'));
$control = new control\StandardFile();
$this->object->setControl($control);
$this->object->run();
$command = $this->object->build("myname.deb");
$this->assertEquals("dpkg -b vfs://root/tmp myname.deb", $command);
}
}

View file

@ -21,7 +21,7 @@ Priority: optional
Architecture: all
Essential: no
Installed-Size: 1024
Maintainer: name [email]
Maintainer: name <email>
Provides: your-company
Description: Your description
@ -46,7 +46,7 @@ OEF;
$this->object["Architecture"] = "x86";
$this->object["Essential"] = "yes";
$this->object["Installed-Size"] = "2048";
$this->object["Maintainer"] = "Walter Dal Mut [walter.dalmut at gmail dot com]";
$this->object["Maintainer"] = "Walter Dal Mut <walter.dalmut at gmail dot com>";
$this->object["Provides"] = "Corley SRL";
$this->object["Description"] = "My Desc";
$this->object["Depends"] = "php5-cli";
@ -63,7 +63,7 @@ Essential: yes
Depends: php5-cli
Recommends: php5-curl
Installed-Size: 2048
Maintainer: Walter Dal Mut [walter.dalmut at gmail dot com]
Maintainer: Walter Dal Mut <walter.dalmut at gmail dot com>
Provides: Corley SRL
Description: My Desc