From bb5a632367901570fc796380affb47e4526d9e00 Mon Sep 17 00:00:00 2001 From: James Adams Date: Wed, 24 Jul 2024 16:29:36 +0100 Subject: [PATCH 1/2] Remove support for installing from source --- Makefile | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/Makefile b/Makefile index 710621b..e0f767e 100644 --- a/Makefile +++ b/Makefile @@ -17,41 +17,11 @@ mandir = $(datadir)/man localstatedir = /var cachedir = $(localstatedir)/cache/mrepo -srcdir = $(localstatedir)/mrepo -wwwdir = $(localstatedir)/www/mrepo -DESTDIR= -OFFICIAL= - -distversion=$(version) -rpmrelease= -ifeq ($(OFFICIAL),) - distversion=$(version)-git$(date) - rpmrelease=.git$(date) -endif all: @echo "There is nothing to be build. Try install !" -install: - install -Dp -m0755 mrepo.py $(DESTDIR)$(bindir)/mrepo - [ ! -f $(DESTDIR)$(sysconfdir)/mrepo.conf ] && install -D -m0600 config/mrepo.conf $(DESTDIR)$(sysconfdir)/mrepo.conf || : - install -d -m0755 $(DESTDIR)$(sysconfdir)/mrepo.conf.d/ - - install -d -m0755 $(DESTDIR)$(srcdir)/all/ - install -d -m0755 $(DESTDIR)$(wwwdir) - install -d -m0755 $(DESTDIR)$(cachedir) - - [ "$(DESTDIR)" -o ! -f "$(DESTDIR)$(sysconfdir)/cron.d/mrepo" ] && install -Dp -m0644 config/mrepo.cron $(DESTDIR)$(sysconfdir)/cron.d/mrepo || : - - install -Dp -m0644 config/mrepo.logrotate $(DESTDIR)$(sysconfdir)/logrotate.d/mrepo - - @if [ -z "$(DESTDIR)" -a -x "/sbin/chkconfig" ]; then \ - /sbin/chkconfig --add mrepo; \ - elif [ -z "$(DESTDIR)" -a -x "$(sbindir)/chkconfig" ]; then \ - $(sbindir)/chkconfig --add mrepo; \ - fi - docs: make -C docs From 25f241f8c2512cde69fd46620393905171e9e425 Mon Sep 17 00:00:00 2001 From: James Adams Date: Wed, 24 Jul 2024 16:30:52 +0100 Subject: [PATCH 2/2] Rework package generation - Rename to mrepo-lite - Replace rpmbuild based workflow with fpm - Remove ancient redundant setup.py - Use git describe to obtain version from tags - Include support for building debs --- Makefile | 100 +++++++++++++++++++++---------- mrepo.py | 5 +- mrepo.spec | 170 ----------------------------------------------------- setup.py | 74 ----------------------- 4 files changed, 70 insertions(+), 279 deletions(-) delete mode 100644 mrepo.spec delete mode 100755 setup.py diff --git a/Makefile b/Makefile index e0f767e..b3de011 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,7 @@ -name = mrepo -version = $(shell awk '/^Version: / {print $$2}' $(name).spec) +name = mrepo-lite +version = $(shell git describe --dirty --broken) date = $(shell date +%Y%m%d%H%M) -### Get the branch information from git -git_ref = $(shell git symbolic-ref -q HEAD) -git_branch ?= $(lastword $(subst /, ,$(git_ref))) -git_branch ?= HEAD - prefix = /usr sysconfdir = /etc bindir = $(prefix)/bin @@ -17,36 +12,77 @@ mandir = $(datadir)/man localstatedir = /var cachedir = $(localstatedir)/cache/mrepo +docdir = $(datadir)/doc/$(name)-$(version) - -all: - @echo "There is nothing to be build. Try install !" +.PHONY: all +all: clean rpm deb docs: make -C docs -dist: clean - sed -i \ - -e 's#^Source:.*#Source: $(name)-$(distversion).tar.bz2#' \ - -e 's#^Version:.*#Version: $(version)#' \ - -e 's#^\(Release: *[0-9]\+\)#\1$(rpmrelease)#' \ - $(name).spec - git ls-tree -r --name-only --full-tree $(git_branch) | \ - tar -cjf $(name)-$(distversion).tar.bz2 --transform='s,^,$(name)-$(version)/,S' --files-from=- - git checkout $(name).spec - -rpm: dist - rpmbuild -tb --clean --rmspec \ - --define "_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" \ - --define "debug_package %{nil}" \ - --define "_rpmdir %(pwd)" \ - $(name)-$(distversion).tar.bz2 - -srpm: dist - rpmbuild -ts --clean --rmsource --rmspec \ - --define "_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" \ - --define "_srcrpmdir ../" \ - $(name)-$(distversion).tar.bz2 +dist: + mkdir -p dist/mrepo.conf.d dist/cache + cp -f mrepo.py dist/mrepo + sed -i 's/#version#/$(version)/' dist/mrepo + +.PHONY: package-% +package-%: dist + fpm \ + --verbose \ + \ + --input-type dir \ + --output-type "$(lastword $(subst -, ,$@))" \ + --package dist/ \ + \ + --name "$(name)" \ + --version "$(version)" \ + --iteration 1 \ + --license GPL \ + --epoch "$(shell date +%s)" \ + --architecture noarch \ + --vendor 'Science and Technology Facilties Council' \ + --url 'https://github.com/stfc/mrepo-lite' \ + --description 'mrepo-lite is a tool for mirroring upstream software repositories.' \ + --category 'System Environment/Base' \ + \ + --depends 'createrepo' \ + --depends 'python >= 2.7' \ + --conflicts yam \ + --conflicts mrepo \ + \ + --config-files $(sysconfdir)/cron.d/mrepo \ + --config-files $(sysconfdir)/logrotate.d/mrepo \ + --config-files $(sysconfdir)/mrepo.conf \ + --config-files $(sysconfdir)/mrepo.conf.d \ + \ + --directories $(sysconfdir)/mrepo.conf.d \ + --directories $(docdir) \ + --directories $(cachedir) \ + \ + dist/mrepo=$(bindir)/mrepo \ + dist/cache=$(cachedir) \ + dist/mrepo.conf.d=$(sysconfdir)/ \ + config/mrepo.conf=$(sysconfdir)/mrepo.conf \ + config/mrepo.cron=$(sysconfdir)/cron.d/mrepo \ + config/mrepo.logrotate=$(sysconfdir)/logrotate.d/mrepo \ + \ + config/mrepo-example.conf=$(docdir)/ \ + config/mrepo-complex.conf=$(docdir)/ \ + docs/=$(docdir) \ + AUTHORS=$(docdir) \ + ChangeLog=$(docdir) \ + COPYING=$(docdir) \ + README=$(docdir) \ + THANKS=$(docdir) \ + TODO=$(docdir) + +.PHONY: rpm +rpm: package-rpm + +.PHONY: deb +deb: package-deb +.PHONY: clean clean: rm -f README*.html + rm -rf dist/ diff --git a/mrepo.py b/mrepo.py index 4d269ce..c0ef39a 100755 --- a/mrepo.py +++ b/mrepo.py @@ -34,10 +34,9 @@ import urlparse import urllib -__version__ = "$Revision$" -# $Source$ +__version__ = "#version#" -VERSION = "0.8.9" +VERSION = __version__ ARCHS = { 'alpha': ('alpha', 'alphaev5', 'alphaev56', 'alphaev6', 'alphaev67'), diff --git a/mrepo.spec b/mrepo.spec deleted file mode 100644 index 62e7fe5..0000000 --- a/mrepo.spec +++ /dev/null @@ -1,170 +0,0 @@ -# $Id: mrepo.spec 2103 2004-08-26 10:38:07Z dag $ -# Authority: dag -# Upstream: Dag Wieers - -Summary: Set up repositories from various sources (ISO, rsync, http, ftp, ...) -Name: mrepo -Version: 0.8.8 -Release: 1 -License: GPL -Group: System Environment/Base -URL: http://dag.wieers.com/home-made/mrepo/ - -Packager: Dag Wieers -Vendor: Dag Apt Repository, http://dag.wieers.com/apt/ - -Source: http://dag.wieers.com/home-made/mrepo/mrepo-%{version}.tar.bz2 -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root - -BuildArch: noarch -BuildRequires: /usr/bin/python2 -Requires: createrepo -Requires: fuse -Requires: python >= 2.0 -Requires: pyOpenSSL -Requires: fuse -Obsoletes: yam <= %{version} - -%description -mrepo builds a local Apt/Yum RPM repository from local ISO files, -downloaded updates and extra packages from 3rd party repositories. - -It can download all updates and extras automatically, creates -the repository structure and meta-data, enables HTTP access to -the repository and creates a directory-structure for remote -network installations using PXE/TFTP. - -mrepo supports ftp, http, sftp, rsync, Red Hat Network and YaST -Online Update and other download methods. - -With mrepo, you can enable your laptop or a local server to provide -updates for the whole network and provide the proper files to -allow installations via the network. - -%prep -%setup - -%{__perl} -pi.orig -e 's|^(VERSION)\s*=\s*.+$|$1 = "%{version}"|' mrepo - -%{__cat} <config/mrepo.cron -### Enable this if you want mrepo to daily synchronize -### your distributions and repositories at 2:30am. -#30 2 * * * root /usr/bin/mrepo -q -ug -EOF - -%{__cat} <config/mrepo.conf -### Configuration file for mrepo - -### The [main] section allows to override mrepo's default settings -### The mrepo-example.conf gives an overview of all the possible settings -[main] -srcdir = /var/mrepo -wwwdir = /var/www/mrepo -confdir = /etc/mrepo.conf.d -arch = i386 - -mailto = root@localhost -smtp-server = localhost - -### Any other section is considered a definition for a distribution -### You can put distribution sections in /etc/mrepo.conf.d/ -### Examples can be found in the documentation at: -### %{_docdir}/%{name}-%{version}/dists/. -EOF - -%build - -%install -%{__rm} -rf %{buildroot} -%{__make} install DESTDIR="%{buildroot}" - -%preun -if [ $1 -eq 0 ]; then - /service mrepo stop &>/dev/null || : - /sbin/chkconfig --del mrepo -fi - -%post -/sbin/chkconfig --add mrepo - -#%postun -#/sbin/service mrepo condrestart &>/dev/null || : - -%clean -%{__rm} -rf %{buildroot} - -%files -%defattr(-, root, root, 0755) -%doc AUTHORS ChangeLog COPYING README THANKS TODO config/* docs/ -%config(noreplace) %{_sysconfdir}/cron.d/mrepo -%config(noreplace) %{_sysconfdir}/httpd/conf.d/mrepo.conf -%config(noreplace) %{_sysconfdir}/logrotate.d/mrepo -%config(noreplace) %{_sysconfdir}/mrepo.conf -%config(noreplace) %{_sysconfdir}/mrepo.conf.d/ -%config %{_initrddir}/mrepo -%{_bindir}/gensystemid -%{_bindir}/mrepo -%{_datadir}/mrepo/ -%{_localstatedir}/cache/mrepo/ -%{_localstatedir}/mrepo/ -%{_localstatedir}/www/mrepo/ - -%changelog -* Mon Sep 19 2011 Dag Wieers - 0.8.8-1 -- Updated to release 0.8.8. - -* Sat Feb 06 2010 Dag Wieers - 0.8.7-1 -- Updated to release 0.8.7. - -* Mon Oct 06 2008 Dag Wieers - 0.8.6-1 -- Updated to release 0.8.6. - -* Fri Aug 15 2008 Dag Wieers - 0.8.5-1 -- Updated to release 0.8.5. - -* Wed Dec 13 2006 Dag Wieers - 0.8.4-1 -- Updated to release 0.8.4. -- Package renamed from yam to mrepo. - -* Sun Oct 15 2006 Dag Wieers - 0.8.3-1 -- Updated to release 0.8.3. - -* Tue Sep 19 2006 Dag Wieers - 0.8.2-1 -- Updated to release 0.8.2. - -* Tue Aug 22 2006 Dag Wieers - 0.8.1-1 -- Updated to release 0.8.1. - -* Thu Mar 09 2006 Dag Wieers - 0.8.0-1 -- Updated to release 0.8.0. - -* Fri Mar 25 2005 Dag Wieers - 0.7.3-1 -- Updated to release 0.7.3. - -* Fri Jan 07 2005 Dag Wieers - 0.7.2-2 -- Add %%post and %%postun scripts. (Bert de Bruijn) - -* Sun Nov 28 2004 Dag Wieers - 0.7.2-1 -- Updated to release 0.7.2. - -* Sun Nov 07 2004 Dag Wieers - 0.7.1-1 -- Updated to release 0.7.1. - -* Sat Sep 11 2004 Dag Wieers - 0.7.0-1 -- Updated to release 0.7.0. - -* Thu Aug 26 2004 Dag Wieers - 0.6.1-1 -- Updated to release 0.6.1. - -* Wed Aug 25 2004 Dag Wieers - 0.6-2 -- Updated to release 0.6. -- Fix a version problem. - -* Thu Aug 19 2004 Dag Wieers - 0.5-1 -- Updated to release 0.5. - -* Wed May 19 2004 Dag Wieers - 0.3-1 -- Updated to release 0.3. - -* Fri May 14 2004 Dag Wieers - 0.2-1 -- Initial package. (using DAR) diff --git a/setup.py b/setup.py deleted file mode 100755 index b207755..0000000 --- a/setup.py +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/python2 - -### This program is free software; you can redistribute it and/or modify -### it under the terms of the GNU Library General Public License as published by -### the Free Software Foundation; version 2 only -### -### This program is distributed in the hope that it will be useful, -### but WITHOUT ANY WARRANTY; without even the implied warranty of -### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -### GNU Library General Public License for more details. -### -### You should have received a copy of the GNU Library General Public License -### along with this program; if not, write to the Free Software -### Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -### Copyright 2004-2006 Dag Wieers - -### FIXME: distutils is pretty clueless for tools (no globs, no renames, ...) -import sys -print 'Distutils installation not enabled. Please use Makefile for now.' -sys.exit(1) - -# if someday we want to *require* setuptools, uncomment this: -# (it will cause setuptools to be automatically downloaded) -#import ez_setup -#ez_setup.use_setuptools() - -try: - from setuptools import setup -except ImportError: - from distutils.core import setup - -setup( - name='mrepo', - version='0.8.4svn', - description='RPM repository mirroring tool', - author='Dag Wieers', - author_email='dag@wieers.com', - url="http://dag.wieers.com/home-made/mrepo/", - scripts=['mrepo.py', 'gensystemid'], - data_files=[ - ('/etc', ['config/mrepo.conf']), - ('/etc/init.d', ['config/mrepo']), - ('/etc/httpd/conf.d', ['config/httpd/mrepo.conf']), - ('/var/cache/mrepo', []), - ('/var/www/mrepo', []), - ], - download_url='http://dag.wieers.com/home-made/mrepo/mrepo-0.8.4svn.tar.gz', - license='GPL', - platforms='Posix', - classifiers=[ - 'Internet :: WWW/HTTP :: Site Management', - 'System :: Archiving :: Mirroring', - 'System :: Archiving :: Packaging', - 'System :: Installation/Setup', - 'System :: Software Distribution', - 'System :: Software Distribution Tools', - 'System :: Systems Administration', - ], - long_description=''' -mrepo builds a local APT/Yum RPM repository from local ISO files, downloaded -updates, and extra packages from 3rd party repositories. It takes care of -setting up the ISO files, downloading the RPMs, configuring HTTP access, and -providing PXE/TFTP resources for remote installations. - -It was primarily intended for doing remote network installations of various -distributions from a laptop without the need for CD media or floppies, but -is equally suitable for an organization's centralized update server. - -Depending on the use it may require: - apt, yum, dnf, createrepo -''', -) - -# vim:ts=4:sw=4