Mailinglist Archive: opensuse-buildservice (184 mails)

< Previous Next >
[opensuse-buildservice] obs_mirror_project verbose patch
  • From: "Ulf" <mopp@xxxxxxx>
  • Date: Tue, 07 Oct 2008 23:25:33 +0200
  • Message-id: <20081007212533.130710@xxxxxxx>
Hi,

I modified obs_mirror_project slightly to have a -v option.
The verbose option will show some useful steps during the mirroring.

Maybe you want to add the patch.

---------------

--- obs_mirror_project.orig 2008-09-26 07:51:58.000000000 +0200
+++ obs_mirror_project 2008-10-07 23:12:28.000000000 +0200
@@ -12,18 +12,22 @@
# * mirroring of package meta data, needed to build packages
# * use mirrors by default for downloading

-if ARGV.length != 3
- print "Call this script with <project> <repository> <architecture>
arguments.\n"
- print "To mirror openSUSE 10.2 as base distro, please call:\n"
- print " \n"
- print " obs_mirror_project openSUSE:10.2 standard i586 \n"
- print " \n"
+if ARGV.length < 3 || ARGV.length > 5
+ puts "\
+Call this script with <project> <repository> <architecture> [-v] arguments.
+To mirror openSUSE 10.2 as base distro, please call:
+
+ obs_mirror_project openSUSE:10.2 standard i586
+
+"
exit(1)
end

project=ARGV[0]
repository=ARGV[1]
architecture=ARGV[2]
+verbose=false
+verbose=1 if ARGV[3] == "-v"

rootdir="/srv/obs/" # package default
ownership="obsrun"
@@ -31,19 +35,25 @@
projectdir = rootdir + "/projects/"

destinationdir = rootdir + "build/" + project + "/" + repository + "/" +
architecture + "/:full/"
+puts "Destination dir: #{destinationdir}\n" if verbose
downloadurl = "http://download.opensuse.org/repositories/"; + project + "/" +
repository
+puts "Download URL: #{downloadurl}\n" if verbose

require 'rexml/document'
include REXML

# prepare project
+puts "Creating directories: #{destinationdir} #{projectdir}\n" if verbose
system("mkdir -p #{destinationdir} #{projectdir}")

# create meta data
+puts "Creating project meta data: osc meta prj #{project} >
#{projectdir}/#{project}.xml\n" if verbose
system("osc meta prj #{project} > #{projectdir}/#{project}.xml")
+puts "Creating project configuration data: osc meta prjconf #{project} >
#{projectdir}/#{project}.conf\n" if verbose
system("osc meta prjconf #{project} > #{projectdir}/#{project}.conf")

# download all binary packages
+puts "Downloading: osc req -m GET
https://api.opensuse.org/build/#{project}/#{repository}/#{architecture}/_repository\n";
if verbose
process = File::popen("osc req -m GET
https://api.opensuse.org/build/#{project}/#{repository}/#{architecture}/_repository";,
"r")
filelist = Document.new process
filelist.elements.each("binarylist/binary") { |binary|
@@ -74,7 +84,11 @@
#end

end
- print "Download " + fname + "\n"
+ if verbose
+ puts "Downloading: osc req -m GET
https://api.opensuse.org/build/#{project}/#{repository}/#{architecture}/_repository/#{fname}";
+ else
+ print "Download " + fname + "\n"
+ end
# FIXME: we can not use the mirrors atm, since the full expanded package
name is unknown
# unless system("wget -q -N -O #{destinationdir}/#{fname}
#{downloadurl}/#{archdir}/#{fname}")
# fallback to api download
@@ -105,6 +119,7 @@
}

# fix ownership in case this script did run as root
+puts "Changing ownerchip: chown -R #{ownership} #{rootdir}/build
#{projectdir}" if verbose
system("chown -R #{ownership} #{rootdir}/build #{projectdir}")

puts "\


---------------

Best regards,
Ulf
--
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen:
http://www.gmx.net/de/go/multimessenger
--
To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-buildservice+help@xxxxxxxxxxxx

< Previous Next >
This Thread
Follow Ups