Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parts 'atomicparsley' and 'get-iplayer' have the following file paths in common which have different contents: README.md #1

Open
Ads20000 opened this issue Aug 18, 2017 · 8 comments

Comments

@Ads20000
Copy link
Owner

Build on build.snapcraft.io fails with the error in the bug title.

@lucyllewy
Copy link

lucyllewy commented Aug 25, 2017

atomicparsley should use the autotools plugin:

  atomicparsley:
    plugin: autotools
    source: https://bitbucket.org/wez/atomicparsley
    source-type: hg
    source-commit: 9183fff

you probably want to also tell it where to install within the snap:

  atomicparsley:
    plugin: autotools
    source: https://bitbucket.org/wez/atomicparsley
    source-type: hg
    source-commit: 9183fff
    configflags:
      - --prefix=/usr

@Ads20000
Copy link
Owner Author

@diddledan Why /usr (my Linux knowledge is clearly much more limited than I thought, hence my failure to snap anything...)?

@lucyllewy
Copy link

purely convention

@Ads20000
Copy link
Owner Author

Ads20000 commented Aug 28, 2017

@diddledan your suggestion didn't fix my bug though, unfortunately :(
Well, I removed the install scriptlets because I assumed that installing to /usr would resolve the issue?

@lucyllewy
Copy link

As I can't fork this repository because of github stupidity, here is a patch file which works for me

From d5b83892f2b8acdd766e722575d42f560c584131 Mon Sep 17 00:00:00 2001
From: Daniel Llewellyn <daniel@bowlhat.net>
Date: Mon, 28 Aug 2017 18:20:30 +0100
Subject: [PATCH] fix #1

---
 snap/run-cli.pl     |  3 ---
 snap/run-server.pl  |  3 ---
 snap/snapcraft.yaml | 27 ++++++++++++---------------
 3 files changed, 12 insertions(+), 21 deletions(-)
 delete mode 100644 snap/run-cli.pl
 delete mode 100644 snap/run-server.pl

diff --git a/snap/run-cli.pl b/snap/run-cli.pl
deleted file mode 100644
index 0a36fa3..0000000
--- a/snap/run-cli.pl
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env perl
-
-system("$ENV{SNAP}/usr/bin/perl", map({ "-I$ENV{SNAP}/$_" } @INC), "$ENV{SNAP}/get_iplayer", @ARGV)
diff --git a/snap/run-server.pl b/snap/run-server.pl
deleted file mode 100644
index fe5b93d..0000000
--- a/snap/run-server.pl
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env perl
-
-system("$ENV{SNAP}/usr/bin/perl", map({ "-I$ENV{SNAP}/$_" } @INC), "$ENV{SNAP}/get_iplayer.cgi", qw(--listen 127.0.0.1 --port 1935 --getiplayer), "$ENV{SNAP}/get_iplayer")
diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
index a0dc47c..43ae452 100644
--- a/snap/snapcraft.yaml
+++ b/snap/snapcraft.yaml
@@ -1,5 +1,5 @@
 name: get-iplayer-ads20000
-version: 3.01
+version: '3.01'
 summary: A utility for downloading TV and radio from BBC iPlayer
 description: BBC iPlayer Indexing Tool and PVR
 confinement: strict
@@ -7,18 +7,18 @@ grade: stable
 
 apps:
   get-iplayer:
-    command: run-cli.pl
+    command: usr/bin/get_iplayer
     plugs:
       - network
   server:
-    command: run-server.pl
+    command: usr/bin/get_iplayer --listen 127.0.0.1 --port 1935 --getiplayer
     daemon: simple
 
 parts:
   get-iplayer:
+    plugin: nil
     source: https://github.com/get-iplayer/get_iplayer.git
     source-tag: v3.01
-    plugin: dump
     stage-packages:
       - perl-base
       - libwww-perl
@@ -30,18 +30,15 @@ parts:
     after:
       - desktop-glib-only
       - ffmpeg
-    install:
-      mv README.md $SNAPCRAFT_PART_INSTALL/README-get-iplayer.md
+    install: |
+      mkdir -p $SNAPCRAFT_PART_INSTALL/usr/bin
+      cp get_iplayer $SNAPCRAFT_PART_INSTALL/usr/bin/
+      chmod +x $SNAPCRAFT_PART_INSTALL/usr/bin/get_iplayer
+
   atomicparsley:
-    plugin: dump
+    plugin: autotools
     source: https://bitbucket.org/wez/atomicparsley
     source-type: hg
     source-commit: 9183fff
