|
| 1 | +#! /bin/bash |
| 2 | +# |
| 3 | +# Copyright (c) 2025 Red Hat, Inc. |
| 4 | +# |
| 5 | +# This program is free software: you can redistribute it and/or |
| 6 | +# modify it under the terms of the GNU General Public License as |
| 7 | +# published by the Free Software Foundation, either version 2 of |
| 8 | +# the License, or (at your option) any later version. |
| 9 | +# |
| 10 | +# This program is distributed in the hope that it will be |
| 11 | +# useful, but WITHOUT ANY WARRANTY; without even the implied |
| 12 | +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 13 | +# PURPOSE. See the GNU General Public License for more details. |
| 14 | +# |
| 15 | +# You should have received a copy of the GNU General Public License |
| 16 | +# along with this program. If not, see http://www.gnu.org/licenses/. |
| 17 | + |
| 18 | + |
| 19 | +# Include Beaker environment |
| 20 | +. /usr/share/beakerlib/beakerlib.sh || exit 1 |
| 21 | + |
| 22 | +# Load config settings |
| 23 | +HERE=$(dirname "$(realpath "$0")") |
| 24 | +source "$HERE/config" |
| 25 | +source "$HERE/helpers" |
| 26 | + |
| 27 | + |
| 28 | +quick_package_script () |
| 29 | +{ |
| 30 | + cp "$HERE/files/quick-package.sh" script |
| 31 | + echo "$1" >> script |
| 32 | +} |
| 33 | + |
| 34 | + |
| 35 | +rlJournalStart |
| 36 | + rlPhaseStartSetup |
| 37 | + setup_checks |
| 38 | + rlAssertRpm "jq" |
| 39 | + setupProjectName "coprdir" |
| 40 | + rlPhaseEnd |
| 41 | + |
| 42 | + rlPhaseStartTest |
| 43 | + # Test that CoprDirs have their own repositories in the buildroot |
| 44 | + tmp=`mktemp -d` |
| 45 | + rlRun "copr-cli create --chroot $CHROOT $PROJECT" |
| 46 | + |
| 47 | + # For an ease of implementation, the dependency and the package that |
| 48 | + # requires it are both `hello`. In a real life the first package would |
| 49 | + # be something like `python-copr` or `python-copr-common`, and the |
| 50 | + # second package would be something like `copr-cli` or `copr-backend`. |
| 51 | + |
| 52 | + # This is the dependency (e.g. python-copr) |
| 53 | + rlRun "curl https://src.fedoraproject.org/rpms/hello/raw/rawhide/f/hello.spec > $tmp/hello-1.spec" |
| 54 | + rlRun "sed -i '1s/^/Epoch: 6\n/' $tmp/hello-1.spec" |
| 55 | + rlRun "copr-cli build $PROJECT:custom:foo $tmp/hello-1.spec" |
| 56 | + |
| 57 | + # And this is the package that builds on top of it (e.g. copr-cli) |
| 58 | + rlRun "curl https://src.fedoraproject.org/rpms/hello/raw/rawhide/f/hello.spec > $tmp/hello-2.spec" |
| 59 | + rlRun "sed -i '1s/^/BuildRequires: hello >= 6:\n/' $tmp/hello-2.spec" |
| 60 | + rlRun "copr-cli build $PROJECT:custom:foo $tmp/hello-2.spec" |
| 61 | + rlPhaseEnd |
| 62 | + |
| 63 | + rlPhaseStartCleanup |
| 64 | + cleanProject |
| 65 | + rlPhaseEnd |
| 66 | +rlJournalPrintText |
| 67 | +rlJournalEnd |
0 commit comments