Browse files

Make it possible to specify Type: in prjconf and have non-rpm.rpm chr…

…oots

Signed-off-by: Carsten Munk <carsten.munk@gmail.com>

Conflicts:

	init_buildsystem
  • Loading branch information...
1 parent 54b1301 commit 8bade085689ec3e9be5766dacc49fe57eb66bbd0 @stskeeps stskeeps committed with adrianschroeter Feb 24, 2012
Showing with 55 additions and 7 deletions.
  1. +1 −0 Makefile
  2. +36 −0 gettype
  3. +18 −7 init_buildsystem
View
1 Makefile
@@ -38,6 +38,7 @@ install:
killchroot \
getmacros \
getoptflags \
+ gettype \
getchangetarget \
common_functions \
init_buildsystem \
View
36 gettype
@@ -0,0 +1,36 @@
+#!/usr/bin/perl -w
+
+BEGIN {
+ unshift @INC, ($::ENV{'BUILD_DIR'} || '/usr/lib/build');
+}
+
+use strict;
+
+use Build;
+
+my ($dist, $archs, $configdir, $debug);
+
+while (@ARGV) {
+ if ($ARGV[0] eq '--dist') {
+ shift @ARGV;
+ $dist = shift @ARGV;
+ next;
+ }
+ if ($ARGV[0] eq '--archpath') {
+ shift @ARGV;
+ $archs = shift @ARGV;
+ next;
+ }
+ if ($ARGV[0] eq '--configdir') {
+ shift @ARGV;
+ $configdir = shift @ARGV;
+ next;
+ }
+ last;
+}
+
+die("Usage: gettype --dist <dist> --archpath <archpath> [--configdir <configdir>]\n") if @ARGV;
+
+my $cf = Build::read_config_dist($dist, $archs, $configdir);
+exit 0 unless $cf->{'type'};
+print "$cf->{'type'}\n";
View
25 init_buildsystem
@@ -723,13 +723,24 @@ else
echo "$GUESSED_DIST" > $BUILD_ROOT/.guessed_dist
test -n "$BUILD_DIST" || BUILD_DIST="$GUESSED_DIST"
- PSUF=
- test -L $BUILD_ROOT/.init_b_cache/rpms/rpm.rpm && PSUF=rpm
- test -L $BUILD_ROOT/.init_b_cache/rpms/dpkg.deb && PSUF=deb
- test -L $BUILD_ROOT/.init_b_cache/rpms/pacman.arch && PSUF=arch
- if test -z "$PSUF" ; then
- echo "unknown package manager" >&2
- cleanup_and_exit 1
+ DIST_TYPE=`gettype --dist "$BUILD_DIST" --configdir "$BUILD_DIR/configs" --archpath "$BUILD_ARCH"`
+ if [ -n $DIST_TYPE ]; then
+ case $DIST_TYPE in
+ spec)
+ PSUF=rpm
+ ;;
+ dsc)
+ PSUF=deb
+ ;;
+ *)
+ PSUF=rpm
+ test -L $BUILD_TARGET/.init_b_cache/rpms/rpm.rpm || PSUF=deb
+ ;;
+ esac
+ else
+ PSUF=rpm
+ test -L $BUILD_ROOT/.init_b_cache/rpms/dpkg.deb && PSUF=deb
+ test -L $BUILD_ROOT/.init_b_cache/rpms/pacman.arch && PSUF=arch
fi
fi

0 comments on commit 8bade08

Please sign in to comment.