def main():
    logging.basicConfig(level=logging.DEBUG, format='%(levelname)s [%(name)s] %(message)s')
    source = sys.argv[1]
    outdir = sys.argv[2]

    added, removed = gitutils.update_changed_artifacts([source], ['master'], [], outdir)
    logger.debug("Results: %d artifacts added, %d artifacts removed", added, removed)

    if added or removed:
        gitutils.delete_old_artifacts(outdir, 1)

        create_index(outdir, os.path.join(outdir, "addons.xml"))
        md5sum = hashlib.md5()
        with open(os.path.join(outdir, "addons.xml.gz"), 'rb') as f:
            md5sum.update(f.read())
        with open(os.path.join(outdir, "addons.xml.gz.md5"), 'wb') as f:
            f.write(md5sum.hexdigest())
示例#2
0
# (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 <http://www.gnu.org/licenses/>.

import os
import sys
from xml_index import create_index
try:
    from ConfigParser import ConfigParser
except ImportError:
    from configparser import ConfigParser

config = ConfigParser()
if not config.read('config.cfg'):
    print("Fatal: Could not read config file.")
    sys.exit(1)


if __name__ == '__main__':
    outdir = config.get('general', 'destination')
    for target_name in os.listdir(outdir):
        target_path = os.path.join(outdir, target_name)
        if os.path.isdir(target_path):
            create_index(target_path, os.path.join(target_path, "addons.xml"))