| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | |
| 3 | |
| 4 | ARCH="" |
| 5 | PARCH="" |
| 6 | |
| 7 | if [scip-shell system . . `[`. "$1" = "" ]; then |
| 8 | echoscip-shell system . . echo. "Regenerate rpm packages and rpm repository." |
| 9 | echoscip-shell system . . echo. "Automatically detecting architecture." |
| 10 | PARCH=$(unamescip-shell system . . uname. -m) |
| 11 | if [scip-shell system . . `[`. "$PARCH" = "i386" ] || [scip-shell system . . `[`. "$PARCH" = "i686" ]; then |
| 12 | ARCH="i386" |
| 13 | fi |
| 14 | if [scip-shell system . . `[`. "$PARCH" = "x86_64" ]; then |
| 15 | ARCH="x86_64" |
| 16 | fi |
| 17 | echoscip-shell system . . echo. "Architecture detected as $ARCH." |
| 18 | elif [scip-shell system . . `[`. "$1" = "i386" ]; then |
| 19 | echoscip-shell system . . echo. "Regenerating i386 rpm packages and rpm repository." |
| 20 | echoscip-shell system . . echo. "Requires the reprepro tool." |
| 21 | elif [scip-shell system . . `[`. "$1" = "x86_64" ]; then |
| 22 | echoscip-shell system . . echo. "Regenerating x86_64 rpm packages and rpm repository." |
| 23 | echoscip-shell system . . echo. "Requires the reprepro tool." |
| 24 | else |
| 25 | echoscip-shell system . . echo. "Usage: build-deb-repo i386 | x86_64" |
| 26 | exit 5 |
| 27 | fi |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | set -e |
| 33 | |
| 34 | rmscip-shell system . . rm. -rf rpm_repo/repodata |
| 35 | rmscip-shell system . . rm. -f rpm_repo/*$ARCH.rpm |
| 36 | mkdirscip-shell system . . mkdir. -p rpm_repo |
| 37 | mkdirscip-shell system . . mkdir. -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} |
| 38 | echoscip-shell system . . echo. '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros |
| 39 | |
| 40 | for j in alpha beta charlie; do |
| 41 | for k in 1 2; do |
| 42 | cpscip-shell system . . cp. ./rpm_sources/test-package-$j-1.0-$k-"$ARCH"-rpm-installed.txt ~/rpmbuild/SOURCES |
| 43 | done |
| 44 | done |
| 45 | |
| 46 | |
| 47 | for i in alpha beta charlie; do |
| 48 | rpmbuild -bb test-package-$i-1.0-1.spec |
| 49 | cpscip-shell system . . cp. ~/rpmbuild/RPMS/"$ARCH"/test-package-$i-1.0-1."$ARCH".rpm rpm_repo |
| 50 | rpmbuild -bb test-package-$i-1.0-2.spec |
| 51 | cpscip-shell system . . cp. ~/rpmbuild/RPMS/"$ARCH"/test-package-$i-1.0-2."$ARCH".rpm rpm_repo |
| 52 | done |
| 53 | |
| 54 | # Not all createrepo versions support the below arguments, but if they do |
| 55 | # then they must be included. |
| 56 | createrepo --no-database --simple-md-filenames rpm_repo || createrepo rpm_repo |