summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/add-herd-to-metadata.rb43
-rwxr-xr-xscripts/check-herds.rb63
-rwxr-xr-xscripts/check-metadata.rb180
-rwxr-xr-xscripts/ebuild-maintainer.rb47
-rwxr-xr-xscripts/iso2usb.sh66
5 files changed, 399 insertions, 0 deletions
diff --git a/scripts/add-herd-to-metadata.rb b/scripts/add-herd-to-metadata.rb
new file mode 100755
index 0000000..0aeaea2
--- /dev/null
+++ b/scripts/add-herd-to-metadata.rb
@@ -0,0 +1,43 @@
+#!/usr/bin/ruby
+
+require "rexml/document"
+PORTAGE_DIR="/home/bangert/gentoo/gentoo-x86"
+#PORTAGE_DIR="/home/bangert/gentoo/test-portage"
+count = 0
+category = nil
+IO::foreach("add-herd-package-list") { |package|
+ package = package.strip
+ curcat = package.split("/")[0]
+# if category.nil?
+# category = curcat
+ #elsif count > 5 && category != curcat
+# elsif category != curcat
+# puts "Done with category #{category} - next category #{curcat}"
+# break
+# end
+ Dir::chdir("#{PORTAGE_DIR}/#{package}") do
+ outdata = ""
+ something_changed = false
+ IO::foreach("metadata.xml") { |line|
+ if line == "<pkgmetadata>\n"
+ line = "<pkgmetadata>\n<herd>no-herd</herd>\n"
+ something_changed = true
+ end
+ outdata += line
+ }
+ if something_changed
+ f = File::open("metadata.xml","w")
+ f.write(outdata)
+ f.close
+ system("cvs diff metadata.xml")
+ end
+ system("echangelog 'add <herd>no-herd</herd>'")
+ system("ebuild #{Dir["*.ebuild"][0]} manifest")
+
+
+ end
+ count += 1
+}
+puts "#{count} Packages fixed!"
+
+
diff --git a/scripts/check-herds.rb b/scripts/check-herds.rb
new file mode 100755
index 0000000..65b3234
--- /dev/null
+++ b/scripts/check-herds.rb
@@ -0,0 +1,63 @@
+#!/usr/bin/ruby
+
+#TODO
+# - multiple maintainer tags in metadata.xml
+
+require "rexml/document"
+
+PORTAGE_DIR="/usr/portage/"
+#PORTAGE_DIR="/home/bangert/gentoo/test-portage"
+
+herdxml = REXML::Document.new File.new( "/home/bangert/gentoo/gentoo/xml/htdocs/proj/en/metastructure/herds/herds.xml" )
+
+herds = Hash::new(false)
+herdemail = Hash::new(false)
+
+herdxml.elements.each("herds/herd") { |e|
+ herds[e.elements["name"].text] = true
+ email = e.elements["email"]
+ if !email.nil?
+ herdemail[email.text.split("@")[0]] = true
+ else
+ puts "herd without email: #{e.elements["name"].text}"
+ end
+}
+
+userxml = REXML::Document.new File.new( "/home/bangert/gentoo/gentoo/xml/htdocs/proj/en/devrel/roll-call/userinfo.xml" )
+
+developers = Hash::new(false)
+userxml.elements.each("userlist/user") { |e|
+ if e.elements["status"] && e.elements["status"].text == "retired"
+ developers[e.attributes["username"]] = false
+ else
+ developers[e.attributes["username"]] = true
+ end
+
+}
+
+ct_herd_unknown_member = 0
+ct_herd_retired_member = 0
+ct_herd_nomembers = 0
+
+herdxml.elements.each("herds/herd") { |e|
+ if e.elements["maintainer"]
+ e.elements.each("maintainer/email") { |m|
+ email = m.text.downcase.strip.split("@")
+ if email[1] != "gentoo.org"
+ puts "error"
+ else
+ if !developers.has_key?(email[0])
+ ct_herd_unknown_member += 1
+ puts e.elements['name'].text.ljust(20) + "unknown member: #{email[0]}"
+ elsif !developers[email[0]]
+ ct_herd_retired_member+=1
+ puts e.elements['name'].text.ljust(20) + "retired member: #{email[0]}"
+ end
+ end
+ }
+ else
+ ct_herd_nomembers += 1
+ puts e.elements['name'].text.ljust(20) + "no members"
+ end
+}
+
diff --git a/scripts/check-metadata.rb b/scripts/check-metadata.rb
new file mode 100755
index 0000000..f2e5b2e
--- /dev/null
+++ b/scripts/check-metadata.rb
@@ -0,0 +1,180 @@
+#!/usr/bin/ruby
+
+#TODO
+# - multiple maintainer tags in metadata.xml
+
+require "rexml/document"
+
+PORTAGE_DIR="/usr/portage/"
+#PORTAGE_DIR="/home/bangert/gentoo/test-portage"
+
+herdxml = REXML::Document.new File.new( "/home/bangert/gentoo/gentoo/xml/htdocs/proj/en/metastructure/herds/herds.xml" )
+
+herds = Hash::new(false)
+herdemail = Hash::new(false)
+
+herdxml.elements.each("herds/herd") { |e|
+ herds[e.elements["name"].text] = true
+ email = e.elements["email"]
+ if !email.nil?
+ herdemail[email.text.split("@")[0]] = true
+ else
+ puts "herd without email: #{e.elements["name"].text}"
+ end
+}
+
+userxml = REXML::Document.new File.new( "/home/bangert/gentoo/gentoo/xml/htdocs/proj/en/devrel/roll-call/userinfo.xml" )
+
+developers = Hash::new(false)
+userxml.elements.each("userlist/user") { |e|
+ if e.elements["status"] && e.elements["status"].text == "retired"
+ developers[e.attributes["username"]] = false
+ else
+ developers[e.attributes["username"]] = true
+ end
+
+}
+#developers.each{ |x,y|
+# puts "#{x} #{y}"
+#}
+
+#herdxml.each_element_with_text("rox") {|e| p e.text}
+categories=`cat #{PORTAGE_DIR}/profiles/categories`.split()
+
+ct_packages = 0
+ct_retired_maint = 0
+ct_unknown_maint = 0
+ct_invalid_proxy_maint = 0
+ct_missing_herd = 0
+ct_missing_maint = 0
+ct_empty_herd = 0
+ct_unknown_herd = 0
+ct_missing_metadata = 0
+ct_unmaintained_package = 0
+ct_maint_needed_no_no_herd = 0
+ct_maint_herd = 0
+ct_no_herd = 0
+ct_ldesc_empty = 0
+ct_ldesc_lang = 0
+
+
+categories.map{ |x|
+# puts "Category: #{x}"
+
+ `ls -1 #{PORTAGE_DIR}/#{x}`.split().map{ |package|
+ if package != "CVS" && package != "metadata.xml"
+ ct_packages += 1
+ metadatafile = "#{PORTAGE_DIR}/#{x}/#{package}/metadata.xml"
+ if File::file? metadatafile
+ metadata = REXML::Document.new File.new( metadatafile )
+ proxy_maint = false
+ gentoo_maint = false
+ herds = Hash::new(false)
+ if metadata.elements["pkgmetadata/herd"]
+ metadata.elements.each("pkgmetadata/herd") { |herd|
+ herd = herd.text
+ if herd.nil?
+ ct_empty_herd += 1
+ puts "#{x}/#{package}".ljust(40) + "<herd> empty"
+ else
+ herd = herd.strip
+ herds[herd] = true
+ if herd == "no-herd"
+ ct_no_herd += 1
+ else
+ if herds[herd]
+ gentoo_maint = true
+ else
+ puts "#{x}/#{package}".ljust(40) + "<herd> unknown: <herd>#{herd}</herd>"
+ ct_unknown_herd += 1
+ end
+ end
+ end
+ }
+ elsif
+ ct_missing_herd += 1
+ puts "#{x}/#{package}".ljust(40) + "<herd> missing"
+ end
+ if metadata.elements["pkgmetadata/maintainer"]
+ metadata.elements.each("pkgmetadata/maintainer/email") { |m|
+ email = m.text.downcase.strip.split("@")
+ if email[1] != "gentoo.org"
+ proxy_maint = true
+ #puts "#{x}/#{package}".ljust(40) + "non-gentoo maintainer: #{m.text}"
+ else
+ if !developers.has_key?(email[0])
+ if email[0] == "maintainer-needed"
+ ct_maint_needed_no_no_herd += 1
+ elsif herdemail[email[0]]
+ ct_maint_herd += 1
+ puts "#{x}/#{package}".ljust(40) + "herd as maintainer: #{m.text}"
+ else
+ ct_unknown_maint+=1
+ puts "#{x}/#{package}".ljust(40) + "unknown maintainer: #{m.text}"
+ end
+ elsif !developers[email[0]]
+ ct_retired_maint+=1
+ puts "#{x}/#{package}".ljust(40) + "retired maintainer: #{m.text}"
+ else
+ gentoo_maint = true
+ end
+ end
+ }
+ else
+ ct_missing_maint += 1
+ # puts "#{x}/#{package}".ljust(40) + "missing <maintainer>"
+ end
+# if metadata.elements["pkgmetadata/longdescription"]
+# metadata.elements.each("pkgmetadata/longdescription") { |d|
+# ldesc = d.text
+# if ldesc.nil?
+# ct_ldesc_empty += 1
+# puts "#{x}/#{package}".ljust(40) + "<longdescription> empty"
+# end
+# if !d.attributes["lang"]
+# ct_ldesc_lang += 1
+# puts "#{x}/#{package}".ljust(40) + "<longdescription> missing lang attribute"
+# end
+# }
+# end
+ if !gentoo_maint
+ if proxy_maint
+ ct_invalid_proxy_maint += 1
+ puts "#{x}/#{package}".ljust(40) + "has proxy maintainer but no gentoo association"
+ else
+ ct_unmaintained_package += 1
+ puts "#{x}/#{package}".ljust(40) + "unmaintained"
+ end
+ end
+
+ elsif
+ ct_missing_metadata += 1
+ puts "#{x}/#{package}".ljust(40) + "metadata.xml missing"
+ end
+ end
+ }
+
+}
+
+puts "\nStatistics"
+puts "=================================================================="
+puts
+puts "Total number of packages:".ljust(40) + "#{ct_packages}".rjust(10)
+puts
+puts "metadata.xml missing".ljust(40) + "#{ct_missing_metadata}".rjust(10)
+puts "<herd> missing".ljust(40) + "#{ct_missing_herd}".rjust(10)
+puts "<herd> empty".ljust(40) + "#{ct_empty_herd}".rjust(10)
+puts "<herd> unknown".ljust(40) + "#{ct_unknown_herd}".rjust(10)
+puts "<herd>=no-herd".ljust(40) + "#{ct_no_herd}".rjust(10)
+puts
+puts "<maintainer> missing".ljust(40) + "#{ct_missing_maint}".rjust(10)
+puts "<maintainer> retired".ljust(40) + "#{ct_retired_maint}".rjust(10)
+puts "<maintainer> is a herd".ljust(40) + "#{ct_maint_herd}".rjust(10)
+puts "<maintainer> unknown".ljust(40) + "#{ct_unknown_maint}".rjust(10)
+puts "<maintainer>=maintainer-needed".ljust(40) + " #{ct_maint_needed_no_no_herd}".rjust(10)
+puts
+puts "Proxy maintainer without gentoo association".ljust(40) + "#{ct_invalid_proxy_maint}".rjust(10)
+puts "Unmaintained packages".ljust(40) +"#{ct_unmaintained_package}".rjust(10)
+puts
+#puts "<longdescription> empty".ljust(40) + "#{ct_ldesc_empty}".rjust(10)
+#puts "<longdescription> missing lang attribute".ljust(40) + "#{ct_ldesc_lang}".rjust(10)
diff --git a/scripts/ebuild-maintainer.rb b/scripts/ebuild-maintainer.rb
new file mode 100755
index 0000000..01318bb
--- /dev/null
+++ b/scripts/ebuild-maintainer.rb
@@ -0,0 +1,47 @@
+#!/usr/bin/ruby
+
+#SEARCH=$1
+#RESULT=`qsearch -NC ${SEARCH}`
+
+#if [ "${RESULT}" != "" ]; then
+# for x in ${RESULT};
+# do
+# echo ${x}
+# cat /usr/portage/${x}/metadata.xml
+# done
+#fi
+
+require "rexml/document"
+
+
+herdxml = REXML::Document.new File.new( "/var/lib/herdstat/herds.xml" )
+#herdxml.each_element_with_text("rox") {|e| p e.text}
+search=$*.pop
+result=`qsearch -NC #{search}`.split()
+
+result.map{ |x|
+ #puts x
+ hit = x
+ metadata = REXML::Document.new File.new( "/usr/portage/#{x}/metadata.xml" )
+ if metadata.elements["pkgmetadata/herd"]
+ herd = metadata.elements["pkgmetadata/herd"].text
+ end
+ hit += " ("
+ if herd != "no-herd"
+ if !herd.nil?
+ herdxml.elements.each("herds/herd") { |e|
+ if ( e.elements["name"].text==herd && e.elements["email"].has_text? ) then
+ hit += e.elements["email"].text
+ end
+ }
+ end
+ elsif
+ hit += "no-herd"
+ end
+ hit += ") "
+ metadata.elements.each("pkgmetadata/maintainer/email") { |m| hit += m.text + " "}
+ puts hit
+
+}
+
+
diff --git a/scripts/iso2usb.sh b/scripts/iso2usb.sh
new file mode 100755
index 0000000..11f3a82
--- /dev/null
+++ b/scripts/iso2usb.sh
@@ -0,0 +1,66 @@
+#!/bin/bash
+
+die() {
+ echo $1
+ exit
+}
+
+msg() {
+ echo
+ echo "*** "$1
+ echo
+}
+
+[ "0" -ne "`id -u`" ] && die "You must be root!"
+
+USBDISK=$1
+ISO=$2
+
+[ -z "${USBDISK}" ] && die "No USBdisk given!"
+[ -z "${ISO}" ] && die "No ISO given!"
+[ -e ${USBDISK} ] || die "USBdisk not found: ${USBDISK}"
+[ -e ${ISO} ] || die "ISO not found: ${ISO}"
+
+MNTPTLOOP=`mktemp -d /mnt/tmp.usb2iso.XXXXXXXXXX`
+MNTPTUSB=`mktemp -d /mnt/tmp.usb2iso.XXXXXXXXXX`
+
+msg "Creating filesystem!"
+mke2fs ${USBDISK} || die "Creating filesystem failed!"
+
+msg "Mounting USBdisk!"
+mount ${USBDISK} ${MNTPTUSB} || die "Could not mount USBdisk: ${USBDISK}"
+
+msg "Mounting ISO!"
+mount -o loop ${ISO} ${MNTPTLOOP} || die "Could not mount ISO: ${ISO}"
+
+msg "Installing bootloader!"
+grub-install --no-floppy --root-directory=${MNTPTUSB} ${USBDISK}
+
+msg "Copying system files!"
+cp ${MNTPTLOOP}/isolinux/gentoo ${MNTPTUSB}/boot/
+cp ${MNTPTLOOP}/isolinux/gentoo.igz ${MNTPTUSB}/boot/
+
+cp ${MNTPTLOOP}/livecd ${MNTPTUSB}
+cp ${MNTPTLOOP}/Getting_Online.txt ${MNTPTUSB}
+cp ${MNTPTLOOP}/README.txt ${MNTPTUSB}
+cp ${MNTPTLOOP}/image.squashfs ${MNTPTUSB}
+cp ${MNTPTLOOP}/gentoo.efimg ${MNTPTUSB}
+
+msg "Installing bootloader configuration!"
+cat > ${MNTPTUSB}/boot/grub/menu.lst << EOF
+title Gentoo Linux
+root (hd1,0)
+kernel /boot/gentoo root=/dev/ram0 init=/linuxrc dokeymap looptype=squashfs loop=/image.squashfs cdroot initrd=gentoo.igz quiet
+initrd /boot/gentoo.igz
+boot
+EOF
+
+msg "Cleaning up! Unmounting Loop!"
+umount ${MNTPTLOOP}
+msg "Cleaning up! Unmounting USB!"
+umount ${MNTPTLOOP}
+
+rmdir ${MNTPTLOOP}
+rmdir ${MNTPTUSB}
+msg "Success!"
+