-    install:
-      mv README.md $SNAPCRAFT_PART_INSTALL/README-atomicparsley.md
-  launcher:
-    plugin: dump
-    source: .
-    organize:
-      run-cli.pl: scripts/run-cli.pl
-      run-server.pl: scripts/run-server.pl
+    configflags:
+      - --prefix=/usr
-- 
2.11.0

@Ads20000
Copy link
Owner Author

Uh I'm a bit of a novice... could you just paste your snapcraft.yaml, run-cli.pl, and run-server.pl please? :)

@lucyllewy
Copy link

I removed run-cli.pl and run-server.pl and replaced with a single script called scripts/perl-launch. (I was just putting that into a second patch.)

scripts/perl-launch:

#!/bin/bash

if [ "$SNAP_ARCH" == "amd64" ]; then
  ARCH="x86_64-linux-gnu"
elif [ "$SNAP_ARCH" == "armhf" ]; then
  ARCH="arm-linux-gnueabihf"
elif [ "$SNAP_ARCH" == "arm64" ]; then
  ARCH="aarch64-linux-gnu"
else
  ARCH="$SNAP_ARCH-linux-gnu"
fi

PERL5LIB=$SNAP/etc/perl
PERL5LIB=$PERL5LIB:$SNAP/usr/local/lib/$ARCH/perl/5.22.1
PERL5LIB=$PERL5LIB:$SNAP/usr/lib/$ARCH/perl5/5.22
PERL5LIB=$PERL5LIB:$SNAP/usr/share/perl5
PERL5LIB=$PERL5LIB:$SNAP/usr/lib/$ARCH/perl/5.22
PERL5LIB=$PERL5LIB:$SNAP/usr/share/perl/5.22
PERL5LIB=$PERL5LIB:$SNAP/usr/lib/$ARCH/perl-base
export PERL5LIB

exec $SNAP/usr/bin/perl "$@"

snap/snapcraft.yaml

name: get-iplayer-ads20000
version: '3.01'
summary: A utility for downloading TV and radio from BBC iPlayer
description: BBC iPlayer Indexing Tool and PVR
confinement: strict
grade: stable

apps:
  get-iplayer:
    command: perl-launch $SNAP/usr/bin/get_iplayer
    plugs:
      - network
  server:
    command: perl-launch $SNAP/usr/bin/get_iplayer --listen 127.0.0.1 --port 1935 --getiplayer
    daemon: simple

parts:
  perl-launch:
    plugin: dump
    source: scripts
    prepare: |
      chmod +x perl-launch
    organize:
      perl-launch: bin/perl-launch

  get-iplayer:
    plugin: nil
    source: https://github.com/get-iplayer/get_iplayer.git
    source-tag: v3.01
    stage-packages:
      - perl-base
      - libwww-perl
      - liblwp-protocol-https-perl
      - libmojolicious-perl
      - libxml-simple-perl
      - libxml-libxml-perl
      - libcgi-pm-perl
    after:
      - desktop-glib-only
      - ffmpeg
    install: |
      mkdir -p $SNAPCRAFT_PART_INSTALL/usr/bin
      cp get_iplayer $SNAPCRAFT_PART_INSTALL/usr/bin/
      chmod +x $SNAPCRAFT_PART_INSTALL/usr/bin/get_iplayer

  atomicparsley:
    plugin: autotools
    source: https://bitbucket.org/wez/atomicparsley
    source-type: hg
    source-commit: 9183fff
    configflags:
      - --prefix=/usr

@Ads20000
Copy link
Owner Author

Ads20000 commented Aug 28, 2017

I get the following with snap run get-iplayer-ads20000.get-iplayer

Can't locate Env.pm in @INC (you may need to install the Env module) (@INC contains: /snap/get-iplayer-ads20000/x1/etc/perl /snap/get-iplayer-ads20000/x1/usr/local/lib/x86_64-linux-gnu/perl/5.22.1 /snap/get-iplayer-ads20000/x1/usr/lib/x86_64-linux-gnu/perl5/5.22 /snap/get-iplayer-ads20000/x1/usr/share/perl5 /snap/get-iplayer-ads20000/x1/usr/lib/x86_64-linux-gnu/perl/5.22 /snap/get-iplayer-ads20000/x1/usr/share/perl/5.22 /snap/get-iplayer-ads20000/x1/usr/lib/x86_64-linux-gnu/perl-base /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.24.1 /usr/local/share/perl/5.24.1 /usr/lib/x86_64-linux-gnu/perl5/5.24 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.24 /usr/share/perl/5.24 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /snap/get-iplayer-ads20000/x1/usr/bin/get_iplayer line 49.
BEGIN failed--compilation aborted at /snap/get-iplayer-ads20000/x1/usr/bin/get_iplayer line 49.

with your setup and after having used snapcraft (rather than snapcraft cleanbuild) to build the snap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants