Skip to content

Commit

Permalink
Moved fendeb-build to fendeb-env with fendeb-make now being the new b…
Browse files Browse the repository at this point in the history
…uild cmd

It didn't really make sense having a make command since the pbuilder command
is build. It should be the same in fendeb. Build command in fendeb for
switching environments is now fendeb-env which makes much more sense.
  • Loading branch information
Andrew Fenn committed May 1, 2015
1 parent f42f045 commit ca655ec
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 96 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DESTDIR?=/usr/local
prefix?=${DESTDIR}

# files that need mode 755
EXEC_FILES=sbin/fendeb sbin/fendeb-build sbin/fendeb-create sbin/fendeb-make sbin/fendeb-update
EXEC_FILES=sbin/fendeb sbin/fendeb-env sbin/fendeb-create sbin/fendeb-build sbin/fendeb-update

# files that need mode 644
MAN_FILE=man1/fendeb.1
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,22 @@ For updating an environment

For building a package with an environment

$ fendeb make somepackage.dsc
$ fendeb build somepackage.dsc

Changing Environments
------------

Your current environment is set in `~/.fendeb/current-build`. You can set any
Your current environment is set in `~/.fendeb/current-env`. You can set any
environment which you have already created that is listed in
`~/.fendeb/available-builds`.
`~/.fendeb/available-envs`.

To switch to a different environment you either type

$ fendeb build
$ fendeb env

and then select from the interactive prompt, or you can type

$ fendeb build debian/stable/amd64
$ fendeb env debian/stable/amd64

which will switch your environment to the Debian Stable AMD64 environment,
assuming you have already created that environment.
12 changes: 6 additions & 6 deletions man/fendeb.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# NAME

fendeb - Conveniance scripts for using pbuilder
fendeb - Convenience scripts for using pbuilder

# SYNOPSIS

Expand All @@ -28,10 +28,10 @@ Finally it also tracks state such as what was the last environment you were usin
`update`
: Updates and upgrades an environment to include the latest packages from a release

`build`
`env`
: Switches build environments so that you can use a different pbuilder environment on your system

`make`
`build`
: Builds a new debian file using a .dsc file

`help`
Expand Down Expand Up @@ -93,11 +93,11 @@ When you create a new environment it automatically becomes your current working

If you have more than one build environment you can switch which one is set to the current working environment like so

$ fendeb build
$ fendeb env

or

$ fendeb build debian/stable/amd64
$ fendeb env debian/stable/amd64

# UPDATING AN ENVIRONMENT

Expand All @@ -110,7 +110,7 @@ Sometimes you might want to upgrade your environment with the latest packages. Y

To build an environment you must first go into the project and run debuild. This will generate a .dsc file which you then feed through to fenbuild.

$ fendeb make [target debian dsc file]
$ fendeb build [target debian dsc file]

This will start pbuilder and generate a log file for you into your environment folder for reference.

Expand Down
12 changes: 6 additions & 6 deletions man/man1/fendeb.1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.TH "FENDEB" "1" "2015\-04\-30" "fendeb User Manual" ""
.SH NAME
.PP
fendeb \- Conveniance scripts for using pbuilder
fendeb \- Convenience scripts for using pbuilder
.SH SYNOPSIS
.PP
fendeb [actions] [options]
Expand Down Expand Up @@ -33,13 +33,13 @@ a release
.RS
.RE
.TP
.B \f[C]build\f[]
.B \f[C]env\f[]
Switches build environments so that you can use a different pbuilder
environment on your system
.RS
.RE
.TP
.B \f[C]make\f[]
.B \f[C]build\f[]
Builds a new debian file using a .dsc file
.RS
.RE
Expand Down Expand Up @@ -155,15 +155,15 @@ set to the current working environment like so
.IP
.nf
\f[C]
$\ fendeb\ build
$\ fendeb\ env
\f[]
.fi
.PP
or
.IP
.nf
\f[C]
$\ fendeb\ build\ debian/stable/amd64
$\ fendeb\ env\ debian/stable/amd64
\f[]
.fi
.SH UPDATING AN ENVIRONMENT
Expand All @@ -185,7 +185,7 @@ This will generate a .dsc file which you then feed through to fenbuild.
.IP
.nf
\f[C]
$\ fendeb\ make\ [target\ debian\ dsc\ file]
$\ fendeb\ build\ [target\ debian\ dsc\ file]
\f[]
.fi
.PP
Expand Down
36 changes: 18 additions & 18 deletions sbin/fendeb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

PROG=`basename $0`
VERSION=0.1.0
VERSION=0.2.0

# Screen Colours used for text
RED="\e[01;31m"
Expand Down Expand Up @@ -271,12 +271,12 @@ choose_arch()
COMPONENTS=$components
}

