Accepting request 240002 from home:jblunck:branches:openSUSE:Tools
- Update to version 0.1: + Initial debianization + fix it + This adds posibility to define filenames with wildcards. Usable to prevent from editing the file path after each version change or after the SVN revision changes. + fix error message + allow subdirectories + fix command parameters OBS-URL: https://build.opensuse.org/request/show/240002 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/obs-service-extract_file?expand=0&rev=8
This commit is contained in:
parent
e518ea9025
commit
0e7f577a62
19
_service
Normal file
19
_service
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<services>
|
||||||
|
<service mode="disabled" name="tar_scm">
|
||||||
|
<param name="url">git@github.com:openSUSE/obs-service-extract_file.git</param>
|
||||||
|
<param name="scm">git</param>
|
||||||
|
<param name="exclude">.git</param>
|
||||||
|
<param name="version">0.1</param>
|
||||||
|
<param name="revision">master</param>
|
||||||
|
<param name="changesgenerate">enable</param>
|
||||||
|
</service>
|
||||||
|
|
||||||
|
<service mode="disabled" name="recompress">
|
||||||
|
<param name="file">*.tar</param>
|
||||||
|
<param name="compression">gz</param>
|
||||||
|
</service>
|
||||||
|
|
||||||
|
<service mode="disabled" name="set_version">
|
||||||
|
<param name="basename">obs-service-extract_file</param>
|
||||||
|
</service>
|
||||||
|
</services>
|
8
debian.dsc
Normal file
8
debian.dsc
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
Format: 1.0
|
||||||
|
Source: obs-service-extract-file
|
||||||
|
Version: 0.1
|
||||||
|
Binary: obs-service-extract-file
|
||||||
|
Maintainer: Adrian Schroeter <adrian@suse.de>
|
||||||
|
Architecture: all
|
||||||
|
Standards-Version: 3.7.2
|
||||||
|
Build-Depends: debhelper (>= 7)
|
77
extract_file
77
extract_file
@ -1,77 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# A simple script to checkout or update a svn or git repo as source service
|
|
||||||
|
|
||||||
# defaults
|
|
||||||
MYARCHIVE=""
|
|
||||||
MYFILES=""
|
|
||||||
OUTFILE="."
|
|
||||||
|
|
||||||
while test $# -gt 0; do
|
|
||||||
case $1 in
|
|
||||||
*-archive)
|
|
||||||
MYARCHIVE="${2##*/}"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
*-file|*-files)
|
|
||||||
MYFILES="$MYFILES ${2}"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
*-outfilename)
|
|
||||||
OUTFILE="${2}"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
*-outdir)
|
|
||||||
MYOUTDIR="$2"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo Unknown parameter $1.
|
|
||||||
echo 'Usage: extract_file --archive $ARCHIVE --file $FILE --outdir $OUT'
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ -z "$MYARCHIVE" ]; then
|
|
||||||
echo "ERROR: no archive specified!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [ -z "$MYFILES" ]; then
|
|
||||||
echo "ERROR: no checkout URL is given via --file parameter!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [ -z "$MYOUTDIR" ]; then
|
|
||||||
echo "ERROR: no output directory is given via --outdir parameter!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
set -x
|
|
||||||
|
|
||||||
existing_archive="$PWD/$(echo $MYARCHIVE)"
|
|
||||||
cd "$MYOUTDIR"
|
|
||||||
|
|
||||||
if [ -e "$existing_archive" ]; then
|
|
||||||
if [ "${existing_archive%.tar.gz}" != "$existing_archive" ]; then
|
|
||||||
tar xfz "$existing_archive" --wildcards $MYFILES || exit 1
|
|
||||||
elif [ "${existing_archive%.tar.bz2}" != "$existing_archive" ]; then
|
|
||||||
tar xfj "$existing_archive" --wildcards $MYFILES || exit 1
|
|
||||||
elif [ "${existing_archive%.tar.xz}" != "$existing_archive" ]; then
|
|
||||||
tar xfJ "$existing_archive" --wildcards $MYFILES || exit 1
|
|
||||||
elif [ "${existing_archive%.tar}" != "$existing_archive" ]; then
|
|
||||||
tar xf "$existing_archive" --wildcards $MYFILES || exit 1
|
|
||||||
elif [ "${existing_archive%.zip}" != "$existing_archive" ]; then
|
|
||||||
unzip "$existing_archive" $MYFILES || exit 1
|
|
||||||
else
|
|
||||||
echo "ERROR: unknown archive format $existing_archive"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
for i in $MYFILES; do
|
|
||||||
mv "$i" "$OUTFILE"
|
|
||||||
done
|
|
||||||
else
|
|
||||||
echo "ERROR: archive not found: $existing_archive"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
exit 0
|
|
@ -1,16 +0,0 @@
|
|||||||
<service name="extract_file">
|
|
||||||
<summary>Extract files from archive</summary>
|
|
||||||
<description>This service can be used to extract a file from an tar or zip archive. This can be used to used a spec file directly from a tar.</description>
|
|
||||||
<parameter name="archive">
|
|
||||||
<description>Archive to be used</description>
|
|
||||||
<required/>
|
|
||||||
</parameter>
|
|
||||||
<parameter name="files">
|
|
||||||
<description>Files to extract. You may use this parameter multiple times</description>
|
|
||||||
<required/>
|
|
||||||
</parameter>
|
|
||||||
<parameter name="outfilename">
|
|
||||||
<description>Rename file into outfilename</description>
|
|
||||||
</parameter>
|
|
||||||
</service>
|
|
||||||
|
|
3
obs-service-extract_file-0.1.tar.gz
Normal file
3
obs-service-extract_file-0.1.tar.gz
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:830847e40a27690b8c5e71c1698fb752e69260234a21f1c520b559d780db2557
|
||||||
|
size 2687
|
@ -1,3 +1,14 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Jul 9 15:43:21 UTC 2014 - jblunck@infradead.org
|
||||||
|
|
||||||
|
- Update to version 0.1:
|
||||||
|
+ Initial debianization
|
||||||
|
+ fix it
|
||||||
|
+ This adds posibility to define filenames with wildcards. Usable to prevent from editing the file path after each version change or after the SVN revision changes.
|
||||||
|
+ fix error message
|
||||||
|
+ allow subdirectories
|
||||||
|
+ fix command parameters
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue May 10 10:02:43 UTC 2011 - adrian@suse.de
|
Tue May 10 10:02:43 UTC 2011 - adrian@suse.de
|
||||||
|
|
||||||
|
@ -1,13 +1,33 @@
|
|||||||
|
#
|
||||||
|
# spec file for package obs-service-extract_file
|
||||||
|
#
|
||||||
|
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||||
|
#
|
||||||
|
# All modifications and additions to the file contributed by third parties
|
||||||
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
|
# upon. The license for this file, and modifications and additions to the
|
||||||
|
# file, is the same license as for the pristine package itself (unless the
|
||||||
|
# license for the pristine package is not an Open Source License, in which
|
||||||
|
# case the license is the MIT License). An "Open Source License" is a
|
||||||
|
# license that conforms to the Open Source Definition (Version 1.9)
|
||||||
|
# published by the Open Source Initiative.
|
||||||
|
|
||||||
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
Name: obs-service-extract_file
|
Name: obs-service-extract_file
|
||||||
License: GPL v2 or later
|
|
||||||
Group: Development/Tools/Building
|
|
||||||
Summary: An OBS source service: Extract a file from an archive
|
Summary: An OBS source service: Extract a file from an archive
|
||||||
|
License: GPL-2.0+
|
||||||
|
Group: Development/Tools/Building
|
||||||
Version: 0.1
|
Version: 0.1
|
||||||
Release: 1
|
Release: 0
|
||||||
Source: extract_file
|
Source: %{name}-%{version}.tar.gz
|
||||||
Source1: extract_file.service
|
Requires: bzip2
|
||||||
Requires: tar bzip2 gzip xz unzip
|
Requires: gzip
|
||||||
|
Requires: tar
|
||||||
|
Requires: unzip
|
||||||
|
Requires: xz
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
|
||||||
@ -18,18 +38,18 @@ It supports to extract a file from an archive, for example a spec file from a ta
|
|||||||
|
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -D -T 0 -n .
|
%setup -q
|
||||||
|
|
||||||
%build
|
%build
|
||||||
|
|
||||||
|
|
||||||
%install
|
%install
|
||||||
mkdir -p $RPM_BUILD_ROOT/usr/lib/obs/service
|
mkdir -p $RPM_BUILD_ROOT/usr/lib/obs/service
|
||||||
install -m 0755 %{SOURCE0} $RPM_BUILD_ROOT/usr/lib/obs/service
|
install -m 0755 extract_file $RPM_BUILD_ROOT/usr/lib/obs/service
|
||||||
install -m 0644 %{SOURCE1} $RPM_BUILD_ROOT/usr/lib/obs/service
|
install -m 0644 extract_file.service $RPM_BUILD_ROOT/usr/lib/obs/service
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%defattr(-,root,root)
|
%defattr(-,root,root)
|
||||||
%dir /usr/lib/obs
|
%dir /usr/lib/obs
|
||||||
/usr/lib/obs/service
|
/usr/lib/obs/service
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
Loading…
Reference in New Issue
Block a user