Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

Commit

Permalink
Version 0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Arciszewski committed Apr 16, 2015
1 parent 22597e2 commit fb825df
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Pharaoh - PHAR diff utility

Display the differences between all of the files in two PHP Archives
Display the differences between all of the files in two PHP Archives.

Copyright 2015 [Paragon Initiative Enterprises](https://paragonie.com)

## Set up

Expand All @@ -11,11 +13,14 @@ ln -s ./pharaoh /usr/bin/pharaoh
## Example

```sh
pharaoh composer-downloaded.phar composer-from-soruce.phar
pharaoh composer.phar composer-from-source.phar
```

## Why?

As part of our [ASGard](https://getasgard.com) project, we must verify the
reproducibility of software deliverables. This means building a .phar from
source and comparing it to the one provided by the vendor.

There wasn't already a simple command line utility for examining the differences
between two .phar files, so our CDO wrote this as a proof of concept.
9 changes: 8 additions & 1 deletion src/Pharaoh.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,19 @@ class Pharaoh
public $phar;
public $tmp;

public function __construct($file, $alias)
public function __construct($file, $alias = null)
{
if (!\is_readable($file)) {
throw new PharError($file.' cannot be read');
}
$this->phar = new \Phar($file);

if (empty($alias)) {
// We have to give every one a different alias, or it pukes.
$alias = \base64_encode(
\mcrypt_create_iv(9, MCRYPT_DEV_URANDOM)
).'.phar';
}
$this->phar->setAlias($alias);

// Make a random folder in /tmp
Expand Down

0 comments on commit fb825df

Please sign in to comment.