Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[obsolet] Gentoo news mit git sync
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) Deutsche Dokumentation
View previous topic :: View next topic  
Author Message
ulenrich
Veteran
Veteran


Joined: 10 Oct 2010
Posts: 1480

PostPosted: Wed Nov 18, 2015 11:33 pm    Post subject: [obsolet] Gentoo news mit git sync Reply with quote

[edit] OBSOLET - post below.
@bell, Danke für den Tip

---
Wenn man die Git Methode benutzt um sehr schnell den Portage Tree zu aktualisieren, bekommt man aber keine News mehr. Oder habe ich eine Möglichkeit nicht gesehen? Jetzt habe ich mir erstmal diese Methode ausgedact: /etc/cron.daily/gentoonews
Code:
#!/bin/bash
temp="${TMPDIR:=/tmp}/www.gentoo.org/support/news-items"
pdir="/usr/share/portage/metadata"
debug=0

[ ${debug} -gt 2 ] \
   &&set -x

[ -d "${pdir}" ] \
   ||pdir="$(portageq get_repo_path / gentoo)/metadata"

[ ! -d "${pdir}" ] \
   &&echo "ERROR gentoo repository" \
   &&exit

[ ${debug} -lt 2 ] \
  &&quiet="-q"     \
  ||quiet=""

mkdir -p $temp     \
  &&cd  ${TMPDIR}  \
  &&wget ${quiet} --no-parent --no-clobber  --continue \
    --recursive https://www.gentoo.org/support/news-items/index.html

pdir="${pdir}/news"
cd ${temp}

for i in 20*.html; do
    [ ! -f $i ] \
       &&echo "WARN not exists $i" \
       &&continue
    cat "${temp}/$i" \
       |sed -n -e'/^Title: /,/<.pre>/b show' \
               -e'b'            \
               -e':show'        \
               -e'/<.pre>/Q'    \
               -e"s/&#39./\'/g" \
               -e's/&lt;/</g'   \
               -e's/&gt;/>/g'   \
               -e's/&quot;/\"/g'\
               -e's/&amp;/\&/g' \
               -e'p' >"${temp}/${i%%.html}.en.txt"

    rm   "${temp}/$i"
done

for j in *.en.txt ; do
    [ ! -f $j ] \
       &&echo "ERROR not exists $j" \
       &&continue

    a="${j%%.en.txt}"

    if /usr/bin/diff -w -B "$j" "${pdir}/$a/$j"; then
       rm   "${temp}/$j"

       [ ${debug} -gt 0 ]  \
          &&echo "OK -- ${pdir}/$a/$j"
    else
       [ ! -d  "${pdir}/$a" ]         \
          &&mkdir -p "${pdir}/$a"

       [ ! -d  "${pdir}/$a" ]            \
          &&echo "ERROR mkdir ${pdir}/$a" \
          &&continue

       [ -f    "${pdir}/$a/$j" ] \
          &&[   ${debug} -gt 1 ] \
          &&cp "${temp}/$j" "${temp}/$j.sic"  \
          &&echo "WARN diff  ${temp}/$j.sic"

       [ -f    "${pdir}/$a/$j" ] \
          &&rm "${pdir}/$a/$j"

       cp "$j" "${pdir}/$a/$j"  \
          &&rm    "${temp}/$j"  \
          ||echo "ERROR cp $j"

       grep -q   "$a"   /var/lib/gentoo/news/news-gentoo.{read,skip,unread} \
          ||echo "$a" >>/var/lib/gentoo/news/news-gentoo.unread
    fi
done


Last edited by ulenrich on Thu Dec 17, 2015 10:49 pm; edited 3 times in total
Back to top
View user's profile Send private message
bell
Guru
Guru


Joined: 27 Nov 2007
Posts: 510

PostPosted: Fri Dec 11, 2015 10:49 am    Post subject: Reply with quote

Also bei mir kommen auch über Git die News an.
Du nutzt wahrscheinlich https://github.com/gentoo/gentoo. In diesem wird das "metadata" Verzeichnis wohl nicht gepflegt.
Ich nutze den https://github.com/gentoo-mirror/gentoo. Dort sind die Metadaten aktuell.
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6747

PostPosted: Fri Apr 22, 2016 5:37 pm    Post subject: Reply with quote

Richtig obsolet ist die Sache nicht:
Erstens sind die Spiegel mit Metadaten nicht offiziell, zweitens speicherst Du dann natürlich auch die "Geschichte" der Metadaten auf Deine Platte, was vermutlich vehrältnismäßig schnell viel Speicher kostet (weil sich bei jedem eclass-Update Hunderte von diesen Dateien ändern).
Es gibt allerdings Scripte, die die Metadaten berechnen, und insbesondere auch die News upgraden. Wenn ich mich recht erinnere, findet man die irgendwie indirekt über die Beschreibung zum git-syncen im gentoo-wiki.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) Deutsche Dokumentation All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum