Package init

This commit is contained in:
wang_yue111 2020-07-14 11:05:45 +08:00
parent 46112d3b5a
commit f5ccfc36dc
4 changed files with 256 additions and 0 deletions

5
libpeas.yaml Normal file
View File

@ -0,0 +1,5 @@
git_url: https://github.com/snapcore/snapd-glib
version_control: github
src_repo: snapcore/snapd-glib
tag_prefix: "^"
seperator: "."

BIN
snapd-glib-1.43.tar.xz Normal file

Binary file not shown.

100
snapd-glib.spec Normal file
View File

@ -0,0 +1,100 @@
%global min_glib2_ver 2.46
%global min_jsonglib_ver 1.2
%global min_libsoup_ver 2.32
%global min_gtkdoc_ver 1.20
%global min_gi_ver 0.9.5
%global min_valatools_ver 0.16
Name: snapd-glib
Version: 1.43
Release: 2
Summary: Library providing a GLib interface to snapd
License: LGPLv2 or LGPLv3
URL: https://github.com/snapcore/%{name}
Source0: https://github.com/snapcore/%{name}/releases/download/%{version}/%{name}-%{version}.tar.xz
BuildRequires: gtk-doc >= %{min_gtkdoc_ver} autoconf automake gcc gcc-c++
BuildRequires: gobject-introspection-devel >= %{min_gi_ver} libtool
BuildRequires: pkgconfig(gio-2.0) >= %{min_glib2_ver}
BuildRequires: pkgconfig(gio-unix-2.0) >= %{min_glib2_ver}
BuildRequires: pkgconfig(glib-2.0) >= %{min_glib2_ver}
BuildRequires: pkgconfig(json-glib-1.0) >= %{min_jsonglib_ver}
BuildRequires: pkgconfig(libsoup-2.4) >= %{min_libsoup_ver} pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Network) pkgconfig(Qt5Qml) vala-tools >= %{min_valatools_ver}
Obsoletes: snapd-login-service < 1.33
Conflicts: snapd-login-service < 1.33
%global __provides_exclude_from ^%{_qt5_qmldir}/Snapd/.*\\.so$
%description
%{name} is a library that provides an interface to communicate
with snapd for GLib based applications.
%package devel
Summary: Development files for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
This package provides the files for developing applications
that use %{name} to communicate with snapd.
%package -n snapd-qt
Summary: Library providing a Qt5 interface to snapd
Requires: %{name}%{?_isa} = %{version}-%{release}
%description -n snapd-qt
snapd-qt is a library that provides an interface to communicate
with snapd for Qt based applications.
%package -n snapd-qt-qml
Summary: Library providing a Qt5 QML interface to snapd
Requires: snapd-qt%{?_isa} = %{version}-%{release}
%description -n snapd-qt-qml
snapd-qt-qml is a library that provides an interface to communicate
with snapd for Qt QML based applications.
%package -n snapd-qt-devel
Summary: Development files for snapd-qt
Requires: snapd-qt%{?_isa} = %{version}-%{release}
Requires: %{name}-devel%{?_isa} = %{version}-%{release}
%description -n snapd-qt-devel
This package provides the files for developing applications
that use snapd-qt to communicate with snapd.
%prep
%autosetup -p1
%build
%configure --enable-gtk-doc --libexecdir=%{_libexecdir}/snapd \
--enable-snapd-qt --enable-qml-module
%make_build
%install
%make_install
find %{buildroot} -name '*.la' -delete
%ldconfig_scriptlets
%ldconfig_scriptlets -n snapd-qt
%files
%license COPYING.LGPL2 COPYING.LGPL3
%doc NEWS
%{_libdir}/libsnapd-glib.so.*
%{_libdir}/girepository-1.0/Snapd-1.typelib
%files devel
%doc %{_datadir}/gtk-doc/html/snapd-glib
%{_includedir}/snapd-glib
%{_libdir}/libsnapd-glib.so
%{_libdir}/pkgconfig/snapd-glib.pc
%{_datadir}/vala/vapi/snapd-glib.*
%{_datadir}/gir-1.0/Snapd-1.gir
%files -n snapd-qt
%{_libdir}/libsnapd-qt.so.*
%files -n snapd-qt-qml
%{_qt5_qmldir}/Snapd/
%files -n snapd-qt-devel
%{_includedir}/snapd-qt
%{_libdir}/libsnapd-qt.so
%{_libdir}/pkgconfig/snapd-qt.pc
%{_libdir}/cmake/Snapd/
%changelog
* Tue Jul 14 2020 wangyue <wangyue92@huawei.com> - 1.43-2
- package init

