github.com/goreleaser/nfpm/v2@v2.44.0/testdata/acceptance/ipk.dockerfile (about)

     1  FROM openwrt/rootfs AS test_base
     2  ARG package
     3  #ARG CACHEBUST=1 
     4  RUN mkdir -p /var/lock && \
     5      mkdir -p /var/run && \
     6      mkdir -p /tmp
     7  RUN echo "${package}"
     8  COPY ${package} /tmp/foo.ipk
     9  
    10  # ---- minimal test ----
    11  FROM test_base AS min
    12  RUN opkg install /tmp/foo.ipk
    13  
    14  
    15  # ---- symlink test ----
    16  FROM min AS symlink
    17  RUN ls -l /path/to/symlink | grep "/path/to/symlink -> /etc/foo/whatever.conf"
    18  
    19  
    20  # ---- simple test ----
    21  FROM min AS simple
    22  RUN test -e /usr/bin/fake
    23  RUN test -f /etc/foo/whatever.conf
    24  RUN echo wat >> /etc/foo/whatever.conf
    25  RUN opkg remove foo
    26  RUN test -f /etc/foo/whatever.conf
    27  RUN test ! -f /usr/bin/fake
    28  
    29  
    30  # ---- no-glob test ----
    31  FROM min AS no-glob
    32  RUN test -d /usr/share/whatever/
    33  RUN test -f /usr/share/whatever/file1
    34  RUN test -f /usr/share/whatever/file2
    35  RUN test -d /usr/share/whatever/folder2
    36  RUN test -f /usr/share/whatever/folder2/file1
    37  RUN test -f /usr/share/whatever/folder2/file2
    38  
    39  
    40  # ---- complex test ----
    41  FROM test_base AS complex
    42  RUN opkg install coreutils-stat
    43  RUN test "$(opkg status fish)" = ""
    44  RUN opkg install /tmp/foo.ipk > install.log
    45  RUN opkg depends foo | grep "bash"
    46  RUN cat install.log | grep "package foo suggests installing zsh"
    47  RUN test "$(opkg status fish)" != ""
    48  RUN opkg info foo | grep "Provides: fake"
    49  RUN test -e /usr/bin/fake
    50  RUN test -f /etc/foo/whatever.conf
    51  RUN test -d /usr/share/whatever/
    52  RUN test -d /usr/share/whatever/folder
    53  RUN test -f /usr/share/whatever/folder/file1
    54  RUN test -f /usr/share/whatever/folder/file2
    55  RUN test -d /usr/share/whatever/folder/folder2
    56  RUN test -f /usr/share/whatever/folder/folder2/file1
    57  RUN test -f /usr/share/whatever/folder/folder2/file2
    58  RUN test -d /var/log/whatever
    59  RUN test -d /usr/share/foo
    60  RUN test -d /usr/foo/bar/something
    61  RUN test -d /etc/something
    62  RUN test -f /etc/something/a
    63  RUN test -f /etc/something/b
    64  RUN test -d /etc/something/c
    65  RUN test -f /etc/something/c/d
    66  RUN test $(stat -c %a /usr/bin/fake2) -eq 4755
    67  RUN test -f /tmp/preinstall-proof
    68  RUN test -f /tmp/postinstall-proof
    69  RUN test ! -f /tmp/preremove-proof
    70  RUN test ! -f /tmp/postremove-proof
    71  RUN echo wat >> /etc/foo/whatever.conf
    72  RUN opkg remove foo
    73  RUN test -f /etc/foo/whatever.conf
    74  RUN test ! -f /usr/bin/fake
    75  RUN test ! -f /usr/bin/fake2
    76  RUN test -f /tmp/preremove-proof
    77  RUN test -f /tmp/postremove-proof
    78  
    79  # ---- overrides test ----
    80  FROM min AS overrides
    81  RUN test -e /usr/bin/fake
    82  RUN test -f /etc/foo/whatever.conf
    83  RUN test ! -f /tmp/preinstall-proof
    84  RUN test -f /tmp/postinstall-proof
    85  RUN test ! -f /tmp/preremove-proof
    86  RUN test ! -f /tmp/postremove-proof
    87  RUN echo wat >> /etc/foo/whatever.conf
    88  RUN opkg remove foo
    89  RUN test -f /etc/foo/whatever.conf
    90  RUN test ! -f /usr/bin/fake
    91  RUN test -f /tmp/preremove-proof
    92  RUN test ! -f /tmp/postremove-proof
    93  
    94  # ---- meta test ----
    95  FROM test_base AS meta
    96  RUN opkg install /tmp/foo.ipk
    97  RUN command -v zsh
    98  
    99  # ---- env-var-version test ----
   100  FROM min AS env-var-version
   101  ENV EXPECTVER="Version: 1.0.0~0.1.b1+git.abcdefgh"
   102  RUN opkg info foo | grep "Version" > found
   103  RUN export FOUND_VER="$(cat found)" && \
   104  	echo "Expected: '${EXPECTVER}' :: Found: '${FOUND_VER}'" && \
   105  	test "${FOUND_VER}" = "${EXPECTVER}"
   106  
   107  # ---- changelog test ----
   108  FROM test_base AS withchangelog
   109  
   110  # ---- signed test ----
   111  FROM test_base AS signed
   112  
   113  # ----- IPK Specific Tests -----
   114  
   115  # ---- alternatives test ----
   116  FROM test_base AS alternatives
   117  RUN test ! -e /usr/bin/foo
   118  RUN test ! -e /usr/bin/bar
   119  RUN test ! -e /usr/bin/baz
   120  RUN opkg install /tmp/foo.ipk
   121  RUN test -e /usr/bin/fake
   122  RUN test -e /usr/bin/bar
   123  RUN test -e /usr/bin/baz
   124  
   125  # ---- conflicts test ----
   126  FROM test_base AS conflicts
   127  COPY dummy.ipk /tmp/dummy.ipk
   128  # install dummy package
   129  RUN opkg install /tmp/dummy.ipk
   130  # make sure foo can't be installed
   131  RUN opkg install /tmp/foo.ipk 2>&1 | grep "Cannot install package foo"
   132  # make sure foo can be installed if dummy is not installed
   133  RUN opkg remove dummy
   134  RUN opkg install /tmp/foo.ipk
   135  
   136  # ---- predepends test ----
   137  FROM test_base AS predepends
   138  COPY dummy.ipk /tmp/dummy.ipk
   139  RUN opkg install /tmp/foo.ipk 2>&1 | grep "cannot find dependency dummy for foo"
   140  RUN opkg install /tmp/dummy.ipk
   141  RUN opkg install /tmp/foo.ipk
   142  
   143  
   144  # ---- upgrade test ----
   145  FROM test_base AS upgrade
   146  ARG oldpackage
   147  RUN echo "${oldpackage}"
   148  COPY ${oldpackage} /tmp/old_foo.ipk
   149  RUN opkg install /tmp/old_foo.ipk
   150  
   151  RUN test -f /tmp/preinstall-proof
   152  RUN cat /tmp/preinstall-proof | grep "Install"
   153  
   154  RUN test -f /tmp/postinstall-proof
   155  RUN cat /tmp/postinstall-proof | grep "Install"
   156  
   157  # The upgrade process doesn't allow a local upgrade.
   158  RUN opkg install /tmp/foo.ipk
   159  
   160  RUN test -f /tmp/preremove-proof
   161  RUN cat /tmp/preremove-proof | grep "Upgrade"
   162  
   163  RUN test -f /tmp/postremove-proof
   164  RUN cat /tmp/postremove-proof | grep "Upgrade"
   165  
   166  RUN test -f /tmp/preinstall-proof
   167  RUN cat /tmp/preinstall-proof | grep "Upgrade"
   168  
   169  # The upgrade process doesn't allow a local upgrade,
   170  # so the following test will fail.
   171  #RUN test -d /tmp/postinstall-proof
   172  #RUN cat /tmp/postinstall-proof | grep "Upgrade"