diff options
author | P. J. McDermott <pjm@nac.net> | 2012-07-21 21:58:43 (EDT) |
---|---|---|
committer | P. J. McDermott <pjm@nac.net> | 2012-07-21 22:06:22 (EDT) |
commit | 3796740095fc4485a31d16838d7736d2aaec4767 (patch) | |
tree | 304876a9d0fd9f59570cce71539658ba4aa536fd /src | |
parent | f087bf18148a0820c8a94d1ff5fa0cd3a903ce8e (diff) | |
download | deb-3796740095fc4485a31d16838d7736d2aaec4767.zip deb-3796740095fc4485a31d16838d7736d2aaec4767.tar.gz deb-3796740095fc4485a31d16838d7736d2aaec4767.tar.bz2 |
Implement "build" command.
Diffstat (limited to 'src')
-rwxr-xr-x | src/deb.sh | 53 |
1 files changed, 52 insertions, 1 deletions
@@ -19,7 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -COMMANDS='init config update download edit builddsc push' +COMMANDS='init config update download edit builddsc build push' CONFIG_NAMES='mirror distribution component remote buildcmd' main() @@ -379,6 +379,57 @@ EOF > "${DEB_TREE}/pkgs/${pkg}/${pkg}.debdiff" } +cmd_build() +{ + find_deb_dir + config_load + + if [ ${#} -lt 1 ]; then + cat >&2 <<EOF +Usage: ${SCRIPT_NAME} ${COMMAND_NAME} <pkg> [<opt>...] +EOF + exit 1 + fi + + pkg="${1}" + shift + opts="${@}" + + # Ensure that source package is built. + [ ! -f "${DEB_TREE}/pkgs/${pkg}/"*.dsc ] && \ + error 'Source package "%s" not built' "${pkg}" + + # Find DSC file and make the build command. + dsc="$(ls "${DEB_TREE}/pkgs/${pkg}/"*.dsc)" + buildcmd="$(echo "${CONFIG_buildcmd}" | \ + sed -e "s@%distribution%@${CONFIG_distribution}@g" \ + -e "s@%opts%@${opts}@g;s@%dsc%@${dsc##*/}@g")" + + # Create build directory if it doesn't exist. + mkdir -p "${DEB_TREE}/builds/${pkg}" + + # Get list of source package files. + files="${dsc##*/}" + while read line; do + if [ "${line#Files:}" != "${line}" ]; then + while read sum size file; do + files="${files} ${file}" + done + fi + done < "${dsc}" + + # Copy source package files. + cd "${DEB_TREE}/pkgs/${pkg}" + cp -p ${files} "${DEB_TREE}/builds/${pkg}" + + # Build. + cd "${DEB_TREE}/builds/${pkg}" + ${buildcmd} + + # Remove source package files from build directory. + rm -f ${files} +} + cmd_push() { find_deb_dir |