Skip to content

Commit

Permalink
[deb] Switch from dpkg-deb to dm.pl.
Browse files Browse the repository at this point in the history
Cygwin was the only platform using dm.pl; now all except iOS are using it. iOS
has dpkg-deb with the “lzma obsolete” check removed, and there are some issues
with Perl, so not switching over there. There is a dependency on a binary
component  (Compress::Raw::Lzma) so for now we’re asking users to install
IO::Compress::Lzma manually. CI updated to install that, and post-update updated
to try to install it at update-theos time.
  • Loading branch information
kirb committed Dec 6, 2017
1 parent 9c3040b commit bad135c
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 207 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "vendor/lib"]
path = vendor/lib
url = https://github.com/theos/lib.git
[submodule "vendor/dm.pl"]
path = vendor/dm.pl
url = https://github.com/theos/dm.pl.git
200 changes: 0 additions & 200 deletions bin/dm.pl

This file was deleted.

1 change: 1 addition & 0 deletions bin/dm.pl
24 changes: 22 additions & 2 deletions bin/post-update
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
#!/bin/bash
# since `git submodule foreach` doesn’t get called for submodules that aren’t
# cloned, force vendor/lib to be cloned here
# since `git submodule foreach` doesn’t get called for submodules that aren’t cloned, force
# vendor/lib and vendor/dm.pl to be cloned here
if [[ ! -f "vendor/lib/.git" ]]; then
git submodule update --init vendor/lib
fi

if [[ ! -f "vendor/dm.pl/.git" ]]; then
git submodule update --init vendor/dm.pl
fi

# dm.pl requires IO::Compress::Lzma to be installed, which uses Compress::Raw::Lzma, which
# tragically includes a binary component, which tragically requires root to install if using system
# perl. we don’t use dm.pl on iOS so skip this check there
if [[ "$(uname -o)-$(uname -p)" != "Darwin-arm" ]] && ! perl -MIO::Compress::Lzma -e '1' 2>/dev/null; then

This comment has been minimized.

Copy link
@bcyrill

bcyrill Dec 6, 2017

The MacOS version of uname does not support the "-o" option. To print the operating system name e.g. Darwin, the "-s" option could be used instead.

This comment has been minimized.

Copy link
@kirb

kirb Dec 7, 2017

Author Member

Good catch. I’m spoiled by GNU utils on my Mac setup. We’re only interested in testing for iOS here anyway so for now it only creates a harmless error message. Will match it up with Theos’s platform detection.

if [[ $(which perl) == /usr/bin/perl ]]; then
echo "A Perl dependency needs to be installed. This will require your password for sudo. Provide it below, or press Ctrl-C and then run this manually:"
echo
echo " sudo cpan IO::Compress::Lzma"
echo
sudo PERL_MM_USE_DEFAULT=1 cpan IO::Compress::Lzma
else
echo "Installing a Perl module dependency. This may take a minute."
PERL_MM_USE_DEFAULT=1 cpan IO::Compress::Lzma
fi
fi
4 changes: 4 additions & 0 deletions extras/ci/cygwin-setup.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ if [[ -z $THEOS ]]; then
exit 1
fi

# install dependencies
status "Installing dependencies"
PERL_MM_USE_DEFAULT=1 cpan IO::Compress::Lzma

# ensure we’re in $THEOS
cd $THEOS

Expand Down
4 changes: 2 additions & 2 deletions extras/ci/macos-setup.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ brew update

# install dependencies
status "Installing dependencies"
brew install fakeroot ldid
brew install --force-bottle https://raw.githubusercontent.com/Homebrew/homebrew-core/7a4dabfc1a2acd9f01a1670fde4f0094c4fb6ffa/Formula/dpkg.rb
brew install ldid
PERL_MM_USE_DEFAULT=1 cpan IO::Compress::Lzma

# ensure we’re in $THEOS
cd $THEOS
Expand Down
2 changes: 1 addition & 1 deletion makefiles/package/deb.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ifeq ($(_THEOS_PACKAGE_FORMAT_LOADED),)
_THEOS_PACKAGE_FORMAT_LOADED := 1

_THEOS_PLATFORM_DU ?= du
_THEOS_PLATFORM_DPKG_DEB ?= dpkg-deb
_THEOS_PLATFORM_DPKG_DEB ?= dm.pl
_THEOS_PLATFORM_DPKG_DEB_COMPRESSION ?= lzma

_THEOS_DEB_PACKAGE_CONTROL_PATH := $(or $(wildcard $(THEOS_PROJECT_DIR)/control),$(wildcard $(THEOS_LAYOUT_DIR)/DEBIAN/control))
Expand Down
1 change: 1 addition & 0 deletions makefiles/platform/Darwin-arm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ _THEOS_PLATFORM_LOADED := 1
THEOS_PLATFORM_NAME := iphone

_THEOS_PLATFORM_DEFAULT_TARGET := iphone
_THEOS_PLATFORM_DPKG_DEB := dpkg-deb
_THEOS_PLATFORM_DU_EXCLUDE := --exclude
_THEOS_PLATFORM_MD5SUM := md5sum
_THEOS_PLATFORM_LIPO = lipo
Expand Down
2 changes: 0 additions & 2 deletions makefiles/platform/Windows.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ THEOS_PLATFORM_NAME := windows

_THEOS_PLATFORM_DEFAULT_TARGET := iphone
_THEOS_PLATFORM_DU_EXCLUDE := --exclude
_THEOS_PLATFORM_DPKG_DEB := dm.pl
_THEOS_PLATFORM_DPKG_DEB_COMPRESSION := gzip
_THEOS_PLATFORM_MD5SUM := md5sum
# TODO: Figure out if hardcoding "/iphone/" in _THEOS_PLATFORM_LIPO's path is a good idea or not
_THEOS_PLATFORM_LIPO = $(THEOS)/toolchain/$(THEOS_PLATFORM_NAME)/iphone/bin/$(SDKTARGET)-lipo
Expand Down
1 change: 1 addition & 0 deletions vendor/dm.pl
Submodule dm.pl added at 34471b

2 comments on commit bad135c

@bcyrill
Copy link

@bcyrill bcyrill commented on bad135c Dec 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to the file mode change of bin/post-update (100755 → 100644) it is not getting executed during an update.

@kirb
Copy link
Member Author

@kirb kirb commented on bad135c Dec 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed both issues in 9d78ab5, thanks @bcyrill.

Please sign in to comment.