Skip to content

Commit

Permalink
Change default deb package name (#19)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
jhfrintrop authored and wdalmut committed Jul 18, 2017
1 parent fe2ad18 commit 22b2fcf
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
6 changes: 5 additions & 1 deletion src/wdm/debian/Packager.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,11 @@ private function _copy($source, $dest)
public function build($debPackageName = false)
{
if (!$debPackageName) {
$debPackageName = basename($this->getOutputPath() . ".deb");
$control = $this->getControl();
$name = $control['Package'];
$version = $control['Version'];
$arch = $control['Architecture'];
$debPackageName = "{$name}_{$version}_{$arch}.deb";
}

$command = "dpkg -b {$this->getOutputPath()} {$debPackageName}";
Expand Down
20 changes: 16 additions & 4 deletions tests/wdm/debian/PackagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,14 @@ public function testOutputFolderExistsButIsEmpty()

$this->object->run();
$command = $this->object->build();

$this->assertEquals("dpkg -b vfs://root/tmp tmp.deb", $command);

$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()
Expand All @@ -72,8 +78,14 @@ public function testCreateDebWhenOutputFolderIsMissing()

$this->object->run();
$command = $this->object->build();

$this->assertEquals("dpkg -b vfs://root/tmp tmp.deb", $command);

$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()
Expand Down

0 comments on commit 22b2fcf

Please sign in to comment.