set_working_builder()
set_working_env()
{
path=`get_fendeb_path`
current=$1

file="$path/available-builds"
file="$path/available-envs"
if [ ! -f $file ]; then
echo -en $RED"Error$NO_COLOUR: There are no builds. Create one first with 'fendeb create'\n"
exit 4
Expand All @@ -297,7 +297,7 @@ set_working_builder()
if [ $VERBOSE ]; then
echo "User cancelled"
fi
print_working_builder
print_working_env
exit 1
fi
fi
Expand All @@ -316,22 +316,22 @@ set_working_builder()
exit 4
fi

old_current=`get_working_builder`
file="$path/current-build"
old_current=`get_working_env`
file="$path/current-env"
echo "$current" > $file
if [ -z `get_working_builder` ]; then
if [ -z `get_working_env` ]; then
echo -en $RED"Error$NO_COLOUR: Can not set '$current' as current environment. Environment not found.\n"
echo "$old_current" > $file
exit 4
fi
fi

print_working_builder
print_working_env
}

print_working_builder()
print_working_env()
{
current=`get_working_builder`
current=`get_working_env`

if [ ! -z $current ]; then
echo "On build $current"
Expand All @@ -341,10 +341,10 @@ print_working_builder()
echo "No working build environment set"
}

get_working_builder()
get_working_env()
{
path=`get_fendeb_path`
file="$path/current-build"
file="$path/current-env"

if [ -f $file ]; then
current=`cat $file`
Expand Down Expand Up @@ -572,9 +572,9 @@ if [ $# -gt 0 ]; then
help)
action="help"
;;
build)
env)
if [ -z $action ]; then
action="build"
action="env"
REQ_ENV="$2"
fi
;;
Expand All @@ -588,9 +588,9 @@ if [ $# -gt 0 ]; then
action="update"
fi
;;
make)
build)
if [ -z $action ]; then
action="make"
action="build"
fi
;;
*)
Expand All @@ -612,8 +612,8 @@ case "$action" in
update)
source fendeb-update
;;
make)
source fendeb-make
env)
source fendeb-env
;;
help)
show_help
Expand Down
45 changes: 41 additions & 4 deletions sbin/fendeb-build
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,48 @@ if [ -z "$PROG" ]; then
exit 0
fi

required_checks
configure_path
current=`get_working_env`
if [ -z $current ]; then
echo "No build selected or can be found. Select one with: fendeb build"
exit 1
fi

IFS='/'
arr=($current)

DISTRO=${arr[0]}
RELEASE=${arr[1]}
ARCH=${arr[2]}

if [ $VERBOSE ]; then
echo "Creating $DISTRO $ $ARCH"
echo "Making build with environment:"
echo "pbuilder binary: $PBUILDER_BIN"
echo "Distribution: $DISTRO"
echo "From Release: $RELEASE"
echo "From Architecture: $ARCH"
echo "Storage Path: $STORAGE_PATH"
fi

required_checks
configure_path
set_working_builder $REQ_ENV
path="$STORAGE_PATH/$DISTRO/$RELEASE/$ARCH"
if [ $VERBOSE ]; then
echo "Building with pbuilder at: $path"
fi

if [ -z $3 ]; then
echo "Must include dsc file"
exit 3
fi

set -u

sudo "$PBUILDER_BIN" --build --basetgz "$path"/base.tar.gz \
--architecture $ARCH \
--buildplace "$path"/build \
--distribution $DISTRO \
--aptcache "$path"/cache \
--buildresult "$path"/result \
--override-config \
--configfile "$path"/pbuilderrc \
--extrapackages apt-utils $3 2>&1 | tee "$path"/logs/$3.log
2 changes: 1 addition & 1 deletion sbin/fendeb-create
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ sudo "$PBUILDER_BIN" --create --basetgz "$path"/base.tar.gz \
if [ $? == 0 ]; then

path=`get_fendeb_path`
file="$path/available-builds"
file="$path/available-envs"
echo "$DISTRO/$RELEASE/$ARCH" >> $file

echo -en $GREEN"Finished"$NO_COLOUR"\n"
Expand Down
17 changes: 17 additions & 0 deletions sbin/fendeb-env
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

set -e

if [ -z "$PROG" ]; then
source fendeb env $@
exit 0
fi

if [ $VERBOSE ]; then
echo "Creating $DISTRO $ $ARCH"
echo "pbuilder binary: $PBUILDER_BIN"
fi

required_checks
configure_path
set_working_env $REQ_ENV
54 changes: 0 additions & 54 deletions sbin/fendeb-make

This file was deleted.

2 changes: 1 addition & 1 deletion sbin/fendeb-update
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fi

required_checks
configure_path
current=`get_working_builder`
current=`get_working_env`
if [ -z $current ]; then
echo "No build selected or can be found. Select one with: fendeb build"
exit 1
Expand Down

0 comments on commit ca655ec

Please sign in to comment.