#!/bin/sh
#
#    Copyright (C) 2013  Rubén Rodríguez <ruben@trisquel.info>
#    Copyright (C) 2019 Mason Hock <mason@masonhock.com>
#    Copyright (C) 2022 Luis Guzman <ark@switnet.org>
#
#    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 2 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, write to the Free Software
#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
#

VERSION=3

. ./config

# ---
# New way of working the db
#https://bugs.launchpad.net/ubuntu/+source/command-not-found/+bug/1844651
# ---

# Delete components upstream, keep universe for passing test making main the first (only) parsed.
sed -i '/universe/d' CommandNotFound/db/creator.py
sed -i '/contrib/d;/restricted/d;/non-free/d;/multiverse/d' CommandNotFound/db/creator.py

#Remove reference to non-free software or mirrors.
#do-mirror - aramo arch.
sed -i 's|ARCH_LIST=.*|ARCH_LIST="i386,amd64,armhf,arm64,ppc64el"|' mirror/do-mirror
sed -i 's|SECTION_LIST=.*|SECTION_LIST="main"|' mirror/do-mirror
sed -i 's|MIRROR_HOST=.*|MIRROR_HOST="archive.trisquel.org"|' mirror/do-mirror
sed -i 's|MIRROR_ROOT=.*|MIRROR_ROOT=":trisquel"|' mirror/do-mirror
sed -i 's|--dist=$DIST,$DIST-updates,$DIST-backports|--dist=$DIST,$DIST-updates,$DIST-security,$DIST-backports|' mirror/do-mirror
#control
sed -i '/snapd/d' debian/control

#Remove update-from-web
rm update-from-web.sh

#Patch the test suite
patch -p1 < $DATA/fix_test.patch

#Do not recommend extra repositories
patch -p1 < $DATA/no_extra_repos.patch

changelog "Removed references to non-free software"

compile

