// // aegis - project change supervisor // Copyright (C) 2014 Peter Miller // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 3 of the License, or (at // your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public License along // with this program. If not, see . // #include #include #include #include #include #include oformat_cpio::~oformat_cpio() { } bool oformat_cpio::candidate(const output::pointer &ofp) { nstring filename = ofp->filename(); return ( filename.ends_with(".ae") || filename.ends_with(".aedist") || filename.ends_with(".aegis") || filename.ends_with(".cpio") ); } oformat_cpio::oformat_cpio( const output::pointer &a_ofp, time_t a_when ) : oformat(a_ofp, a_when), cpio_p(output_cpio::create(a_ofp, a_when)) { } oformat_cpio::pointer oformat_cpio::create(const output::pointer &a_ofp, long a_when) { return pointer(new oformat_cpio(a_ofp, a_when)); } void oformat_cpio::emit_project_name(const nstring &name) { nstring childs_name = "etc/project-name"; long len = -1; output::pointer op = cpio_p->child(childs_name, len); op->fprintf("%s\n", name.c_str()); } void oformat_cpio::emit_change_number(const nstring &version_number) { nstring childs_name = "etc/change-number"; long len = -1; output::pointer op = cpio_p->child(childs_name, len); op->fprintf("%s\n", version_number.c_str()); } void oformat_cpio::emit_change_set_meta_data(cstate_ty *value) { nstring childs_name = "etc/change-set"; long len = -1; output::pointer op = cpio_p->child(childs_name, len); op = output_filter_indent::create(op); cstate_write(op, value); } void oformat_cpio::emit_patch(const nstring &file_name, const input::pointer &ifp) { assert(ifp); nstring childs_name = "patch/" + file_name; long len = ifp->length(); output::pointer op = cpio_p->child(childs_name, len); op << ifp; } void oformat_cpio::emit_source(const nstring &file_name, const input::pointer &ifp, bool executable) { // fixme: pass it thru (void)executable; assert(ifp); nstring childs_name = "src/" + file_name; long len = ifp->length(); output::pointer op = cpio_p->child(childs_name, len); op << ifp; } // vim: set ts=8 sw=4 et :