Mailinglist Archive: opensuse-buildservice (170 mails)

< Previous Next >
Re: [opensuse-buildservice] osc rdelete leftovers files
On 07/29/2013 05:17 AM, Michael Schroeder wrote:
On Fri, Jul 26, 2013 at 04:16:13PM -0400, Michel Bourget wrote:
'osc rdelete project -r -f' do not delete everything but, rather, copy some
stuff
to the "_deleted" project directory and keep bazillions of files related
to that project under:

* ./trees/
* ./repos/.../.../...
* /repos_sync/
The publisher should eventually delete the ./repos and ./repos_sync stuff.

Interesting ... Didn't notice. Likely, I didn't dig/research it enough.

The sources of the packages in the project are kept because you can
undelete projects.

(Keeping all sources is kind of an obs feature, we promise that you
can at any time get the sources for packages that were built with obs.
You can use 'rpm -q --qf '%{DISTURL'}\n'<rpm>' to query a built
package for a reference to its sources.)


Hi Michael, thanks for feedback.

The real I have is about an asymmetric semantic, ie:
- non-admin user can create "home:user:blah" project.
- but can't wipe it, ie. only admin can do it.

Imo, a user should be able to "wipe" a project he/she created.
"osc rwipe" ?

Here's the scenario I went thru:
-1. osc meta {prj,prjconf} home:user:blah
-2. osc add a couple of packages ...
-3. something goes really wrong. Hey, let's restart
-4. osc rdelete -f -r home:user:blah
-5. re-do step 1 and 2 but better and/or with fixes.
-6. re-do step 2 in same manner.

Here is where it goes wrong. In step 6, new _pkg and _service files
were checked/committed. OBS then states "nothing to do" somehow.
Guess what , the buildlog ( and service logs details ) were restored
back to what they were, even showing impossible errors because
some fixes were applied to a (new, btw ) /usr/lib/obs/service/script.
Doing an "osc service remoterun" fixes that ... but, needless to say,
it wasn't obvious.

At any rate, being able to "osc rwipe" would be a "Very Nice to have(Tm)" :)

For the sake of our operations, I wrote a little script to accomplish this
on the OBS server as "Admin". Script attached.

Thanks !


Cheers,
Michael.


#! /bin/sh

BUILD_FUNCTIONS=$(dirname $0)/build.functions
[ ! -f $BUILD_FUNCTIONS ] \
&& echo $0: FATAL : $BUILD_FUNCTIONS not found. Aborting. 1>&2 \
|| source $BUILD_FUNCTIONS
PROJECT=
BASE_OBS=/srv/obs

_usage() {
[ -n "$1" ] && _msg "$*"
cat <<-FIN 1>&2
Usage: ${MY_NAME} [options] OBS_project

${MY_NAME} perform a full removal of an OBS project.

Options:
-h This help message
-r Run it. Default: test run.

NOTES:
- WARNING: The operations CANNOT be undone.
- The operation need to be performed on the OBS build machine
- The operations should be performed by the "Admin" OBS user.
FIN
}

# Main
rflag=0
while getopts :hr opt ; do case "$opt" in
:) _usage ERROR: an argument require a value. && exit 1 ;;
h) _usage ; exit 0 ;;
r) rflag=1 ;;
\?) _usage ERROR: bad parameters ; exit 1 ;;
esac
done
shift `expr $OPTIND - 1`

[ $rflag -ne 1 ] && _msg "===== INFO: Test run. Use "-r" to run it."
prj=$1
[ -z "$prj" ] && _usage && exit 1

osc ls 2>/dev/null | egrep -q "^${prj}$" \
&& _msg "===== INFO : ${prj} is an active project." \
&& _msg "===== osc rdelete -f -r -m 'Wiping out ${prj}' ${prj}" \
&& [ $flag -eq 1 ] \
&& osc rdelete -f -r -m "Wiping out ${prj}" ${prj}

osc ls -D 2>/dev/null | egrep -q "^${prj}$" \
&& _msg "===== INFO : ${prj} is a deleted project." \
|| _msg "===== INFO : ${prj} is not a deleted project or is an unknown
project."

[ $rflag -eq 0 ] && exit 0
prj2=$(echo $prj | sed -e 's=:=:/=g')
rm -rvf ${BASE_OBS}/projects/_deleted/${prj}.pkg
rm -rvf ${BASE_OBS}/repos/${prj2}
rm -rvf ${BASE_OBS}/trees/${prj}
rm -rvf ${BASE_OBS}/repos_sync/${prj}
exit 0
< Previous Next >
Follow Ups