151
spec_prep.sh Normal file
View File

@ -0,0 +1,151 @@
changelog_update(){
# changelog replace
sed -i '/^%changelog/,$d' $file
date=`date +"%a %b %_d %Y"`
name='Shuaishuai Song'
email='songshuaishuai2@huawei.com'
changelog="%changelog\n* $date $name <$email> - ${version}-$release\n- package init"
echo -e $changelog >> $file #sed -n '/^%changelog/,$p' $file
echo "Hint: changelog updated"
}
single_merge(){
awk -v key="$1" -v max_len=80 -F : \
'BEGIN {\
tmp="";\
} \
{\
if( key == $1 ){\
if( NF > 2){\
oofs=FS;FS="#";
bbb=sub(/[[:alnum:] ]+:/,"",$0);\
aaa=$bbb;
FS=oofs;
}\
else{\
$1=""; \
aaa=$0;\
}\
tmp1=tmp aaa
gsub(" +"," ",tmp1);\
#print FNR tmp1
if(length(tmp1) > max_len){\
gsub(" +"," ",tmp);\
printf "%-20s%s\n",key ":",tmp;\
tmp="";\
}\
tmp=tmp aaa;\
}\
else {\
if( length(tmp) != 0){\
gsub(" +"," ",tmp);\
printf "%-20s%s\n",key ":",tmp;\
tmp="";\
}\
print $0;\
}\
}'
}
headers_merge(){
cat $file | single_merge "BuildRequires" | single_merge "Requires" > .$file
mv -f .$file $file
echo "Hint: Tags merged"
}
delete_comment(){
sed -i '/^#.*/d' $file
echo "Hint: commentline deleted"
}
delete_blank(){
sed -i 's/[[:blank:]]\{1,\}$//g' $file
echo "Hint: tail-blank deleted "
}
insert_enter(){
sed -i '/^$/d' $file
sed -i '/^%package.*/i\ ' $file
sed -i '/^%pre.*/i\ ' $file
sed -i '/^%post.*/i\ ' $file
sed -i '/^%build.*/i\ ' $file
sed -i '/^%install.*/i\ ' $file
sed -i '/^%check*/i\ ' $file
sed -i '/^%files.*/i\ ' $file
sed -i '/^%changelog.*/i\ ' $file
echo "Hint: insert newline before stages"
}
increase_release(){
# release +1
sed -i "/^Release.*$/s/${release_oo}/${release}/" $file
# delete Group Tags
sed -i '/^Group.*/d' $file
echo "Hint: release ++"
}
header_align() {
awk '{
if ($0 ~ /^[A-Z][[:alnum:]]*: / ) {
va="";
for(i=2;i<=NF;i++){ va=va" "$i};
printf("%-20s%s\n",$1,va);
}
else print $0;
}' $file > .$file
mv -f .$file $file
echo "Hint: header_align done"
}
#################### main
main(){
file_o=$1
file=${file_o}.cp
cp -f $file_o $file
# got verison release
version=`cat $file |grep '^Version' | awk '{print $2}'`
release_oo=`cat $file |grep '^Release' | awk '{print $2}'`
release_o=`echo $release_oo | sed 's/%{.*}//'`
release=$((release_o+1))
#marcos_expand keep this bug ...
delete_comment
changelog_update
increase_release
header_align
headers_merge
insert_enter
delete_blank
#let's play
read -p "Hint: exec vimdiff $file $file_o ? enter [yes/no]: " ans
vimdiff $file $file_o
read -p "Hint: do mv -b -f $file $file_o ? enter [yes/no]: " ans
if [[ $ans =~ [Yy]([Ee][Ss])? ]];then
mv -b -f $file $file_o
echo "Hint: $file_o updated"
else
rm -f $file
echo "Hint: $file deleted. Not my bad :P "
fi
echo "From SONG: Enjoy your spec working !"
}
banner(){
cat <<eof
+-+-+-+-+-+-+-+-+-+
|s|p|e|c|_|p|r|e|p|
+-+-+-+-+-+-+-+-+-+
eof
}
if [[ $# != 1 ]];then
banner
echo "USAGE: $(basename $0) SPECFILE"
exit 2
fi
banner
main $1