diff options
-rwxr-xr-x | clean_repo.py | 9 | ||||
-rwxr-xr-x | get_license.sh | 34 | ||||
-rw-r--r-- | local_config.example | 2 | ||||
-rwxr-xr-x | repo-update | 13 |
4 files changed, 34 insertions, 24 deletions
diff --git a/clean_repo.py b/clean_repo.py index 6f3d632..51e62d4 100755 --- a/clean_repo.py +++ b/clean_repo.py @@ -25,10 +25,9 @@ def mkpending(packages_iterable, pending_file, blacklisted_names, fsock.write("\n".join([pkg["name"] + ":" + pkg["location"] + ":" + pkg["license"] for pkg in pkgs]) + "\n") - except(IOError): - raise NonValidFile("Can't read or write %s" % pending_file) - finally: fsock.close() + except(IOError): + printf("Can't read or write %s" % pending_file) return pkgs def remove_from_blacklist(path_to_db, blacklisted_names): @@ -70,7 +69,7 @@ if __name__ == "__main__": help="directory to clean") group_db=parser.add_argument_group("Clean non-free packages in db", - "All arguments need to be specified for db cleaning") + "All these arguments need to be specified for db cleaning:") group_db.add_argument("-b", "--database", type=str, help="dabatase to clean") group_db.add_argument("-p", "--pending-file", type=str, @@ -89,7 +88,7 @@ if __name__ == "__main__": if args.database: whitelisted=listado(args.whitelist_file) pkgs=pkginfo_from_db(args.database) - remove_from_blacklist(args.database, blacklisted) + # remove_from_blacklist(args.database, blacklisted) mkpending(pkgs, args.pending_file, blacklisted, whitelisted) diff --git a/get_license.sh b/get_license.sh index 024876c..b768cd5 100755 --- a/get_license.sh +++ b/get_license.sh @@ -19,27 +19,37 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License - # along with Parabola. If not, see <http://www.gnu.org/licenses/>. + # along with Parabola. If not, see <http://www.gnu.org/licenses/>. + source ./config source ./local_config source ./libremessages msg "Creating pending licenses list" -pushd ${licenses_dir} +pushd ${licenses_dir} >/dev/null rm -rf ${licenses_dir}/* +popd >/dev/null + +dir=$(mktemp -d ${tempdir}/licenses.XXXX) +pushd $dir > /dev/null -for repo in ${PKGREPOS[@]}; do +for repo in ${ARCHREPOS[@]}; do msg2 "Extracting licenses in ${repo}" - pending=($(cut -d: -f2 ${docs_dir}/pending-${repo})) - pushd ${repodir}/${repo} - for pkg in ${pending[@]}; do + pending=($(cut -d: -f1 ${docs_dir}/pending-${repo}.txt)) + for name in ${pending[@]}; do plain "${pkg}" - bsdtar -xf ${pkg} usr/share/licenses || { - error "${pkg} has no licenses" - } - chmod -r ${pkg} + for pkg in $(find ${repodir}/staging/${repo} -name "${name}-*${PKGEXT}" -printf '%f '); do + chmod +r ${pkg} + bsdtar -xf ${pkg} usr/share/licenses || { + error "${pkg} has no licenses" + } + chmod -r ${pkg} + done done done -popd -exit 0
\ No newline at end of file +mv ${dir}/* ${licenses_dir}/ +rm -rf ${dir} + + +exit 0 diff --git a/local_config.example b/local_config.example index 05694e9..2280cc2 100644 --- a/local_config.example +++ b/local_config.example @@ -7,7 +7,7 @@ paraboladir=~/parabolagnulinux.org tempdir=~/tmp archdb=${tempdir}/db docs_dir=${paraboladir}/docs -repodir=${paraboladir}/repo/staging +repodir=${paraboladir}/repo licenses_dir=${docs_dir}/pending_licenses # End Directories diff --git a/repo-update b/repo-update index 7241507..2133f46 100755 --- a/repo-update +++ b/repo-update @@ -27,19 +27,20 @@ for repo in ${ARCHREPOS[@]}; do rsync://${mirror}/${mirrorpath}/${repo}/os/${arch}/ \ ${repodir}/staging/${repo}/ done - for arch in ${ARCHES[@]}; do - msg2 "Cleaning" + for arch in 'i686' 'x86_64'; do + msg "Cleaning $repo $arch" # if there is a db in repo (db is created on rsync) - if [ -r ${repodir}/${repo}/os/${arch}/${repo}${DBEXT} ]; then + if [ -r ${repodir}/staging/${repo}/os/${arch}/${repo}${DBEXT} ]; then # clean_repo makes pending list with files on db and remove # packages from db clean_repo.py -k ${blacklist} -w ${whitelist} \ - -p ${docs_dir}/pending-${repo} \ + -p ${docs_dir}/pending-${repo}.txt \ -b ${repodir}/staging/${repo}/${repo}${DBEXT} fi - # if some nonfree files got pass the filter this command delete them - python clean_repo.py -k ${blacklist} -d ${repodir}/staging/${repo} done + # if some nonfree files got pass the filter this command delete them + msg "Fallback cleaning repo" + python clean_repo.py -k ${blacklist} -d ${repodir}/staging/${repo} done db-update |